ServerTrustCertificateResource IOperationSource <ServerTrustCertificateResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ServerTrustCertificateData.DeserializeServerTrustCertificateData(document.RootElement); return(new ServerTrustCertificateResource(_client, data)); }
internal ServerTrustCertificateResource(ArmClient client, ServerTrustCertificateData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <ServerTrustCertificateResource> Update(WaitUntil waitUntil, ServerTrustCertificateData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateResource.Update"); scope.Start(); try { var response = _serverTrustCertificateRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new SqlArmOperation <ServerTrustCertificateResource>(new ServerTrustCertificateOperationSource(Client), _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <ServerTrustCertificateResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string certificateName, ServerTrustCertificateData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _serverTrustCertificateClientDiagnostics.CreateScope("ServerTrustCertificateCollection.CreateOrUpdate"); scope.Start(); try { var response = await _serverTrustCertificateRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data, cancellationToken).ConfigureAwait(false); var operation = new SqlArmOperation <ServerTrustCertificateResource>(new ServerTrustCertificateOperationSource(Client), _serverTrustCertificateClientDiagnostics, Pipeline, _serverTrustCertificateRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }