public async Task Update() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); AfdEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); AfdOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); AfdOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); AfdRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); AfdRouteResource afdRoute = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); AfdRoutePatch updateOptions = new AfdRoutePatch { EnabledState = EnabledState.Disabled }; var lro = await afdRoute.UpdateAsync(WaitUntil.Completed, updateOptions); AfdRouteResource updatedAfdRoute = lro.Value; ResourceDataHelper.AssertAfdRouteUpdate(updatedAfdRoute, updateOptions); }
public virtual ArmOperation <AfdRouteResource> Update(WaitUntil waitUntil, AfdRoutePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _afdRouteClientDiagnostics.CreateScope("AfdRouteResource.Update"); scope.Start(); try { var response = _afdRouteRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); var operation = new CdnArmOperation <AfdRouteResource>(new AfdRouteOperationSource(Client), _afdRouteClientDiagnostics, Pipeline, _afdRouteRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, 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 AssertAfdRouteUpdate(AfdRouteResource updatedRoute, AfdRoutePatch updateOptions) { Assert.AreEqual(updatedRoute.Data.EnabledState, updateOptions.EnabledState); }