public virtual ArmOperation <ElasticSanResource> Update(WaitUntil waitUntil, ElasticSanPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _elasticSanClientDiagnostics.CreateScope("ElasticSanResource.Update"); scope.Start(); try { var response = _elasticSanRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); var operation = new ElasticSanArmOperation <ElasticSanResource>(new ElasticSanOperationSource(Client), _elasticSanClientDiagnostics, Pipeline, _elasticSanRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <ElasticSanVolumeGroupResource> CreateOrUpdate(WaitUntil waitUntil, string elasticSanVolumeGroupName, ElasticSanVolumeGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(elasticSanVolumeGroupName, nameof(elasticSanVolumeGroupName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _elasticSanVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("ElasticSanVolumeGroupCollection.CreateOrUpdate"); scope.Start(); try { var response = _elasticSanVolumeGroupVolumeGroupsRestClient.Create(elasticSanVolumeGroupName, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); var operation = new ElasticSanArmOperation <ElasticSanVolumeGroupResource>(new ElasticSanVolumeGroupOperationSource(Client), _elasticSanVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _elasticSanVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(elasticSanVolumeGroupName, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }