Beispiel #1
0
        public virtual async Task <ArmOperation <OnlineDeploymentResource> > UpdateAsync(WaitUntil waitUntil, OnlineDeploymentPatch patch, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(patch, nameof(patch));

            using var scope = _onlineDeploymentClientDiagnostics.CreateScope("OnlineDeploymentResource.Update");
            scope.Start();
            try
            {
                var response = await _onlineDeploymentRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false);

                var operation = new MachineLearningArmOperation <OnlineDeploymentResource>(new OnlineDeploymentOperationSource(Client), _onlineDeploymentClientDiagnostics, Pipeline, _onlineDeploymentRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #2
0
        public virtual async Task <ArmOperation <CodeVersionResource> > UpdateAsync(WaitUntil waitUntil, CodeVersionData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _codeVersionClientDiagnostics.CreateScope("CodeVersionResource.Update");
            scope.Start();
            try
            {
                var response = await _codeVersionRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, 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;
            }
        }
Beispiel #3
0
        public virtual async Task <ArmOperation <DatastoreResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string name, DatastoreData data, bool?skipValidation = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _datastoreRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, skipValidation, cancellationToken).ConfigureAwait(false);

                var operation = new MachineLearningArmOperation <DatastoreResource>(Response.FromValue(new DatastoreResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #4
0
        public virtual async Task <ArmOperation <OnlineEndpointResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string endpointName, OnlineEndpointData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _onlineEndpointClientDiagnostics.CreateScope("OnlineEndpointCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _onlineEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, data, cancellationToken).ConfigureAwait(false);

                var operation = new MachineLearningArmOperation <OnlineEndpointResource>(new OnlineEndpointOperationSource(Client), _onlineEndpointClientDiagnostics, Pipeline, _onlineEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, data).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }