コード例 #1
0
        public virtual AfdCustomDomainUpdateOperation Update(bool waitForCompletion, AfdCustomDomainUpdateOptions customDomainUpdateProperties, CancellationToken cancellationToken = default)
        {
            if (customDomainUpdateProperties == null)
            {
                throw new ArgumentNullException(nameof(customDomainUpdateProperties));
            }

            using var scope = _clientDiagnostics.CreateScope("AfdCustomDomain.Update");
            scope.Start();
            try
            {
                var response  = _afdCustomDomainsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainUpdateProperties, cancellationToken);
                var operation = new AfdCustomDomainUpdateOperation(this, _clientDiagnostics, Pipeline, _afdCustomDomainsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainUpdateProperties).Request, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #2
0
        public virtual ArmOperation <AfdCustomDomain> Update(bool waitForCompletion, AfdCustomDomainUpdateOptions options, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(options, nameof(options));

            using var scope = _afdCustomDomainClientDiagnostics.CreateScope("AfdCustomDomain.Update");
            scope.Start();
            try
            {
                var response  = _afdCustomDomainRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options, cancellationToken);
                var operation = new CdnArmOperation <AfdCustomDomain>(new AfdCustomDomainOperationSource(Client), _afdCustomDomainClientDiagnostics, Pipeline, _afdCustomDomainRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, options).Request, response, OperationFinalStateVia.OriginalUri);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #3
0
        public async Task Update()
        {
            //This test doesn't create a new afd custom domain bucause the update actoin needs to manualy add dns txt record and validate.
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroup rg = await subscription.GetResourceGroups().GetAsync("CdnTest");

            Profile afdProfile = await rg.GetProfiles().GetAsync("testAFDProfile");

            AfdCustomDomain afdCustomDomain = await afdProfile.GetAfdCustomDomains().GetAsync("customdomain4afd-azuretest-net");

            AfdCustomDomainUpdateOptions updateOptions = new AfdCustomDomainUpdateOptions
            {
                TlsSettings = new AfdCustomDomainHttpsParameters(AfdCertificateType.ManagedCertificate)
                {
                    MinimumTlsVersion = AfdMinimumTlsVersion.TLS12
                },
            };
            var lro = await afdCustomDomain.UpdateAsync(true, updateOptions);

            AfdCustomDomain updatedAfdCustomDomain = lro.Value;

            ResourceDataHelper.AssertAfdDomainUpdate(updatedAfdCustomDomain, updateOptions);
        }
コード例 #4
0
 public static void AssertAfdDomainUpdate(AfdCustomDomain updatedAfdDomain, AfdCustomDomainUpdateOptions updateOptions)
 {
     Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.CertificateType, updateOptions.TlsSettings.CertificateType);
     Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.MinimumTlsVersion, updateOptions.TlsSettings.MinimumTlsVersion);
 }
コード例 #5
0
        public async virtual Task <ArmOperation <AfdCustomDomain> > UpdateAsync(bool waitForCompletion, AfdCustomDomainUpdateOptions customDomainUpdateProperties, CancellationToken cancellationToken = default)
        {
            if (customDomainUpdateProperties == null)
            {
                throw new ArgumentNullException(nameof(customDomainUpdateProperties));
            }

            using var scope = _afdCustomDomainClientDiagnostics.CreateScope("AfdCustomDomain.Update");
            scope.Start();
            try
            {
                var response = await _afdCustomDomainRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainUpdateProperties, cancellationToken).ConfigureAwait(false);

                var operation = new CdnArmOperation <AfdCustomDomain>(new AfdCustomDomainOperationSource(Client), _afdCustomDomainClientDiagnostics, Pipeline, _afdCustomDomainRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, customDomainUpdateProperties).Request, response, OperationFinalStateVia.OriginalUri);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }