예제 #1
0
        public virtual async Task <ArmOperation <ContainerAppCertificateResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string certificateName, ContainerAppCertificateData data = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(certificateName, nameof(certificateName));

            using var scope = _containerAppCertificateCertificatesClientDiagnostics.CreateScope("ContainerAppCertificateCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _containerAppCertificateCertificatesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, certificateName, data, cancellationToken).ConfigureAwait(false);

                var operation = new ContainersArmOperation <ContainerAppCertificateResource>(Response.FromValue(new ContainerAppCertificateResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 internal ContainerAppCertificateResource(ArmClient client, ContainerAppCertificateData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }