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

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

            using var scope = _modelVersionClientDiagnostics.CreateScope("ModelVersionCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _modelVersionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, version, data, cancellationToken).ConfigureAwait(false);

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