FrontDoorSecretResource IOperationSource <FrontDoorSecretResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = FrontDoorSecretData.DeserializeFrontDoorSecretData(document.RootElement); return(new FrontDoorSecretResource(_client, data)); }
internal FrontDoorSecretResource(ArmClient client, FrontDoorSecretData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <FrontDoorSecretResource> Update(WaitUntil waitUntil, FrontDoorSecretData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _frontDoorSecretClientDiagnostics.CreateScope("FrontDoorSecretResource.Update"); scope.Start(); try { var response = _frontDoorSecretRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new CdnArmOperation <FrontDoorSecretResource>(new FrontDoorSecretOperationSource(Client), _frontDoorSecretClientDiagnostics, Pipeline, _frontDoorSecretRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <FrontDoorSecretResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string secretName, FrontDoorSecretData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _frontDoorSecretClientDiagnostics.CreateScope("FrontDoorSecretCollection.CreateOrUpdate"); scope.Start(); try { var response = await _frontDoorSecretRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, data, cancellationToken).ConfigureAwait(false); var operation = new CdnArmOperation <FrontDoorSecretResource>(new FrontDoorSecretOperationSource(Client), _frontDoorSecretClientDiagnostics, Pipeline, _frontDoorSecretRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }