Skip to content

Commit c757df2

Browse files
no sdk (broken, no NetworkSecurityGroup and no VirtualNetwork)
1 parent d5cbdcc commit c757df2

20 files changed

+66
-73
lines changed

src/ResourceManager/Common/Commands.Common.Strategies/Commands.Common.Strategies.csproj

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@
3333
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="Microsoft.Azure.Management.Compute, Version=16.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
37-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.16.3.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
38-
<Private>True</Private>
39-
</Reference>
40-
<Reference Include="Microsoft.Azure.Management.Network, Version=15.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
41-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.15.1.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
42-
<Private>True</Private>
43-
</Reference>
44-
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
45-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
46-
<Private>True</Private>
47-
</Reference>
4836
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4937
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
5038
<Private>True</Private>
@@ -67,8 +55,6 @@
6755
<Reference Include="System.Xml" />
6856
</ItemGroup>
6957
<ItemGroup>
70-
<Compile Include="Compute\Image.cs" />
71-
<Compile Include="Compute\Images.cs" />
7258
<Compile Include="IReportProgress.cs" />
7359
<Compile Include="IResourceConfig.cs" />
7460
<Compile Include="IResourceConfigVisitor.cs" />
@@ -77,8 +63,6 @@
7763
<Compile Include="ProgressMap.cs" />
7864
<Compile Include="TimeSlot.cs" />
7965
<Compile Include="StateOperationContext.cs" />
80-
<Compile Include="Compute\ComputeStrategy.cs" />
81-
<Compile Include="Compute\VirtualMachineStrategy.cs" />
8266
<Compile Include="SyncTaskScheduler.cs" />
8367
<Compile Include="TimeSlotExtensions.cs" />
8468
<Compile Include="UpdateStateExtensions.cs" />
@@ -98,13 +82,6 @@
9882
<Compile Include="TargetDependencies.cs" />
9983
<Compile Include="NestedResourceConfig.cs" />
10084
<Compile Include="NestedResourceStrategy.cs" />
101-
<Compile Include="Network\NetworkInterfaceStrategy.cs" />
102-
<Compile Include="Network\NetworkSecurityGroupPolicy.cs" />
103-
<Compile Include="Network\NetworkStrategy.cs" />
104-
<Compile Include="Network\PublicIPAddressStrategy.cs" />
105-
<Compile Include="Network\SubnetStrategy.cs" />
106-
<Compile Include="Network\VirtualNetworkStrategy.cs" />
107-
<Compile Include="ResourceManager\ResourceGroupStrategy.cs" />
10885
<Compile Include="TargetState.cs" />
10986
<Compile Include="Properties\AssemblyInfo.cs" />
11087
<Compile Include="ResourceConfig.cs" />

src/ResourceManager/Common/Commands.Common.Strategies/LocationExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.ResourceManager.Models;
1615
using System.Linq;
1716

1817
namespace Microsoft.Azure.Commands.Common.Strategies
@@ -39,7 +38,7 @@ static DependencyLocation GetDependencyLocation<TModel>(
3938
return info != null
4039
? new DependencyLocation(
4140
config.Strategy.GetLocation(info),
42-
typeof(TModel) != typeof(ResourceGroup))
41+
config.Strategy.CompulsoryLocation)
4342
: config
4443
.GetResourceDependencies()
4544
.Select(state.GetDependencyLocationDispatch)

src/ResourceManager/Common/Commands.Common.Strategies/ResourceConfigExtensions.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

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

42-
public static ResourceConfig<TModel> CreateConfig<TModel>(
43-
this ResourceStrategy<TModel> strategy,
44-
ResourceConfig<ResourceGroup> resourceGroup,
45-
string name,
46-
Func<string, TModel> createModel = null,
47-
IEnumerable<IEntityConfig> dependencies = null)
48-
where TModel : class, new()
49-
=> strategy.CreateConfig(
50-
resourceGroup.Name,
51-
name,
52-
createModel,
53-
dependencies.EmptyIfNull().Where(d => d != null).Concat(new[] { resourceGroup }));
54-
5541
public static async Task<TModel> GetAsync<TModel>(
5642
this ResourceConfig<TModel> config,
5743
IClient client,

src/ResourceManager/Common/Commands.Common.Strategies/ResourceStrategy.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ public Func<IClient, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> CreateOrUp
3737

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

40+
public bool CompulsoryLocation { get; }
41+
4042
public ResourceStrategy(
4143
string type,
4244
Func<string, IEnumerable<string>> getId,
4345
Func<IClient, GetAsyncParams, Task<TModel>> getAsync,
4446
Func<IClient, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> createOrUpdateAsync,
4547
Func<TModel, string> getLocation,
4648
Action<TModel, string> setLocation,
47-
Func<TModel, int> createTime)
49+
Func<TModel, int> createTime,
50+
bool compulsoryLocation)
4851
{
4952
Type = type;
5053
GetId = getId;
@@ -53,6 +56,7 @@ public ResourceStrategy(
5356
GetLocation = getLocation;
5457
SetLocation = setLocation;
5558
CreateTime = createTime;
59+
CompulsoryLocation = compulsoryLocation;
5660
}
5761
}
5862

@@ -66,7 +70,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
6670
Func<TOperation, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> createOrUpdateAsync,
6771
Func<TModel, string> getLocation,
6872
Action<TModel, string> setLocation,
69-
Func<TModel, int> createTime)
73+
Func<TModel, int> createTime,
74+
bool compulsoryLocation)
7075
where TClient : ServiceClient<TClient>
7176
{
7277
Func<IClient, TOperation> toOperations = client => getOperations(client.GetClient<TClient>());
@@ -77,7 +82,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
7782
(client, p) => createOrUpdateAsync(toOperations(client), p),
7883
getLocation,
7984
setLocation,
80-
createTime);
85+
createTime,
86+
compulsoryLocation);
8187
}
8288

8389
public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
@@ -88,7 +94,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
8894
Func<TOperation, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> createOrUpdateAsync,
8995
Func<TModel, string> getLocation,
9096
Action<TModel, string> setLocation,
91-
Func<TModel, int> createTime)
97+
Func<TModel, int> createTime,
98+
bool compulsoryLocation)
9299
where TClient : ServiceClient<TClient>
93100
=> Create(
94101
type,
@@ -98,6 +105,7 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
98105
createOrUpdateAsync,
99106
getLocation,
100107
setLocation,
101-
createTime);
108+
createTime,
109+
compulsoryLocation);
102110
}
103111
}

src/ResourceManager/Common/Commands.Common.Strategies/UpdateStateExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
16-
using System.Collections.Generic;
1715
using System.Linq;
1816
using System.Threading;
1917
using System.Threading.Tasks;

src/ResourceManager/Common/Commands.Common.Strategies/packages.config

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Azure.Management.Compute" version="16.3.0" targetFramework="net452" />
4-
<package id="Microsoft.Azure.Management.Network" version="15.1.0-preview" targetFramework="net452" />
5-
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
63
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
74
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />
85
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@
6464
<HintPath>..\..\..\packages\Microsoft.Azure.Management.KeyVault.2.3.0-preview\lib\net452\Microsoft.Azure.Management.KeyVault.dll</HintPath>
6565
<Private>True</Private>
6666
</Reference>
67-
<Reference Include="Microsoft.Azure.Management.Network, Version=15.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.15.1.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
69-
<Private>True</Private>
70-
</Reference>
71-
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
72-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
73-
<Private>True</Private>
74-
</Reference>
7567
<Reference Include="Microsoft.Azure.Management.Storage">
7668
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.4.1.0-preview\lib\net45\Microsoft.Azure.Management.Storage.dll</HintPath>
7769
</Reference>
@@ -292,8 +284,20 @@
292284
<Compile Include="StorageServices\StorageCredentialsFactory.cs" />
293285
<Compile Include="Strategies\AsyncCmdletExtensions.cs" />
294286
<Compile Include="Strategies\Client.cs" />
287+
<Compile Include="Strategies\Compute\ComputeStrategy.cs" />
288+
<Compile Include="Strategies\Compute\Image.cs" />
289+
<Compile Include="Strategies\Compute\Images.cs" />
290+
<Compile Include="Strategies\Compute\VirtualMachineStrategy.cs" />
295291
<Compile Include="Strategies\IAsyncCmdlet.cs" />
292+
<Compile Include="Strategies\Network\NetworkInterfaceStrategy.cs" />
293+
<Compile Include="Strategies\Network\NetworkSecurityGroupPolicy.cs" />
294+
<Compile Include="Strategies\Network\NetworkStrategy.cs" />
295+
<Compile Include="Strategies\Network\PublicIPAddressStrategy.cs" />
296+
<Compile Include="Strategies\Network\SubnetStrategy.cs" />
297+
<Compile Include="Strategies\Network\VirtualNetworkStrategy.cs" />
296298
<Compile Include="Strategies\ProgressReport.cs" />
299+
<Compile Include="Strategies\ResourceManager\ResourceConfigExtensions.cs" />
300+
<Compile Include="Strategies\ResourceManager\ResourceGroupStrategy.cs" />
297301
<Compile Include="Strategies\ShouldProcess.cs" />
298302
<Compile Include="Usage\GetAzureVMUsageCommand.cs" />
299303
<Compile Include="Usage\VirtualMachineUsageBaseCmdlet.cs" />

src/ResourceManager/Common/Commands.Common.Strategies/Compute/VirtualMachineStrategy.cs renamed to src/ResourceManager/Compute/Commands.Compute/Strategies/Compute/VirtualMachineStrategy.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
using Microsoft.Azure.Management.Compute;
1616
using Microsoft.Azure.Management.Compute.Models;
17-
using Microsoft.Azure.Management.Network.Models;
18-
using Microsoft.Azure.Management.ResourceManager.Models;
17+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
18+
using Microsoft.Azure.Management.Internal.Resources.Models;
19+
using Microsoft.Azure.Commands.Compute.Strategies.ResourceManager;
1920

2021
namespace Microsoft.Azure.Commands.Common.Strategies.Compute
2122
{

src/ResourceManager/Common/Commands.Common.Strategies/Network/NetworkInterfaceStrategy.cs renamed to src/ResourceManager/Compute/Commands.Compute/Strategies/Network/NetworkInterfaceStrategy.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.Network;
16-
using Microsoft.Azure.Management.Network.Models;
17-
using Microsoft.Azure.Management.ResourceManager.Models;
15+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01;
16+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
17+
using Microsoft.Azure.Management.Internal.Resources.Models;
1818

1919
namespace Microsoft.Azure.Commands.Common.Strategies.Network
2020
{

src/ResourceManager/Common/Commands.Common.Strategies/Network/NetworkSecurityGroupPolicy.cs renamed to src/ResourceManager/Compute/Commands.Compute/Strategies/Network/NetworkSecurityGroupPolicy.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.Network;
16-
using Microsoft.Azure.Management.Network.Models;
17-
using Microsoft.Azure.Management.ResourceManager.Models;
15+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
16+
using Microsoft.Azure.Management.Internal.Resources.Models;
17+
using Microsoft.Azure.Commands.Compute.Strategies.ResourceManager;
1818
using System.Linq;
1919

2020
namespace Microsoft.Azure.Commands.Common.Strategies.Network

src/ResourceManager/Common/Commands.Common.Strategies/Network/NetworkStrategy.cs renamed to src/ResourceManager/Compute/Commands.Compute/Strategies/Network/NetworkStrategy.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.Network;
16-
using Microsoft.Azure.Management.Network.Models;
15+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01;
16+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
1717
using System;
1818
using System.Threading.Tasks;
1919

@@ -37,6 +37,7 @@ public static ResourceStrategy<TModel> Create<TModel, TOperations>(
3737
createOrUpdateAsync,
3838
model => model.Location,
3939
(model, location) => model.Location = location,
40-
createTime);
40+
createTime,
41+
true);
4142
}
4243
}

src/ResourceManager/Common/Commands.Common.Strategies/Network/SubnetStrategy.cs renamed to src/ResourceManager/Compute/Commands.Compute/Strategies/Network/SubnetStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.Network.Models;
15+
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models;
1616
using System.Collections.Generic;
1717
using System.Linq;
1818

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.Azure.Commands.Common.Strategies;
2+
using Microsoft.Azure.Management.Internal.Resources.Models;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
7+
namespace Microsoft.Azure.Commands.Compute.Strategies.ResourceManager
8+
{
9+
static class ResourceConfigExtensions
10+
{
11+
public static ResourceConfig<TModel> CreateConfig<TModel>(
12+
this ResourceStrategy<TModel> strategy,
13+
ResourceConfig<ResourceGroup> resourceGroup,
14+
string name,
15+
Func<string, TModel> createModel = null,
16+
IEnumerable<IEntityConfig> dependencies = null)
17+
where TModel : class, new()
18+
=> strategy.CreateConfig(
19+
resourceGroup.Name,
20+
name,
21+
createModel,
22+
dependencies.EmptyIfNull().Where(d => d != null).Concat(new[] { resourceGroup }));
23+
}
24+
}

src/ResourceManager/Common/Commands.Common.Strategies/ResourceManager/ResourceGroupStrategy.cs renamed to src/ResourceManager/Compute/Commands.Compute/Strategies/ResourceManager/ResourceGroupStrategy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Management.ResourceManager;
16-
using Microsoft.Azure.Management.ResourceManager.Models;
15+
using Microsoft.Azure.Management.Internal.Resources;
16+
using Microsoft.Azure.Management.Internal.Resources.Models;
1717
using System.Linq;
1818

1919
namespace Microsoft.Azure.Commands.Common.Strategies.ResourceManager

src/ResourceManager/Compute/Commands.Compute/packages.config

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Management.Compute" version="16.3.0" targetFramework="net452" />
66
<package id="Microsoft.Azure.Management.KeyVault" version="2.3.0-preview" targetFramework="net452" />
7-
<package id="Microsoft.Azure.Management.Network" version="15.1.0-preview" targetFramework="net452" />
8-
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
97
<package id="Microsoft.Azure.Management.Storage" version="4.1.0-preview" targetFramework="net45" />
108
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
119
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.10" targetFramework="net452" />

0 commit comments

Comments
 (0)