Ejemplo n.º 1
0
        public virtual ArmOperation <CodeVersionResource> Update(WaitUntil waitUntil, CodeVersionData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

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

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

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