FrontDoorRouteResource IOperationSource <FrontDoorRouteResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = FrontDoorRouteData.DeserializeFrontDoorRouteData(document.RootElement); return(new FrontDoorRouteResource(_client, data)); }
internal FrontDoorRouteResource(ArmClient client, FrontDoorRouteData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual async Task <ArmOperation <FrontDoorRouteResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string routeName, FrontDoorRouteData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(routeName, nameof(routeName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _frontDoorRouteClientDiagnostics.CreateScope("FrontDoorRouteCollection.CreateOrUpdate"); scope.Start(); try { var response = await _frontDoorRouteRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, routeName, data, cancellationToken).ConfigureAwait(false); var operation = new CdnArmOperation <FrontDoorRouteResource>(new FrontDoorRouteOperationSource(Client), _frontDoorRouteClientDiagnostics, Pipeline, _frontDoorRouteRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, routeName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }