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

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

            using var scope = _appDeploymentResourceDeploymentsClientDiagnostics.CreateScope("AppDeploymentResource.Update");
            scope.Start();
            try
            {
                var response  = _appDeploymentResourceDeploymentsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new AppPlatformArmOperation <AppDeploymentResource>(new AppDeploymentResourceOperationSource(Client), _appDeploymentResourceDeploymentsClientDiagnostics, Pipeline, _appDeploymentResourceDeploymentsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
示例#4
0
        public virtual async Task <ArmOperation <AppDeploymentResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string deploymentName, AppDeploymentResourceData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _appDeploymentResourceDeploymentsClientDiagnostics.CreateScope("AppDeploymentResourceCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _appDeploymentResourceDeploymentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, data, cancellationToken).ConfigureAwait(false);

                var operation = new AppPlatformArmOperation <AppDeploymentResource>(new AppDeploymentResourceOperationSource(Client), _appDeploymentResourceDeploymentsClientDiagnostics, Pipeline, _appDeploymentResourceDeploymentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }