Package com.cloudinary.provisioning
Class Account
java.lang.Object
com.cloudinary.provisioning.Account
public class Account
extends java.lang.Object
Entry point class for all account and provisioning API actions: Manage users, cloud names and user groups.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAccount.RoleA user role to use in the user management API (create/update user). -
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACCOUNTSstatic java.lang.StringPROVISIONINGstatic java.lang.StringUSER_GROUPSstatic java.lang.StringUSERS -
Constructor Summary
Constructors Constructor Description Account(Cloudinary cloudinary)Create a new instance to use the account API.Account(AccountConfiguration accountConfiguration, Cloudinary cloudinary)Create a new instance to use the account API. -
Method Summary
Modifier and Type Method Description ApiResponseaddUserToGroup(java.lang.String groupId, java.lang.String userId)Add an existing user to a group.ApiResponseaddUserToGroup(java.lang.String groupId, java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options)Add an existing user to a group.ApiResponsecreateSubAccount(java.lang.String name, java.lang.String cloudName, java.util.Map customAttributes, boolean enabled, java.lang.String baseAccount)ApiResponsecreateSubAccount(java.lang.String name, java.lang.String cloudName, java.util.Map customAttributes, boolean enabled, java.lang.String baseAccount, java.util.Map<java.lang.String,java.lang.Object> options)ApiResponsecreateUser(java.lang.String name, java.lang.String email, Account.Role role, java.lang.Boolean enabled, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options)Create a new user.ApiResponsecreateUser(java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds)Create a new user.ApiResponsecreateUser(java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options)Create a new user.ApiResponsecreateUserGroup(java.lang.String name)Create a new user groupApiResponsecreateUserGroup(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> options)Create a new user groupApiResponsedeleteSubAccount(java.lang.String subAccountId)Deletes the sub-account.ApiResponsedeleteSubAccount(java.lang.String subAccountId, java.util.Map<java.lang.String,java.lang.Object> options)Deletes the sub-account.ApiResponsedeleteUser(java.lang.String userId)Delete a user.ApiResponsedeleteUser(java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options)Delete a user.ApiResponsedeleteUserGroup(java.lang.String groupId)Delete a user groupApiResponsedeleteUserGroup(java.lang.String groupId, java.util.Map<java.lang.String,java.lang.Object> options)Delete a user groupApiResponseremoveUserFromGroup(java.lang.String groupId, java.lang.String userId)Removes a user from a group.ApiResponseremoveUserFromGroup(java.lang.String groupId, java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options)Removes a user from a group.ApiResponsesubAccount(java.lang.String subAccountId)Get details of a specific sub accountApiResponsesubAccount(java.lang.String subAccountId, java.util.Map<java.lang.String,java.lang.Object> options)Get details of a specific sub accountApiResponsesubAccounts(java.lang.Boolean enabled, java.util.List<java.lang.String> ids, java.lang.String prefix)Get a list of sub accounts.ApiResponsesubAccounts(java.lang.Boolean enabled, java.util.List<java.lang.String> ids, java.lang.String prefix, java.util.Map<java.lang.String,java.lang.Object> options)Get a list of sub accounts.ApiResponseupdateSubAccount(java.lang.String subAccountId, java.lang.String name, java.lang.String cloudName, java.util.Map<java.lang.String,java.lang.String> customAttributes, java.lang.Boolean enabled)ApiResponseupdateSubAccount(java.lang.String subAccountId, java.lang.String name, java.lang.String cloudName, java.util.Map<java.lang.String,java.lang.String> customAttributes, java.lang.Boolean enabled, java.util.Map<java.lang.String,java.lang.Object> options)ApiResponseupdateUser(java.lang.String userId, java.lang.String name, java.lang.String email, Account.Role role, java.lang.Boolean enabled, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options)Update an existing user.ApiResponseupdateUser(java.lang.String userId, java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds)Update an existing user.ApiResponseupdateUser(java.lang.String userId, java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options)Update an existing user.ApiResponseupdateUserGroup(java.lang.String groupId, java.lang.String name)Update an existing user groupApiResponseupdateUserGroup(java.lang.String groupId, java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> options)Update an existing user groupApiResponseuser(java.lang.String userId)Get details of a specific user.ApiResponseuser(java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options)Get details of a specific user.ApiResponseuserGroup(java.lang.String groupId)Get details of a group.ApiResponseuserGroup(java.lang.String groupId, java.util.Map<java.lang.String,java.lang.Object> options)Get details of a group.ApiResponseuserGroups()Gets a list of all the user groups.ApiResponseuserGroups(java.util.Map<java.lang.String,java.lang.Object> options)Gets a list of all the user groups.ApiResponseuserGroupUsers(java.lang.String groupId)Lists the users belonging to this user group.ApiResponseuserGroupUsers(java.lang.String groupId, java.util.Map<java.lang.String,java.lang.Object> options)Lists the users belonging to this user group.ApiResponseusers(java.lang.Boolean pending, java.util.List<java.lang.String> userIds, java.lang.String prefix, java.lang.String subAccountId)Get a list of the users according to filters.ApiResponseusers(java.lang.Boolean pending, java.util.List<java.lang.String> userIds, java.lang.String prefix, java.lang.String subAccountId, java.util.Map<java.lang.String,java.lang.Object> options)Get a list of the users according to filters.
-
Field Details
-
PROVISIONING
public static final java.lang.String PROVISIONING- See Also:
- Constant Field Values
-
ACCOUNTS
public static final java.lang.String ACCOUNTS- See Also:
- Constant Field Values
-
USERS
public static final java.lang.String USERS- See Also:
- Constant Field Values
-
USER_GROUPS
public static final java.lang.String USER_GROUPS- See Also:
- Constant Field Values
-
-
Constructor Details
-
Account
Create a new instance to use the account API. The account information will be extracted from an environment variable CLOUDINARY_ACCOUNT_URL. If it's missing an exception will be thrown.- Parameters:
cloudinary- A cloudinary instance. This is used to fetch the correct network configuration.
-
Account
Create a new instance to use the account API. The account information will be extracted from- Parameters:
accountConfiguration- Account configuration to use in requests.cloudinary- A cloudinary instance. This is used to fetch the correct network configuration.
-
-
Method Details
-
subAccount
Get details of a specific sub account- Parameters:
subAccountId- The id of the sub account- Returns:
- the sub account details.
- Throws:
java.lang.Exception- If the request fails
-
subAccount
public ApiResponse subAccount(java.lang.String subAccountId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionGet details of a specific sub account- Parameters:
subAccountId- The id of the sub accountoptions- Generic advanced options map, see online documentation.- Returns:
- the sub account details.
- Throws:
java.lang.Exception- If the request fails
-
subAccounts
public ApiResponse subAccounts(java.lang.Boolean enabled, java.util.List<java.lang.String> ids, java.lang.String prefix) throws java.lang.ExceptionGet a list of sub accounts.- Parameters:
enabled- Optional. Whether to fetch enabled or disabled accounts. Default is all.ids- Optional. List of sub-account IDs. Up to 100. When provided, other filters are ignored.prefix- Optional. Search by prefix of the sub-account name. Case-insensitive.- Returns:
- the list of sub-accounts details.
- Throws:
java.lang.Exception- If the request fails
-
subAccounts
public ApiResponse subAccounts(java.lang.Boolean enabled, java.util.List<java.lang.String> ids, java.lang.String prefix, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionGet a list of sub accounts.- Parameters:
enabled- Optional. Whether to fetch enabled or disabled accounts. Default is all.ids- Optional. List of sub-account IDs. Up to 100. When provided, other filters are ignored.prefix- Optional. Search by prefix of the sub-account name. Case-insensitive.options- Generic advanced options map, see online documentation.- Returns:
- the list of sub-accounts details.
- Throws:
java.lang.Exception- If the request fails
-
createSubAccount
public ApiResponse createSubAccount(java.lang.String name, java.lang.String cloudName, java.util.Map customAttributes, boolean enabled, java.lang.String baseAccount) throws java.lang.Exception- Parameters:
name- Required. The name displayed in the management console.cloudName- Optional, unique (case insensitive)customAttributes- Custom attributes associated with the sub-account, as a map of key/value pairs.enabled- Optional. Whether to create the account as enabled (default is enabled).baseAccount- Optional. ID of sub-account from which to copy settings- Returns:
- details of the created sub-account
- Throws:
java.lang.Exception- If the request fails
-
createSubAccount
public ApiResponse createSubAccount(java.lang.String name, java.lang.String cloudName, java.util.Map customAttributes, boolean enabled, java.lang.String baseAccount, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.Exception- Parameters:
name- Required. The name displayed in the management console.cloudName- Optional, unique (case insensitive)customAttributes- Custom attributes associated with the sub-account, as a map of key/value pairs.enabled- Optional. Whether to create the account as enabled (default is enabled).baseAccount- Optional. ID of sub-account from which to copy settingsoptions- Generic advanced options map, see online documentation.- Returns:
- details of the created sub-account
- Throws:
java.lang.Exception- If the request fails
-
updateSubAccount
public ApiResponse updateSubAccount(java.lang.String subAccountId, java.lang.String name, java.lang.String cloudName, java.util.Map<java.lang.String,java.lang.String> customAttributes, java.lang.Boolean enabled) throws java.lang.Exception- Parameters:
subAccountId- The id of the sub-account to updatename- The name displayed in the management console.cloudName- The cloud name to set.customAttributes- ACustom attributes associated with the sub-account, as a map of key/value pairs.enabled- Set the sub-account as enabled or not.- Returns:
- details of the updated sub-account
- Throws:
java.lang.Exception- If the request fails
-
updateSubAccount
public ApiResponse updateSubAccount(java.lang.String subAccountId, java.lang.String name, java.lang.String cloudName, java.util.Map<java.lang.String,java.lang.String> customAttributes, java.lang.Boolean enabled, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.Exception- Parameters:
subAccountId- The id of the sub-account to updatename- The name displayed in the management console.cloudName- The cloud name to set.customAttributes- ACustom attributes associated with the sub-account, as a map of key/value pairs.enabled- Set the sub-account as enabled or not.options- Generic advanced options map, see online documentation.- Returns:
- details of the updated sub-account
- Throws:
java.lang.Exception- If the request fails
-
deleteSubAccount
Deletes the sub-account.- Parameters:
subAccountId- The id of the sub-account to delete- Returns:
- result message.
- Throws:
java.lang.Exception- If the request fails.
-
deleteSubAccount
public ApiResponse deleteSubAccount(java.lang.String subAccountId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionDeletes the sub-account.- Parameters:
subAccountId- The id of the sub-account to deleteoptions- Generic advanced options map, see online documentation.- Returns:
- result message.
- Throws:
java.lang.Exception- If the request fails.
-
user
Get details of a specific user.- Parameters:
userId- The id of the user to fetch- Returns:
- details of the user.
- Throws:
java.lang.Exception- If the request fails.
-
user
public ApiResponse user(java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionGet details of a specific user.- Parameters:
userId- The id of the user to fetchoptions- Generic advanced options map, see online documentation.- Returns:
- details of the user.
- Throws:
java.lang.Exception- If the request fails.
-
users
public ApiResponse users(java.lang.Boolean pending, java.util.List<java.lang.String> userIds, java.lang.String prefix, java.lang.String subAccountId) throws java.lang.ExceptionGet a list of the users according to filters.- Parameters:
pending- Optional. Limit results to pending users (true), users that are not pending (false), or all users (null)userIds- Optionals. List of user IDs. Up to 100prefix- Optional. Search by prefix of the user's name or email. Case-insensitivesubAccountId- Optional. Return only users who have access to the given sub-account- Returns:
- the users' details.
- Throws:
java.lang.Exception- If the request fails.
-
users
public ApiResponse users(java.lang.Boolean pending, java.util.List<java.lang.String> userIds, java.lang.String prefix, java.lang.String subAccountId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionGet a list of the users according to filters.- Parameters:
pending- Optional. Limit results to pending users (true), users that are not pending (false), or all users (null)userIds- Optionals. List of user IDs. Up to 100prefix- Optional. Search by prefix of the user's name or email. Case-insensitivesubAccountId- Optional. Return only users who have access to the given sub-accountoptions- Generic advanced options map, see online documentation.- Returns:
- the users' details.
- Throws:
java.lang.Exception- If the request fails.
-
createUser
public ApiResponse createUser(java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds) throws java.lang.ExceptionCreate a new user.- Parameters:
name- Required. Username.email- Required. User's email.role- Required. User's role.subAccountsIds- Optional. Sub-accounts for which the user should have access. If not provided or empty, user should have access to all accounts.- Returns:
- The newly created user details.
- Throws:
java.lang.Exception- If the request fails.
-
createUser
public ApiResponse createUser(java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionCreate a new user.- Parameters:
name- Required. Username.email- Required. User's email.role- Required. User's role.subAccountsIds- Optional. Sub-accounts for which the user should have access. If not provided or empty, user should have access to all accounts.options- Generic advanced options map, see online documentation.- Returns:
- The newly created user details.
- Throws:
java.lang.Exception- If the request fails.
-
createUser
public ApiResponse createUser(java.lang.String name, java.lang.String email, Account.Role role, java.lang.Boolean enabled, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionCreate a new user.- Parameters:
name- Required. Username.email- Required. User's email.role- Required. User's role.enabled- Optional. User's status (enabled or disabled).subAccountsIds- Optional. Sub-accounts for which the user should have access. If not provided or empty, user should have access to all accounts.options- Generic advanced options map, see online documentation.- Returns:
- The newly created user details.
- Throws:
java.lang.Exception- If the request fails.
-
updateUser
public ApiResponse updateUser(java.lang.String userId, java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds) throws java.lang.ExceptionUpdate an existing user.- Parameters:
userId- The id of the user to update.name- Username.email- User's email.role- User's role.subAccountsIds- Sub-accounts for which the user should have access. If not provided or empty, user should have access to all accounts.- Returns:
- The updated user details
- Throws:
java.lang.Exception- If the request fails.
-
updateUser
public ApiResponse updateUser(java.lang.String userId, java.lang.String name, java.lang.String email, Account.Role role, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionUpdate an existing user.- Parameters:
userId- The id of the user to update.name- Username.email- User's email.role- User's role.subAccountsIds- Sub-accounts for which the user should have access. If not provided or empty, user should have access to all accounts.options- Generic advanced options map, see online documentation.- Returns:
- The updated user details
- Throws:
java.lang.Exception- If the request fails.
-
updateUser
public ApiResponse updateUser(java.lang.String userId, java.lang.String name, java.lang.String email, Account.Role role, java.lang.Boolean enabled, java.util.List<java.lang.String> subAccountsIds, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionUpdate an existing user.- Parameters:
userId- The id of the user to update.name- Username.email- User's email.role- User's role.enabled- User's status (enabled or disabled)subAccountsIds- Sub-accounts for which the user should have access. If not provided or empty, user should have access to all accounts.options- Generic advanced options map, see online documentation.- Returns:
- The updated user details
- Throws:
java.lang.Exception- If the request fails.
-
deleteUser
Delete a user.- Parameters:
userId- Id of the user to delete.- Returns:
- result message.
- Throws:
java.lang.Exception
-
deleteUser
public ApiResponse deleteUser(java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionDelete a user.- Parameters:
userId- Id of the user to delete.options- Generic advanced options map, see online documentation.- Returns:
- result message.
- Throws:
java.lang.Exception
-
createUserGroup
Create a new user group- Parameters:
name- Required. Name for the group.- Returns:
- The newly created group.
- Throws:
java.lang.Exception- If the request fails
-
createUserGroup
public ApiResponse createUserGroup(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionCreate a new user group- Parameters:
name- Required. Name for the group.options- Generic advanced options map, see online documentation.- Returns:
- The newly created group.
- Throws:
java.lang.Exception- If the request fails
-
updateUserGroup
public ApiResponse updateUserGroup(java.lang.String groupId, java.lang.String name) throws java.lang.ExceptionUpdate an existing user group- Parameters:
groupId- The id of the group to updatename- The name of the group.- Returns:
- The updated group.
- Throws:
java.lang.Exception- If the request fails
-
updateUserGroup
public ApiResponse updateUserGroup(java.lang.String groupId, java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionUpdate an existing user group- Parameters:
groupId- The id of the group to updatename- The name of the group.options- Generic advanced options map, see online documentation.- Returns:
- The updated group.
- Throws:
java.lang.Exception- If the request fails
-
deleteUserGroup
Delete a user group- Parameters:
groupId- The group id to delete- Returns:
- A result message.
- Throws:
java.lang.Exception- if the request fails.
-
deleteUserGroup
public ApiResponse deleteUserGroup(java.lang.String groupId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionDelete a user group- Parameters:
groupId- The group id to deleteoptions- Generic advanced options map, see online documentation.- Returns:
- A result message.
- Throws:
java.lang.Exception- if the request fails.
-
addUserToGroup
public ApiResponse addUserToGroup(java.lang.String groupId, java.lang.String userId) throws java.lang.ExceptionAdd an existing user to a group.- Parameters:
groupId- The group id.userId- The user id to add.- Throws:
java.lang.Exception- If the request fails
-
addUserToGroup
public ApiResponse addUserToGroup(java.lang.String groupId, java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionAdd an existing user to a group.- Parameters:
groupId- The group id.userId- The user id to add.options- Generic advanced options map, see online documentation.- Throws:
java.lang.Exception- If the request fails
-
removeUserFromGroup
public ApiResponse removeUserFromGroup(java.lang.String groupId, java.lang.String userId) throws java.lang.ExceptionRemoves a user from a group.- Parameters:
groupId- The group id.userId- The id of the user to remove- Returns:
- A result message
- Throws:
java.lang.Exception- If the request fails.
-
removeUserFromGroup
public ApiResponse removeUserFromGroup(java.lang.String groupId, java.lang.String userId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionRemoves a user from a group.- Parameters:
groupId- The group id.userId- The id of the user to removeoptions- Generic advanced options map, see online documentation.- Returns:
- A result message
- Throws:
java.lang.Exception- If the request fails.
-
userGroup
Get details of a group.- Parameters:
groupId- The group id to fetch- Returns:
- Details of the group.
- Throws:
java.lang.Exception- If the request fails.
-
userGroup
public ApiResponse userGroup(java.lang.String groupId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionGet details of a group.- Parameters:
groupId- The group id to fetchoptions- Generic advanced options map, see online documentation.- Returns:
- Details of the group.
- Throws:
java.lang.Exception- If the request fails.
-
userGroups
Gets a list of all the user groups.- Returns:
- The list of the groups.
- Throws:
java.lang.Exception- If the request fails.
-
userGroups
public ApiResponse userGroups(java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionGets a list of all the user groups.- Parameters:
options- Generic advanced options map, see online documentation.- Returns:
- The list of the groups.
- Throws:
java.lang.Exception- If the request fails.
-
userGroupUsers
Lists the users belonging to this user group.- Parameters:
groupId- The id of the user group.- Returns:
- The list of users in that group.
- Throws:
java.lang.Exception- If the request fails.
-
userGroupUsers
public ApiResponse userGroupUsers(java.lang.String groupId, java.util.Map<java.lang.String,java.lang.Object> options) throws java.lang.ExceptionLists the users belonging to this user group.- Parameters:
groupId- The id of the user group.options- Generic advanced options map, see online documentation.- Returns:
- The list of users in that group.
- Throws:
java.lang.Exception- If the request fails.
-