forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed16283
commit cc429b7
Showing
31 changed files
with
417 additions
and
455 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
experiments/Azure.Experiments/Azure.Experiments/Compute/VirtualMachineConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.Azure.Management.Compute; | ||
using Microsoft.Azure.Management.Compute.Models; | ||
using Microsoft.Azure.Management.Network.Models; | ||
using Microsoft.Azure.Management.ResourceManager.Models; | ||
|
||
namespace Microsoft.Azure.Experiments.Compute | ||
{ | ||
public static class VirtualMachineConfig | ||
{ | ||
public static ResourceConfig<VirtualMachine> Create( | ||
string name, | ||
ResourceConfig<ResourceGroup> resourceGroup, | ||
ResourceConfig<NetworkInterface> networkInterface) | ||
=> ManagedResourceConfig.Create( | ||
resourceGroup, | ||
name, | ||
new[] { networkInterface }, | ||
c => c | ||
.CreateComputeManagementClient() | ||
.VirtualMachines | ||
.GetAsync(resourceGroup.Name, name), | ||
c => c.Location); | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
experiments/Azure.Experiments/Azure.Experiments/Compute/VirtualMachineParameters.cs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
experiments/Azure.Experiments/Azure.Experiments/CreateInfo.cs
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
experiments/Azure.Experiments/Azure.Experiments/DependencyLocation.cs
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
experiments/Azure.Experiments/Azure.Experiments/DependencyLocationExtensions.cs
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
experiments/Azure.Experiments/Azure.Experiments/GetInfoContext.cs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
experiments/Azure.Experiments/Azure.Experiments/ICreateContext.cs
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
experiments/Azure.Experiments/Azure.Experiments/ICreateOperation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Azure.Experiments | ||
{ | ||
public interface ICreateOperation | ||
{ | ||
IEnumerable<ICreateOperation> Dependencies { get; } | ||
|
||
Task<object> Create(Context context); | ||
} | ||
|
||
public sealed class CreateOperation<I> : ICreateOperation | ||
{ | ||
public IEnumerable<ICreateOperation> Dependencies { get; } | ||
|
||
public async Task<object> Create(Context context) => await CreateFunc(context); | ||
|
||
public CreateOperation( | ||
IEnumerable<ICreateOperation> dependencies, Func<Context, Task<I>> createFunc) | ||
{ | ||
Dependencies = dependencies; | ||
CreateFunc = createFunc; | ||
} | ||
|
||
private Func<Context, Task<I>> CreateFunc { get; } | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
experiments/Azure.Experiments/Azure.Experiments/IGetInfoContext.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Microsoft.Azure.Experiments | ||
{ | ||
public interface IStateMap | ||
{ | ||
I Get<I>(ResourceConfig<I> config) | ||
where I : class; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
experiments/Azure.Experiments/Azure.Experiments/Location.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Microsoft.Azure.Experiments | ||
{ | ||
/// <summary> | ||
/// null is no prefered location | ||
/// { IsCommon = ...; Name = null } is a location conflict. | ||
/// </summary> | ||
public sealed class Location | ||
{ | ||
public bool IsCommon { get; } | ||
|
||
public string Name { get; } | ||
|
||
public Location(bool isCommon, string name) | ||
{ | ||
IsCommon = isCommon; | ||
Name = name; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
experiments/Azure.Experiments/Azure.Experiments/LocationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace Microsoft.Azure.Experiments | ||
{ | ||
public static class LocationExtensions | ||
{ | ||
public static Location Merge(this Location a, Location b) | ||
{ | ||
if (a == null) | ||
{ | ||
return b; | ||
} | ||
if (b == null) | ||
{ | ||
return a; | ||
} | ||
|
||
if (a.IsCommon != b.IsCommon) | ||
{ | ||
return a.IsCommon ? b : a; | ||
} | ||
|
||
return a.Name == b.Name ? a : new Location(a.IsCommon, null); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
experiments/Azure.Experiments/Azure.Experiments/ManagedResourceConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.Azure.Management.ResourceManager.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Azure.Experiments | ||
{ | ||
public static class ManagedResourceConfig | ||
{ | ||
public static ResourceConfig<I> Create<I>( | ||
ResourceConfig<ResourceGroup> resourceGroup, | ||
string name, | ||
IEnumerable<IResourceConfig> dependencies, | ||
Func<Context, Task<I>> getAsync, | ||
Func<I, string> getLocation) | ||
where I : class | ||
=> ResourceConfig.Create( | ||
name, | ||
dependencies.Concat(new[] { resourceGroup }), | ||
getAsync, | ||
i => new Location(true, getLocation(i)), | ||
(map, config) => map.Get(config)); | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
experiments/Azure.Experiments/Azure.Experiments/ManagedResourceParameters.cs
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
experiments/Azure.Experiments/Azure.Experiments/Network/NetworkInterfaceConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Microsoft.Azure.Management.Network; | ||
using Microsoft.Azure.Management.Network.Models; | ||
using Microsoft.Azure.Management.ResourceManager.Models; | ||
|
||
namespace Microsoft.Azure.Experiments.Network | ||
{ | ||
public static class NetworkInterfaceConfig | ||
{ | ||
public static ResourceConfig<NetworkInterface> Create( | ||
ResourceConfig<ResourceGroup> resourceGroup, | ||
string name, | ||
ResourceConfig<Subnet> subnet, | ||
ResourceConfig<PublicIPAddress> publicIpAddress, | ||
ResourceConfig<NetworkSecurityGroup> networkSecurityGroup) | ||
=> NetworkResourceConfig.Create( | ||
resourceGroup, | ||
name, | ||
new IResourceConfig[] { subnet, publicIpAddress, networkSecurityGroup }, | ||
c => c.NetworkInterfaces.GetAsync(resourceGroup.Name, name)); | ||
} | ||
} |
40 changes: 0 additions & 40 deletions
40
experiments/Azure.Experiments/Azure.Experiments/Network/NetworkInterfaceParameters.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.