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
157f96b
commit 8b2b24b
Showing
2 changed files
with
30 additions
and
23 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
experiments/Azure.Experiments/Azure.Experiments/Network/NetworkInterfacePolicy.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 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 NetworkInterfacePolicy | ||
{ | ||
public static ResourcePolicy<ResourceName, NetworkInterface> Policy { get; } | ||
= NetworkPolicy.Create( | ||
client => client.NetworkInterfaces, | ||
(operations, name) => operations.GetAsync(name.ResourceGroupName, name.Name), | ||
(operations, name, info) | ||
=> operations.CreateOrUpdateAsync(name.ResourceGroupName, name.Name, info)); | ||
|
||
public static ResourceConfig<ResourceName, NetworkInterface> CreateNetworkInterfaceConfig( | ||
this ResourceConfig<string, ResourceGroup> resourceGroup, | ||
string name, | ||
ResourceConfig<ResourceName, VirtualNetwork> virtualNetwork, | ||
ResourceConfig<ResourceName, NetworkSecurityGroup> networkSecurityGroup, | ||
ResourceConfig<ResourceName, PublicIPAddress> publicIPAddress) | ||
=> resourceGroup.CreateResourceConfig( | ||
Policy, | ||
name, | ||
new NetworkInterface(), | ||
new IResourceConfig[] { virtualNetwork, networkSecurityGroup, publicIPAddress }); | ||
} | ||
} |
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