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. SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await subscription.GetResourceGroups().GetAsync("CdnTest"); ProfileResource afdProfile = await rg.GetProfiles().GetAsync("testAFDProfile"); AfdCustomDomainResource afdCustomDomain = await afdProfile.GetAfdCustomDomains().GetAsync("customdomain4afd-azuretest-net"); AfdCustomDomainPatch updateOptions = new AfdCustomDomainPatch { TlsSettings = new AfdCustomDomainHttpsContent(AfdCertificateType.ManagedCertificate) { MinimumTlsVersion = AfdMinimumTlsVersion.Tls10 }, }; var lro = await afdCustomDomain.UpdateAsync(WaitUntil.Completed, updateOptions); ; AfdCustomDomainResource updatedAfdCustomDomain = lro.Value; ResourceDataHelper.AssertAfdDomainUpdate(updatedAfdCustomDomain, updateOptions); }
public virtual ArmOperation <AfdCustomDomainResource> Update(WaitUntil waitUntil, AfdCustomDomainPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _afdCustomDomainClientDiagnostics.CreateScope("AfdCustomDomainResource.Update"); scope.Start(); try { var response = _afdCustomDomainRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); var operation = new CdnArmOperation <AfdCustomDomainResource>(new AfdCustomDomainOperationSource(Client), _afdCustomDomainClientDiagnostics, Pipeline, _afdCustomDomainRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public static void AssertAfdDomainUpdate(AfdCustomDomainResource updatedAfdDomain, AfdCustomDomainPatch updateOptions) { Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.CertificateType, updateOptions.TlsSettings.CertificateType); Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.MinimumTlsVersion, updateOptions.TlsSettings.MinimumTlsVersion); }