Пример #1
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.')
Пример #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.",
        )
 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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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.'))