public virtual LocalUserCreateOrUpdateOperation CreateOrUpdate(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 = _localUserRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, username, properties, cancellationToken); var operation = new LocalUserCreateOrUpdateOperation(ArmClient, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
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; } }