Skip to content

Commit

Permalink
no sdk (broken, no NetworkSecurityGroup and no VirtualNetwork)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar committed Dec 4, 2017
1 parent d5cbdcc commit c757df2
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Azure.Management.Compute, Version=16.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.16.3.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=15.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.15.1.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
<Private>True</Private>
Expand All @@ -67,8 +55,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Compute\Image.cs" />
<Compile Include="Compute\Images.cs" />
<Compile Include="IReportProgress.cs" />
<Compile Include="IResourceConfig.cs" />
<Compile Include="IResourceConfigVisitor.cs" />
Expand All @@ -77,8 +63,6 @@
<Compile Include="ProgressMap.cs" />
<Compile Include="TimeSlot.cs" />
<Compile Include="StateOperationContext.cs" />
<Compile Include="Compute\ComputeStrategy.cs" />
<Compile Include="Compute\VirtualMachineStrategy.cs" />
<Compile Include="SyncTaskScheduler.cs" />
<Compile Include="TimeSlotExtensions.cs" />
<Compile Include="UpdateStateExtensions.cs" />
Expand All @@ -98,13 +82,6 @@
<Compile Include="TargetDependencies.cs" />
<Compile Include="NestedResourceConfig.cs" />
<Compile Include="NestedResourceStrategy.cs" />
<Compile Include="Network\NetworkInterfaceStrategy.cs" />
<Compile Include="Network\NetworkSecurityGroupPolicy.cs" />
<Compile Include="Network\NetworkStrategy.cs" />
<Compile Include="Network\PublicIPAddressStrategy.cs" />
<Compile Include="Network\SubnetStrategy.cs" />
<Compile Include="Network\VirtualNetworkStrategy.cs" />
<Compile Include="ResourceManager\ResourceGroupStrategy.cs" />
<Compile Include="TargetState.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceConfig.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.ResourceManager.Models;
using System.Linq;

namespace Microsoft.Azure.Commands.Common.Strategies
Expand All @@ -39,7 +38,7 @@ static DependencyLocation GetDependencyLocation<TModel>(
return info != null
? new DependencyLocation(
config.Strategy.GetLocation(info),
typeof(TModel) != typeof(ResourceGroup))
config.Strategy.CompulsoryLocation)
: config
.GetResourceDependencies()
.Select(state.GetDependencyLocationDispatch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Rest.Azure;
using System;
using System.Collections.Generic;
Expand All @@ -39,19 +38,6 @@ public static ResourceConfig<TModel> CreateConfig<TModel>(
createModel ?? (_ => new TModel()),
dependencies.EmptyIfNull());

public static ResourceConfig<TModel> CreateConfig<TModel>(
this ResourceStrategy<TModel> strategy,
ResourceConfig<ResourceGroup> resourceGroup,
string name,
Func<string, TModel> createModel = null,
IEnumerable<IEntityConfig> dependencies = null)
where TModel : class, new()
=> strategy.CreateConfig(
resourceGroup.Name,
name,
createModel,
dependencies.EmptyIfNull().Where(d => d != null).Concat(new[] { resourceGroup }));

public static async Task<TModel> GetAsync<TModel>(
this ResourceConfig<TModel> config,
IClient client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ public Func<IClient, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> CreateOrUp

public Func<TModel, int> CreateTime { get; }

public bool CompulsoryLocation { get; }

public ResourceStrategy(
string type,
Func<string, IEnumerable<string>> getId,
Func<IClient, GetAsyncParams, Task<TModel>> getAsync,
Func<IClient, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> createOrUpdateAsync,
Func<TModel, string> getLocation,
Action<TModel, string> setLocation,
Func<TModel, int> createTime)
Func<TModel, int> createTime,
bool compulsoryLocation)
{
Type = type;
GetId = getId;
Expand All @@ -53,6 +56,7 @@ public ResourceStrategy(
GetLocation = getLocation;
SetLocation = setLocation;
CreateTime = createTime;
CompulsoryLocation = compulsoryLocation;
}
}

Expand All @@ -66,7 +70,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
Func<TOperation, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> createOrUpdateAsync,
Func<TModel, string> getLocation,
Action<TModel, string> setLocation,
Func<TModel, int> createTime)
Func<TModel, int> createTime,
bool compulsoryLocation)
where TClient : ServiceClient<TClient>
{
Func<IClient, TOperation> toOperations = client => getOperations(client.GetClient<TClient>());
Expand All @@ -77,7 +82,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
(client, p) => createOrUpdateAsync(toOperations(client), p),
getLocation,
setLocation,
createTime);
createTime,
compulsoryLocation);
}

public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
Expand All @@ -88,7 +94,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
Func<TOperation, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> createOrUpdateAsync,
Func<TModel, string> getLocation,
Action<TModel, string> setLocation,
Func<TModel, int> createTime)
Func<TModel, int> createTime,
bool compulsoryLocation)
where TClient : ServiceClient<TClient>
=> Create(
type,
Expand All @@ -98,6 +105,7 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
createOrUpdateAsync,
getLocation,
setLocation,
createTime);
createTime,
compulsoryLocation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Management.Compute" version="16.3.0" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Network" version="15.1.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.KeyVault.2.3.0-preview\lib\net452\Microsoft.Azure.Management.KeyVault.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=15.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.15.1.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.4.1.0-preview\lib\net45\Microsoft.Azure.Management.Storage.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -292,8 +284,20 @@
<Compile Include="StorageServices\StorageCredentialsFactory.cs" />
<Compile Include="Strategies\AsyncCmdletExtensions.cs" />
<Compile Include="Strategies\Client.cs" />
<Compile Include="Strategies\Compute\ComputeStrategy.cs" />
<Compile Include="Strategies\Compute\Image.cs" />
<Compile Include="Strategies\Compute\Images.cs" />
<Compile Include="Strategies\Compute\VirtualMachineStrategy.cs" />
<Compile Include="Strategies\IAsyncCmdlet.cs" />
<Compile Include="Strategies\Network\NetworkInterfaceStrategy.cs" />
<Compile Include="Strategies\Network\NetworkSecurityGroupPolicy.cs" />
<Compile Include="Strategies\Network\NetworkStrategy.cs" />
<Compile Include="Strategies\Network\PublicIPAddressStrategy.cs" />
<Compile Include="Strategies\Network\SubnetStrategy.cs" />
<Compile Include="Strategies\Network\VirtualNetworkStrategy.cs" />
<Compile Include="Strategies\ProgressReport.cs" />
<Compile Include="Strategies\ResourceManager\ResourceConfigExtensions.cs" />
<Compile Include="Strategies\ResourceManager\ResourceGroupStrategy.cs" />
<Compile Include="Strategies\ShouldProcess.cs" />
<Compile Include="Usage\GetAzureVMUsageCommand.cs" />
<Compile Include="Usage\VirtualMachineUsageBaseCmdlet.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.Azure.Management.Network.Models;
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
using Microsoft.Azure.Management.Internal.Resources.Models;
using Microsoft.Azure.Commands.Compute.Strategies.ResourceManager;

namespace Microsoft.Azure.Commands.Common.Strategies.Compute
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
using Microsoft.Azure.Management.Internal.Resources.Models;

namespace Microsoft.Azure.Commands.Common.Strategies.Network
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
using Microsoft.Azure.Management.Internal.Resources.Models;
using Microsoft.Azure.Commands.Compute.Strategies.ResourceManager;
using System.Linq;

namespace Microsoft.Azure.Commands.Common.Strategies.Network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Network;
using Microsoft.Azure.Management.Network.Models;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
using System;
using System.Threading.Tasks;

Expand All @@ -37,6 +37,7 @@ public static ResourceStrategy<TModel> Create<TModel, TOperations>(
createOrUpdateAsync,
model => model.Location,
(model, location) => model.Location = location,
createTime);
createTime,
true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Network.Models;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
using System.Collections.Generic;
using System.Linq;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.Azure.Commands.Common.Strategies;
using Microsoft.Azure.Management.Internal.Resources.Models;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.Azure.Commands.Compute.Strategies.ResourceManager
{
static class ResourceConfigExtensions
{
public static ResourceConfig<TModel> CreateConfig<TModel>(
this ResourceStrategy<TModel> strategy,
ResourceConfig<ResourceGroup> resourceGroup,
string name,
Func<string, TModel> createModel = null,
IEnumerable<IEntityConfig> dependencies = null)
where TModel : class, new()
=> strategy.CreateConfig(
resourceGroup.Name,
name,
createModel,
dependencies.EmptyIfNull().Where(d => d != null).Concat(new[] { resourceGroup }));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.ResourceManager;
using Microsoft.Azure.Management.ResourceManager.Models;
using Microsoft.Azure.Management.Internal.Resources;
using Microsoft.Azure.Management.Internal.Resources.Models;
using System.Linq;

namespace Microsoft.Azure.Commands.Common.Strategies.ResourceManager
Expand Down
2 changes: 0 additions & 2 deletions src/ResourceManager/Compute/Commands.Compute/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="16.3.0" targetFramework="net452" />
<package id="Microsoft.Azure.Management.KeyVault" version="2.3.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Network" version="15.1.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
<package id="Microsoft.Azure.Management.Storage" version="4.1.0-preview" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
Expand Down

0 comments on commit c757df2

Please sign in to comment.