def cli_storage_data_plane_command(name, operation, client_factory, transform=None, table_transformer=None): """ Registers an Azure CLI Storage Data Plane command. These commands always include the four parameters which can be used to obtain a storage client: account-name, account-key, connection-string, and sas-token. """ command = create_command(__name__, name, operation, transform, table_transformer, client_factory) #pylint: disable=line-too-long # add parameters required to create a storage client group_name = 'Storage Account' command.add_argument('account_name', '--account-name', required=False, default=None, arg_group=group_name, help='Storage account name. Must be used in conjunction with either ' 'storage account key or a SAS token. Environment variable: ' 'AZURE_STORAGE_ACCOUNT') command.add_argument('account_key', '--account-key', required=False, default=None, arg_group=group_name, help='Storage account key. Must be used in conjunction with storage ' 'account name. Environment variable: ' 'AZURE_STORAGE_KEY') command.add_argument('connection_string', '--connection-string', required=False, default=None, validator=validate_client_parameters, arg_group=group_name, help='Storage account connection string. Environment variable: ' 'AZURE_STORAGE_CONNECTION_STRING') command.add_argument('sas_token', '--sas-token', required=False, default=None, arg_group=group_name, help='A Shared Access Signature (SAS). Must be used in conjunction with ' 'storage account name. Environment variable: ' 'AZURE_STORAGE_SAS_TOKEN') command_table[command.name] = command
def cli_documentdb_data_plane_command(name, operation, client_factory, # pylint: disable=too-many-arguments transform=None, table_transformer=None, exception_handler=None): """ Registers an Azure CLI DocumentDB Data Plane command. These commands always include the parameters which can be used to obtain a documentdb client.""" if not exception_handler: from ._exception_handler import generic_exception_handler exception_handler = generic_exception_handler # pylint: disable=line-too-long command = create_command(__name__, name, operation, transform, table_transformer, client_factory, exception_handler=exception_handler) # add parameters required to create a documentdb client group_name = 'DocumentDB Account' command.add_argument('db_resource_group_name', '--resource-group-name', '-g', arg_group=group_name, help='name of the resource group') command.add_argument('db_account_name', '--name', '-n', arg_group=group_name, help='DocumentDB account name.') command.add_argument('db_account_key', '--key', required=False, default=None, arg_group=group_name, help='DocumentDB account key. Must be used in conjunction with documentdb ' 'account name or url-connection.') command.add_argument('db_url_connection', '--url-connection', required=False, default=None, arg_group=group_name, help='DocumentDB account url connection. Must be used in conjunction with documentdb ' 'account key.') command_table[command.name] = command
def cli_storage_data_plane_command(name, operation, client_factory, transform=None, table_transformer=None): """ Registers an Azure CLI Storage Data Plane command. These commands always include the four parameters which can be used to obtain a storage client: account-name, account-key, connection-string, and sas-token. """ command = create_command(__name__, name, operation, transform, table_transformer, client_factory) # pylint: disable=line-too-long # add parameters required to create a storage client group_name = 'Storage Account' command.add_argument('account_name', '--account-name', required=False, default=None, arg_group=group_name, help='Storage account name. Must be used in conjunction with either ' 'storage account key or a SAS token. Environment variable: ' 'AZURE_STORAGE_ACCOUNT') command.add_argument('account_key', '--account-key', required=False, default=None, arg_group=group_name, help='Storage account key. Must be used in conjunction with storage ' 'account name. Environment variable: ' 'AZURE_STORAGE_KEY') command.add_argument('connection_string', '--connection-string', required=False, default=None, validator=validate_client_parameters, arg_group=group_name, help='Storage account connection string. Environment variable: ' 'AZURE_STORAGE_CONNECTION_STRING') command.add_argument('sas_token', '--sas-token', required=False, default=None, arg_group=group_name, help='A Shared Access Signature (SAS). Must be used in conjunction with ' 'storage account name. Environment variable: ' 'AZURE_STORAGE_SAS_TOKEN') command_table[command.name] = command
def cli_cosmosdb_data_plane_command(name, operation, client_factory, transform=None, table_transformer=None, exception_handler=None): """Registers an Azure CLI Cosmos DB Data Plane command. These commands always include the parameters which can be used to obtain a cosmosdb client.""" if not exception_handler: from ._exception_handler import generic_exception_handler exception_handler = generic_exception_handler command = create_command(__name__, name, operation, transform, table_transformer, client_factory, exception_handler=exception_handler) # add parameters required to create a cosmosdb client group_name = 'Cosmos DB Account' command.add_argument('db_resource_group_name', '--resource-group-name', '-g', arg_group=group_name, help='name of the resource group. Must be used in conjunction with ' 'cosmosdb account name.') command.add_argument('db_account_name', '--name', '-n', arg_group=group_name, help='Cosmos DB account name. Must be used in conjunction with ' 'either name of the resource group or cosmosdb account key.') command.add_argument('db_account_key', '--key', required=False, default=None, arg_group=group_name, help='Cosmos DB account key. Must be used in conjunction with cosmosdb ' 'account name or url-connection.') command.add_argument('db_url_connection', '--url-connection', required=False, default=None, arg_group=group_name, help='Cosmos DB account url connection. Must be used in conjunction with ' 'cosmosdb account key.') command_table[command.name] = command
def cli_storage_data_plane_command(name, operation, client_factory, transform=None, table_transformer=None, exception_handler=None, resource_type=None, min_api=None, max_api=None): """ Registers an Azure CLI Storage Data Plane command. These commands always include the four parameters which can be used to obtain a storage client: account-name, account-key, connection-string, and sas-token. """ if resource_type and (min_api or max_api): from azure.cli.core.profiles import supported_api_version if not supported_api_version( resource_type, min_api=min_api, max_api=max_api): return command = create_command(__name__, name, operation, transform, table_transformer, client_factory, exception_handler=exception_handler) # add parameters required to create a storage client group_name = 'Storage Account' command.add_argument( 'account_name', '--account-name', required=False, default=None, arg_group=group_name, help='Storage account name. Must be used in conjunction with either ' 'storage account key or a SAS token. Environment variable: ' 'AZURE_STORAGE_ACCOUNT') command.add_argument( 'account_key', '--account-key', required=False, default=None, arg_group=group_name, help='Storage account key. Must be used in conjunction with storage ' 'account name. Environment variable: ' 'AZURE_STORAGE_KEY') command.add_argument( 'connection_string', '--connection-string', required=False, default=None, validator=validate_client_parameters, arg_group=group_name, help='Storage account connection string. Environment variable: ' 'AZURE_STORAGE_CONNECTION_STRING') command.add_argument( 'sas_token', '--sas-token', required=False, default=None, arg_group=group_name, help='A Shared Access Signature (SAS). Must be used in conjunction with ' 'storage account name. Environment variable: ' 'AZURE_STORAGE_SAS_TOKEN') command_table[command.name] = command