コード例 #1
0
ファイル: rule.py プロジェクト: yetudada/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(RuleListCommand, self).__init__(resource, 'list',
                                              'Get the list of the %s most recent %s.' %
                                              (self.default_limit,
                                               resource.get_plural_display_name().lower()),
                                              *args, **kwargs)

        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))
        self.parser.add_argument('--iftt', action='store_true',
                                 help='Show trigger and action in display list.')
        self.parser.add_argument('-p', '--pack', type=str,
                                 help=('Only return resources belonging to the'
                                       ' provided pack'))
        self.group.add_argument('-c', '--action',
                                help='Action reference to filter the list.')
        self.group.add_argument('-g', '--trigger',
                                help='Trigger type reference to filter the list.')
        self.enabled_filter_group = self.parser.add_mutually_exclusive_group()
        self.enabled_filter_group.add_argument('--enabled', action='store_true',
                                               help='Show rules that are enabled.')
        self.enabled_filter_group.add_argument('--disabled', action='store_true',
                                               help='Show rules that are disabled.')
コード例 #2
0
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(
            resource,
            "install",
            "Install new %s." % resource.get_plural_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "packs",
            nargs="+",
            metavar="pack",
            help="Name of the %s in Exchange, or a git repo URL." %
            resource.get_plural_display_name().lower(),
        )
        self.parser.add_argument(
            "--python3",
            action="store_true",
            default=False,
            help="Use Python 3 binary for pack virtual environment.",
        )
        self.parser.add_argument(
            "--force",
            action="store_true",
            default=False,
            help="Force pack installation.",
        )
        self.parser.add_argument(
            "--skip-dependencies",
            action="store_true",
            default=False,
            help="Skip pack dependency installation.",
        )
コード例 #3
0
 def __init__(self, resource, *args, **kwargs):
     super(KeyValuePairListCommand, self).__init__(
         resource, 'list', 'Get the list of the 50 most recent %s.' %
         resource.get_plural_display_name().lower(), *args, **kwargs)
     self.default_limit = 50
     self.resource_name = resource.get_plural_display_name().lower()
     # Filter options
     self.parser.add_argument(
         '--prefix',
         help=('Only return values which name starts with the '
               ' provided prefix.'))
     self.parser.add_argument(
         '--decrypt',
         action='store_true',
         help='Decrypt secrets and display plain text.')
     self.parser.add_argument('-s',
                              '--scope',
                              default='system',
                              dest='scope',
                              help='Scope item is under. Example: "user".')
     self.parser.add_argument(
         '-u',
         '--user',
         dest='user',
         default=None,
         help='User for user scoped items (admin only).')
     self.parser.add_argument(
         '-n',
         '--last',
         type=int,
         dest='last',
         default=self.default_limit,
         help=('List N most recent %s. Default is 50.' %
               self.resource_name))
コード例 #4
0
ファイル: triggerinstance.py プロジェクト: jtopjian/st2
    def __init__(self, resource, *args, **kwargs):
        super(TriggerInstanceListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s; '
                                       'list all if 0.' %
                                       resource.get_plural_display_name().lower()))

        # Filter options
        self.group.add_argument('--trigger', help='Trigger reference to filter the list.')

        self.parser.add_argument('-tg', '--timestamp-gt', type=str, dest='timestamp_gt',
                                 default=None,
                                 help=('Only return trigger instances with occurrence_time '
                                       'greater than the one provided. '
                                       'Use time in the format 2000-01-01T12:00:00.000Z'))
        self.parser.add_argument('-tl', '--timestamp-lt', type=str, dest='timestamp_lt',
                                 default=None,
                                 help=('Only return trigger instances with timestamp '
                                       'lower than the one provided. '
                                       'Use time in the format 2000-01-01T12:00:00.000Z'))
        # Display options
        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.'))
コード例 #5
0
    def __init__(self, resource, *args, **kwargs):
        super(TraceListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.default_limit = 50
        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_mutually_exclusive_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s.' % self.resource_name))
        self.parser.add_argument('-s', '--sort', type=str, dest='sort_order',
                                 default='descending',
                                 help=('Sort %s by start timestamp, '
                                       'asc|ascending (earliest first) '
                                       'or desc|descending (latest first)' % self.resource_name))

        # Filter options
        self.group.add_argument('-c', '--trace-tag', help='Trace-tag to filter the list.')
        self.group.add_argument('-e', '--execution', help='Execution to filter the list.')
        self.group.add_argument('-r', '--rule', help='Rule to filter the list.')
        self.group.add_argument('-g', '--trigger-instance',
                                help='TriggerInstance to filter the list.')
        # Display options
        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.'))
コード例 #6
0
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(
            resource, 'install',
            'Install new %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument(
            'packs',
            nargs='+',
            metavar='pack',
            help='Name of the %s in Exchange, or a git repo URL.' %
            resource.get_plural_display_name().lower())
        self.parser.add_argument(
            '--python3',
            action='store_true',
            default=False,
            help='Use Python 3 binary for pack virtual environment.')
        self.parser.add_argument('--timeout',
                                 type=int,
                                 default=600,
                                 help='Action timeout in seconds.')
        self.parser.add_argument('--force',
                                 action='store_true',
                                 default=False,
                                 help='Force pack installation.')
        self.parser.add_argument('--skip-dependencies',
                                 action='store_true',
                                 default=False,
                                 help='Skip pack dependency installation.')
コード例 #7
0
ファイル: rule_enforcement.py プロジェクト: jsjeannotte/st2
    def __init__(self, resource, *args, **kwargs):
        super(RuleEnforcementListCommand, self).__init__(
            resource,
            "list",
            "Get the list of the 50 most recent %s." % resource.get_plural_display_name().lower(),
            *args,
            **kwargs
        )

        self.group = self.parser.add_argument_group()
        self.parser.add_argument(
            "-n",
            "--last",
            type=int,
            dest="last",
            default=50,
            help=("List N most recent %s; " "list all if 0." % resource.get_plural_display_name().lower()),
        )

        # Filter options
        self.group.add_argument("--trigger-instance", help="Trigger instance id to filter the list.")

        self.group.add_argument("--execution", help="Execution id to filter the list.")
        self.group.add_argument("--rule", help="Rule ref to filter the list.")

        self.parser.add_argument(
            "-tg",
            "--timestamp-gt",
            type=str,
            dest="timestamp_gt",
            default=None,
            help=(
                "Only return enforcements with enforced_at "
                "greater than the one provided. "
                "Use time in the format 2000-01-01T12:00:00.000Z"
            ),
        )
        self.parser.add_argument(
            "-tl",
            "--timestamp-lt",
            type=str,
            dest="timestamp_lt",
            default=None,
            help=(
                "Only return enforcements with enforced_at "
                "lower than the one provided. "
                "Use time in the format 2000-01-01T12:00:00.000Z"
            ),
        )
        # Display options
        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.")
        )
コード例 #8
0
ファイル: inquiry.py プロジェクト: diogouchoas/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 20

        super(InquiryListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s most recent %s.' %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args, **kwargs)

        self.resource_name = resource.get_plural_display_name().lower()
        self.parser.add_argument('-n',
                                 '--last',
                                 type=int,
                                 dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s.' %
                                       self.resource_name))

        # Display options
        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.'))
コード例 #9
0
ファイル: rule.py プロジェクト: StackStorm/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(RuleListCommand, self).__init__(resource, 'list',
                                              'Get the list of the %s most recent %s.' %
                                              (self.default_limit,
                                               resource.get_plural_display_name().lower()),
                                              *args, **kwargs)

        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))
        self.parser.add_argument('--iftt', action='store_true',
                                 help='Show trigger and action in display list.')
        self.parser.add_argument('-p', '--pack', type=str,
                                 help=('Only return resources belonging to the'
                                       ' provided pack'))
        self.group.add_argument('-c', '--action',
                                help='Action reference to filter the list.')
        self.group.add_argument('-g', '--trigger',
                                help='Trigger type reference to filter the list.')
        self.enabled_filter_group = self.parser.add_mutually_exclusive_group()
        self.enabled_filter_group.add_argument('--enabled', action='store_true',
                                               help='Show rules that are enabled.')
        self.enabled_filter_group.add_argument('--disabled', action='store_true',
                                               help='Show rules that are disabled.')
コード例 #10
0
    def __init__(self, resource, *args, **kwargs):
        super(TriggerInstanceListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s; '
                                       'list all if 0.' %
                                       resource.get_plural_display_name().lower()))

        # Filter options
        self.group.add_argument('--trigger', help='Trigger reference to filter the list.')

        self.parser.add_argument('-tg', '--timestamp-gt', type=str, dest='timestamp_gt',
                                 default=None,
                                 help=('Only return trigger instances with occurrence_time '
                                       'greater than the one provided. '
                                       'Use time in the format 2000-01-01T12:00:00.000Z'))
        self.parser.add_argument('-tl', '--timestamp-lt', type=str, dest='timestamp_lt',
                                 default=None,
                                 help=('Only return trigger instances with timestamp '
                                       'lower than the one provided. '
                                       'Use time in the format 2000-01-01T12:00:00.000Z'))
        # Display options
        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.'))
コード例 #11
0
ファイル: trace.py プロジェクト: automotola/st2
    def __init__(self, resource, *args, **kwargs):
        super(TraceListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_mutually_exclusive_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s; '
                                       'list all if 0.' %
                                       resource.get_plural_display_name().lower()))

        # Filter options
        self.group.add_argument('-c', '--trace-tag', help='Trace-tag to filter the list.')
        self.group.add_argument('-e', '--execution', help='Execution to filter the list.')
        self.group.add_argument('-r', '--rule', help='Rule to filter the list.')
        self.group.add_argument('-g', '--trigger-instance',
                                help='TriggerInstance to filter the list.')
        # Display options
        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.'))
コード例 #12
0
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(RuleEnforcementListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s most recent %s.' %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args, **kwargs)
        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_argument_group()
        self.parser.add_argument(
            '-n',
            '--last',
            type=int,
            dest='last',
            default=self.default_limit,
            help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))

        # Filter options
        self.group.add_argument('--trigger-instance',
                                help='Trigger instance id to filter the list.')

        self.group.add_argument('--execution',
                                help='Execution id to filter the list.')
        self.group.add_argument('--rule', help='Rule ref to filter the list.')

        self.parser.add_argument(
            '-tg',
            '--timestamp-gt',
            type=str,
            dest='timestamp_gt',
            default=None,
            help=('Only return enforcements with enforced_at '
                  'greater than the one provided. '
                  'Use time in the format 2000-01-01T12:00:00.000Z'))
        self.parser.add_argument(
            '-tl',
            '--timestamp-lt',
            type=str,
            dest='timestamp_lt',
            default=None,
            help=('Only return enforcements with enforced_at '
                  'lower than the one provided. '
                  'Use time in the format 2000-01-01T12:00:00.000Z'))
        # Display options
        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.'))
コード例 #13
0
ファイル: keyvalue.py プロジェクト: automotola/st2
    def __init__(self, resource, *args, **kwargs):
        help_text = ('Load a list of %s from file.' %
                     resource.get_plural_display_name().lower())
        super(KeyValuePairLoadCommand, self).__init__(resource, 'load',
            help_text, *args, **kwargs)

        self.parser.add_argument(
            'file', help=('JSON file containing the %s to create.'
                          % resource.get_plural_display_name().lower()))
コード例 #14
0
ファイル: datastore.py プロジェクト: timff/st2
    def __init__(self, resource, *args, **kwargs):
        help_text = ('Load a list of %s from file.' %
                     resource.get_plural_display_name().lower())
        super(KeyValuePairLoadCommand, self).__init__(resource, 'load',
            help_text, *args, **kwargs)

        self.parser.add_argument(
            'file', help=('JSON file containing the %s to create.'
                          % resource.get_plural_display_name().lower()))
コード例 #15
0
ファイル: pack.py プロジェクト: LindsayHill/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(resource, 'install',
            'Install new %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s to install.' %
                                 resource.get_plural_display_name().lower())
コード例 #16
0
ファイル: pack.py プロジェクト: LindsayHill/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackRemoveCommand, self).__init__(resource, 'remove',
            'Remove %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s to remove.' %
                                 resource.get_plural_display_name().lower())
コード例 #17
0
ファイル: pack.py プロジェクト: neufeldtech/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackRemoveCommand, self).__init__(resource, 'remove',
            'Remove %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s to remove.' %
                                 resource.get_plural_display_name().lower())
コード例 #18
0
ファイル: pack.py プロジェクト: neufeldtech/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(resource, 'install',
            'Install new %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s to install.' %
                                 resource.get_plural_display_name().lower())
コード例 #19
0
ファイル: pack.py プロジェクト: Plexxi/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackRemoveCommand, self).__init__(
            resource, "remove", "Remove %s." % resource.get_plural_display_name().lower(), *args, **kwargs
        )

        self.parser.add_argument(
            "packs",
            nargs="+",
            metavar="pack",
            help="Name of the %s to remove." % resource.get_plural_display_name().lower(),
        )
コード例 #20
0
ファイル: pack.py プロジェクト: Plexxi/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(
            resource, "install", "Install new %s." % resource.get_plural_display_name().lower(), *args, **kwargs
        )

        self.parser.add_argument(
            "packs",
            nargs="+",
            metavar="pack",
            help="Name of the %s in Exchange, or a git repo URL." % resource.get_plural_display_name().lower(),
        )
        self.parser.add_argument("--force", action="store_true", default=False, help="Force pack installation.")
コード例 #21
0
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(RuleListCommand, self).__init__(
            resource,
            "list",
            "Get the list of the %s most recent %s." %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args,
            **kwargs,
        )

        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_argument_group()
        self.parser.add_argument(
            "-n",
            "--last",
            type=int,
            dest="last",
            default=self.default_limit,
            help=("List N most recent %s. Use -n -1 to fetch the full result \
                                       set." % self.resource_name),
        )
        self.parser.add_argument(
            "--iftt",
            action="store_true",
            help="Show trigger and action in display list.",
        )
        self.parser.add_argument(
            "-p",
            "--pack",
            type=str,
            help=("Only return resources belonging to the"
                  " provided pack"),
        )
        self.group.add_argument("-c",
                                "--action",
                                help="Action reference to filter the list.")
        self.group.add_argument(
            "-g",
            "--trigger",
            help="Trigger type reference to filter the list.")
        self.enabled_filter_group = self.parser.add_mutually_exclusive_group()
        self.enabled_filter_group.add_argument(
            "--enabled",
            action="store_true",
            help="Show rules that are enabled.")
        self.enabled_filter_group.add_argument(
            "--disabled",
            action="store_true",
            help="Show rules that are disabled.")
コード例 #22
0
ファイル: keyvalue.py プロジェクト: smudkey/st2
    def __init__(self, resource, *args, **kwargs):
        help_text = ('Load a list of %s from file.' %
                     resource.get_plural_display_name().lower())
        super(KeyValuePairLoadCommand, self).__init__(resource, 'load',
                                                      help_text, *args, **kwargs)

        self.parser.add_argument('-c', '--convert', action='store_true',
                                 help=('Convert non-string types (hash, array, boolean,'
                                       ' int, float) to a JSON string before loading it'
                                       ' into the datastore.'))
        self.parser.add_argument(
            'file', help=('JSON/YAML file containing the %s(s) to load'
                          % resource.get_plural_display_name().lower()))
コード例 #23
0
ファイル: keyvalue.py プロジェクト: lyandut/st2
    def __init__(self, resource, *args, **kwargs):
        help_text = ('Load a list of %s from file.' %
                     resource.get_plural_display_name().lower())
        super(KeyValuePairLoadCommand, self).__init__(resource, 'load',
                                                      help_text, *args, **kwargs)

        self.parser.add_argument('-c', '--convert', action='store_true',
                                 help=('Convert non-string types (hash, array, boolean,'
                                       ' int, float) to a JSON string before loading it'
                                       ' into the datastore.'))
        self.parser.add_argument(
            'file', help=('JSON/YAML file containing the %s(s) to load'
                          % resource.get_plural_display_name().lower()))
コード例 #24
0
ファイル: pack.py プロジェクト: Pulsant/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(resource, 'install',
            'Install new %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s to install.' %
                                 resource.get_plural_display_name().lower())
        self.parser.add_argument('--force',
                                 action='store_true',
                                 default=False,
                                 help='Force pack installation.')
コード例 #25
0
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(
            resource, 'install',
            'Install new %s.' % resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s to install.' %
                                 resource.get_plural_display_name().lower())
        self.parser.add_argument('--force',
                                 action='store_true',
                                 default=False,
                                 help='Force pack installation.')
コード例 #26
0
ファイル: action.py プロジェクト: vishnu81/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionExecutionListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s.' %
                                       resource.get_plural_display_name().lower()))
        self.parser.add_argument('-s', '--sort', type=str, dest='sort_order',
                                 default='descending',
                                 help=('Sort %s by start timestamp, '
                                       'asc|ascending (earliest first) '
                                       'or desc|descending (latest first)' %
                                       resource.get_plural_display_name().lower()))

        # Filter options
        self.group.add_argument('--action', help='Action reference to filter the list.')
        self.group.add_argument('--status', help=('Only return executions with the provided status.'
                                                  ' Possible values are \'%s\', \'%s\', \'%s\','
                                                  '\'%s\' or \'%s\''
                                                  '.' % POSSIBLE_ACTION_STATUS_VALUES))
        self.group.add_argument('--trigger_instance',
                                help='Trigger instance id to filter the list.')
        self.parser.add_argument('-tg', '--timestamp-gt', type=str, dest='timestamp_gt',
                                 default=None,
                                 help=('Only return executions with timestamp '
                                       'greater than the one provided. '
                                       'Use time in the format "2000-01-01T12:00:00.000Z".'))
        self.parser.add_argument('-tl', '--timestamp-lt', type=str, dest='timestamp_lt',
                                 default=None,
                                 help=('Only return executions with timestamp '
                                       'lower than the one provided. '
                                       'Use time in the format "2000-01-01T12:00:00.000Z".'))
        self.parser.add_argument('-l', '--showall', action='store_true',
                                 help='')

        # Display options
        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.'))
コード例 #27
0
    def __init__(self, resource, *args, **kwargs):
        super(TimerListCommand, self).__init__(resource, *args, **kwargs)

        self.parser.add_argument('-ty', '--timer-type', type=str, dest='timer_type',
                                 help=("List %s type, example: 'core.st2.IntervalTimer', \
                                       'core.st2.DateTimer', 'core.st2.CronTimer'." %
                                       resource.get_plural_display_name().lower()), required=False)
コード例 #28
0
ファイル: timer.py プロジェクト: yuemanxilou/st2
    def __init__(self, resource, *args, **kwargs):
        super(TimerListCommand, self).__init__(resource, *args, **kwargs)

        self.parser.add_argument('-ty', '--timer-type', type=str, dest='timer_type',
                                 help=('List N most recent %s.' %
                                       resource.get_plural_display_name().lower()),
                                 required=False)
コード例 #29
0
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasMatchCommand, self).__init__(
            resource, 'match',
            'Get the list of %s that match the command text.' %
            resource.get_plural_display_name().lower(), *args, **kwargs)

        self.parser.add_argument('match_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('-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
    def __init__(self, resource, *args, **kwargs):
        super(RuleListCommand, self).__init__(resource, *args, **kwargs)

        self.group = self.parser.add_argument_group()
        self.parser.add_argument(
            '-n',
            '--last',
            type=int,
            dest='last',
            default=50,
            help=('List N most recent %s.' %
                  resource.get_plural_display_name().lower()))
        self.parser.add_argument(
            '--iftt',
            action='store_true',
            help='Show trigger and action in display list.')
        self.group.add_argument('-c',
                                '--action',
                                help='Action reference to filter the list.')
        self.group.add_argument(
            '-g',
            '--trigger',
            help='Trigger type reference to filter the list.')
        self.enabled_filter_group = self.parser.add_mutually_exclusive_group()
        self.enabled_filter_group.add_argument(
            '--enabled',
            action='store_true',
            help='Show rules that are enabled.')
        self.enabled_filter_group.add_argument(
            '--disabled',
            action='store_true',
            help='Show rules that are disabled.')
コード例 #31
0
    def __init__(self, resource, *args, **kwargs):
        super(RoleAssignmentListCommand, self).__init__(
            resource, 'list', 'Get the list of the  %s.' %
            resource.get_plural_display_name().lower(), *args, **kwargs)

        # Filter options
        self.parser.add_argument('-r', '--role', help='Role to filter on.')
        self.parser.add_argument('-u', '--user', help='User to filter on.')
        self.parser.add_argument('-s', '--source', help='Source to filter on.')
        self.parser.add_argument('--remote',
                                 action='store_true',
                                 help='Only display remote role assignments.')

        # Display options
        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.'))
コード例 #32
0
    def __init__(self, resource, *args, **kwargs):
        super(PackRemoveCommand, self).__init__(
            resource,
            "remove",
            "Remove %s." % resource.get_plural_display_name().lower(),
            *args,
            **kwargs,
        )

        self.parser.add_argument(
            "packs",
            nargs="+",
            metavar="pack",
            help="Name of the %s to remove." %
            resource.get_plural_display_name().lower(),
        )
コード例 #33
0
    def __init__(self, resource, *args, **kwargs):
        super(RoleListCommand, self).__init__(
            resource, 'list', 'Get the list of the  %s.' %
            resource.get_plural_display_name().lower(), *args, **kwargs)

        self.group = self.parser.add_mutually_exclusive_group()

        # Filter options
        self.group.add_argument('-s',
                                '--system',
                                action='store_true',
                                help='Only display system roles.')

        # Display options
        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.'))
コード例 #34
0
ファイル: inquiry.py プロジェクト: st2sandbox/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(InquiryListCommand, self).__init__(
            resource,
            "list",
            "Get the list of the %s most recent %s."
            % (self.default_limit, resource.get_plural_display_name().lower()),
            *args,
            **kwargs,
        )

        self.resource_name = resource.get_plural_display_name().lower()
        self.parser.add_argument(
            "-n",
            "--last",
            type=int,
            dest="last",
            default=self.default_limit,
            help=(
                "List N most recent %s. Use -n -1 to fetch the full result \
                                       set."
                % self.resource_name
            ),
        )

        # Display options
        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."),
        )
コード例 #35
0
ファイル: pack.py プロジェクト: lyandut/st2
    def __init__(self, resource, *args, **kwargs):
        super(PackInstallCommand, self).__init__(resource, 'install', 'Install new %s.'
                                                 % resource.get_plural_display_name().lower(),
                                                 *args, **kwargs)

        self.parser.add_argument('packs',
                                 nargs='+',
                                 metavar='pack',
                                 help='Name of the %s in Exchange, or a git repo URL.' %
                                 resource.get_plural_display_name().lower())
        self.parser.add_argument('--python3',
                                 action='store_true',
                                 default=False,
                                 help='Use Python 3 binary for pack virtual environment.')
        self.parser.add_argument('--force',
                                 action='store_true',
                                 default=False,
                                 help='Force pack installation.')
コード例 #36
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()))
コード例 #37
0
ファイル: rule_enforcement.py プロジェクト: StackStorm/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(RuleEnforcementListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s most recent %s.' %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args, **kwargs)
        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))

        # Filter options
        self.group.add_argument('--trigger-instance',
                                help='Trigger instance id to filter the list.')

        self.group.add_argument('--execution',
                                help='Execution id to filter the list.')
        self.group.add_argument('--rule',
                                help='Rule ref to filter the list.')

        self.parser.add_argument('-tg', '--timestamp-gt', type=str, dest='timestamp_gt',
                                 default=None,
                                 help=('Only return enforcements with enforced_at '
                                       'greater than the one provided. '
                                       'Use time in the format 2000-01-01T12:00:00.000Z'))
        self.parser.add_argument('-tl', '--timestamp-lt', type=str, dest='timestamp_lt',
                                 default=None,
                                 help=('Only return enforcements with enforced_at '
                                       'lower than the one provided. '
                                       'Use time in the format 2000-01-01T12:00:00.000Z'))
        # Display options
        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.'))
コード例 #38
0
ファイル: trace.py プロジェクト: tomzhang/st2
    def __init__(self, resource, *args, **kwargs):
        super(TraceListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(), *args, **kwargs)

        self.group = self.parser.add_mutually_exclusive_group()
        self.parser.add_argument(
            '-n',
            '--last',
            type=int,
            dest='last',
            default=50,
            help=('List N most recent %s; '
                  'list all if 0.' %
                  resource.get_plural_display_name().lower()))

        # Filter options
        self.group.add_argument('-c',
                                '--trace-tag',
                                help='Trace-tag to filter the list.')
        self.group.add_argument('-e',
                                '--execution',
                                help='Execution to filter the list.')
        self.group.add_argument('-r',
                                '--rule',
                                help='Rule to filter the list.')
        self.group.add_argument('-g',
                                '--trigger-instance',
                                help='TriggerInstance to filter the list.')
        # Display options
        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.'))
コード例 #39
0
ファイル: timer.py プロジェクト: Pulsant/st2
    def __init__(self, resource, *args, **kwargs):
        super(TimerListCommand, self).__init__(resource, *args, **kwargs)

        self.parser.add_argument(
            "-ty",
            "--timer-type",
            type=str,
            dest="timer_type",
            help=("List N most recent %s." % resource.get_plural_display_name().lower()),
            required=False,
        )
コード例 #40
0
    def __init__(self, resource, *args, **kwargs):
        super(ActionExecutionListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_mutually_exclusive_group()
        self.group.add_argument('--action', help='Action reference to filter the list.')
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s; '
                                       'list all if 0.' %
                                       resource.get_plural_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=[28],
                                 help=('Set the width of columns in output.'))
コード例 #41
0
ファイル: action.py プロジェクト: bjoernbessert/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionExecutionListCommand, self).__init__(
            resource, 'list', 'Get the list of the 50 most recent %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_mutually_exclusive_group()
        self.group.add_argument('--action', help='Action reference to filter the list.')
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s; '
                                       'list all if 0.' %
                                       resource.get_plural_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=[28],
                                 help=('Set the width of columns in output.'))
コード例 #42
0
ファイル: keyvalue.py プロジェクト: yetudada/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(KeyValuePairListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s most recent %s.' %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args, **kwargs)
        self.resource_name = resource.get_plural_display_name().lower()
        # Filter options
        self.parser.add_argument(
            '--prefix',
            help=('Only return values with names starting with '
                  'the provided prefix.'))
        self.parser.add_argument(
            '-d',
            '--decrypt',
            action='store_true',
            help='Decrypt secrets and displays plain text.')
        self.parser.add_argument('-s',
                                 '--scope',
                                 default=DEFAULT_LIST_SCOPE,
                                 dest='scope',
                                 help='Scope item is under. Example: "user".')
        self.parser.add_argument(
            '-u',
            '--user',
            dest='user',
            default=None,
            help='User for user scoped items (admin only).')
        self.parser.add_argument(
            '-n',
            '--last',
            type=int,
            dest='last',
            default=self.default_limit,
            help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))
コード例 #43
0
ファイル: keyvalue.py プロジェクト: lyandut/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(KeyValuePairListCommand, self).__init__(resource, 'list',
                                                      'Get the list of the %s most recent %s.' %
                                                      (self.default_limit,
                                                       resource.get_plural_display_name().lower()),
                                                      *args, **kwargs)
        self.resource_name = resource.get_plural_display_name().lower()
        # Filter options
        self.parser.add_argument('--prefix', help=('Only return values with names starting with '
                                                   'the provided prefix.'))
        self.parser.add_argument('--decrypt', action='store_true',
                                 help='Decrypt secrets and displays plain text.')
        self.parser.add_argument('-s', '--scope', default='system', dest='scope',
                                 help='Scope item is under. Example: "user".')
        self.parser.add_argument('-u', '--user', dest='user', default=None,
                                 help='User for user scoped items (admin only).')
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))
コード例 #44
0
ファイル: inquiry.py プロジェクト: StackStorm/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(InquiryListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s most recent %s.' %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args, **kwargs)

        self.resource_name = resource.get_plural_display_name().lower()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))

        # Display options
        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.'))
コード例 #45
0
ファイル: action_alias.py プロジェクト: Kailashkatheth1/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s' %
            (resource.get_plural_display_name().lower()),
            *args, **kwargs)

        # Display options
        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.'))
コード例 #46
0
ファイル: trace.py プロジェクト: nzlosh/st2
    def __init__(self, resource, *args, **kwargs):

        self.default_limit = 50

        super(TraceListCommand, self).__init__(
            resource, 'list', 'Get the list of the %s most recent %s.' %
            (self.default_limit, resource.get_plural_display_name().lower()),
            *args, **kwargs)

        self.resource_name = resource.get_plural_display_name().lower()
        self.group = self.parser.add_mutually_exclusive_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=self.default_limit,
                                 help=('List N most recent %s. Use -n -1 to fetch the full result \
                                       set.' % self.resource_name))
        self.parser.add_argument('-s', '--sort', type=str, dest='sort_order',
                                 default='descending',
                                 help=('Sort %s by start timestamp, '
                                       'asc|ascending (earliest first) '
                                       'or desc|descending (latest first)' % self.resource_name))

        # Filter options
        self.group.add_argument('-c', '--trace-tag', help='Trace-tag to filter the list.')
        self.group.add_argument('-e', '--execution', help='Execution to filter the list.')
        self.group.add_argument('-r', '--rule', help='Rule to filter the list.')
        self.group.add_argument('-g', '--trigger-instance',
                                help='TriggerInstance to filter the list.')
        # Display options
        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.'))
コード例 #47
0
ファイル: rule.py プロジェクト: AlexeyDeyneko/st2
    def __init__(self, resource, *args, **kwargs):
        super(RuleListCommand, self).__init__(resource, *args, **kwargs)

        self.group = self.parser.add_argument_group()
        self.parser.add_argument('-n', '--last', type=int, dest='last',
                                 default=50,
                                 help=('List N most recent %s; '
                                       'list all if 0.' %
                                       resource.get_plural_display_name().lower()))
        self.parser.add_argument('--iftt', action='store_true',
                                 help='Show trigger and action in display list.')
        self.group.add_argument('-c', '--action',
                                help='Action reference to filter the list.')
        self.group.add_argument('-g', '--trigger',
                                help='Trigger type reference to filter the list.')
コード例 #48
0
ファイル: action_alias.py プロジェクト: peak6/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasMatchCommand, self).__init__(
            resource, 'match',
            'Get the list of %s that match the command text.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.parser.add_argument('match_text',
                                 metavar='command',
                                 help=help)

        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.'))
コード例 #49
0
ファイル: rbac.py プロジェクト: StackStorm/st2
    def __init__(self, resource, *args, **kwargs):
        super(RoleListCommand, self).__init__(
            resource, 'list', 'Get the list of the  %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        self.group = self.parser.add_mutually_exclusive_group()

        # Filter options
        self.group.add_argument('-s', '--system', action='store_true',
                                help='Only display system roles.')

        # Display options
        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.'))
コード例 #50
0
ファイル: action_alias.py プロジェクト: Pulsant/st2
    def __init__(self, resource, *args, **kwargs):
        super(ActionAliasMatchCommand, self).__init__(
            resource,
            "match",
            "Get the list of %s that match the command text." % resource.get_plural_display_name().lower(),
            *args,
            **kwargs
        )

        self.parser.add_argument("match_text", metavar="command", help=help)

        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.")
        )
コード例 #51
0
ファイル: rbac.py プロジェクト: StackStorm/st2
    def __init__(self, resource, *args, **kwargs):
        super(RoleAssignmentListCommand, self).__init__(
            resource, 'list', 'Get the list of the  %s.' %
            resource.get_plural_display_name().lower(),
            *args, **kwargs)

        # Filter options
        self.parser.add_argument('-r', '--role', help='Role to filter on.')
        self.parser.add_argument('-u', '--user', help='User to filter on.')
        self.parser.add_argument('-s', '--source', help='Source to filter on.')
        self.parser.add_argument('--remote', action='store_true',
                                help='Only display remote role assignments.')

        # Display options
        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.'))