@@ -14,8 +14,10 @@ public class Account {
1414 private static final String CLOUDINARY_ACCOUNT_URL = "CLOUDINARY_ACCOUNT_URL" ;
1515 public static final String PROVISIONING = "provisioning" ;
1616 public static final String ACCOUNTS = "accounts" ;
17+ public static final String SUB_ACCOUNTS = "sub_accounts" ;
1718 public static final String USERS = "users" ;
1819 public static final String USER_GROUPS = "user_groups" ;
20+ public static final String ACCESS_KEYS = "access_keys" ;
1921
2022 private final AccountConfiguration configuration ;
2123 private final String accountId ;
@@ -619,6 +621,60 @@ public ApiResponse userGroupUsers(String groupId, Map<String, Object> options) t
619621 return callAccountApi (Api .HttpMethod .GET , uri , Collections .<String , Object >emptyMap (), options );
620622 }
621623
624+ /**
625+ * Lists the access keys belonging to this sub account id.
626+ * @param subAccountId The id of the user group.
627+ * @param options Generic advanced options map, see online documentation.
628+ * @return The list of access keys in that sub account id.
629+ * @throws Exception If the request fails.
630+ */
631+ public ApiResponse getAccessKeys (String subAccountId , Map <String , Object > options ) throws Exception {
632+ List <String > uri = Arrays .asList (PROVISIONING , ACCOUNTS , accountId , SUB_ACCOUNTS , subAccountId );
633+ return callAccountApi (Api .HttpMethod .GET , uri , Collections .<String , Object >emptyMap (), options );
634+ }
635+
636+ /**
637+ * Creates a new access key for this sub account id.
638+ * @param subAccountId The id of the user group.
639+ * @param name The name for the access key.
640+ * @param enabled Access key's status (enabled or disabled).
641+ * @param options Generic advanced options map, see online documentation.
642+ * @return The created access key.
643+ * @throws Exception If the request fails.
644+ */
645+ public ApiResponse createAccessKey (String subAccountId , String name , Boolean enabled , Map <String , Object > options ) throws Exception {
646+ List <String > uri = Arrays .asList (PROVISIONING , ACCOUNTS , accountId , SUB_ACCOUNTS , subAccountId , ACCESS_KEYS );
647+ return callAccountApi (Api .HttpMethod .POST , uri , ObjectUtils .asMap ("name" , name , "enabled" , enabled ), options );
648+ }
649+
650+ /**
651+ * Updates an existing access key for this sub account id.
652+ * @param subAccountId The id of the user group.
653+ * @param accessKey The key of the access key.
654+ * @param name The name for the access key.
655+ * @param enabled Access key's status (enabled or disabled).
656+ * @param options Generic advanced options map, see online documentation.
657+ * @return The updated access key.
658+ * @throws Exception If the request fails.
659+ */
660+ public ApiResponse updateAccessKey (String subAccountId , String accessKey , String name , Boolean enabled , Map <String , Object > options ) throws Exception {
661+ List <String > uri = Arrays .asList (PROVISIONING , ACCOUNTS , accountId , SUB_ACCOUNTS , subAccountId , ACCESS_KEYS , accessKey );
662+ return callAccountApi (Api .HttpMethod .PUT , uri , ObjectUtils .asMap ("name" , name , "enabled" , enabled ), options );
663+ }
664+
665+ /**
666+ * Deletes an existing access key for this sub account id.
667+ * @param subAccountId The id of the user group.
668+ * @param accessKey The key of the access key.
669+ * @param options Generic advanced options map, see online documentation.
670+ * @return "message": "ok".
671+ * @throws Exception If the request fails.
672+ */
673+ public ApiResponse deleteAccessKey (String subAccountId , String accessKey , Map <String , Object > options ) throws Exception {
674+ List <String > uri = Arrays .asList (PROVISIONING , ACCOUNTS , accountId , SUB_ACCOUNTS , subAccountId , ACCESS_KEYS , accessKey );
675+ return callAccountApi (Api .HttpMethod .DELETE , uri , Collections .<String , Object >emptyMap (), options );
676+ }
677+
622678 /**
623679 * Private helper method for users api calls
624680 * @param method Http method
0 commit comments