Class UsersRequestBuilder

java.lang.Object
org.azd.abstractions.BaseRequestBuilder
org.azd.graph.users.UsersRequestBuilder

public class UsersRequestBuilder extends BaseRequestBuilder
Provides functionality to work with Graph Users Api.
  • Constructor Details

    • UsersRequestBuilder

      public UsersRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential)
      Instantiates a new RequestBuilder instance and sets the default values.
      Parameters:
      organizationUrl - Represents organization location request url.
      accessTokenCredential - Access token credential object.
  • Method Details

    • createAsync

      public CompletableFuture<GraphUser> createAsync(GraphUserCreationContext creationContext) throws AzDException
      Materialize an existing AAD or MSA user into the ADO account.



      NOTE: Created users are not active in an account unless they have been explicitly assigned a parent group at creation time or have signed in and been autolicensed through AAD group memberships.



      Adding a user to an account is required before the user can be added to ADO groups or assigned an asset.



      The body of the request must be a derived type of GraphUserCreationContext:



      GraphUserMailAddressCreationContext - Create a new user using the mail address as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserOriginIdCreationContext - Create a new user using the OriginID as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserPrincipalNameCreationContext - Create a new user using the principal name as a reference to an existing user from an external AD or AAD backed provider.

      If the user to be added corresponds to a user that was previously deleted, then that user will be restored.



      Optionally, you can add the newly created user as a member of an existing ADO group and/or specify a custom storage key for the user.

      Parameters:
      creationContext - graph user creation context object to create a user.
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • createAsync

      public CompletableFuture<GraphUser> createAsync(GraphUserCreationContext creationContext, Consumer<UsersRequestBuilder.RequestConfiguration> requestConfiguration) throws AzDException
      Materialize an existing AAD or MSA user into the ADO account.



      NOTE: Created users are not active in an account unless they have been explicitly assigned a parent group at creation time or have signed in and been autolicensed through AAD group memberships.



      Adding a user to an account is required before the user can be added to ADO groups or assigned an asset.



      The body of the request must be a derived type of GraphUserCreationContext:



      GraphUserMailAddressCreationContext - Create a new user using the mail address as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserOriginIdCreationContext - Create a new user using the OriginID as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserPrincipalNameCreationContext - Create a new user using the principal name as a reference to an existing user from an external AD or AAD backed provider.

      If the user to be added corresponds to a user that was previously deleted, then that user will be restored.



      Optionally, you can add the newly created user as a member of an existing ADO group and/or specify a custom storage key for the user.

      Parameters:
      creationContext - graph user creation context object to create a user.
      requestConfiguration - Consumer of request configuration. This represents the query parameter for the request.
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • deleteAsync

      public CompletableFuture<Void> deleteAsync(String userDescriptor) throws AzDException
      The user will still be visible, but membership checks for the user will return false.
      Parameters:
      userDescriptor - The descriptor of the user to delete.
      Throws:
      AzDException - Default Api exception handler.
    • getAsync

      public CompletableFuture<GraphUser> getAsync(String userDescriptor) throws AzDException
      Get a user by its descriptor.
      Parameters:
      userDescriptor - The descriptor of the user to delete.
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • listAsync

      public CompletableFuture<GraphUsers> listAsync() throws AzDException
      Get a list of all users in a given scope.

      Since the list of users may be large, results are returned in pages of users. If there are more results than can be returned in a single page, the result set will contain a continuation token for retrieval of the next set of results.

      Returns:
      Collection of graph user as a paged response. Use getNextPageLink() to get the next page.
      Throws:
      AzDException - Default Api exception handler.
    • listAsync

      Get a list of all users in a given scope.

      Since the list of users may be large, results are returned in pages of users. If there are more results than can be returned in a single page, the result set will contain a continuation token for retrieval of the next set of results.

      Parameters:
      requestConfiguration - Consumer of request configuration. This represents the query parameter for the request.
      Returns:
      Collection of graph user as a paged response. Use getNextPageLink() to get the next page.
      Throws:
      AzDException - Default Api exception handler.
    • updateAsync

      public CompletableFuture<GraphUser> updateAsync(GraphUserUpdateContext updateContext, String userDescriptor) throws AzDException
      Map an existing user to a different user.
      The body of the request must be a derived type of GraphUserUpdateContext:

      GraphUserOriginIdUpdateContext - Map an existing user in an account, to an existing user from an external AD or AAD backed provider using the OriginId as a reference.
      Parameters:
      updateContext - origin id and optionally storage key to update.
      userDescriptor - The descriptor of the user to update
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • create

      public GraphUser create(GraphUserCreationContext creationContext) throws AzDException
      Materialize an existing AAD or MSA user into the ADO account.



      NOTE: Created users are not active in an account unless they have been explicitly assigned a parent group at creation time or have signed in and been autolicensed through AAD group memberships.



      Adding a user to an account is required before the user can be added to ADO groups or assigned an asset.



      The body of the request must be a derived type of GraphUserCreationContext:



      GraphUserMailAddressCreationContext - Create a new user using the mail address as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserOriginIdCreationContext - Create a new user using the OriginID as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserPrincipalNameCreationContext - Create a new user using the principal name as a reference to an existing user from an external AD or AAD backed provider.

      If the user to be added corresponds to a user that was previously deleted, then that user will be restored.



      Optionally, you can add the newly created user as a member of an existing ADO group and/or specify a custom storage key for the user.

      Parameters:
      creationContext - graph user creation context object to create a user.
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • create

      public GraphUser create(GraphUserCreationContext creationContext, Consumer<UsersRequestBuilder.RequestConfiguration> requestConfiguration) throws AzDException
      Materialize an existing AAD or MSA user into the ADO account.



      NOTE: Created users are not active in an account unless they have been explicitly assigned a parent group at creation time or have signed in and been autolicensed through AAD group memberships.



      Adding a user to an account is required before the user can be added to ADO groups or assigned an asset.



      The body of the request must be a derived type of GraphUserCreationContext:



      GraphUserMailAddressCreationContext - Create a new user using the mail address as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserOriginIdCreationContext - Create a new user using the OriginID as a reference to an existing user from an external AD or AAD backed provider.

      GraphUserPrincipalNameCreationContext - Create a new user using the principal name as a reference to an existing user from an external AD or AAD backed provider.

      If the user to be added corresponds to a user that was previously deleted, then that user will be restored.



      Optionally, you can add the newly created user as a member of an existing ADO group and/or specify a custom storage key for the user.

      Parameters:
      creationContext - graph user creation context object to create a user.
      requestConfiguration - Consumer of request configuration. This represents the query parameter for the request.
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • delete

      public Void delete(String userDescriptor) throws AzDException
      The user will still be visible, but membership checks for the user will return false.
      Parameters:
      userDescriptor - The descriptor of the user to delete.
      Throws:
      AzDException - Default Api exception handler.
    • get

      public GraphUser get(String userDescriptor) throws AzDException
      Get a user by its descriptor.
      Parameters:
      userDescriptor - The descriptor of the user to delete.
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.
    • list

      public GraphUsers list() throws AzDException
      Get a list of all users in a given scope.

      Since the list of users may be large, results are returned in pages of users. If there are more results than can be returned in a single page, the result set will contain a continuation token for retrieval of the next set of results.

      Returns:
      Collection of graph user as a paged response. Use getNextPageLink() to get the next page.
      Throws:
      AzDException - Default Api exception handler.
    • list

      Get a list of all users in a given scope.

      Since the list of users may be large, results are returned in pages of users. If there are more results than can be returned in a single page, the result set will contain a continuation token for retrieval of the next set of results.

      Parameters:
      requestConfiguration - Consumer of request configuration. This represents the query parameter for the request.
      Returns:
      Collection of graph user as a paged response. Use getNextPageLink() to get the next page.
      Throws:
      AzDException - Default Api exception handler.
    • update

      public GraphUser update(GraphUserUpdateContext updateContext, String userDescriptor) throws AzDException
      Map an existing user to a different user.
      The body of the request must be a derived type of GraphUserUpdateContext:

      GraphUserOriginIdUpdateContext - Map an existing user in an account, to an existing user from an external AD or AAD backed provider using the OriginId as a reference.
      Parameters:
      updateContext - origin id and optionally storage key to update.
      userDescriptor - The descriptor of the user to update
      Returns:
      Graph user object GraphUser
      Throws:
      AzDException - Default Api exception handler.