Example #1
0
        public virtual ArmOperation <ModelContainerResource> Update(WaitUntil waitUntil, ModelContainerData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _modelContainerClientDiagnostics.CreateScope("ModelContainerResource.Update");
            scope.Start();
            try
            {
                var response  = _modelContainerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new MachineLearningArmOperation <ModelContainerResource>(Response.FromValue(new ModelContainerResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
 internal ModelContainerResource(ArmClient client, ModelContainerData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Example #3
0
        public virtual async Task <ArmOperation <ModelContainerResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string name, ModelContainerData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _modelContainerClientDiagnostics.CreateScope("ModelContainerCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _modelContainerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false);

                var operation = new MachineLearningArmOperation <ModelContainerResource>(Response.FromValue(new ModelContainerResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }