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)); }
internal WordPressInstanceResource(ArmClient client, WordPressInstanceResourceData data) : this(client, data.Id) { HasData = true; _data = data; }
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; } }