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
0b84a5e
commit 157f96b
Showing
8 changed files
with
101 additions
and
57 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
experiments/Azure.Experiments/Azure.Experiments/Compute/VirtualMachinePolicy.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,28 @@ | ||
using Microsoft.Azure.Experiments.ResourceManager; | ||
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 VirtualMachinePolicy | ||
{ | ||
public static ResourcePolicy<ResourceName, VirtualMachine> Policy { get; } | ||
= ComputePolicy.Create( | ||
client => client.VirtualMachines, | ||
(operations, name) => operations.GetAsync(name.ResourceGroupName, name.Name), | ||
(operations, name, info) | ||
=> operations.CreateOrUpdateAsync(name.ResourceGroupName, name.Name, info)); | ||
|
||
public static ResourceConfig<ResourceName, VirtualMachine> CreateVirtualMachineConfig( | ||
this ResourceConfig<string, ResourceGroup> resourceGroup, | ||
string name, | ||
ResourceConfig<ResourceName, NetworkInterface> networkInterface) | ||
=> resourceGroup.CreateResourceConfig( | ||
Policy, | ||
name, | ||
new VirtualMachine(), | ||
new[] { networkInterface }); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
experiments/Azure.Experiments/Azure.Experiments/Network/NetworkSecurityGroupPolicy.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,22 @@ | ||
using Microsoft.Azure.Experiments.ResourceManager; | ||
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 NetworkSecurityGroupPolicy | ||
{ | ||
public static ResourcePolicy<ResourceName, NetworkSecurityGroup> Policy { get; } | ||
= NetworkPolicy.Create( | ||
client => client.NetworkSecurityGroups, | ||
(operations, name) => operations.GetAsync(name.ResourceGroupName, name.Name), | ||
(operations, name, info) | ||
=> operations.CreateOrUpdateAsync(name.ResourceGroupName, name.Name, info)); | ||
|
||
public static ResourceConfig<ResourceName, NetworkSecurityGroup> CreateNetworkSecurityGroupConfig( | ||
this ResourceConfig<string, ResourceGroup> resourceGroup, | ||
string name) | ||
=> resourceGroup.CreateResourceConfig(Policy, name, new NetworkSecurityGroup()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
experiments/Azure.Experiments/Azure.Experiments/Network/PublicIPAddressPolicy.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,22 @@ | ||
using Microsoft.Azure.Experiments.ResourceManager; | ||
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 PublicIPAddressPolicy | ||
{ | ||
public static ResourcePolicy<ResourceName, PublicIPAddress> Policy { get; } | ||
= NetworkPolicy.Create( | ||
client => client.PublicIPAddresses, | ||
(operations, name) => operations.GetAsync(name.ResourceGroupName, name.Name), | ||
(operations, name, info) | ||
=> operations.CreateOrUpdateAsync(name.ResourceGroupName, name.Name, info)); | ||
|
||
public static ResourceConfig<ResourceName, PublicIPAddress> CreatePublicIPAddressConfig( | ||
this ResourceConfig<string, ResourceGroup> resourceGroup, | ||
string name) | ||
=> resourceGroup.CreateResourceConfig(Policy, name, new PublicIPAddress()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
experiments/Azure.Experiments/Azure.Experiments/Network/VirtualNetworkPolicy.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,22 @@ | ||
using Microsoft.Azure.Experiments.ResourceManager; | ||
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 VirtualNetworkPolicy | ||
{ | ||
public static ResourcePolicy<ResourceName, VirtualNetwork> Policy { get; } | ||
= NetworkPolicy.Create( | ||
client => client.VirtualNetworks, | ||
(operations, name) => operations.GetAsync(name.ResourceGroupName, name.Name), | ||
(operations, name, info) | ||
=> operations.CreateOrUpdateAsync(name.ResourceGroupName, name.Name, info)); | ||
|
||
public static ResourceConfig<ResourceName, VirtualNetwork> CreateVirtualNetworkConfig( | ||
this ResourceConfig<string, ResourceGroup> resourceGroup, | ||
string name) | ||
=> resourceGroup.CreateResourceConfig(Policy, name, new VirtualNetwork()); | ||
} | ||
} |
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
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