Ejemplo n.º 1
0
        FrontDoorOriginGroupResource IOperationSource <FrontDoorOriginGroupResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = FrontDoorOriginGroupData.DeserializeFrontDoorOriginGroupData(document.RootElement);

            return(new FrontDoorOriginGroupResource(_client, data));
        }
Ejemplo n.º 2
0
        public virtual async Task <ArmOperation <FrontDoorOriginGroupResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string originGroupName, FrontDoorOriginGroupData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(originGroupName, nameof(originGroupName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _frontDoorOriginGroupClientDiagnostics.CreateScope("FrontDoorOriginGroupCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _frontDoorOriginGroupRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, originGroupName, data, cancellationToken).ConfigureAwait(false);

                var operation = new CdnArmOperation <FrontDoorOriginGroupResource>(new FrontDoorOriginGroupOperationSource(Client), _frontDoorOriginGroupClientDiagnostics, Pipeline, _frontDoorOriginGroupRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, originGroupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Ejemplo n.º 3
0
 internal FrontDoorOriginGroupResource(ArmClient client, FrontDoorOriginGroupData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }