Пример #1
0
        BatchDeploymentResource IOperationSource <BatchDeploymentResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = BatchDeploymentData.DeserializeBatchDeploymentData(document.RootElement);

            return(new BatchDeploymentResource(_client, data));
        }
Пример #2
0
 internal BatchDeploymentResource(ArmClient client, BatchDeploymentData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Пример #3
0
        public virtual async Task <ArmOperation <BatchDeploymentResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string deploymentName, BatchDeploymentData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
            Argument.AssertNotNull(data, nameof(data));

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

                var operation = new MachineLearningArmOperation <BatchDeploymentResource>(new BatchDeploymentOperationSource(Client), _batchDeploymentClientDiagnostics, Pipeline, _batchDeploymentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deploymentName, data).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }