Beispiel #1
0
        public virtual ArmOperation <DatastoreResource> Update(WaitUntil waitUntil, DatastoreData data, bool?skipValidation = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _datastoreClientDiagnostics.CreateScope("DatastoreResource.Update");
            scope.Start();
            try
            {
                var response  = _datastoreRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, skipValidation, cancellationToken);
                var operation = new MachineLearningArmOperation <DatastoreResource>(Response.FromValue(new DatastoreResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #2
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 #3
0
 internal DatastoreResource(ArmClient client, DatastoreData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }