public virtual VirtualMachineScaleSetCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string vmScaleSetName, VirtualMachineScaleSetData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vmScaleSetName, nameof(vmScaleSetName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _virtualMachineScaleSetClientDiagnostics.CreateScope("VirtualMachineScaleSetCollection.CreateOrUpdate"); scope.Start(); try { var response = _virtualMachineScaleSetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, vmScaleSetName, parameters, cancellationToken); var operation = new VirtualMachineScaleSetCreateOrUpdateOperation(ArmClient, _virtualMachineScaleSetClientDiagnostics, Pipeline, _virtualMachineScaleSetRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vmScaleSetName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <VirtualMachineScaleSetCreateOrUpdateOperation> CreateOrUpdateAsync(string vmScaleSetName, VirtualMachineScaleSetData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (vmScaleSetName == null) { throw new ArgumentNullException(nameof(vmScaleSetName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetCollection.CreateOrUpdate"); scope.Start(); try { var response = await _virtualMachineScaleSetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, vmScaleSetName, parameters, cancellationToken).ConfigureAwait(false); var operation = new VirtualMachineScaleSetCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _virtualMachineScaleSetsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vmScaleSetName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual VirtualMachineScaleSetCreateOrUpdateOperation CreateOrUpdate(string vmScaleSetName, VirtualMachineScaleSetData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (vmScaleSetName == null) { throw new ArgumentNullException(nameof(vmScaleSetName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, vmScaleSetName, parameters, cancellationToken); var operation = new VirtualMachineScaleSetCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, vmScaleSetName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }