示例#1
0
        WordPressInstanceResource IOperationSource <WordPressInstanceResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = WordPressInstanceResourceData.DeserializeWordPressInstanceResourceData(document.RootElement);

            return(new WordPressInstanceResource(_client, data));
        }
示例#2
0
 internal WordPressInstanceResource(ArmClient client, WordPressInstanceResourceData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
示例#3
0
        public virtual ArmOperation <WordPressInstanceResource> CreateOrUpdate(WaitUntil waitUntil, WordPressInstanceResourceData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _wordPressInstanceResourceWordpressInstancesClientDiagnostics.CreateScope("WordPressInstanceResource.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _wordPressInstanceResourceWordpressInstancesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken);
                var operation = new WorkloadsArmOperation <WordPressInstanceResource>(new WordPressInstanceResourceOperationSource(Client), _wordPressInstanceResourceWordpressInstancesClientDiagnostics, Pipeline, _wordPressInstanceResourceWordpressInstancesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }