From 27cf71299ec51976fed8b18dbf5c0e4f9f4fd6f5 Mon Sep 17 00:00:00 2001 From: Lingxian Kong Date: Sat, 18 Apr 2020 23:25:26 +1200 Subject: Remove flavor API Change-Id: I5a35911b5658fdf6bc08844b31cc1325b749526a --- doc/source/cli/index.rst | 3 - doc/source/cli/trove.rst | 2924 -------------------- doc/source/index.rst | 4 +- doc/source/user/index.rst | 53 +- setup.cfg | 2 - troveclient/compat/__init__.py | 2 - troveclient/compat/cli.py | 11 - troveclient/compat/client.py | 3 - troveclient/compat/mcli.py | 26 - troveclient/osc/v1/database_flavors.py | 97 - troveclient/osc/v1/database_instances.py | 6 +- troveclient/tests/osc/v1/fakes.py | 8 - troveclient/tests/osc/v1/test_database_flavors.py | 78 - .../tests/osc/v1/test_database_instances.py | 2 +- troveclient/tests/test_management.py | 32 - troveclient/tests/test_v1_shell.py | 59 +- troveclient/v1/client.py | 2 - troveclient/v1/flavors.py | 58 - troveclient/v1/management.py | 39 - troveclient/v1/shell.py | 56 +- 20 files changed, 34 insertions(+), 3431 deletions(-) delete mode 100644 doc/source/cli/index.rst delete mode 100644 doc/source/cli/trove.rst delete mode 100644 troveclient/osc/v1/database_flavors.py delete mode 100644 troveclient/tests/osc/v1/test_database_flavors.py delete mode 100644 troveclient/v1/flavors.py diff --git a/doc/source/cli/index.rst b/doc/source/cli/index.rst deleted file mode 100644 index a407afd..0000000 --- a/doc/source/cli/index.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. toctree:: - - trove.rst diff --git a/doc/source/cli/trove.rst b/doc/source/cli/trove.rst deleted file mode 100644 index 84c52a5..0000000 --- a/doc/source/cli/trove.rst +++ /dev/null @@ -1,2924 +0,0 @@ -.. ################################################### -.. ## WARNING ###################################### -.. ############## WARNING ########################## -.. ########################## WARNING ############## -.. ###################################### WARNING ## -.. ################################################### -.. ################################################### -.. ## -.. This file is tool-generated. Do not edit manually. -.. http://docs.openstack.org/contributor-guide/ -.. doc-tools/cli-reference.html -.. ## -.. ## WARNING ###################################### -.. ############## WARNING ########################## -.. ########################## WARNING ############## -.. ###################################### WARNING ## -.. ################################################### - -============================================ -Database service (trove) command-line client -============================================ - -The trove client is the command-line interface (CLI) for -the Database service (trove) API and its extensions. - -This chapter documents :command:`trove` version ``2.10.0``. - -For help on a specific :command:`trove` command, enter: - -.. code-block:: console - - $ trove help COMMAND - -.. _trove_command_usage: - -trove usage -~~~~~~~~~~~ - -.. code-block:: console - - usage: trove [--version] [--debug] [--service-type ] - [--service-name ] [--bypass-url ] - [--database-service-name ] - [--endpoint-type ] - [--os-database-api-version ] - [--retries ] [--json] [--profile HMAC_KEY] [--insecure] - [--os-cacert ] [--os-cert ] - [--os-key ] [--timeout ] [--os-auth-type ] - [--os-auth-url OS_AUTH_URL] [--os-domain-id OS_DOMAIN_ID] - [--os-domain-name OS_DOMAIN_NAME] [--os-project-id OS_PROJECT_ID] - [--os-project-name OS_PROJECT_NAME] - [--os-project-domain-id OS_PROJECT_DOMAIN_ID] - [--os-project-domain-name OS_PROJECT_DOMAIN_NAME] - [--os-trust-id OS_TRUST_ID] - [--os-default-domain-id OS_DEFAULT_DOMAIN_ID] - [--os-default-domain-name OS_DEFAULT_DOMAIN_NAME] - [--os-user-id OS_USER_ID] [--os-username OS_USERNAME] - [--os-user-domain-id OS_USER_DOMAIN_ID] - [--os-user-domain-name OS_USER_DOMAIN_NAME] - [--os-password OS_PASSWORD] [--os-region-name ] - ... - -**Subcommands:** - -``backup-copy`` - Creates a backup from another backup. - -``backup-create`` - Creates a backup of an instance. - -``backup-delete`` - Deletes a backup. - -``backup-list`` - Lists available backups. - -``backup-list-instance`` - Lists available backups for an instance. - -``backup-show`` - Shows details of a backup. - -``cluster-create`` - Creates a new cluster. - -``cluster-delete`` - Deletes a cluster. - -``cluster-force-delete`` - Force delete a cluster - -``cluster-grow`` - Adds more instances to a cluster. - -``cluster-instances`` - Lists all instances of a cluster. - -``cluster-list`` - Lists all the clusters. - -``cluster-modules`` - Lists all modules for each instance of a - cluster. - -``cluster-reset-status`` - Set the cluster task to NONE. - -``cluster-show`` - Shows details of a cluster. - -``cluster-shrink`` - Drops instances from a cluster. - -``cluster-upgrade`` - Upgrades a cluster to a new datastore - version. - -``configuration-attach`` - Attaches a configuration group to an - instance. - -``configuration-create`` - Creates a configuration group. - -``configuration-default`` - Shows the default configuration of an - instance. - -``configuration-delete`` - Deletes a configuration group. - -``configuration-detach`` - Detaches a configuration group from an - instance. - -``configuration-instances`` - Lists all instances associated with a - configuration group. - -``configuration-list`` - Lists all configuration groups. - -``configuration-parameter-list`` - Lists available parameters for a - configuration group. - -``configuration-parameter-show`` - Shows details of a configuration parameter. - -``configuration-patch`` - Patches a configuration group. - -``configuration-show`` - Shows details of a configuration group. - -``configuration-update`` - Updates a configuration group. - -``create`` - Creates a new instance. - -``database-create`` - Creates a database on an instance. - -``database-delete`` - Deletes a database from an instance. - -``database-list`` - Lists available databases on an instance. - -``datastore-list`` - Lists available datastores. - -``datastore-show`` - Shows details of a datastore. - -``datastore-version-list`` - Lists available versions for a datastore. - -``datastore-version-show`` - Shows details of a datastore version. - -``delete`` - Deletes an instance. - -``detach-replica`` - Detaches a replica instance from its - replication source. - -``eject-replica-source`` - Ejects a replica source from its set. - -``execution-delete`` - Deletes an execution. - -``execution-list`` - Lists executions of a scheduled backup of an - instance. - -``flavor-list`` - Lists available flavors. - -``flavor-show`` - Shows details of a flavor. - -``force-delete`` - Force delete an instance. - -``limit-list`` - Lists the limits for a tenant. - -``list`` - Lists all the instances. - -``log-disable`` - Instructs Trove guest to stop collecting log - details. - -``log-discard`` - Instructs Trove guest to discard the - container of the published log. - -``log-enable`` - Instructs Trove guest to start collecting - log details. - -``log-list`` - Lists the log files available for instance. - -``log-publish`` - Instructs Trove guest to publish latest log - entries on instance. - -``log-save`` - Save log file for instance. - -``log-show`` - Instructs Trove guest to show details of - log. - -``log-tail`` - Display log entries for instance. - -``metadata-create`` - Creates metadata in the database for - instance . - -``metadata-delete`` - Deletes metadata for instance . - -``metadata-edit`` - Replaces metadata value with a new one, this - is non-destructive. - -``metadata-list`` - Shows all metadata for instance . - -``metadata-show`` - Shows metadata entry for key and - instance . - -``metadata-update`` - Updates metadata, this is destructive. - -``module-apply`` - Apply modules to an instance. - -``module-create`` - Create a module. - -``module-delete`` - Delete a module. - -``module-instance-count`` - Lists a count of the instances for each - module md5. - -``module-instances`` - Lists the instances that have a particular - module applied. - -``module-list`` - Lists the modules available. - -``module-list-instance`` - Lists the modules that have been applied to - an instance. - -``module-query`` - Query the status of the modules on an - instance. - -``module-reapply`` - Reapply a module. - -``module-remove`` - Remove a module from an instance. - -``module-retrieve`` - Retrieve module contents from an instance. - -``module-show`` - Shows details of a module. - -``module-update`` - Update a module. - -``promote-to-replica-source`` - Promotes a replica to be the new replica - source of its set. - -``quota-show`` - Show quotas for a tenant. - -``quota-update`` - Update quotas for a tenant. - -``reset-status`` - Set the status to NONE. - -``resize-instance`` - Resizes an instance with a new flavor. - -``resize-volume`` - Resizes the volume size of an instance. - -``restart`` - Restarts an instance. - -``root-disable`` - Disables root for an instance. - -``root-enable`` - Enables root for an instance and resets if - already exists. - -``root-show`` - Gets status if root was ever enabled for an - instance or cluster. - -``schedule-create`` - Schedules backups for an instance. - -``schedule-delete`` - Deletes a schedule. - -``schedule-list`` - Lists scheduled backups for an instance. - -``schedule-show`` - Shows details of a schedule. - -``secgroup-add-rule`` - Creates a security group rule. - -``secgroup-delete-rule`` - Deletes a security group rule. - -``secgroup-list`` - Lists all security groups. - -``secgroup-list-rules`` - Lists all rules for a security group. - -``secgroup-show`` - Shows details of a security group. - -``show`` - Shows details of an instance. - -``update`` - Updates an instance: Edits name, - configuration, or replica source. - -``upgrade`` - Upgrades an instance to a new datastore - version. - -``user-create`` - Creates a user on an instance. - -``user-delete`` - Deletes a user from an instance. - -``user-grant-access`` - Grants access to a database(s) for a user. - -``user-list`` - Lists the users for an instance. - -``user-revoke-access`` - Revokes access to a database for a user. - -``user-show`` - Shows details of a user of an instance. - -``user-show-access`` - Shows access details of a user of an - instance. - -``user-update-attributes`` - Updates a user's attributes on an instance. - -``volume-type-list`` - Lists available volume types. - -``volume-type-show`` - Shows details of a volume type. - -``bash-completion`` - Prints arguments for bash_completion. - -``help`` - Displays help about this program or one of - its subcommands. - -.. _trove_command_options: - -trove optional arguments -~~~~~~~~~~~~~~~~~~~~~~~~ - -``--version`` - Show program's version number and exit. - -``--debug`` - Print debugging output. - -``--service-type `` - Defaults to database for most actions. - -``--service-name `` - Defaults to ``env[TROVE_SERVICE_NAME]``. - -``--bypass-url `` - Defaults to ``env[TROVE_BYPASS_URL]``. - -``--database-service-name `` - Defaults to - ``env[TROVE_DATABASE_SERVICE_NAME]``. - -``--endpoint-type `` - Defaults to ``env[TROVE_ENDPOINT_TYPE]`` or - ``env[OS_ENDPOINT_TYPE]`` or publicURL. - -``--os-database-api-version `` - Accepts 1, defaults to - ``env[OS_DATABASE_API_VERSION]``. - -``--retries `` - Number of retries. - -``--json, --os-json-output`` - Output JSON instead of prettyprint. Defaults - to ``env[OS_JSON_OUTPUT]``. - -``--profile HMAC_KEY`` - HMAC key used to encrypt context data when - profiling the performance of an operation. - This key should be set to one of the HMAC - keys configured in Trove (they are found in - api-paste.ini, typically in /etc/trove). - Without the key, profiling will not be - triggered even if it is enabled on the - server side. Defaults to - ``env[OS_PROFILE_HMACKEY]``. - -``--os-auth-type , --os-auth-plugin `` - Authentication type to use - -``--os-region-name `` - Specify the region to use. Defaults to - ``env[OS_REGION_NAME]``. - -.. _trove_backup-copy: - -trove backup-copy ------------------ - -.. code-block:: console - - usage: trove backup-copy [--description ] - -Creates a backup from another backup. - -**Positional arguments:** - -```` - Name of the backup. - -```` - Backup ID of the source backup. - -**Optional arguments:** - -``--description `` - An optional description for the backup. - -.. _trove_backup-create: - -trove backup-create -------------------- - -.. code-block:: console - - usage: trove backup-create - [--description ] [--parent ] - [--incremental] - -Creates a backup of an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of the backup. - -**Optional arguments:** - -``--description `` - An optional description for the backup. - -``--parent `` - Optional ID of the parent backup to perform an - incremental backup from. - -``--incremental`` - Create an incremental backup based on the last - full or incremental backup. It will create a - full backup if no existing backup found. - -.. _trove_backup-delete: - -trove backup-delete -------------------- - -.. code-block:: console - - usage: trove backup-delete - -Deletes a backup. - -**Positional arguments:** - -```` - ID or name of the backup. - -.. _trove_backup-list: - -trove backup-list ------------------ - -.. code-block:: console - - usage: trove backup-list [--limit ] [--marker ] - [--datastore ] - -Lists available backups. - -**Optional arguments:** - -``--limit `` - Return up to N number of the most recent backups. - -``--marker `` - Begin displaying the results for IDs greater than - the specified marker. When used with --limit, set - this to the last ID displayed in the previous run. - -``--datastore `` - ID or name of the datastore (to filter backups by). - -.. _trove_backup-list-instance: - -trove backup-list-instance --------------------------- - -.. code-block:: console - - usage: trove backup-list-instance [--limit ] [--marker ] - -Lists available backups for an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -**Optional arguments:** - -``--limit `` - Return up to N number of the most recent backups. - -``--marker `` - Begin displaying the results for IDs greater than the - specified marker. When used with --limit, set this to the - last ID displayed in the previous run. - -.. _trove_backup-show: - -trove backup-show ------------------ - -.. code-block:: console - - usage: trove backup-show - -Shows details of a backup. - -**Positional arguments:** - -```` - ID or name of the backup. - -.. _trove_cluster-create: - -trove cluster-create --------------------- - -.. code-block:: console - - usage: trove cluster-create - [--instance "opt=[,opt= ...] "] - [--locality ] - -Creates a new cluster. - -**Positional arguments:** - -```` - Name of the cluster. - -```` - A datastore name or ID. - -```` - A datastore version name or ID. - -**Optional arguments:** - -``--instance "opt=[,opt= ...] "`` - Add an instance to the cluster. Specify - multiple times to create multiple instances. - Valid options are: - flavor=, - volume=, - volume_type=, nic=', - v4-fixed-ip=, port-id=>' - (where net-id=network_id, v4-fixed-ip=IPv4r_fixed_address, port-id=port_id), - availability_zone=, - module=, - type=. - -``--locality `` - Locality policy to use when creating - cluster. Choose one of affinity, anti-affinity. - -.. _trove_cluster-delete: - -trove cluster-delete --------------------- - -.. code-block:: console - - usage: trove cluster-delete - -Deletes a cluster. - -**Positional arguments:** - -```` - ID or name of the cluster. - -.. _trove_cluster-force-delete: - -trove cluster-force-delete --------------------------- - -.. code-block:: console - - usage: trove cluster-force-delete - -Force delete a cluster - -**Positional arguments:** - -```` - ID or name of the cluster. - -.. _trove_cluster-grow: - -trove cluster-grow ------------------- - -.. code-block:: console - - usage: trove cluster-grow - [--instance "opt=[,opt= ...] "] - -Adds more instances to a cluster. - -**Positional arguments:** - -```` - ID or name of the cluster. - -**Optional arguments:** - -``--instance "opt=[,opt= ...] "`` - Add an instance to the cluster. Specify - multiple times to create multiple instances. - Valid options are: - flavor=, - volume=, - volume_type=, nic=', - v4-fixed-ip=, port-id=>' - (where net-id=network_id, v4-fixed-ip=IPv4r_fixed_address, port-id=port_id), - availability_zone=, - module=, - type=. - -.. _trove_cluster-instances: - -trove cluster-instances ------------------------ - -.. code-block:: console - - usage: trove cluster-instances - -Lists all instances of a cluster. - -**Positional arguments:** - -```` - ID or name of the cluster. - -.. _trove_cluster-list: - -trove cluster-list ------------------- - -.. code-block:: console - - usage: trove cluster-list [--limit ] [--marker ] - -Lists all the clusters. - -**Optional arguments:** - -``--limit `` - Limit the number of results displayed. - -``--marker `` - Begin displaying the results for IDs greater than the - specified marker. When used with --limit, set this to the - last ID displayed in the previous run. - -.. _trove_cluster-modules: - -trove cluster-modules ---------------------- - -.. code-block:: console - - usage: trove cluster-modules - -Lists all modules for each instance of a cluster. - -**Positional arguments:** - -```` - ID or name of the cluster. - -.. _trove_cluster-reset-status: - -trove cluster-reset-status --------------------------- - -.. code-block:: console - - usage: trove cluster-reset-status - -Set the cluster task to NONE. - -**Positional arguments:** - -```` - ID or name of the cluster. - -.. _trove_cluster-show: - -trove cluster-show ------------------- - -.. code-block:: console - - usage: trove cluster-show - -Shows details of a cluster. - -**Positional arguments:** - -```` - ID or name of the cluster. - -.. _trove_cluster-shrink: - -trove cluster-shrink --------------------- - -.. code-block:: console - - usage: trove cluster-shrink [ ...] - -Drops instances from a cluster. - -**Positional arguments:** - -```` - ID or name of the cluster. - -```` - Drop instance(s) from the cluster. Specify multiple ids to drop - multiple instances. - -.. _trove_cluster-upgrade: - -trove cluster-upgrade ---------------------- - -.. code-block:: console - - usage: trove cluster-upgrade - -Upgrades a cluster to a new datastore version. - -**Positional arguments:** - -```` - ID or name of the cluster. - -```` - A datastore version name or ID. - -.. _trove_configuration-attach: - -trove configuration-attach --------------------------- - -.. code-block:: console - - usage: trove configuration-attach - -Attaches a configuration group to an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - ID or name of the configuration group to attach to the - instance. - -.. _trove_configuration-create: - -trove configuration-create --------------------------- - -.. code-block:: console - - usage: trove configuration-create - [--datastore ] - [--datastore_version ] - [--description ] - -Creates a configuration group. - -**Positional arguments:** - -```` - Name of the configuration group. - -```` - Dictionary of the values to set. - -**Optional arguments:** - -``--datastore `` - Datastore assigned to the configuration - group. Required if default datastore is not - configured. - -``--datastore_version `` - Datastore version ID assigned to the - configuration group. - -``--description `` - An optional description for the - configuration group. - -.. _trove_configuration-default: - -trove configuration-default ---------------------------- - -.. code-block:: console - - usage: trove configuration-default - -Shows the default configuration of an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_configuration-delete: - -trove configuration-delete --------------------------- - -.. code-block:: console - - usage: trove configuration-delete - -Deletes a configuration group. - -**Positional arguments:** - -```` - ID or name of the configuration group. - -.. _trove_configuration-detach: - -trove configuration-detach --------------------------- - -.. code-block:: console - - usage: trove configuration-detach - -Detaches a configuration group from an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_configuration-instances: - -trove configuration-instances ------------------------------ - -.. code-block:: console - - usage: trove configuration-instances - [--limit ] [--marker ] - -Lists all instances associated with a configuration group. - -**Positional arguments:** - -```` - ID or name of the configuration group. - -**Optional arguments:** - -``--limit `` - Limit the number of results displayed. - -``--marker `` - Begin displaying the results for IDs greater than the - specified marker. When used with --limit, set this to - the last ID displayed in the previous run. - -.. _trove_configuration-list: - -trove configuration-list ------------------------- - -.. code-block:: console - - usage: trove configuration-list [--limit ] [--marker ] - -Lists all configuration groups. - -**Optional arguments:** - -``--limit `` - Limit the number of results displayed. - -``--marker `` - Begin displaying the results for IDs greater than the - specified marker. When used with --limit, set this to the - last ID displayed in the previous run. - -.. _trove_configuration-parameter-list: - -trove configuration-parameter-list ----------------------------------- - -.. code-block:: console - - usage: trove configuration-parameter-list - [--datastore ] - -Lists available parameters for a configuration group. - -**Positional arguments:** - -```` - Datastore version name or ID assigned to the - configuration group. - -**Optional arguments:** - -``--datastore `` - ID or name of the datastore to list configuration - parameters for. Optional if the ID of the - datastore_version is provided. - -.. _trove_configuration-parameter-show: - -trove configuration-parameter-show ----------------------------------- - -.. code-block:: console - - usage: trove configuration-parameter-show - [--datastore ] - -Shows details of a configuration parameter. - -**Positional arguments:** - -```` - Datastore version name or ID assigned to the - configuration group. - -```` - Name of the configuration parameter. - -**Optional arguments:** - -``--datastore `` - ID or name of the datastore to list configuration - parameters for. Optional if the ID of the - datastore_version is provided. - -.. _trove_configuration-patch: - -trove configuration-patch -------------------------- - -.. code-block:: console - - usage: trove configuration-patch - -Patches a configuration group. - -**Positional arguments:** - -```` - ID or name of the configuration group. - -```` - Dictionary of the values to set. - -.. _trove_configuration-show: - -trove configuration-show ------------------------- - -.. code-block:: console - - usage: trove configuration-show - -Shows details of a configuration group. - -**Positional arguments:** - -```` - ID or name of the configuration group. - -.. _trove_configuration-update: - -trove configuration-update --------------------------- - -.. code-block:: console - - usage: trove configuration-update - [--name ] - [--description ] - -Updates a configuration group. - -**Positional arguments:** - -```` - ID or name of the configuration group. - -```` - Dictionary of the values to set. - -**Optional arguments:** - -``--name `` - Name of the configuration group. - -``--description `` - An optional description for the configuration - group. - -.. _trove_create: - -trove create ------------- - -.. code-block:: console - - usage: trove create - [--size ] [--volume_type ] - [--databases [ ...]] - [--users [ ...]] - [--backup ] - [--availability_zone ] - [--datastore ] - [--datastore_version ] - [--nic ,v4-fixed-ip=,port-id=>] - [--configuration ] - [--replica_of ] [--replica_count ] - [--module ] [--locality ] - -Creates a new instance. - -**Positional arguments:** - -```` - Name of the instance. - -```` - A flavor name or ID. - -**Optional arguments:** - -``--size `` - Size of the instance disk volume in GB. - Required when volume support is enabled. - -``--volume_type `` - Volume type. Optional when volume support is - enabled. - -``--databases [ ...]`` - Optional list of databases. - -``--users [ ...]`` - Optional list of users. - -``--backup `` - A backup name or ID. - -``--availability_zone `` - The Zone hint to give to Nova. - -``--datastore `` - A datastore name or ID. - -``--datastore_version `` - A datastore version name or ID. - -``--nic ,v4-fixed-ip=,port-id=>`` - Create a NIC on the instance. Specify option - multiple - times - to - create - multiple - NICs. - net-id: - attach - NIC - to - network - with - this - ID - (either port-id or net-id must be - specified), v4-fixed-ip: IPv4 fixed address - for NIC (optional), port-id: attach NIC to - port with this ID (either port-id or net-id - must be specified). - -``--configuration `` - ID of the configuration group to attach to - the instance. - -``--replica_of `` - ID or name of an existing instance to - replicate from. - -``--replica_count `` - Number of replicas to create (defaults to 1 - if replica_of specified). - -``--module `` - ID or name of the module to apply. Specify - multiple times to apply multiple modules. - -``--locality `` - Locality policy to use when creating - replicas. Choose one of affinity, anti-affinity. - -.. _trove_database-create: - -trove database-create ---------------------- - -.. code-block:: console - - usage: trove database-create - [--character_set ] - [--collate ] - -Creates a database on an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of the database. - -**Optional arguments:** - -``--character_set `` - Optional character set for database. - -``--collate `` - Optional collation type for database. - -.. _trove_database-delete: - -trove database-delete ---------------------- - -.. code-block:: console - - usage: trove database-delete - -Deletes a database from an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of the database. - -.. _trove_database-list: - -trove database-list -------------------- - -.. code-block:: console - - usage: trove database-list - -Lists available databases on an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_datastore-list: - -trove datastore-list --------------------- - -.. code-block:: console - - usage: trove datastore-list - -Lists available datastores. - -.. _trove_datastore-show: - -trove datastore-show --------------------- - -.. code-block:: console - - usage: trove datastore-show - -Shows details of a datastore. - -**Positional arguments:** - -```` - ID of the datastore. - -.. _trove_datastore-version-list: - -trove datastore-version-list ----------------------------- - -.. code-block:: console - - usage: trove datastore-version-list - -Lists available versions for a datastore. - -**Positional arguments:** - -```` - ID or name of the datastore. - -.. _trove_datastore-version-show: - -trove datastore-version-show ----------------------------- - -.. code-block:: console - - usage: trove datastore-version-show - [--datastore ] - -Shows details of a datastore version. - -**Positional arguments:** - -```` - ID or name of the datastore version. - -**Optional arguments:** - -``--datastore `` - ID or name of the datastore. Optional if the ID of - the datastore_version is provided. - -.. _trove_delete: - -trove delete ------------- - -.. code-block:: console - - usage: trove delete - -Deletes an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_detach-replica: - -trove detach-replica --------------------- - -.. code-block:: console - - usage: trove detach-replica - -Detaches a replica instance from its replication source. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_eject-replica-source: - -trove eject-replica-source --------------------------- - -.. code-block:: console - - usage: trove eject-replica-source - -Ejects a replica source from its set. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_execution-delete: - -trove execution-delete ----------------------- - -.. code-block:: console - - usage: trove execution-delete - -Deletes an execution. - -**Positional arguments:** - -```` - Id of the execution to delete. - -.. _trove_execution-list: - -trove execution-list --------------------- - -.. code-block:: console - - usage: trove execution-list [--limit ] [--marker ] - -Lists executions of a scheduled backup of an instance. - -**Positional arguments:** - -```` - Id of the schedule. - -**Optional arguments:** - -``--limit `` - Return up to N number of the most recent executions. - -``--marker `` - Begin displaying the results for IDs greater than the - specified marker. When used with --limit, set this to the - last ID displayed in the previous run. - -.. _trove_flavor-list: - -trove flavor-list ------------------ - -.. code-block:: console - - usage: trove flavor-list [--datastore_type ] - [--datastore_version_id ] - -Lists available flavors. - -**Optional arguments:** - -``--datastore_type `` - Type of the datastore. For eg: mysql. - -``--datastore_version_id `` - ID of the datastore version. - -.. _trove_flavor-show: - -trove flavor-show ------------------ - -.. code-block:: console - - usage: trove flavor-show - -Shows details of a flavor. - -**Positional arguments:** - -```` - ID or name of the flavor. - -.. _trove_force-delete: - -trove force-delete ------------------- - -.. code-block:: console - - usage: trove force-delete - -Force delete an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_limit-list: - -trove limit-list ----------------- - -.. code-block:: console - - usage: trove limit-list - -Lists the limits for a tenant. - -.. _trove_list: - -trove list ----------- - -.. code-block:: console - - usage: trove list [--limit ] [--marker ] [--include_clustered] - -Lists all the instances. - -**Optional arguments:** - -``--limit `` - Limit the number of results displayed. - -``--marker `` - Begin displaying the results for IDs greater - than the specified marker. When used with - --limit, set this to the last ID displayed - in the previous run. - -``--include_clustered, --include-clustered`` - Include instances that are part of a cluster - (default False). --include-clustered may be - deprecated in the future, retaining just - --include_clustered. - -.. _trove_log-disable: - -trove log-disable ------------------ - -.. code-block:: console - - usage: trove log-disable [--discard] - -Instructs Trove guest to stop collecting log details. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to publish. - -**Optional arguments:** - -``--discard`` - Discard published contents of specified log. - -.. _trove_log-discard: - -trove log-discard ------------------ - -.. code-block:: console - - usage: trove log-discard - -Instructs Trove guest to discard the container of the published log. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to publish. - -.. _trove_log-enable: - -trove log-enable ----------------- - -.. code-block:: console - - usage: trove log-enable - -Instructs Trove guest to start collecting log details. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to publish. - -.. _trove_log-list: - -trove log-list --------------- - -.. code-block:: console - - usage: trove log-list - -Lists the log files available for instance. - -**Positional arguments:** - -```` - Id or Name of the instance. - -.. _trove_log-publish: - -trove log-publish ------------------ - -.. code-block:: console - - usage: trove log-publish [--disable] [--discard] - -Instructs Trove guest to publish latest log entries on instance. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to publish. - -**Optional arguments:** - -``--disable`` - Stop collection of specified log. - -``--discard`` - Discard published contents of specified log. - -.. _trove_log-save: - -trove log-save --------------- - -.. code-block:: console - - usage: trove log-save [--publish] [--file ] - -Save log file for instance. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to publish. - -**Optional arguments:** - -``--publish`` - Publish latest entries from guest before display. - -``--file `` - Path of file to save log to for instance. - -.. _trove_log-show: - -trove log-show --------------- - -.. code-block:: console - - usage: trove log-show - -Instructs Trove guest to show details of log. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to show. - -.. _trove_log-tail: - -trove log-tail --------------- - -.. code-block:: console - - usage: trove log-tail [--publish] [--lines ] - -Display log entries for instance. - -**Positional arguments:** - -```` - Id or Name of the instance. - -```` - Name of log to publish. - -**Optional arguments:** - -``--publish`` - Publish latest entries from guest before display. - -``--lines `` - Publish latest entries from guest before display. - -.. _trove_metadata-create: - -trove metadata-create ---------------------- - -.. code-block:: console - - usage: trove metadata-create - -Creates metadata in the database for instance . - -**Positional arguments:** - -```` - UUID for instance. - -```` - Key for assignment. - -```` - Value to assign to . - -.. _trove_metadata-delete: - -trove metadata-delete ---------------------- - -.. code-block:: console - - usage: trove metadata-delete - -Deletes metadata for instance . - -**Positional arguments:** - -```` - UUID for instance. - -```` - Metadata key to delete. - -.. _trove_metadata-edit: - -trove metadata-edit -------------------- - -.. code-block:: console - - usage: trove metadata-edit - -Replaces metadata value with a new one, this is non-destructive. - -**Positional arguments:** - -```` - UUID for instance. - -```` - Key to replace. - -```` - New value to assign to . - -.. _trove_metadata-list: - -trove metadata-list -------------------- - -.. code-block:: console - - usage: trove metadata-list - -Shows all metadata for instance . - -**Positional arguments:** - -```` - UUID for instance. - -.. _trove_metadata-show: - -trove metadata-show -------------------- - -.. code-block:: console - - usage: trove metadata-show - -Shows metadata entry for key and instance . - -**Positional arguments:** - -```` - UUID for instance. - -```` - Key to display. - -.. _trove_metadata-update: - -trove metadata-update ---------------------- - -.. code-block:: console - - usage: trove metadata-update - -Updates metadata, this is destructive. - -**Positional arguments:** - -```` - UUID for instance. - -```` - Key to update. - -```` - New key. - -```` - Value to assign to . - -.. _trove_module-apply: - -trove module-apply ------------------- - -.. code-block:: console - - usage: trove module-apply [ ...] - -Apply modules to an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - ID or name of the module. - -.. _trove_module-create: - -trove module-create -------------------- - -.. code-block:: console - - usage: trove module-create - [--description ] - [--datastore ] - [--datastore_version ] [--auto_apply] - [--all_tenants] [--hidden] [--live_update] - [--priority_apply] - [--apply_order {0,1,2,3,4,5,6,7,8,9}] - [--full_access] - -Create a module. - -**Positional arguments:** - -```` - Name of the module. - -```` - Type of the module. The type must be - supported by a corresponding module plugin - on the datastore it is applied to. - -```` - File containing data contents for the - module. - -**Optional arguments:** - -``--description `` - Description of the module. - -``--datastore `` - Name or ID of datastore this module can be - applied to. If not specified, module can be - applied to all datastores. - -``--datastore_version `` - Name or ID of datastore version this module - can be applied to. If not specified, module - can be applied to all versions. - -``--auto_apply`` - Automatically apply this module when - creating an instance or cluster. Admin only. - -``--all_tenants`` - Module is valid for all tenants. Admin only. - -``--hidden`` - Hide this module from non-Admin. Useful in - creating auto-apply modules without - cluttering up module lists. Admin only. - -``--live_update`` - Allow module to be updated even if it is - already applied to a current instance or - cluster. - -``--priority_apply`` - Sets a priority for applying the module. All - priority modules will be applied before non-priority ones. Admin only. - -``--apply_order {0,1,2,3,4,5,6,7,8,9}`` - Sets an order for applying the module. - Modules with a lower value will be applied - before modules with a higher value. Modules - having the same value may be applied in any - order (default 5). - -``--full_access`` - Marks a module as 'non-admin', unless an - admin-only option was specified. Admin only. - -.. _trove_module-delete: - -trove module-delete -------------------- - -.. code-block:: console - - usage: trove module-delete - -Delete a module. - -**Positional arguments:** - -```` - ID or name of the module. - -.. _trove_module-instance-count: - -trove module-instance-count ---------------------------- - -.. code-block:: console - - usage: trove module-instance-count [--include_clustered] - -Lists a count of the instances for each module md5. - -**Positional arguments:** - -```` - ID or name of the module. - -**Optional arguments:** - -``--include_clustered`` - Include instances that are part of a cluster (default - False). - -.. _trove_module-instances: - -trove module-instances ----------------------- - -.. code-block:: console - - usage: trove module-instances - [--include_clustered] [--limit ] - [--marker ] - -Lists the instances that have a particular module applied. - -**Positional arguments:** - -```` - ID or name of the module. - -**Optional arguments:** - -``--include_clustered`` - Include instances that are part of a cluster (default - False). - -``--limit `` - Return up to N number of the most recent results. - -``--marker `` - Begin displaying the results for IDs greater than the - specified marker. When used with --limit, set this to - the last ID displayed in the previous run. - -.. _trove_module-list: - -trove module-list ------------------ - -.. code-block:: console - - usage: trove module-list [--datastore ] - -Lists the modules available. - -**Optional arguments:** - -``--datastore `` - Name or ID of datastore to list modules for. Use - 'all' to list modules that apply to all datastores. - -.. _trove_module-list-instance: - -trove module-list-instance --------------------------- - -.. code-block:: console - - usage: trove module-list-instance - -Lists the modules that have been applied to an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_module-query: - -trove module-query ------------------- - -.. code-block:: console - - usage: trove module-query - -Query the status of the modules on an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_module-reapply: - -trove module-reapply --------------------- - -.. code-block:: console - - usage: trove module-reapply - [--md5 ] [--include_clustered] - [--batch_size ] [--delay ] - [--force] - -Reapply a module. - -**Positional arguments:** - -```` - Name or ID of the module. - -**Optional arguments:** - -``--md5 `` - Reapply the module only to instances applied with - the specific md5. - -``--include_clustered`` - Include instances that are part of a cluster - (default False). - -``--batch_size `` - Number of instances to reapply the module to - before sleeping. - -``--delay `` - Time to sleep in seconds between applying - batches. - -``--force`` - Force reapply even on modules already having the - current MD5 - -.. _trove_module-remove: - -trove module-remove -------------------- - -.. code-block:: console - - usage: trove module-remove - -Remove a module from an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - ID or name of the module. - -.. _trove_module-retrieve: - -trove module-retrieve ---------------------- - -.. code-block:: console - - usage: trove module-retrieve - [--directory ] - [--prefix ] - -Retrieve module contents from an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -**Optional arguments:** - -``--directory `` - Directory to write module content files in. It - will be created if it does not exist. Defaults - to the current directory. - -``--prefix `` - Prefix to prepend to generated filename for each - module. - -.. _trove_module-show: - -trove module-show ------------------ - -.. code-block:: console - - usage: trove module-show - -Shows details of a module. - -**Positional arguments:** - -```` - ID or name of the module. - -.. _trove_module-update: - -trove module-update -------------------- - -.. code-block:: console - - usage: trove module-update - [--name ] [--type ] [--file ] - [--description ] - [--datastore ] [--all_datastores] - [--datastore_version ] - [--all_datastore_versions] [--auto_apply] - [--no_auto_apply] [--all_tenants] - [--no_all_tenants] [--hidden] [--no_hidden] - [--live_update] [--no_live_update] - [--priority_apply] [--no_priority_apply] - [--apply_order {0,1,2,3,4,5,6,7,8,9}] - [--full_access] [--no_full_access] - -Update a module. - -**Positional arguments:** - -```` - Name or ID of the module. - -**Optional arguments:** - -``--name `` - Name of the module. - -``--type `` - Type of the module. The type must be - supported by a corresponding module driver - plugin on the datastore it is applied to. - -``--file `` - File containing data contents for the - module. - -``--description `` - Description of the module. - -``--datastore `` - Name or ID of datastore this module can be - applied to. If not specified, module can be - applied to all datastores. - -``--all_datastores`` - Module is valid for all datastores. - -``--datastore_version `` - Name or ID of datastore version this module - can be applied to. If not specified, module - can be applied to all versions. - -``--all_datastore_versions`` - Module is valid for all datastore versions. - -``--auto_apply`` - Automatically apply this module when - creating an instance or cluster. Admin only. - -``--no_auto_apply`` - Do not automatically apply this module when - creating an instance or cluster. Admin only. - -``--all_tenants`` - Module is valid for all tenants. Admin only. - -``--no_all_tenants`` - Module is valid for current tenant only. - Admin only. - -``--hidden`` - Hide this module from non-admin users. - Useful in creating auto-apply modules - without cluttering up module lists. Admin - only. - -``--no_hidden`` - Allow all users to see this module. Admin - only. - -``--live_update`` - Allow module to be updated or deleted even - if it is already applied to a current - instance or cluster. - -``--no_live_update`` - Restricts a module from being updated or - deleted if it is already applied to a - current instance or cluster. - -``--priority_apply`` - Sets a priority for applying the module. All - priority modules will be applied before non-priority ones. Admin only. - -``--no_priority_apply`` - Removes apply priority from the module. - Admin only. - -``--apply_order {0,1,2,3,4,5,6,7,8,9}`` - Sets an order for applying the module. - Modules with a lower value will be applied - before modules with a higher value. Modules - having the same value may be applied in any - order (default None). - -``--full_access`` - Marks a module as 'non-admin', unless an - admin-only option was specified. Admin only. - -``--no_full_access`` - Restricts modification access for non-admin. - Admin only. - -.. _trove_promote-to-replica-source: - -trove promote-to-replica-source -------------------------------- - -.. code-block:: console - - usage: trove promote-to-replica-source - -Promotes a replica to be the new replica source of its set. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_quota-show: - -trove quota-show ----------------- - -.. code-block:: console - - usage: trove quota-show - -Show quotas for a tenant. - -**Positional arguments:** - -```` - Id of tenant for which to show quotas. - -.. _trove_quota-update: - -trove quota-update ------------------- - -.. code-block:: console - - usage: trove quota-update - -Update quotas for a tenant. - -**Positional arguments:** - -```` - Id of tenant for which to update quotas. - -```` - Id of resource to change. - -```` - New limit to set for the named resource. - -.. _trove_reset-status: - -trove reset-status ------------------- - -.. code-block:: console - - usage: trove reset-status - -Set the status to NONE. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_resize-instance: - -trove resize-instance ---------------------- - -.. code-block:: console - - usage: trove resize-instance - -Resizes an instance with a new flavor. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - New flavor of the instance. - -.. _trove_resize-volume: - -trove resize-volume -------------------- - -.. code-block:: console - - usage: trove resize-volume - -Resizes the volume size of an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - New size of the instance disk volume in GB. - -.. _trove_restart: - -trove restart -------------- - -.. code-block:: console - - usage: trove restart - -Restarts an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_root-disable: - -trove root-disable ------------------- - -.. code-block:: console - - usage: trove root-disable - -Disables root for an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_root-enable: - -trove root-enable ------------------ - -.. code-block:: console - - usage: trove root-enable - [--root_password ] - -Enables root for an instance and resets if already exists. - -**Positional arguments:** - -```` - ID or name of the instance or cluster. - -**Optional arguments:** - -``--root_password `` - Root password to set. - -.. _trove_root-show: - -trove root-show ---------------- - -.. code-block:: console - - usage: trove root-show - -Gets status if root was ever enabled for an instance or cluster. - -**Positional arguments:** - -```` - ID or name of the instance or cluster. - -.. _trove_schedule-create: - -trove schedule-create ---------------------- - -.. code-block:: console - - usage: trove schedule-create - [--description ] [--incremental] - -Schedules backups for an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Cron style pattern describing schedule - occurrence. - -```` - Name of the backup. - -**Optional arguments:** - -``--description `` - An optional description for the backup. - -``--incremental`` - Flag to select incremental backup based on most - recent backup. - -.. _trove_schedule-delete: - -trove schedule-delete ---------------------- - -.. code-block:: console - - usage: trove schedule-delete - -Deletes a schedule. - -**Positional arguments:** - -```` - Id of the schedule. - -.. _trove_schedule-list: - -trove schedule-list -------------------- - -.. code-block:: console - - usage: trove schedule-list - -Lists scheduled backups for an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_schedule-show: - -trove schedule-show -------------------- - -.. code-block:: console - - usage: trove schedule-show - -Shows details of a schedule. - -**Positional arguments:** - -```` - Id of the schedule. - -.. _trove_secgroup-add-rule: - -trove secgroup-add-rule ------------------------ - -.. code-block:: console - - usage: trove secgroup-add-rule - -Creates a security group rule. - -**Positional arguments:** - -```` - Security group ID. - -```` - CIDR address. - -.. _trove_secgroup-delete-rule: - -trove secgroup-delete-rule --------------------------- - -.. code-block:: console - - usage: trove secgroup-delete-rule - -Deletes a security group rule. - -**Positional arguments:** - -```` - Name of security group rule. - -.. _trove_secgroup-list: - -trove secgroup-list -------------------- - -.. code-block:: console - - usage: trove secgroup-list - -Lists all security groups. - -.. _trove_secgroup-list-rules: - -trove secgroup-list-rules -------------------------- - -.. code-block:: console - - usage: trove secgroup-list-rules - -Lists all rules for a security group. - -**Positional arguments:** - -```` - Security group ID. - -.. _trove_secgroup-show: - -trove secgroup-show -------------------- - -.. code-block:: console - - usage: trove secgroup-show - -Shows details of a security group. - -**Positional arguments:** - -```` - Security group ID. - -.. _trove_show: - -trove show ----------- - -.. code-block:: console - - usage: trove show - -Shows details of an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_update: - -trove update ------------- - -.. code-block:: console - - usage: trove update - [--name ] [--configuration ] - [--detach_replica_source] [--remove_configuration] - -Updates an instance: Edits name, configuration, or replica source. - -**Positional arguments:** - -```` - ID or name of the instance. - -**Optional arguments:** - -``--name `` - Name of the instance. - -``--configuration `` - ID of the configuration reference to attach. - -``--detach_replica_source, --detach-replica-source`` - Detach the replica instance from its - replication source. --detach-replica-source - may be deprecated in the future in favor of - just --detach_replica_source - -``--remove_configuration`` - Drops the current configuration reference. - -.. _trove_upgrade: - -trove upgrade -------------- - -.. code-block:: console - - usage: trove upgrade - -Upgrades an instance to a new datastore version. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - A datastore version name or ID. - -.. _trove_user-create: - -trove user-create ------------------ - -.. code-block:: console - - usage: trove user-create - [--host ] - [--databases [ ...]] - -Creates a user on an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -```` - Password of user. - -**Optional arguments:** - -``--host `` - Optional host of user. - -``--databases [ ...]`` - Optional list of databases. - -.. _trove_user-delete: - -trove user-delete ------------------ - -.. code-block:: console - - usage: trove user-delete [--host ] - -Deletes a user from an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -**Optional arguments:** - -``--host `` - Optional host of user. - -.. _trove_user-grant-access: - -trove user-grant-access ------------------------ - -.. code-block:: console - - usage: trove user-grant-access [ ...] - [--host ] - -Grants access to a database(s) for a user. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -```` - List of databases. - -**Optional arguments:** - -``--host `` - Optional host of user. - -.. _trove_user-list: - -trove user-list ---------------- - -.. code-block:: console - - usage: trove user-list - -Lists the users for an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -.. _trove_user-revoke-access: - -trove user-revoke-access ------------------------- - -.. code-block:: console - - usage: trove user-revoke-access [--host ] - -Revokes access to a database for a user. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -```` - A single database. - -**Optional arguments:** - -``--host `` - Optional host of user. - -.. _trove_user-show: - -trove user-show ---------------- - -.. code-block:: console - - usage: trove user-show [--host ] - -Shows details of a user of an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -**Optional arguments:** - -``--host `` - Optional host of user. - -.. _trove_user-show-access: - -trove user-show-access ----------------------- - -.. code-block:: console - - usage: trove user-show-access [--host ] - -Shows access details of a user of an instance. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -**Optional arguments:** - -``--host `` - Optional host of user. - -.. _trove_user-update-attributes: - -trove user-update-attributes ----------------------------- - -.. code-block:: console - - usage: trove user-update-attributes - [--host ] [--new_name ] - [--new_password ] - [--new_host ] - -Updates a user's attributes on an instance. At least one optional argument -must be provided. - -**Positional arguments:** - -```` - ID or name of the instance. - -```` - Name of user. - -**Optional arguments:** - -``--host `` - Optional host of user. - -``--new_name `` - Optional new name of user. - -``--new_password `` - Optional new password of user. - -``--new_host `` - Optional new host of user. - -.. _trove_volume-type-list: - -trove volume-type-list ----------------------- - -.. code-block:: console - - usage: trove volume-type-list [--datastore_type ] - [--datastore_version_id ] - -Lists available volume types. - -**Optional arguments:** - -``--datastore_type `` - Type of the datastore. For eg: mysql. - -``--datastore_version_id `` - ID of the datastore version. - -.. _trove_volume-type-show: - -trove volume-type-show ----------------------- - -.. code-block:: console - - usage: trove volume-type-show - -Shows details of a volume type. - -**Positional arguments:** - -```` - ID or name of the volume type. - diff --git a/doc/source/index.rst b/doc/source/index.rst index 9b3e989..f2d2096 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -16,8 +16,7 @@ =========================================== This is a client for the OpenStack Trove API. There's a Python API (the -``troveclient`` module), and a command-line script (``trove``). Each -implements 100% of the OpenStack Trove API. +``troveclient`` module), and an ``openstack`` command-line plugin. Contents -------- @@ -26,7 +25,6 @@ Contents :maxdepth: 2 user/index - cli/index reference/index Indices and tables diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index 2656e42..6eabb98 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -2,42 +2,16 @@ Trove Client User Guide ========================= -Command-line API ----------------- +Command-line Interface +---------------------- -Installing this package gets you a shell command, ``trove``, that you -can use to interact with any OpenStack cloud. +Installing this package allows you to use ``openstack`` command to interact +with Trove. Refer to +https://docs.openstack.org/python-openstackclient/latest +for how to install ``openstack`` command and configuration. -You'll need to provide your OpenStack username and password. You can do this -with the ``--os-username``, ``--os-password`` and ``--os-tenant-name`` -params, but it's easier to just set them as environment variables:: - - export OS_USERNAME=openstack - export OS_PASSWORD=yadayada - export OS_TENANT_NAME=myproject - -You will also need to define the authentication url with ``--os-auth-url`` and -the version of the API with ``--os-database-api-version`` (default is version -1.0). Or set them as an environment variables as well:: - - export OS_AUTH_URL=http://example.com:5000/v2.0/ - export OS_AUTH_URL=1.0 - -If you are using Keystone, you need to set the OS_AUTH_URL to the keystone -endpoint:: - - export OS_AUTH_URL=http://example.com:5000/v2.0/ - -Since Keystone can return multiple regions in the Service Catalog, you -can specify the one you want with ``--os-region-name`` (or -``export OS_REGION_NAME``). It defaults to the first in the list returned. - -Argument ``--profile`` is available only when the osprofiler lib is installed. - -You'll find complete documentation on the shell by running -``trove help``. - -For more details, refer to :doc:`../cli/index`. +You can find all supported Trove commands in ``openstack.database.v1`` +entry_points section in ``setup.cfg`` file of the repo. Python API ---------- @@ -46,14 +20,11 @@ There's also a complete Python API. Quick-start using keystone:: - # use v2.0 auth with http://example.com:5000/v2.0/ - >>> from troveclient.v1 import client - >>> nt = client.Client(USERNAME, PASSWORD, TENANT_NAME, AUTH_URL) - >>> nt.datastores.list() - [...] - >>> nt.flavors.list() + >>> from troveclient import client + >>> trove_client = client.Client('1.0', session=keystone_session, endpoint_type='public', service_type='database', region_name='RegionOne') + >>> trove_client.datastores.list() [...] - >>> nt.instances.list() + >>> trove_client.instances.list() [...] .. toctree:: diff --git a/setup.cfg b/setup.cfg index dd78075..5d5c939 100644 --- a/setup.cfg +++ b/setup.cfg @@ -62,8 +62,6 @@ openstack.database.v1 = database_db_create = troveclient.osc.v1.databases:CreateDatabase database_db_delete = troveclient.osc.v1.databases:DeleteDatabase database_db_list = troveclient.osc.v1.databases:ListDatabases - database_flavor_list = troveclient.osc.v1.database_flavors:ListDatabaseFlavors - database_flavor_show = troveclient.osc.v1.database_flavors:ShowDatabaseFlavor database_instance_create = troveclient.osc.v1.database_instances:CreateDatabaseInstance database_instance_delete = troveclient.osc.v1.database_instances:DeleteDatabaseInstance database_instance_detach_replica = troveclient.osc.v1.database_instances:DetachDatabaseInstanceReplica diff --git a/troveclient/compat/__init__.py b/troveclient/compat/__init__.py index a08dcb8..1e9734d 100644 --- a/troveclient/compat/__init__.py +++ b/troveclient/compat/__init__.py @@ -21,11 +21,9 @@ from troveclient.v1.accounts import Accounts # noqa from troveclient.v1.databases import Databases # noqa from troveclient.v1.diagnostics import DiagnosticsInterrogator # noqa from troveclient.v1.diagnostics import HwInfoInterrogator # noqa -from troveclient.v1.flavors import Flavors # noqa from troveclient.v1.hosts import Hosts # noqa from troveclient.v1.instances import Instances # noqa from troveclient.v1.management import Management # noqa -from troveclient.v1.management import MgmtFlavors # noqa from troveclient.v1.management import RootHistory # noqa from troveclient.v1.root import Root # noqa from troveclient.v1.storage import StorageInfo # noqa diff --git a/troveclient/compat/cli.py b/troveclient/compat/cli.py index 8d82ab7..6f6199e 100644 --- a/troveclient/compat/cli.py +++ b/troveclient/compat/cli.py @@ -129,16 +129,6 @@ class InstanceCommands(common.AuthedCommandsBase): self._pretty_print(self.dbaas.instances.configuration, self.id) -class FlavorsCommands(common.AuthedCommandsBase): - """Command for listing Flavors.""" - - params = [] - - def list(self): - """List the available flavors.""" - self._pretty_list(self.dbaas.flavors.list) - - class DatabaseCommands(common.AuthedCommandsBase): """Database CRUD operations on an instance.""" @@ -436,7 +426,6 @@ class MetadataCommands(common.AuthedCommandsBase): COMMANDS = { 'auth': common.Auth, 'instance': InstanceCommands, - 'flavor': FlavorsCommands, 'database': DatabaseCommands, 'limit': LimitsCommands, 'backup': BackupsCommands, diff --git a/troveclient/compat/client.py b/troveclient/compat/client.py index 9dfa284..1daa129 100644 --- a/troveclient/compat/client.py +++ b/troveclient/compat/client.py @@ -309,7 +309,6 @@ class Dbaas(object): from troveclient.v1 import databases from troveclient.v1 import datastores from troveclient.v1 import diagnostics - from troveclient.v1 import flavors from troveclient.v1 import hosts from troveclient.v1 import instances from troveclient.v1 import limits @@ -331,7 +330,6 @@ class Dbaas(object): region_name=region_name) self.versions = versions.Versions(self) self.databases = databases.Databases(self) - self.flavors = flavors.Flavors(self) self.instances = instances.Instances(self) self.limits = limits.Limits(self) self.users = users.Users(self) @@ -349,7 +347,6 @@ class Dbaas(object): self.storage = storage.StorageInfo(self) self.management = management.Management(self) self.mgmt_cluster = management.MgmtClusters(self) - self.mgmt_flavor = management.MgmtFlavors(self) self.accounts = accounts.Accounts(self) self.diagnostics = diagnostics.DiagnosticsInterrogator(self) self.hwinfo = diagnostics.HwInfoInterrogator(self) diff --git a/troveclient/compat/mcli.py b/troveclient/compat/mcli.py index e3efbae..f151ab7 100644 --- a/troveclient/compat/mcli.py +++ b/troveclient/compat/mcli.py @@ -181,31 +181,6 @@ class StorageCommands(common.AuthedCommandsBase): self._pretty_list(self.dbaas.storage.index) -class FlavorsCommands(common.AuthedCommandsBase): - """Commands for managing Flavors.""" - - params = [ - 'name', - 'ram', - 'disk', - 'vcpus', - 'flavor_id', - 'ephemeral', - 'swap', - 'rxtx_factor', - 'service_type' - ] - - def create(self): - """Create a new flavor.""" - self._require('name', 'ram', 'disk', 'vcpus', - 'flavor_id', 'service_type') - self._pretty_print(self.dbaas.mgmt_flavor.create, self.name, - self.ram, self.disk, self.vcpus, self.flavor_id, - self.ephemeral, self.swap, self.rxtx_factor, - self.service_type) - - def config_options(oparser): oparser.add_option("-u", "--url", default="http://localhost:5000/v1.1", help="Auth API endpoint URL with port and version. \ @@ -219,7 +194,6 @@ COMMANDS = { 'root': RootCommands, 'storage': StorageCommands, 'quota': QuotaCommands, - 'flavor': FlavorsCommands, } diff --git a/troveclient/osc/v1/database_flavors.py b/troveclient/osc/v1/database_flavors.py deleted file mode 100644 index 5fb513e..0000000 --- a/troveclient/osc/v1/database_flavors.py +++ /dev/null @@ -1,97 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""Database v1 Flavors action implementations""" - -from osc_lib.command import command -from osc_lib import utils -import six - -from troveclient import exceptions -from troveclient.i18n import _ - - -def set_attributes_for_print_detail(flavor): - info = flavor._info.copy() - # Get rid of those ugly links - if info.get('links'): - del(info['links']) - - # Fallback to str_id for flavors, where necessary - if hasattr(flavor, 'str_id'): - info['id'] = flavor.id - del(info['str_id']) - return info - - -class ListDatabaseFlavors(command.Lister): - - _description = _("List database flavors") - columns = ['ID', 'Name', 'RAM', 'vCPUs', 'Disk', 'Ephemeral'] - - def get_parser(self, prog_name): - parser = super(ListDatabaseFlavors, self).get_parser(prog_name) - parser.add_argument( - '--datastore-type', - dest='datastore_type', - metavar='', - help=_('Type of the datastore. For eg: mysql.') - ) - parser.add_argument( - '--datastore-version-id', - dest='datastore_version_id', - metavar='', - help=_('ID of the datastore version.') - ) - return parser - - def take_action(self, parsed_args): - db_flavors = self.app.client_manager.database.flavors - if parsed_args.datastore_type and parsed_args.datastore_version_id: - flavors = db_flavors.list_datastore_version_associated_flavors( - datastore=parsed_args.datastore_type, - version_id=parsed_args.datastore_version_id) - elif (not parsed_args.datastore_type and not - parsed_args.datastore_version_id): - flavors = db_flavors.list() - else: - raise exceptions.MissingArgs(['datastore-type', - 'datastore-version-id']) - - # Fallback to str_id where necessary. - _flavors = [] - for f in flavors: - if not f.id and hasattr(f, 'str_id'): - f.id = f.str_id - _flavors.append(utils.get_item_properties(f, self.columns)) - - return self.columns, _flavors - - -class ShowDatabaseFlavor(command.ShowOne): - _description = _("Shows details of a database flavor") - - def get_parser(self, prog_name): - parser = super(ShowDatabaseFlavor, self).get_parser(prog_name) - parser.add_argument( - 'flavor', - metavar='', - help=_('ID or name of the flavor'), - ) - return parser - - def take_action(self, parsed_args): - db_flavors = self.app.client_manager.database.flavors - flavor = utils.find_resource(db_flavors, - parsed_args.flavor) - flavor = set_attributes_for_print_detail(flavor) - return zip(*sorted(six.iteritems(flavor))) diff --git a/troveclient/osc/v1/database_instances.py b/troveclient/osc/v1/database_instances.py index 9595ac1..9eecb18 100644 --- a/troveclient/osc/v1/database_instances.py +++ b/troveclient/osc/v1/database_instances.py @@ -225,7 +225,7 @@ class CreateDatabaseInstance(command.ShowOne): 'flavor', metavar='', type=str, - help=_("A flavor name or ID."), + help=_("A flavor ID."), ) parser.add_argument( '--size', @@ -348,8 +348,8 @@ class CreateDatabaseInstance(command.ShowOne): def take_action(self, parsed_args): database = self.app.client_manager.database db_instances = database.instances - flavor_id = osc_utils.find_resource(database.flavors, - parsed_args.flavor).id + flavor_id = parsed_args.flavor + volume = None if parsed_args.size is not None and parsed_args.size <= 0: raise exceptions.ValidationError( diff --git a/troveclient/tests/osc/v1/fakes.py b/troveclient/tests/osc/v1/fakes.py index fde9237..7002c3c 100644 --- a/troveclient/tests/osc/v1/fakes.py +++ b/troveclient/tests/osc/v1/fakes.py @@ -20,7 +20,6 @@ from troveclient.v1 import clusters from troveclient.v1 import configurations from troveclient.v1 import databases from troveclient.v1 import datastores -from troveclient.v1 import flavors from troveclient.v1 import instances from troveclient.v1 import limits from troveclient.v1 import modules @@ -34,13 +33,6 @@ class TestDatabasev1(utils.TestCommand): self.app.client_manager.database = mock.MagicMock() -class FakeFlavors(object): - fake_flavors = fakes.FakeHTTPClient().get_flavors()[2]['flavors'] - - def get_flavors_1(self): - return flavors.Flavor(None, self.fake_flavors[0]) - - class FakeBackups(object): fake_backups = fakes.FakeHTTPClient().get_backups()[2]['backups'] diff --git a/troveclient/tests/osc/v1/test_database_flavors.py b/troveclient/tests/osc/v1/test_database_flavors.py deleted file mode 100644 index 6b87f06..0000000 --- a/troveclient/tests/osc/v1/test_database_flavors.py +++ /dev/null @@ -1,78 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from troveclient.osc.v1 import database_flavors -from troveclient.tests.osc.v1 import fakes - - -class TestFlavors(fakes.TestDatabasev1): - fake_flavors = fakes.FakeFlavors() - - def setUp(self): - super(TestFlavors, self).setUp() - self.mock_client = self.app.client_manager.database - self.flavor_client = self.app.client_manager.database.flavors - - -class TestFlavorList(TestFlavors): - columns = database_flavors.ListDatabaseFlavors.columns - values = (1, 'm1.tiny', 512, '', '', '') - - def setUp(self): - super(TestFlavorList, self).setUp() - self.cmd = database_flavors.ListDatabaseFlavors(self.app, None) - self.data = [self.fake_flavors.get_flavors_1()] - self.flavor_client.list.return_value = self.data - self.flavor_client.list_datastore_version_associated_flavors. \ - return_value = self.data - - def test_flavor_list_defaults(self): - parsed_args = self.check_parser(self.cmd, [], []) - columns, values = self.cmd.take_action(parsed_args) - self.flavor_client.list.assert_called_once_with() - self.assertEqual(self.columns, columns) - self.assertEqual([self.values], values) - - def test_flavor_list_with_optional_args(self): - args = ['--datastore-type', 'mysql', - '--datastore-version-id', '5.6'] - parsed_args = self.check_parser(self.cmd, args, []) - list_flavor_dict = {'datastore': 'mysql', - 'version_id': '5.6'} - columns, values = self.cmd.take_action(parsed_args) - self.flavor_client.list_datastore_version_associated_flavors. \ - assert_called_once_with(**list_flavor_dict) - self.assertEqual(self.columns, columns) - self.assertEqual([self.values], values) - - -class TestFlavorShow(TestFlavors): - - values = (1, 'm1.tiny', 512) - - def setUp(self): - super(TestFlavorShow, self).setUp() - self.cmd = database_flavors.ShowDatabaseFlavor(self.app, None) - self.data = self.fake_flavors.get_flavors_1() - self.flavor_client.get.return_value = self.data - self.columns = ( - 'id', - 'name', - 'ram', - ) - - def test_flavor_show_defaults(self): - args = ['m1.tiny'] - parsed_args = self.check_parser(self.cmd, args, []) - columns, data = self.cmd.take_action(parsed_args) - self.assertEqual(self.columns, columns) - self.assertEqual(self.values, data) diff --git a/troveclient/tests/osc/v1/test_database_instances.py b/troveclient/tests/osc/v1/test_database_instances.py index 43b076c..dbe6f3f 100644 --- a/troveclient/tests/osc/v1/test_database_instances.py +++ b/troveclient/tests/osc/v1/test_database_instances.py @@ -197,7 +197,7 @@ class TestDatabaseInstanceCreate(TestInstances): @mock.patch.object(utils, 'find_resource') def test_instance_create(self, mock_find): - mock_find.id.side_effect = ['103', 'test', 'mod_id'] + mock_find.id.side_effect = ['test', 'mod_id'] args = ['test-name', '103', '--size', '1', '--databases', 'db1', 'db2', diff --git a/troveclient/tests/test_management.py b/troveclient/tests/test_management.py index 73d0a7c..23401b9 100644 --- a/troveclient/tests/test_management.py +++ b/troveclient/tests/test_management.py @@ -165,38 +165,6 @@ class ManagementTest(testtools.TestCase): self.assertEqual({'reset-task-status': {}}, self.body_) -class MgmtFlavorsTest(testtools.TestCase): - - def setUp(self): - super(MgmtFlavorsTest, self).setUp() - self.orig__init = management.MgmtFlavors.__init__ - management.MgmtFlavors.__init__ = mock.Mock(return_value=None) - self.flavors = management.MgmtFlavors() - self.flavors.api = mock.Mock() - self.flavors.api.client = mock.Mock() - self.flavors.resource_class = mock.Mock(return_value="flavor-1") - self.orig_base_getid = base.getid - base.getid = mock.Mock(return_value="flavor1") - - def tearDown(self): - super(MgmtFlavorsTest, self).tearDown() - management.MgmtFlavors.__init__ = self.orig__init - base.getid = self.orig_base_getid - - def test_create(self): - def side_effect_func(path, body, inst): - return path, body, inst - - self.flavors._create = mock.Mock(side_effect=side_effect_func) - p, b, i = self.flavors.create("test-name", 1024, 30, 2, 1) - self.assertEqual("/mgmt/flavors", p) - self.assertEqual("flavor", i) - self.assertEqual("test-name", b["flavor"]["name"]) - self.assertEqual(1024, b["flavor"]["ram"]) - self.assertEqual(2, b["flavor"]["vcpu"]) - self.assertEqual(1, b["flavor"]["flavor_id"]) - - class MgmtDatastoreVersionsTest(testtools.TestCase): def setUp(self): diff --git a/troveclient/tests/test_v1_shell.py b/troveclient/tests/test_v1_shell.py index 6bb1e23..fc26e66 100644 --- a/troveclient/tests/test_v1_shell.py +++ b/troveclient/tests/test_v1_shell.py @@ -209,41 +209,6 @@ class ShellTest(utils.TestCase): self.run_command('eject-replica-source 1234') self.assert_called('POST', '/instances/1234/action') - def test_flavor_list(self): - self.run_command('flavor-list') - self.assert_called('GET', '/flavors') - - def test_flavor_list_with_datastore(self): - cmd = ('flavor-list --datastore_type mysql ' - '--datastore_version_id some-version-id') - self.run_command(cmd) - self.assert_called( - 'GET', '/datastores/mysql/versions/some-version-id/flavors') - - def test_flavor_list_error(self): - cmd = 'flavor-list --datastore_type mysql' - exepcted_error_msg = (r'Missing argument\(s\): ' - 'datastore_type, datastore_version_id') - self.assertRaisesRegex( - exceptions.MissingArgs, exepcted_error_msg, self.run_command, - cmd) - - def test_flavor_show(self): - self.run_command('flavor-show 1') - self.assert_called('GET', '/flavors/1') - - def test_flavor_show_leading_zero(self): - self.run_command('flavor-show 02') - self.assert_called('GET', '/flavors/02') - - def test_flavor_show_by_name(self): - self.run_command('flavor-show m1.tiny') # defined in fakes.py - self.assert_called('GET', '/flavors/m1.tiny') - - def test_flavor_show_uuid(self): - self.run_command('flavor-show m1.uuid') - self.assert_called('GET', '/flavors/m1.uuid') - def test_volume_type_list(self): self.run_command('volume-type-list') self.assert_called('GET', '/volume-types') @@ -301,7 +266,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': 'lvm'}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'test-member-1' }}) @@ -312,19 +277,19 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': 'lvm'}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'test-member-1', 'modules': [{'id': '4321'}, {'id': '8765'}] }}) def test_boot_by_flavor_name(self): self.run_command( - 'create test-member-1 m1.tiny --size 1 --volume_type lvm') + 'create test-member-1 1 --size 1 --volume_type lvm') self.assert_called_anytime( 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': 'lvm'}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'test-member-1' }}) @@ -346,7 +311,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': None}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'repl-1', 'replica_count': 4, 'locality': 'anti-affinity' @@ -358,7 +323,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': None}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'slave-1', 'replica_of': 'myid', 'replica_count': 1 @@ -371,7 +336,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': None}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'slave-1', 'replica_of': 'myid', 'replica_count': 3 @@ -383,7 +348,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': None}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'master-1', 'locality': 'affinity' }}) @@ -411,7 +376,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': None}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'test-restore-1', 'restorePoint': {'backupRef': 'bk-1234'}, }}) @@ -422,7 +387,7 @@ class ShellTest(utils.TestCase): 'POST', '/instances', {'instance': { 'volume': {'size': 1, 'type': None}, - 'flavorRef': 1, + 'flavorRef': '1', 'name': 'test-restore-1', 'restorePoint': {'backupRef': 'bk-1234'}, }}) @@ -454,8 +419,8 @@ class ShellTest(utils.TestCase): def test_cluster_create_by_flavor_name(self): cmd = ('cluster-create test-clstr vertica 7.1 ' - '--instance flavor=m1.small,volume=2 ' - '--instance flavor=m1.leading-zero,volume=1') + '--instance flavor=2,volume=2 ' + '--instance flavor=02,volume=1') self.run_command(cmd) self.assert_called_anytime( 'POST', '/clusters', diff --git a/troveclient/v1/client.py b/troveclient/v1/client.py index 685a5cd..97af857 100644 --- a/troveclient/v1/client.py +++ b/troveclient/v1/client.py @@ -20,7 +20,6 @@ from troveclient.v1 import clusters from troveclient.v1 import configurations from troveclient.v1 import databases from troveclient.v1 import datastores -from troveclient.v1 import flavors from troveclient.v1 import instances from troveclient.v1 import limits from troveclient.v1 import management @@ -64,7 +63,6 @@ class Client(object): # self.limits = limits.LimitsManager(self) # extensions - self.flavors = flavors.Flavors(self) self.volume_types = volume_types.VolumeTypes(self) self.users = users.Users(self) self.databases = databases.Databases(self) diff --git a/troveclient/v1/flavors.py b/troveclient/v1/flavors.py deleted file mode 100644 index 7b1d72f..0000000 --- a/troveclient/v1/flavors.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2011 OpenStack Foundation -# Copyright 2013 Rackspace Hosting -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from troveclient import base - - -class Flavor(base.Resource): - """A Flavor is an Instance type, specifying other things, like RAM size.""" - - def __init__(self, manager, info, loaded=False): - super(Flavor, self).__init__(manager, info, loaded) - if self.id is None and self.str_id is not None: - self.id = self.str_id - - def __repr__(self): - return "" % self.name - - -class Flavors(base.ManagerWithFind): - """Manage :class:`Flavor` resources.""" - resource_class = Flavor - - def list(self): - """Get a list of all flavors. - :rtype: list of :class:`Flavor`. - """ - return self._list("/flavors", "flavors") - - def list_datastore_version_associated_flavors(self, datastore, - version_id): - """Get a list of all flavors for the specified datastore type - and datastore version . - :rtype: list of :class:`Flavor`. - """ - return self._list("/datastores/%s/versions/%s/flavors" % - (datastore, version_id), - "flavors") - - def get(self, flavor): - """Get a specific flavor. - - :rtype: :class:`Flavor` - """ - return self._get("/flavors/%s" % base.getid(flavor), - "flavor") diff --git a/troveclient/v1/management.py b/troveclient/v1/management.py index fc38504..bb1711c 100644 --- a/troveclient/v1/management.py +++ b/troveclient/v1/management.py @@ -21,7 +21,6 @@ from troveclient import common from troveclient.v1 import clusters from troveclient.v1 import configurations from troveclient.v1 import datastores -from troveclient.v1 import flavors from troveclient.v1 import instances @@ -145,44 +144,6 @@ class MgmtClusters(base.ManagerWithFind): self._action(cluster_id, body) -class MgmtFlavors(base.ManagerWithFind): - """Manage :class:`Flavor` resources.""" - resource_class = flavors.Flavor - - def __repr__(self): - return "" % id(self) - - # Appease the abc gods - def list(self): - pass - - def create(self, name, ram, disk, vcpus, - flavorid="auto", ephemeral=None, swap=None, rxtx_factor=None, - service_type=None): - """Create a new flavor.""" - body = {"flavor": { - "flavor_id": flavorid, - "name": name, - "ram": ram, - "disk": disk, - "vcpu": vcpus, - "ephemeral": 0, - "swap": 0, - "rxtx_factor": "1.0", - "is_public": "True" - }} - if ephemeral: - body["flavor"]["ephemeral"] = ephemeral - if swap: - body["flavor"]["swap"] = swap - if rxtx_factor: - body["flavor"]["rxtx_factor"] = rxtx_factor - if service_type: - body["flavor"]["service_type"] = service_type - - return self._create("/mgmt/flavors", body, "flavor") - - class MgmtConfigurationParameters(configurations.ConfigurationParameters): def create(self, version, name, restart_required, data_type, max_size=None, min_size=None): diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 1b72d31..9c8014c 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -189,11 +189,6 @@ def _find_cluster(cs, cluster): return utils.find_resource(cs.clusters, cluster) -def _find_flavor(cs, flavor): - """Get a flavor by ID.""" - return utils.find_resource(cs.flavors, flavor) - - def _find_volume_type(cs, volume_type): """Get a volume type by ID.""" return utils.find_resource(cs.volume_types, volume_type) @@ -224,46 +219,6 @@ def _find_configuration(cs, configuration): return utils.find_resource(cs.configurations, configuration) -# Flavor related calls -@utils.arg('--datastore_type', metavar='', - default=None, - help=_('Type of the datastore. For eg: mysql.')) -@utils.arg("--datastore_version_id", metavar="", - default=None, help=_("ID of the datastore version.")) -@utils.service_type('database') -def do_flavor_list(cs, args): - """Lists available flavors.""" - if args.datastore_type and args.datastore_version_id: - flavors = cs.flavors.list_datastore_version_associated_flavors( - args.datastore_type, args.datastore_version_id) - elif not args.datastore_type and not args.datastore_version_id: - flavors = cs.flavors.list() - else: - raise exceptions.MissingArgs(['datastore_type', - 'datastore_version_id']) - - # Fallback to str_id where necessary. - _flavors = [] - for f in flavors: - if not f.id and hasattr(f, 'str_id'): - f.id = f.str_id - _flavors.append(f) - - utils.print_list(_flavors, ['id', 'name', 'ram', 'vcpus', 'disk', - 'ephemeral'], - labels={'ram': 'RAM', 'vcpus': 'vCPUs', 'disk': 'Disk'}, - order_by='ram') - - -@utils.arg('flavor', metavar='', type=str, - help=_('ID or name of the flavor.')) -@utils.service_type('database') -def do_flavor_show(cs, args): - """Shows details of a flavor.""" - flavor = _find_flavor(cs, args.flavor) - _print_object(flavor) - - # Volume type related calls @utils.arg('--datastore_type', metavar='', default=None, @@ -555,7 +510,7 @@ def do_update(cs, args): @utils.arg('flavor', metavar='', type=str, - help=_('A flavor name or ID.')) + help=_('A flavor ID.')) @utils.arg('--databases', metavar='', help=_('Optional list of databases.'), nargs="+", default=[]) @@ -623,7 +578,7 @@ def do_update(cs, args): @utils.service_type('database') def do_create(cs, args): """Creates a new instance.""" - flavor_id = _find_flavor(cs, args.flavor).id + flavor_id = args.flavor volume = None if args.size is not None and args.size <= 0: raise exceptions.ValidationError( @@ -686,8 +641,7 @@ def _validate_nic_info(nic_info, nic_str): def _get_flavor(cs, opts_str): - flavor_name, opts_str = _strip_option(opts_str, 'flavor', True) - flavor_id = _find_flavor(cs, flavor_name).id + flavor_id, opts_str = _strip_option(opts_str, 'flavor', True) return str(flavor_id), opts_str @@ -929,12 +883,12 @@ def do_cluster_create(cs, args): @utils.arg('flavor', metavar='', type=str, - help=_('New flavor of the instance.')) + help=_('New flavor ID for the instance.')) @utils.service_type('database') def do_resize_instance(cs, args): """Resizes an instance with a new flavor.""" instance = _find_instance(cs, args.instance) - flavor_id = _find_flavor(cs, args.flavor).id + flavor_id = args.flavor cs.instances.resize_instance(instance, flavor_id) -- cgit v1.2.1