Ejemplo n.º 1
0
        OnlineDeploymentResource IOperationSource <OnlineDeploymentResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = OnlineDeploymentData.DeserializeOnlineDeploymentData(document.RootElement);

            return(new OnlineDeploymentResource(_client, data));
        }
Ejemplo n.º 2
0
 internal OnlineDeploymentResource(ArmClient client, OnlineDeploymentData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Ejemplo n.º 3
0
        public virtual async Task <ArmOperation <OnlineDeploymentResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string deploymentName, OnlineDeploymentData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName));
            Argument.AssertNotNull(data, nameof(data));

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

                var operation = new MachineLearningArmOperation <OnlineDeploymentResource>(new OnlineDeploymentOperationSource(Client), _onlineDeploymentClientDiagnostics, Pipeline, _onlineDeploymentRestClient.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;
            }
        }