ElasticSanVolumeGroupResource IOperationSource <ElasticSanVolumeGroupResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ElasticSanVolumeGroupData.DeserializeElasticSanVolumeGroupData(document.RootElement); return(new ElasticSanVolumeGroupResource(_client, data)); }
internal ElasticSanVolumeGroupResource(ArmClient client, ElasticSanVolumeGroupData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual async Task <ArmOperation <ElasticSanVolumeGroupResource> > CreateOrUpdateAsync(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 = await _elasticSanVolumeGroupVolumeGroupsRestClient.CreateAsync(elasticSanVolumeGroupName, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); 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) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }