コード例 #1
0
ファイル: pack.py プロジェクト: LindsayHill/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackShowCommand, self).__init__(resource, 'show',
              'Get information about a %s from the index.' % resource.get_display_name().lower(),
              *args, **kwargs)

        self.parser.add_argument('pack',
                                 help='Name of the %s to show.' %
                                 resource.get_display_name().lower())
コード例 #2
0
ファイル: pack.py プロジェクト: LindsayHill/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackConfigCommand, self).__init__(resource, 'config',
              'Configure a %s based on config schema.' % resource.get_display_name().lower(),
              *args, **kwargs)

        self.parser.add_argument('name',
                                 help='Name of the %s(s) to configure.' %
                                      resource.get_display_name().lower())
コード例 #3
0
ファイル: pack.py プロジェクト: Plexxi/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackConfigCommand, self).__init__(
            resource,
            "config",
            "Configure a %s based on config schema." % resource.get_display_name().lower(),
            *args,
            **kwargs
        )

        self.parser.add_argument("name", help="Name of the %s(s) to configure." % resource.get_display_name().lower())
コード例 #4
0
    def __init__(self, resource, *args, **kwargs):
        help_string = (
            'Get information about an available %s from the index.' %
            resource.get_display_name().lower())
        super(PackShowCommand, self).__init__(resource, 'show', help_string,
                                              *args, **kwargs)

        self.parser.add_argument('pack',
                                 help='Name of the %s to show.' %
                                 resource.get_display_name().lower())
コード例 #5
0
ファイル: action.py プロジェクト: tomzhang/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionExecutionGetCommand, self).__init__(
            resource, 'get',
            'Get individual %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('id',
                                 help=('ID of the %s.' %
                                       resource.get_display_name().lower()))

        self._add_common_options()
コード例 #6
0
ファイル: action_alias.py プロジェクト: zwunix/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasExecuteCommand, self).__init__(
            resource, 'execute',
            ('Execute the command text by finding a matching %s.' %
             resource.get_display_name().lower()), *args, **kwargs)

        self.parser.add_argument('command_text',
                                 metavar='command',
                                 help=('Execute the command text by finding a matching %s.' %
                                       resource.get_display_name().lower()))
        self.parser.add_argument('-u', '--user', type=str, default=None,
                                 help='User under which to run the action (admins only).')
コード例 #7
0
ファイル: pack.py プロジェクト: neufeldtech/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackRegisterCommand, self).__init__(resource, 'register',
              'Register a %s: sync all file changes with DB.' % resource.get_display_name().lower(),
              *args, **kwargs)

        self.parser.add_argument('--packs',
                                 nargs='+',
                                 help='Name of the %s(s) to register.' %
                                 resource.get_display_name().lower())

        self.parser.add_argument('--types',
                                 nargs='+',
                                 help='Types of content to register.')
コード例 #8
0
ファイル: pack.py プロジェクト: LindsayHill/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackRegisterCommand, self).__init__(resource, 'register',
              'Register a %s: sync all file changes with DB.' % resource.get_display_name().lower(),
              *args, **kwargs)

        self.parser.add_argument('--packs',
                                 nargs='+',
                                 help='Name of the %s(s) to register.' %
                                 resource.get_display_name().lower())

        self.parser.add_argument('--types',
                                 nargs='+',
                                 help='Types of content to register.')
コード例 #9
0
ファイル: auth.py プロジェクト: yetudada/st2
    def __init__(self, resource, *args, **kwargs):
        super(ApiKeyLoadCommand, self).__init__(
            resource, 'load', 'Load %s from a file.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('file',
                                 help=('JSON/YAML file containing the %s(s) to load.'
                                       % resource.get_display_name().lower()),
                                 default='')

        self.parser.add_argument('-w', '--width', nargs='+', type=int,
                                 default=None,
                                 help=('Set the width of columns in output.'))
コード例 #10
0
ファイル: auth.py プロジェクト: Bala96/st2
    def __init__(self, resource, *args, **kwargs):
        super(ApiKeyLoadCommand, self).__init__(
            resource, 'load', 'Load %s from a file.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('file',
                                 help=('JSON/YAML file containing the %s(s) to load.'
                                       % resource.get_display_name().lower()),
                                 default='')

        self.parser.add_argument('-w', '--width', nargs='+', type=int,
                                 default=None,
                                 help=('Set the width of columns in output.'))
コード例 #11
0
    def __init__(self, resource, *args, **kwargs):
        super(ActionExecutionGetCommand, self).__init__(
            resource, 'get',
            'Get individual %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('id',
                                 help=('ID of the %s.' %
                                       resource.get_display_name().lower()))
        self.parser.add_argument('-a', '--attr', nargs='+',
                                 default=self.display_attributes,
                                 help=('List of attributes to include in the '
                                       'output. "all" or unspecified will '
                                       'return all attributes.'))
コード例 #12
0
    def __init__(self, resource, *args, **kwargs):
        super(PackConfigCommand, self).__init__(
            resource,
            "config",
            "Configure a %s based on config schema." %
            resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "name",
            help="Name of the %s(s) to configure." %
            resource.get_display_name().lower(),
        )
コード例 #13
0
ファイル: datastore.py プロジェクト: bjoernbessert/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairCreateCommand, self).__init__(resource, 'create',
            'Create a new %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('name', help='Key name.')
        self.parser.add_argument('value', help='Value paired with the key.')
コード例 #14
0
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(
            resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs
        )

        # --encrypt and --encrypted options are mutually exclusive.
        # --encrypt implies provided value is plain text and should be encrypted whereas
        # --encrypted implies value is already encrypted and should be treated as-is.
        encryption_group = self.parser.add_mutually_exclusive_group()
        encryption_group.add_argument('-e', '--encrypt', dest='secret',
                                      action='store_true',
                                      help='Encrypt value before saving.')
        encryption_group.add_argument('--encrypted', dest='encrypted',
                                      action='store_true',
                                      help=('Value provided is already encrypted with the '
                                            'instance crypto key and should be stored as-is.'))

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
        self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None,
                                 help='TTL (in seconds) for this value.')
        self.parser.add_argument('-s', '--scope', dest='scope', default=DEFAULT_CUD_SCOPE,
                                 help='Specify the scope under which you want ' +
                                      'to place the item.')
        self.parser.add_argument('-u', '--user', dest='user', default=None,
                                 help='User for user scoped items (admin only).')
コード例 #15
0
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(
            resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(), *args,
            **kwargs)

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
        self.parser.add_argument('-l',
                                 '--ttl',
                                 dest='ttl',
                                 type=int,
                                 default=None,
                                 help='TTL (in seconds) for this value.')
        self.parser.add_argument('-e',
                                 '--encrypt',
                                 dest='secret',
                                 action='store_true',
                                 help='Encrypt value before saving the value.')
        self.parser.add_argument(
            '-s',
            '--scope',
            dest='scope',
            default=DEFAULT_SCOPE,
            help='Specify the scope under which you want ' +
            'to place the item.')
        self.parser.add_argument(
            '-u',
            '--user',
            dest='user',
            default=None,
            help='User for user scoped items (admin only).')
コード例 #16
0
ファイル: pack.py プロジェクト: LindsayHill/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackSearchCommand, self).__init__(resource, 'search',
            'Search for a %s in the directory.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('query',
                                 help='Search query.')
コード例 #17
0
ファイル: pack.py プロジェクト: neufeldtech/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackSearchCommand, self).__init__(resource, 'search',
            'Search for a %s in the directory.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('query',
                                 help='Search query.')
コード例 #18
0
ファイル: action_alias.py プロジェクト: peak6/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasExecuteCommand, self).__init__(
            resource, 'execute',
            ('Execute the command text by finding a matching %s.' %
            resource.get_display_name().lower()),
            *args, **kwargs)

        self.parser.add_argument('command_text',
                                 metavar='command',
                                 help=help)
        self.parser.add_argument('-h', '--help',
                                 action='store_true', dest='help',
                                 help='Print usage for the given action.')
        self.parser.add_argument('--trace-tag', '--trace_tag',
                                 help='A trace tag string to track execution later.',
                                 dest='trace_tag', required=False)
        self.parser.add_argument('--trace-id',
                                 help='Existing trace id for this execution.',
                                 dest='trace_id', required=False)
        self.parser.add_argument('-a', '--async',
                                 action='store_true', dest='async',
                                 help='Do not wait for action to finish.')
        self.parser.add_argument('-u', '--user', type=str, default=None,
                                 help='User under which to run the action (admins only).')

        self.parser.add_argument('--attr', nargs='+',
                                 default=self.display_attributes,
                                 help=('List of attributes to include in the '
                                       'output. "all" will return all '
                                       'attributes.'))
        self.parser.add_argument('-w', '--width', nargs='+', type=int,
                                 default=None,
                                 help=('Set the width of columns in output.'))
コード例 #19
0
ファイル: pack.py プロジェクト: ssubbanna/st2_test
    def __init__(self, resource, *args, **kwargs):
        super(PackSearchCommand, self).__init__(
            resource, 'search', 'Search the index for a %s with any attribute \
                                                matching the query.' %
            resource.get_display_name().lower(), *args, **kwargs)

        self.parser.add_argument('query', help='Search query.')
コード例 #20
0
ファイル: auth.py プロジェクト: shivankittech/st2
    def __init__(self, resource, *args, **kwargs):
        super(ApiKeyCreateCommand, self).__init__(
            resource,
            "create",
            "Create a new %s." % resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "-u",
            "--user",
            type=str,
            help="User for which to create API Keys.",
            default="",
        )
        self.parser.add_argument(
            "-m",
            "--metadata",
            type=json.loads,
            help="Optional metadata to associate with the API Keys.",
            default={},
        )
        self.parser.add_argument(
            "-k",
            "--only-key",
            action="store_true",
            dest="only_key",
            default=False,
            help="Only print API Key to the console on creation.",
        )
コード例 #21
0
ファイル: pack.py プロジェクト: Plexxi/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackRegisterCommand, self).__init__(
            resource,
            "register",
            "Register a %s: sync all file changes with DB." % resource.get_display_name().lower(),
            *args,
            **kwargs
        )

        self.parser.add_argument(
            "packs",
            nargs="*",
            metavar="pack",
            help="Name of the %s(s) to register." % resource.get_display_name().lower(),
        )

        self.parser.add_argument("--types", nargs="+", help="Types of content to register.")
コード例 #22
0
ファイル: datastore.py プロジェクト: gitter-badger/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairCreateCommand, self).__init__(
            resource, 'create',
            'Create a new %s.' % resource.get_display_name().lower(), *args,
            **kwargs)

        self.parser.add_argument('name', help='Key name.')
        self.parser.add_argument('value', help='Value paired with the key.')
コード例 #23
0
ファイル: datastore.py プロジェクト: BlazeMediaGroup/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
コード例 #24
0
ファイル: datastore.py プロジェクト: timff/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
コード例 #25
0
ファイル: action.py プロジェクト: tomzhang/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionExecutionCancelCommand, self).__init__(
            resource, 'cancel', 'Cancel an %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('id',
                                 help=('ID of the %s.' %
                                       resource.get_display_name().lower()))
コード例 #26
0
ファイル: datastore.py プロジェクト: bjoernbessert/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairUpdateCommand, self).__init__(resource, 'update',
            'Update an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('name_or_id',
                                 metavar='name-or-id',
                                 help='Name or ID of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
コード例 #27
0
ファイル: pack.py プロジェクト: lyandut/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackSearchCommand, self).__init__(resource, 'search',
                                                'Search the index for a %s with any attribute \
                                                matching the query.'
                                                % resource.get_display_name().lower(),
                                                *args, **kwargs)

        self.parser.add_argument('query',
                                 help='Search query.')
コード例 #28
0
ファイル: keyvalue.py プロジェクト: st2sandbox/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(
            resource,
            "set",
            "Set an existing %s." % resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        # --encrypt and --encrypted options are mutually exclusive.
        # --encrypt implies provided value is plain text and should be encrypted whereas
        # --encrypted implies value is already encrypted and should be treated as-is.
        encryption_group = self.parser.add_mutually_exclusive_group()
        encryption_group.add_argument(
            "-e",
            "--encrypt",
            dest="secret",
            action="store_true",
            help="Encrypt value before saving.",
        )
        encryption_group.add_argument(
            "--encrypted",
            dest="encrypted",
            action="store_true",
            help=(
                "Value provided is already encrypted with the "
                "instance crypto key and should be stored as-is."
            ),
        )

        self.parser.add_argument(
            "name", metavar="name", help="Name of the key value pair."
        )
        self.parser.add_argument("value", help="Value paired with the key.", nargs="?")
        self.parser.add_argument(
            "-l",
            "--ttl",
            dest="ttl",
            type=int,
            default=None,
            help="TTL (in seconds) for this value.",
        )
        self.parser.add_argument(
            "-s",
            "--scope",
            dest="scope",
            default=DEFAULT_CUD_SCOPE,
            help="Specify the scope under which you want " + "to place the item.",
        )
        self.parser.add_argument(
            "-u",
            "--user",
            dest="user",
            default=None,
            help="User for user scoped items (admin only).",
        )
コード例 #29
0
ファイル: action_alias.py プロジェクト: zwunix/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasMatchCommand, self).__init__(
            resource, 'match',
            'Get the %s that match the command text.' %
            resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('match_text',
                                 metavar='command',
                                 help=('Get the %s that match the command text.' %
                                       resource.get_display_name().lower()))
        self.parser.add_argument('-a', '--attr', nargs='+',
                                 default=self.display_attributes,
                                 help=('List of attributes to include in the '
                                       'output. "all" will return all '
                                       'attributes.'))
        self.parser.add_argument('-w', '--width', nargs='+', type=int,
                                 default=None,
                                 help=('Set the width of columns in output.'))
コード例 #30
0
ファイル: pack.py プロジェクト: Plexxi/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackSearchCommand, self).__init__(
            resource,
            "search",
            "Search the index for a %s with any attribute matching the query." % resource.get_display_name().lower(),
            *args,
            **kwargs
        )

        self.parser.add_argument("query", help="Search query.")
コード例 #31
0
ファイル: datastore.py プロジェクト: gitter-badger/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairUpdateCommand, self).__init__(
            resource, 'update',
            'Update an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('name_or_id',
                                 metavar='name-or-id',
                                 help='Name or ID of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
コード例 #32
0
    def __init__(self, resource, *args, **kwargs):
        super(PackRegisterCommand, self).__init__(
            resource,
            "register",
            "Register %s(s): sync all file changes with DB."
            % resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "packs",
            nargs="*",
            metavar="pack",
            help="Name of the %s(s) to register." % resource.get_display_name().lower(),
        )

        self.parser.add_argument(
            "--types", nargs="+", help="Types of content to register."
        )
コード例 #33
0
ファイル: keyvalue.py プロジェクト: automotola/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(
            resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs
        )

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
        self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None,
                                 help='TTL (in seconds) for this value.')
コード例 #34
0
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasExecuteCommand, self).__init__(
            resource,
            "execute",
            ("Execute the command text by finding a matching %s." %
             resource.get_display_name().lower()),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "command_text",
            metavar="command",
            help=("Execute the command text by finding a matching %s." %
                  resource.get_display_name().lower()),
        )
        self.parser.add_argument(
            "-u",
            "--user",
            type=str,
            default=None,
            help="User under which to run the action (admins only).",
        )
コード例 #35
0
ファイル: auth.py プロジェクト: Bala96/st2
    def __init__(self, resource, *args, **kwargs):
        super(ApiKeyCreateCommand, self).__init__(
            resource, 'create', 'Create a new %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('-u', '--user', type=str,
                                 help='User for which to create API Keys.',
                                 default='')
        self.parser.add_argument('-m', '--metadata', type=json.loads,
                                 help='User for which to create API Keys.',
                                 default={})
        self.parser.add_argument('-k', '--only-key', action='store_true', dest='only_key',
                                 default=False,
                                 help='Only print API Key to the console on creation.')
コード例 #36
0
    def __init__(self, resource, *args, **kwargs):
        super(InquiryRespondCommand, self).__init__(
            resource, 'respond',
            'Respond to an %s.' % resource.get_display_name().lower(),
            *args, **kwargs
        )

        self.parser.add_argument('id',
                                 metavar='id',
                                 help='Inquiry ID')
        self.parser.add_argument('-r', '--response', type=str, dest='response',
                                 default=None,
                                 help=('Entire response payload as JSON string '
                                       '(bypass interactive mode)'))
コード例 #37
0
ファイル: inquiry.py プロジェクト: StackStorm/st2
    def __init__(self, resource, *args, **kwargs):
        super(InquiryRespondCommand, self).__init__(
            resource, 'respond',
            'Respond to an %s.' % resource.get_display_name().lower(),
            *args, **kwargs
        )

        self.parser.add_argument('id',
                                 metavar='id',
                                 help='Inquiry ID')
        self.parser.add_argument('-r', '--response', type=str, dest='response',
                                 default=None,
                                 help=('Entire response payload as JSON string '
                                       '(bypass interactive mode)'))
コード例 #38
0
ファイル: auth.py プロジェクト: yetudada/st2
    def __init__(self, resource, *args, **kwargs):
        super(ApiKeyCreateCommand, self).__init__(
            resource, 'create', 'Create a new %s.' % resource.get_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('-u', '--user', type=str,
                                 help='User for which to create API Keys.',
                                 default='')
        self.parser.add_argument('-m', '--metadata', type=json.loads,
                                 help='Optional metadata to associate with the API Keys.',
                                 default={})
        self.parser.add_argument('-k', '--only-key', action='store_true', dest='only_key',
                                 default=False,
                                 help='Only print API Key to the console on creation.')
コード例 #39
0
ファイル: action_alias.py プロジェクト: rush-skills/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasMatchCommand, self).__init__(
            resource,
            "match",
            "Get the %s that match the command text."
            % resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "match_text",
            metavar="command",
            help=(
                "Get the %s that match the command text."
                % resource.get_display_name().lower()
            ),
        )
        self.parser.add_argument(
            "-a",
            "--attr",
            nargs="+",
            default=self.display_attributes,
            help=(
                "List of attributes to include in the "
                'output. "all" will return all '
                "attributes."
            ),
        )
        self.parser.add_argument(
            "-w",
            "--width",
            nargs="+",
            type=int,
            default=None,
            help=("Set the width of columns in output."),
        )
コード例 #40
0
ファイル: auth.py プロジェクト: shivankittech/st2
    def __init__(self, resource, *args, **kwargs):
        super(ApiKeyLoadCommand, self).__init__(
            resource,
            "load",
            "Load %s from a file." % resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "file",
            help=("JSON/YAML file containing the %s(s) to load." %
                  resource.get_display_name().lower()),
            default="",
        )

        self.parser.add_argument(
            "-w",
            "--width",
            nargs="+",
            type=int,
            default=None,
            help=("Set the width of columns in output."),
        )
コード例 #41
0
ファイル: action_alias.py プロジェクト: rush-skills/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasTestCommand, self).__init__(
            resource,
            "test",
            (
                "Execute the command text by finding a matching %s and format the result."
                % resource.get_display_name().lower()
            ),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "command_text",
            metavar="command",
            help=(
                "Execute the command text by finding a matching %s."
                % resource.get_display_name().lower()
            ),
        )
        self.parser.add_argument(
            "-u",
            "--user",
            type=str,
            default=None,
            help="User under which to run the action (admins only).",
        )

        self._add_common_options()
        self.parser.add_argument(
            "-a",
            "--async",
            action="store_true",
            dest="action_async",
            help="Do not wait for action to finish.",
        )
コード例 #42
0
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(
            resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(), *args,
            **kwargs)

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
        self.parser.add_argument('-l',
                                 '--ttl',
                                 dest='ttl',
                                 type=int,
                                 default=None,
                                 help='TTL (in seconds) for this value.')
コード例 #43
0
ファイル: action_alias.py プロジェクト: yuemanxilou/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasExecuteCommand, self).__init__(
            resource, 'execute',
            ('Execute the command text by finding a matching %s.' %
             resource.get_display_name().lower()), *args, **kwargs)

        self.parser.add_argument('command_text', metavar='command', help=help)
        self.parser.add_argument('-h',
                                 '--help',
                                 action='store_true',
                                 dest='help',
                                 help='Print usage for the given action.')
        self.parser.add_argument(
            '--trace-tag',
            '--trace_tag',
            help='A trace tag string to track execution later.',
            dest='trace_tag',
            required=False)
        self.parser.add_argument('--trace-id',
                                 help='Existing trace id for this execution.',
                                 dest='trace_id',
                                 required=False)
        self.parser.add_argument('-a',
                                 '--async',
                                 action='store_true',
                                 dest='async',
                                 help='Do not wait for action to finish.')
        self.parser.add_argument(
            '-u',
            '--user',
            type=str,
            default=None,
            help='User under which to run the action (admins only).')

        self.parser.add_argument('--attr',
                                 nargs='+',
                                 default=self.display_attributes,
                                 help=('List of attributes to include in the '
                                       'output. "all" will return all '
                                       'attributes.'))
        self.parser.add_argument('-w',
                                 '--width',
                                 nargs='+',
                                 type=int,
                                 default=None,
                                 help=('Set the width of columns in output.'))
コード例 #44
0
ファイル: inquiry.py プロジェクト: shivankittech/st2
    def __init__(self, resource, *args, **kwargs):
        super(InquiryRespondCommand, self).__init__(
            resource,
            "respond",
            "Respond to an %s." % resource.get_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument("id", metavar="id", help="Inquiry ID")
        self.parser.add_argument(
            "-r",
            "--response",
            type=str,
            dest="response",
            default=None,
            help=("Entire response payload as JSON string "
                  "(bypass interactive mode)"),
        )
コード例 #45
0
ファイル: keyvalue.py プロジェクト: lyandut/st2
    def __init__(self, resource, *args, **kwargs):
        super(KeyValuePairSetCommand, self).__init__(
            resource, 'set',
            'Set an existing %s.' % resource.get_display_name().lower(),
            *args, **kwargs
        )

        self.parser.add_argument('name',
                                 metavar='name',
                                 help='Name of the key value pair.')
        self.parser.add_argument('value', help='Value paired with the key.')
        self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None,
                                 help='TTL (in seconds) for this value.')
        self.parser.add_argument('-e', '--encrypt', dest='secret',
                                 action='store_true',
                                 help='Encrypt value before saving.')
        self.parser.add_argument('-s', '--scope', dest='scope', default=DEFAULT_SCOPE,
                                 help='Specify the scope under which you want ' +
                                      'to place the item.')
        self.parser.add_argument('-u', '--user', dest='user', default=None,
                                 help='User for user scoped items (admin only).')
コード例 #46
0
ファイル: pack.py プロジェクト: Plexxi/st2
    def __init__(self, resource, *args, **kwargs):
        help_string = "Get information about an available %s from the index." % resource.get_display_name().lower()
        super(PackShowCommand, self).__init__(resource, "show", help_string, *args, **kwargs)

        self.parser.add_argument("pack", help="Name of the %s to show." % resource.get_display_name().lower())