Skip to content

Commit d6799c5

Browse files
Paolo MilaniFrancis Pang
authored andcommitted
[s3g] OPSAPS-39330 API Metadata endpoint for External Account Commands
Added method to python bindings Testing: manually instantiated api client, invoked new metadata method on an ext. account and verified returned results (cherry picked from commit 052ef99) (cherry picked from commit 19efc7d5c4ae5300e77819a83b13b12219f70262)
1 parent fe72240 commit d6799c5

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

python/src/cm_api/api_client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,16 @@ def delete_external_account(self, name):
389389
"""
390390
return external_accounts.delete_external_account(self, name)
391391

392+
def list_external_account_commands_by_name(self, type_name):
393+
"""
394+
Lists all the commands that can be executed by name
395+
on the provided external account type.
396+
@param type_name: Account type
397+
@return: A list of ApiCommandMetadata objects
398+
@since: API v16
399+
"""
400+
return external_accounts.list_commands_by_name(self, type_name)
401+
392402
def get_root_resource(server_host, server_port=None,
393403
username="admin", password="admin",
394404
use_tls=False, version=API_CURRENT_VERSION):

python/src/cm_api/endpoints/external_accounts.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
EXTERNAL_ACCOUNT_PATH = "/externalAccounts/%s"
2727
EXTERNAL_ACCOUNT_FETCH_PATH = "/externalAccounts/%s/%s"
2828
EXTERNAL_ACCOUNT_CONFIG_FETCH_PATH = "/externalAccounts/account/%s"
29+
EXTERNAL_ACCOUNT_TYPE_INFO_FETCH_PATH = "/externalAccounts/typeInfo/%s/%s"
2930

3031
def get_supported_categories(resource_root):
3132
"""
@@ -47,6 +48,19 @@ def get_supported_types(resource_root, category_name):
4748
EXTERNAL_ACCOUNT_FETCH_PATH % ("supportedTypes", category_name,),
4849
ApiExternalAccountType, True)
4950

51+
def list_commands_by_name(resource_root, type_name):
52+
"""
53+
Lists all the commands that can be executed by name
54+
on the provided external account type.
55+
56+
@param type_name: Account type
57+
@return: A list of command metadata objects
58+
@since: API v16
59+
"""
60+
return call(resource_root.get,
61+
EXTERNAL_ACCOUNT_TYPE_INFO_FETCH_PATH % (type_name, "commandsByName"),
62+
ApiCommandMetadata, True, api_version=16)
63+
5064
def create_external_account(resource_root, name, display_name, type_name,
5165
account_configs=None):
5266
"""
@@ -202,4 +216,4 @@ def external_account_cmd_by_name(self, command_name):
202216
@return: Reference to the submitted command.
203217
@since: API v16
204218
"""
205-
return self._cmd(command_name, data=self.name, api_version=16)
219+
return self._cmd(command_name, data=self.name, api_version=16)

0 commit comments

Comments
 (0)