public virtual ArmOperation <LocalUserResource> Update(WaitUntil waitUntil, LocalUserData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _localUserClientDiagnostics.CreateScope("LocalUserResource.Update");
            scope.Start();
            try
            {
                var response  = _localUserRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new StorageArmOperation <LocalUserResource>(Response.FromValue(new LocalUserResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Пример #2
0
        public virtual async Task <ArmOperation <LocalUserResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string username, LocalUserData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(username, nameof(username));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _localUserClientDiagnostics.CreateScope("LocalUserCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _localUserRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, username, data, cancellationToken).ConfigureAwait(false);

                var operation = new StorageArmOperation <LocalUserResource>(Response.FromValue(new LocalUserResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 internal LocalUserResource(ArmClient client, LocalUserData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Пример #4
0
 internal LocalUser(ArmClient armClient, LocalUserData data) : this(armClient, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Пример #5
0
        public async virtual Task <LocalUserCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, string username, LocalUserData properties, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(username, nameof(username));
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            using var scope = _localUserClientDiagnostics.CreateScope("LocalUserCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _localUserRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, username, properties, cancellationToken).ConfigureAwait(false);

                var operation = new LocalUserCreateOrUpdateOperation(ArmClient, response);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Пример #6
0
        public virtual ArmOperation <LocalUser> CreateOrUpdate(bool waitForCompletion, string username, LocalUserData properties, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(username, nameof(username));
            Argument.AssertNotNull(properties, nameof(properties));

            using var scope = _localUserClientDiagnostics.CreateScope("LocalUserCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _localUserRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, username, properties, cancellationToken);
                var operation = new StorageArmOperation <LocalUser>(Response.FromValue(new LocalUser(Client, response), response.GetRawResponse()));
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }