コード例 #1
0
        FrontDoorOriginResource IOperationSource <FrontDoorOriginResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = FrontDoorOriginData.DeserializeFrontDoorOriginData(document.RootElement);

            return(new FrontDoorOriginResource(_client, data));
        }
コード例 #2
0
 internal FrontDoorOriginResource(ArmClient client, FrontDoorOriginData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
コード例 #3
0
        public virtual async Task <ArmOperation <FrontDoorOriginResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string originName, FrontDoorOriginData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(originName, nameof(originName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _frontDoorOriginClientDiagnostics.CreateScope("FrontDoorOriginCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _frontDoorOriginRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, data, cancellationToken).ConfigureAwait(false);

                var operation = new CdnArmOperation <FrontDoorOriginResource>(new FrontDoorOriginOperationSource(Client), _frontDoorOriginClientDiagnostics, Pipeline, _frontDoorOriginRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, originName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }