forked from AzureRT/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 5
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
d6db1f6
commit 4a41002
Showing
8 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
experiments/Azure.Experiments/Azure.Experiments/Compute/VirtualMachineParameters.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,27 @@ | ||
using Microsoft.Azure.Management.Compute.Models; | ||
using Microsoft.Azure.Experiments.Network; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Management.Compute; | ||
|
||
namespace Microsoft.Azure.Experiments.Compute | ||
{ | ||
public sealed class VirtualMachineParameters : ResourceParameters<VirtualMachine> | ||
{ | ||
public NetworkInterfaceParameters Ni { get; } | ||
|
||
public VirtualMachineParameters( | ||
string name, | ||
ResourceGroupParameters resourceGroup, | ||
NetworkInterfaceParameters ni) | ||
: base(name, resourceGroup, new[] { ni }) | ||
{ | ||
Ni = ni; | ||
} | ||
|
||
public override Task<VirtualMachine> GetAsync(Context context) | ||
=> context | ||
.CreateCompute() | ||
.VirtualMachines | ||
.GetAsync(ResourceGroup.Name, Name); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
experiments/Azure.Experiments/Azure.Experiments/Context.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,32 @@ | ||
using Microsoft.Azure.Management.Compute; | ||
using Microsoft.Azure.Management.Network; | ||
using Microsoft.Rest; | ||
|
||
namespace Microsoft.Azure.Experiments | ||
{ | ||
public sealed class Context | ||
{ | ||
public Context( | ||
ServiceClientCredentials credentials, string subscriptionId) | ||
{ | ||
Credentials = credentials; | ||
SubscriptionId = subscriptionId; | ||
} | ||
|
||
public ServiceClientCredentials Credentials { get; } | ||
|
||
public string SubscriptionId { get; } | ||
|
||
public NetworkManagementClient CreateNetwork() | ||
=> new NetworkManagementClient(Credentials) | ||
{ | ||
SubscriptionId = SubscriptionId | ||
}; | ||
|
||
public ComputeManagementClient CreateCompute() | ||
=> new ComputeManagementClient(Credentials) | ||
{ | ||
SubscriptionId = SubscriptionId | ||
}; | ||
} | ||
} |
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
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
3 changes: 2 additions & 1 deletion
3
experiments/Azure.Experiments/Azure.Experiments/Network/SubnetParameters.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
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