Пример #1
0
 public AzureRestClient(
     IOptions <AzureOptions> azureOptions,
     IOptions <ServicePrincipleOptions> servicePrincipleOptions,
     IOptions <VirtualMachineOptions> virtualMachineOptions)
 {
     _azureOptions            = azureOptions?.Value;
     _servicePrincipleOptions = servicePrincipleOptions?.Value;
     _virtualMachineOptions   = virtualMachineOptions?.Value;
     _bearerTokenUri          = new Uri($"https://login.microsoftonline.com/{_azureOptions.TenantId}/oauth2/token");
     _dealocateVmEndpoint     = new Uri(_azureOptions.ResourceUri, $"/subscriptions/{_azureOptions.SubscriptionId}/resourceGroups/{_virtualMachineOptions.ResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{_virtualMachineOptions.Name}/deallocate?api-version=2019-03-01");
     _startVmEndpoint         = new Uri(_azureOptions.ResourceUri, $"/subscriptions/{_azureOptions.SubscriptionId}/resourceGroups/{_virtualMachineOptions.ResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{_virtualMachineOptions.Name}/start?api-version=2019-03-01");
     _vmStateEndpoint         = new Uri(_azureOptions.ResourceUri, $"/subscriptions/{_azureOptions.SubscriptionId}/resourceGroups/{_virtualMachineOptions.ResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{_virtualMachineOptions.Name}/instanceView?api-version=2019-03-01");
 }
Пример #2
0
 public void setOptions(VirtualMachineOptions options)
 {
     throw new NotImplementedException();
 }