public Response Update(string subscriptionId, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVmExtensionUpdateOptions options, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (vmScaleSetName == null) { throw new ArgumentNullException(nameof(vmScaleSetName)); } if (instanceId == null) { throw new ArgumentNullException(nameof(instanceId)); } if (vmExtensionName == null) { throw new ArgumentNullException(nameof(vmExtensionName)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, options); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: return(message.Response); default: throw ClientDiagnostics.CreateRequestFailedException(message.Response); } }
internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVmExtensionUpdateOptions options) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); uri.AppendPath(vmScaleSetName, true); uri.AppendPath("/virtualMachines/", false); uri.AppendPath(instanceId, true); uri.AppendPath("/extensions/", false); uri.AppendPath(vmExtensionName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(options); request.Content = content; message.SetProperty("SDKUserAgent", _userAgent); return(message); }
public virtual ArmOperation <VirtualMachineScaleSetVmExtension> Update(bool waitForCompletion, VirtualMachineScaleSetVmExtensionUpdateOptions extensionParameters, CancellationToken cancellationToken = default) { if (extensionParameters == null) { throw new ArgumentNullException(nameof(extensionParameters)); } using var scope = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmExtension.Update"); scope.Start(); try { var response = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, extensionParameters, cancellationToken); var operation = new ComputeArmOperation <VirtualMachineScaleSetVmExtension>(new VirtualMachineScaleSetVmExtensionOperationSource(Client), _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics, Pipeline, _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, extensionParameters).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async Task <Response> UpdateAsync(string subscriptionId, string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionName, VirtualMachineScaleSetVmExtensionUpdateOptions extensionParameters, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (vmScaleSetName == null) { throw new ArgumentNullException(nameof(vmScaleSetName)); } if (instanceId == null) { throw new ArgumentNullException(nameof(instanceId)); } if (vmExtensionName == null) { throw new ArgumentNullException(nameof(vmExtensionName)); } if (extensionParameters == null) { throw new ArgumentNullException(nameof(extensionParameters)); } using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, extensionParameters); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: return(message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } }
public async virtual Task <ArmOperation <VirtualMachineScaleSetVmExtension> > UpdateAsync(bool waitForCompletion, VirtualMachineScaleSetVmExtensionUpdateOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(options, nameof(options)); using var scope = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmExtension.Update"); scope.Start(); try { var response = await _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options, cancellationToken).ConfigureAwait(false); var operation = new ComputeArmOperation <VirtualMachineScaleSetVmExtension>(new VirtualMachineScaleSetVmExtensionOperationSource(Client), _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics, Pipeline, _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, options).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <VirtualMachineScaleSetVmExtensionUpdateOperation> UpdateAsync(bool waitForCompletion, VirtualMachineScaleSetVmExtensionUpdateOptions extensionParameters, CancellationToken cancellationToken = default) { if (extensionParameters == null) { throw new ArgumentNullException(nameof(extensionParameters)); } using var scope = _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics.CreateScope("VirtualMachineScaleSetVmExtension.Update"); scope.Start(); try { var response = await _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, extensionParameters, cancellationToken).ConfigureAwait(false); var operation = new VirtualMachineScaleSetVmExtensionUpdateOperation(ArmClient, _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsClientDiagnostics, Pipeline, _virtualMachineScaleSetVmExtensionVirtualMachineScaleSetVMExtensionsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, extensionParameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }