typesafehub / conductr-cli

CLI for Lightbend ConductR
Other
16 stars 21 forks source link

Refactoring the bndl arguments #475

Closed markusjura closed 7 years ago

markusjura commented 7 years ago

Modifications:

markusjura commented 7 years ago

bndl -h

$ bndl -h
usage: bndl [-h] [-f {bundle,configuration,docker,oci-image}] [--no-shazar]
            [-o [OUTPUT]] [--annotation ANNOTATIONS] [--component COMPONENT]
            [--component-description COMPONENT_DESCRIPTION]
            [--compatibility-version [COMPATIBILITY_VERSION]]
            [--disk-space [DISK_SPACE]] [--env] [--image-tag IMAGE_TAG]
            [--image-name IMAGE_NAME] [--memory [MEMORY]] [--name [NAME]]
            [--no-default-check] [--no-default-endpoints]
            [--no-default-volumes] [--nr-of-cpus [NR_OF_CPUS]]
            [--roles [ROLES [ROLES ...]]] [--start-command START_COMMAND]
            [--system [SYSTEM]] [--system-version [SYSTEM_VERSION]]
            [--tag TAGS] [--validation-exclude {property-names,required}]
            [--version [VERSION]] [--volume NAME=MOUNT-POINT]
            [--check CHECK_ADDRESSES [CHECK_ADDRESSES ...]]
            [--connection-timeout CHECK_CONNECTION_TIMEOUT]
            [--initial-delay CHECK_INITIAL_DELAY] [--endpoint ENDPOINT]
            [--bind-protocol BIND_PROTOCOL] [--bind-port BIND_PORT]
            [--service-name SERVICE_NAME] [--acl ACL] [--path] [--path-beg]
            [--path-regex] [--rewrite REWRITE]
            [source]

Create or modify a bundle

positional arguments:
  source                Optional path to a directory or tar file
                        When absent, stdin is used

optional arguments:
  -h, --help            show this help message and exit
  -f {bundle,configuration,docker,oci-image}, --format {bundle,configuration,docker,oci-image}
                        The input format
                        When absent, auto-detection is attempted
                        The format configuration needs to be specified because it cannot be auto-detected.
  --no-shazar           If enabled, a bundle will not be run through shazar
  -o [OUTPUT], --output [OUTPUT]
                        The target output file
                        When absent, stdout is used
  --annotation ANNOTATIONS
                        Annotations to add to bundle.conf
                        Example: bndl --annotation my.first=value1 --annotation my.second=value2
                        Defaults to []
  --component COMPONENT
                        Specify the component that should be modified
                        Required when the bundle has more than one component
                        Used in conjunction with the following: --endpoint, --start-command
  --component-description COMPONENT_DESCRIPTION
                        Description to use for the generated ConductR component
                        For use with docker and oci-image formats
  --compatibility-version [COMPATIBILITY_VERSION]
                        Sets the "compatibilityVersion" bundle.conf value
  --disk-space [DISK_SPACE]
                        Sets the "diskSpace" bundle.conf value
  --env                 Additional environment variables for the bundle's runtime-config.sh
                        Defaults to []
  --image-tag IMAGE_TAG
                        The name of the tag to create a ConductR bundle from
                        For use with docker and oci-image formats
                        When absent, the first tag present is used
  --image-name IMAGE_NAME
                        The name of the image to create a ConductR bundle from
                        For use with docker and oci-image formats
                        When absent, the first image present is used
  --memory [MEMORY]     Sets the "memory" bundle.conf value
  --name [NAME]         Sets the "name" bundle.conf value
  --no-default-check    If provided, a bundle will not contain a default check command
                        For use with docker and oci-image formats
  --no-default-endpoints
                        If provided, a bundle will not contain endpoints for ExposedPorts
                        For use with docker and oci-image formats
  --no-default-volumes  If provided, a bundle will not contain any volume declarations
                        For use with docker and oci-image formats
  --nr-of-cpus [NR_OF_CPUS]
                        Sets the "nrOfCpus" bundle.conf value
  --roles [ROLES [ROLES ...]]
                        Sets the "roles" bundle.conf value
  --start-command START_COMMAND
                        Sets "start-command" for a component
                        Must be specified in HOCON format
                        If the bundle has more than one component, you must specify --component
                        Example: bndl --start-command '["/my/app", "my arg"]' --component service
  --system [SYSTEM]     Sets the "system" bundle.conf value
  --system-version [SYSTEM_VERSION]
                        Sets the "systemVersion" bundle.conf value
  --tag TAGS            Tags to add to bundle.conf
                        Example: bndl --tag 16.04 --tag xenial
                        Defaults to []
  --validation-exclude {property-names,required}
                        If provided, skips a given validation rule
                        The following validation rules can be skipped:
                          property-names: Checks that the bundle.conf only contains property names that are known by ConductR
                          required: Checks that the bundle.conf contains all required properties
                        By default, no validation rule is excluded
  --version [VERSION]   Sets the "version" bundle.conf value
  --volume NAME=MOUNT-POINT
                        Declare a volume path for a component given its name and mount point separated by an equals sign
                        For use with oci-image, oci-bundle and docker components
                        If the bundle has more than one component, you must specify--component
                        If provided, existing volumes are removed
                        Example: bndl --volume my-vol=/data --component web

check:
  --check CHECK_ADDRESSES [CHECK_ADDRESSES ...]
                        Check command that is added to the bundle
                        Specify one or multiple addresses that are used to check for bundle connectivity
                        As an address, environment variables can be specified that are available during Bundle startup, e.g. $MY_BUNDLE_HOST
                        If specified, the existing check command is removed
                        Example: bndl --check \$WEB_BUNDLE_HOST \$BACKEND_BUNDLE_HOST
                        Accepted address formats:
                          \$ENV/<path>?<params>
                          [docker+]http://<address>:<port>/<path>?<params>
                          [docker+]tcp://<address>:<port>?<params>
                        Accepted params:
                          retry-count=<int> - Number of retries
                          retry-delay=<int> - Delay in seconds between retries
                          docker-timeout=<int> - Timeout in seconds for docker container start
  --connection-timeout CHECK_CONNECTION_TIMEOUT
                        Connection timeout in seconds
                        Used in conjunction with the --check option
  --initial-delay CHECK_INITIAL_DELAY
                        Initial delay in seconds
                        Used in conjunction with the --check option

endpoints:
  Add endpoints to the bundle. If the bundle has more than one component, you must specify --component

  --endpoint ENDPOINT   Endpoints that are added to the bundle
                        If specified, existing endpoints are removed
                        Example: bndl --endpoint web --component web --bind-protocol http --service-name web --acl http:/subpath
  --bind-protocol BIND_PROTOCOL
                        Bind protocol of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, tcp is used
  --bind-port BIND_PORT
                        Bind port of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, 0 is used, meaning a bind port is selected by ConductR
  --service-name SERVICE_NAME
                        Service name of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, the endpoint is not locatable via the service name
  --acl ACL             Request ACL of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, the endpoint will not be accessible via the Proxy
  --path                If provided, a path must equal the provided string for the ACL to match
                        Used in conjunction with the --acl option
  --path-beg            If provided, a path must begin with the provided string for the ACL to match
                        Used in conjunction with the --acl option
  --path-regex          If provided, a path must match the provided regular expression string for the ACL to match
                        Used in conjunction with the --acl option
  --rewrite REWRITE     If provided, specifies a rewrite value for the ACL
                        Used in conjunction with the --acl option

conduct load -h

$ conduct load -h
usage: conduct load [-h] [--offline] [--scheme SCHEME] [--host HOST] [-i IP]
                    [-p PORT] [--base-path BASE_PATH] [-v]
                    [--disable-instructions] [-q] [--long-ids]
                    [--api-version {1,2}] [--settings-dir CLI_SETTINGS_DIR]
                    [--custom-settings-file CUSTOM_SETTINGS_FILE]
                    [--custom-plugins-dir CUSTOM_PLUGINS_DIR]
                    [--bundle-resolve-cache-dir BUNDLE_RESOLVE_CACHE_DIR]
                    [--configuration-resolve-cache-dir CONFIGURATION_RESOLVE_CACHE_DIR]
                    [--wait-timeout WAIT_TIMEOUT] [--no-wait]
                    [--annotation ANNOTATIONS] [--component COMPONENT]
                    [--component-description COMPONENT_DESCRIPTION]
                    [--compatibility-version [COMPATIBILITY_VERSION]]
                    [--disk-space [DISK_SPACE]] [--env]
                    [--image-tag IMAGE_TAG] [--image-name IMAGE_NAME]
                    [--memory [MEMORY]] [--name [NAME]] [--no-default-check]
                    [--no-default-endpoints] [--no-default-volumes]
                    [--nr-of-cpus [NR_OF_CPUS]] [--roles [ROLES [ROLES ...]]]
                    [--start-command START_COMMAND] [--system [SYSTEM]]
                    [--system-version [SYSTEM_VERSION]] [--tag TAGS]
                    [--validation-exclude {property-names,required}]
                    [--version [VERSION]] [--volume NAME=MOUNT-POINT]
                    [--check CHECK_ADDRESSES [CHECK_ADDRESSES ...]]
                    [--connection-timeout CHECK_CONNECTION_TIMEOUT]
                    [--initial-delay CHECK_INITIAL_DELAY]
                    [--endpoint ENDPOINT] [--bind-protocol BIND_PROTOCOL]
                    [--bind-port BIND_PORT] [--service-name SERVICE_NAME]
                    [--acl ACL] [--path] [--path-beg] [--path-regex]
                    [--rewrite REWRITE]
                    bundle [configuration]

positional arguments:
  bundle                The path to the bundle. Specify "-" to skip when providing stdin
  configuration         The optional configuration for the bundle

optional arguments:
  -h, --help            show this help message and exit
  --offline             Enables offline mode to resolve bundles only locally
                        either by file uri or from the cache directory
                        True if CONDUCTR_OFFLINE_MODE environment variable is set
                        False if --offline flag not specified and environment variable not set
  --scheme SCHEME       The optional ConductR scheme, defaults to http
  --host HOST           The optional ConductR host
                        Defaults to one of the value in this order:
                        1. $CONDUCTR_HOST
                        2. $CONDUCTR_IP
                        3. IP address of the docker VM or
                        4. 127.0.0.1
  -i IP, --ip IP        The optional ConductR IP
                        Defaults to one of the value in this order:
                        1. $CONDUCTR_IP
                        2. IP address of the docker VM
                        3. 127.0.0.1
  -p PORT, --port PORT  The optional ConductR port
                        Defaults to $CONDUCTR_PORT or 9005
  --base-path BASE_PATH
                        The optional ConductR base path
                        Defaults to $DEFAULT_BASE_PATH or /
  -v, --verbose         Print detailed information of the command
  --disable-instructions
                        Disables further instruction output after the command has been succeeded
                        Defaults to False
  -q                    Prints affected bundle id on screen if enabled
                        Defaults to False
  --long-ids            Print long Bundle IDs
  --api-version {1,2}   Sets which ConductR api version to be used
                        Defaults to 2
  --settings-dir CLI_SETTINGS_DIR
                        Directory where ConductR CLI settings are stored
                        Defaults to /Users/mj/.conductr
  --custom-settings-file CUSTOM_SETTINGS_FILE
                        Configuration where custom settings for ConductR CLI are stored in HOCON format
                        Defaults to /Users/mj/.conductr/settings.conf
  --custom-plugins-dir CUSTOM_PLUGINS_DIR
                        Directory where custom plugins for ConductR CLI are stored
                        Defaults to /Users/mj/.conductr/plugins
  --bundle-resolve-cache-dir BUNDLE_RESOLVE_CACHE_DIR
                        Directory where resolved bundles are cached
                        Defaults to /Users/mj/.conductr/cache/bundle
  --configuration-resolve-cache-dir CONFIGURATION_RESOLVE_CACHE_DIR
                        Directory where resolved bundle configurations are cached
                        Defaults to /Users/mj/.conductr/cache/configuration
  --wait-timeout WAIT_TIMEOUT
                        Timeout in seconds waiting for bundle scale to be achieved in conduct run
                        or bundle to be stopped in conduct stop
                        Defaults to 60
  --no-wait             Disables waiting for bundle scale to be achieved in conduct run
                        or bundle to be stopped in conduct stop
                        Defaults to False
  --annotation ANNOTATIONS
                        Annotations to add to bundle.conf
                        Example: bndl --annotation my.first=value1 --annotation my.second=value2
                        Defaults to []
  --component COMPONENT
                        Specify the component that should be modified
                        Required when the bundle has more than one component
                        Used in conjunction with the following: --endpoint, --start-command
  --component-description COMPONENT_DESCRIPTION
                        Description to use for the generated ConductR component
                        For use with docker and oci-image formats
  --compatibility-version [COMPATIBILITY_VERSION]
                        Sets the "compatibilityVersion" bundle.conf value
  --disk-space [DISK_SPACE]
                        Sets the "diskSpace" bundle.conf value
  --env                 Additional environment variables for the bundle's runtime-config.sh
                        Defaults to []
  --image-tag IMAGE_TAG
                        The name of the tag to create a ConductR bundle from
                        For use with docker and oci-image formats
                        When absent, the first tag present is used
  --image-name IMAGE_NAME
                        The name of the image to create a ConductR bundle from
                        For use with docker and oci-image formats
                        When absent, the first image present is used
  --memory [MEMORY]     Sets the "memory" bundle.conf value
  --name [NAME]         Sets the "name" bundle.conf value
  --no-default-check    If provided, a bundle will not contain a default check command
                        For use with docker and oci-image formats
  --no-default-endpoints
                        If provided, a bundle will not contain endpoints for ExposedPorts
                        For use with docker and oci-image formats
  --no-default-volumes  If provided, a bundle will not contain any volume declarations
                        For use with docker and oci-image formats
  --nr-of-cpus [NR_OF_CPUS]
                        Sets the "nrOfCpus" bundle.conf value
  --roles [ROLES [ROLES ...]]
                        Sets the "roles" bundle.conf value
  --start-command START_COMMAND
                        Sets "start-command" for a component
                        Must be specified in HOCON format
                        If the bundle has more than one component, you must specify --component
                        Example: bndl --start-command '["/my/app", "my arg"]' --component service
  --system [SYSTEM]     Sets the "system" bundle.conf value
  --system-version [SYSTEM_VERSION]
                        Sets the "systemVersion" bundle.conf value
  --tag TAGS            Tags to add to bundle.conf
                        Example: bndl --tag 16.04 --tag xenial
                        Defaults to []
  --validation-exclude {property-names,required}
                        If provided, skips a given validation rule
                        The following validation rules can be skipped:
                          property-names: Checks that the bundle.conf only contains property names that are known by ConductR
                          required: Checks that the bundle.conf contains all required properties
                        By default, no validation rule is excluded
  --version [VERSION]   Sets the "version" bundle.conf value
  --volume NAME=MOUNT-POINT
                        Declare a volume path for a component given its name and mount point separated by an equals sign
                        For use with oci-image, oci-bundle and docker components
                        If the bundle has more than one component, you must specify--component
                        If provided, existing volumes are removed
                        Example: bndl --volume my-vol=/data --component web

check:
  --check CHECK_ADDRESSES [CHECK_ADDRESSES ...]
                        Check command that is added to the bundle
                        Specify one or multiple addresses that are used to check for bundle connectivity
                        As an address, environment variables can be specified that are available during Bundle startup, e.g. $MY_BUNDLE_HOST
                        If specified, the existing check command is removed
                        Example: bndl --check \$WEB_BUNDLE_HOST \$BACKEND_BUNDLE_HOST
                        Accepted address formats:
                          \$ENV/<path>?<params>
                          [docker+]http://<address>:<port>/<path>?<params>
                          [docker+]tcp://<address>:<port>?<params>
                        Accepted params:
                          retry-count=<int> - Number of retries
                          retry-delay=<int> - Delay in seconds between retries
                          docker-timeout=<int> - Timeout in seconds for docker container start
  --connection-timeout CHECK_CONNECTION_TIMEOUT
                        Connection timeout in seconds
                        Used in conjunction with the --check option
  --initial-delay CHECK_INITIAL_DELAY
                        Initial delay in seconds
                        Used in conjunction with the --check option

endpoints:
  Add endpoints to the bundle. If the bundle has more than one component, you must specify --component

  --endpoint ENDPOINT   Endpoints that are added to the bundle
                        If specified, existing endpoints are removed
                        Example: bndl --endpoint web --component web --bind-protocol http --service-name web --acl http:/subpath
  --bind-protocol BIND_PROTOCOL
                        Bind protocol of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, tcp is used
  --bind-port BIND_PORT
                        Bind port of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, 0 is used, meaning a bind port is selected by ConductR
  --service-name SERVICE_NAME
                        Service name of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, the endpoint is not locatable via the service name
  --acl ACL             Request ACL of an endpoint
                        Used in conjunction with the --endpoint option
                        When absent, the endpoint will not be accessible via the Proxy
  --path                If provided, a path must equal the provided string for the ACL to match
                        Used in conjunction with the --acl option
  --path-beg            If provided, a path must begin with the provided string for the ACL to match
                        Used in conjunction with the --acl option
  --path-regex          If provided, a path must match the provided regular expression string for the ACL to match
                        Used in conjunction with the --acl option
  --rewrite REWRITE     If provided, specifies a rewrite value for the ACL
                        Used in conjunction with the --acl option