def __init__(self, resource, *args, **kwargs): super(PackShowCommand, self).__init__(resource, 'show', 'Get information about a %s from the index.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('pack', help='Name of the %s to show.' % resource.get_display_name().lower())
def __init__(self, resource, *args, **kwargs): super(PackConfigCommand, self).__init__(resource, 'config', 'Configure a %s based on config schema.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name', help='Name of the %s(s) to configure.' % resource.get_display_name().lower())
def __init__(self, resource, *args, **kwargs): super(PackConfigCommand, self).__init__( resource, "config", "Configure a %s based on config schema." % resource.get_display_name().lower(), *args, **kwargs ) self.parser.add_argument("name", help="Name of the %s(s) to configure." % resource.get_display_name().lower())
def __init__(self, resource, *args, **kwargs): help_string = ( 'Get information about an available %s from the index.' % resource.get_display_name().lower()) super(PackShowCommand, self).__init__(resource, 'show', help_string, *args, **kwargs) self.parser.add_argument('pack', help='Name of the %s to show.' % resource.get_display_name().lower())
def __init__(self, resource, *args, **kwargs): super(ActionExecutionGetCommand, self).__init__( resource, 'get', 'Get individual %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('id', help=('ID of the %s.' % resource.get_display_name().lower())) self._add_common_options()
def __init__(self, resource, *args, **kwargs): super(ActionAliasExecuteCommand, self).__init__( resource, 'execute', ('Execute the command text by finding a matching %s.' % resource.get_display_name().lower()), *args, **kwargs) self.parser.add_argument('command_text', metavar='command', help=('Execute the command text by finding a matching %s.' % resource.get_display_name().lower())) self.parser.add_argument('-u', '--user', type=str, default=None, help='User under which to run the action (admins only).')
def __init__(self, resource, *args, **kwargs): super(PackRegisterCommand, self).__init__(resource, 'register', 'Register a %s: sync all file changes with DB.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('--packs', nargs='+', help='Name of the %s(s) to register.' % resource.get_display_name().lower()) self.parser.add_argument('--types', nargs='+', help='Types of content to register.')
def __init__(self, resource, *args, **kwargs): super(ApiKeyLoadCommand, self).__init__( resource, 'load', 'Load %s from a file.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('file', help=('JSON/YAML file containing the %s(s) to load.' % resource.get_display_name().lower()), default='') self.parser.add_argument('-w', '--width', nargs='+', type=int, default=None, help=('Set the width of columns in output.'))
def __init__(self, resource, *args, **kwargs): super(ActionExecutionGetCommand, self).__init__( resource, 'get', 'Get individual %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('id', help=('ID of the %s.' % resource.get_display_name().lower())) self.parser.add_argument('-a', '--attr', nargs='+', default=self.display_attributes, help=('List of attributes to include in the ' 'output. "all" or unspecified will ' 'return all attributes.'))
def __init__(self, resource, *args, **kwargs): super(PackConfigCommand, self).__init__( resource, "config", "Configure a %s based on config schema." % resource.get_display_name().lower(), *args, **kwargs, ) self.parser.add_argument( "name", help="Name of the %s(s) to configure." % resource.get_display_name().lower(), )
def __init__(self, resource, *args, **kwargs): super(KeyValuePairCreateCommand, self).__init__(resource, 'create', 'Create a new %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name', help='Key name.') self.parser.add_argument('value', help='Value paired with the key.')
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__( resource, 'set', 'Set an existing %s.' % resource.get_display_name().lower(), *args, **kwargs ) # --encrypt and --encrypted options are mutually exclusive. # --encrypt implies provided value is plain text and should be encrypted whereas # --encrypted implies value is already encrypted and should be treated as-is. encryption_group = self.parser.add_mutually_exclusive_group() encryption_group.add_argument('-e', '--encrypt', dest='secret', action='store_true', help='Encrypt value before saving.') encryption_group.add_argument('--encrypted', dest='encrypted', action='store_true', help=('Value provided is already encrypted with the ' 'instance crypto key and should be stored as-is.')) self.parser.add_argument('name', metavar='name', help='Name of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.') self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None, help='TTL (in seconds) for this value.') self.parser.add_argument('-s', '--scope', dest='scope', default=DEFAULT_CUD_SCOPE, help='Specify the scope under which you want ' + 'to place the item.') self.parser.add_argument('-u', '--user', dest='user', default=None, help='User for user scoped items (admin only).')
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__( resource, 'set', 'Set an existing %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name', metavar='name', help='Name of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.') self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None, help='TTL (in seconds) for this value.') self.parser.add_argument('-e', '--encrypt', dest='secret', action='store_true', help='Encrypt value before saving the value.') self.parser.add_argument( '-s', '--scope', dest='scope', default=DEFAULT_SCOPE, help='Specify the scope under which you want ' + 'to place the item.') self.parser.add_argument( '-u', '--user', dest='user', default=None, help='User for user scoped items (admin only).')
def __init__(self, resource, *args, **kwargs): super(PackSearchCommand, self).__init__(resource, 'search', 'Search for a %s in the directory.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('query', help='Search query.')
def __init__(self, resource, *args, **kwargs): super(ActionAliasExecuteCommand, self).__init__( resource, 'execute', ('Execute the command text by finding a matching %s.' % resource.get_display_name().lower()), *args, **kwargs) self.parser.add_argument('command_text', metavar='command', help=help) self.parser.add_argument('-h', '--help', action='store_true', dest='help', help='Print usage for the given action.') self.parser.add_argument('--trace-tag', '--trace_tag', help='A trace tag string to track execution later.', dest='trace_tag', required=False) self.parser.add_argument('--trace-id', help='Existing trace id for this execution.', dest='trace_id', required=False) self.parser.add_argument('-a', '--async', action='store_true', dest='async', help='Do not wait for action to finish.') self.parser.add_argument('-u', '--user', type=str, default=None, help='User under which to run the action (admins only).') self.parser.add_argument('--attr', nargs='+', default=self.display_attributes, help=('List of attributes to include in the ' 'output. "all" will return all ' 'attributes.')) self.parser.add_argument('-w', '--width', nargs='+', type=int, default=None, help=('Set the width of columns in output.'))
def __init__(self, resource, *args, **kwargs): super(PackSearchCommand, self).__init__( resource, 'search', 'Search the index for a %s with any attribute \ matching the query.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('query', help='Search query.')
def __init__(self, resource, *args, **kwargs): super(ApiKeyCreateCommand, self).__init__( resource, "create", "Create a new %s." % resource.get_display_name().lower(), *args, **kwargs, ) self.parser.add_argument( "-u", "--user", type=str, help="User for which to create API Keys.", default="", ) self.parser.add_argument( "-m", "--metadata", type=json.loads, help="Optional metadata to associate with the API Keys.", default={}, ) self.parser.add_argument( "-k", "--only-key", action="store_true", dest="only_key", default=False, help="Only print API Key to the console on creation.", )
def __init__(self, resource, *args, **kwargs): super(PackRegisterCommand, self).__init__( resource, "register", "Register a %s: sync all file changes with DB." % resource.get_display_name().lower(), *args, **kwargs ) self.parser.add_argument( "packs", nargs="*", metavar="pack", help="Name of the %s(s) to register." % resource.get_display_name().lower(), ) self.parser.add_argument("--types", nargs="+", help="Types of content to register.")
def __init__(self, resource, *args, **kwargs): super(KeyValuePairCreateCommand, self).__init__( resource, 'create', 'Create a new %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name', help='Key name.') self.parser.add_argument('value', help='Value paired with the key.')
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__(resource, 'set', 'Set an existing %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name', metavar='name', help='Name of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.')
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()))
def __init__(self, resource, *args, **kwargs): super(KeyValuePairUpdateCommand, self).__init__(resource, 'update', 'Update an existing %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name_or_id', metavar='name-or-id', help='Name or ID of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.')
def __init__(self, resource, *args, **kwargs): super(PackSearchCommand, self).__init__(resource, 'search', 'Search the index for a %s with any attribute \ matching the query.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('query', help='Search query.')
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__( resource, "set", "Set an existing %s." % resource.get_display_name().lower(), *args, **kwargs, ) # --encrypt and --encrypted options are mutually exclusive. # --encrypt implies provided value is plain text and should be encrypted whereas # --encrypted implies value is already encrypted and should be treated as-is. encryption_group = self.parser.add_mutually_exclusive_group() encryption_group.add_argument( "-e", "--encrypt", dest="secret", action="store_true", help="Encrypt value before saving.", ) encryption_group.add_argument( "--encrypted", dest="encrypted", action="store_true", help=( "Value provided is already encrypted with the " "instance crypto key and should be stored as-is." ), ) self.parser.add_argument( "name", metavar="name", help="Name of the key value pair." ) self.parser.add_argument("value", help="Value paired with the key.", nargs="?") self.parser.add_argument( "-l", "--ttl", dest="ttl", type=int, default=None, help="TTL (in seconds) for this value.", ) self.parser.add_argument( "-s", "--scope", dest="scope", default=DEFAULT_CUD_SCOPE, help="Specify the scope under which you want " + "to place the item.", ) self.parser.add_argument( "-u", "--user", dest="user", default=None, help="User for user scoped items (admin only).", )
def __init__(self, resource, *args, **kwargs): super(ActionAliasMatchCommand, self).__init__( resource, 'match', 'Get the %s that match the command text.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('match_text', metavar='command', help=('Get the %s that match the command text.' % resource.get_display_name().lower())) self.parser.add_argument('-a', '--attr', nargs='+', default=self.display_attributes, help=('List of attributes to include in the ' 'output. "all" will return all ' 'attributes.')) self.parser.add_argument('-w', '--width', nargs='+', type=int, default=None, help=('Set the width of columns in output.'))
def __init__(self, resource, *args, **kwargs): super(PackSearchCommand, self).__init__( resource, "search", "Search the index for a %s with any attribute matching the query." % resource.get_display_name().lower(), *args, **kwargs ) self.parser.add_argument("query", help="Search query.")
def __init__(self, resource, *args, **kwargs): super(KeyValuePairUpdateCommand, self).__init__( resource, 'update', 'Update an existing %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name_or_id', metavar='name-or-id', help='Name or ID of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.')
def __init__(self, resource, *args, **kwargs): super(PackRegisterCommand, self).__init__( resource, "register", "Register %s(s): sync all file changes with DB." % resource.get_display_name().lower(), *args, **kwargs, ) self.parser.add_argument( "packs", nargs="*", metavar="pack", help="Name of the %s(s) to register." % resource.get_display_name().lower(), ) self.parser.add_argument( "--types", nargs="+", help="Types of content to register." )
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__( resource, 'set', 'Set an existing %s.' % resource.get_display_name().lower(), *args, **kwargs ) self.parser.add_argument('name', metavar='name', help='Name of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.') self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None, help='TTL (in seconds) for this value.')
def __init__(self, resource, *args, **kwargs): super(ActionAliasExecuteCommand, self).__init__( resource, "execute", ("Execute the command text by finding a matching %s." % resource.get_display_name().lower()), *args, **kwargs, ) self.parser.add_argument( "command_text", metavar="command", help=("Execute the command text by finding a matching %s." % resource.get_display_name().lower()), ) self.parser.add_argument( "-u", "--user", type=str, default=None, help="User under which to run the action (admins only).", )
def __init__(self, resource, *args, **kwargs): super(ApiKeyCreateCommand, self).__init__( resource, 'create', 'Create a new %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('-u', '--user', type=str, help='User for which to create API Keys.', default='') self.parser.add_argument('-m', '--metadata', type=json.loads, help='User for which to create API Keys.', default={}) self.parser.add_argument('-k', '--only-key', action='store_true', dest='only_key', default=False, help='Only print API Key to the console on creation.')
def __init__(self, resource, *args, **kwargs): super(InquiryRespondCommand, self).__init__( resource, 'respond', 'Respond to an %s.' % resource.get_display_name().lower(), *args, **kwargs ) self.parser.add_argument('id', metavar='id', help='Inquiry ID') self.parser.add_argument('-r', '--response', type=str, dest='response', default=None, help=('Entire response payload as JSON string ' '(bypass interactive mode)'))
def __init__(self, resource, *args, **kwargs): super(ApiKeyCreateCommand, self).__init__( resource, 'create', 'Create a new %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('-u', '--user', type=str, help='User for which to create API Keys.', default='') self.parser.add_argument('-m', '--metadata', type=json.loads, help='Optional metadata to associate with the API Keys.', default={}) self.parser.add_argument('-k', '--only-key', action='store_true', dest='only_key', default=False, help='Only print API Key to the console on creation.')
def __init__(self, resource, *args, **kwargs): super(ActionAliasMatchCommand, self).__init__( resource, "match", "Get the %s that match the command text." % resource.get_display_name().lower(), *args, **kwargs, ) self.parser.add_argument( "match_text", metavar="command", help=( "Get the %s that match the command text." % resource.get_display_name().lower() ), ) self.parser.add_argument( "-a", "--attr", nargs="+", default=self.display_attributes, help=( "List of attributes to include in the " 'output. "all" will return all ' "attributes." ), ) self.parser.add_argument( "-w", "--width", nargs="+", type=int, default=None, help=("Set the width of columns in output."), )
def __init__(self, resource, *args, **kwargs): super(ApiKeyLoadCommand, self).__init__( resource, "load", "Load %s from a file." % resource.get_display_name().lower(), *args, **kwargs, ) self.parser.add_argument( "file", help=("JSON/YAML file containing the %s(s) to load." % resource.get_display_name().lower()), default="", ) self.parser.add_argument( "-w", "--width", nargs="+", type=int, default=None, help=("Set the width of columns in output."), )
def __init__(self, resource, *args, **kwargs): super(ActionAliasTestCommand, self).__init__( resource, "test", ( "Execute the command text by finding a matching %s and format the result." % resource.get_display_name().lower() ), *args, **kwargs, ) self.parser.add_argument( "command_text", metavar="command", help=( "Execute the command text by finding a matching %s." % resource.get_display_name().lower() ), ) self.parser.add_argument( "-u", "--user", type=str, default=None, help="User under which to run the action (admins only).", ) self._add_common_options() self.parser.add_argument( "-a", "--async", action="store_true", dest="action_async", help="Do not wait for action to finish.", )
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__( resource, 'set', 'Set an existing %s.' % resource.get_display_name().lower(), *args, **kwargs) self.parser.add_argument('name', metavar='name', help='Name of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.') self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None, help='TTL (in seconds) for this value.')
def __init__(self, resource, *args, **kwargs): super(ActionAliasExecuteCommand, self).__init__( resource, 'execute', ('Execute the command text by finding a matching %s.' % resource.get_display_name().lower()), *args, **kwargs) self.parser.add_argument('command_text', metavar='command', help=help) self.parser.add_argument('-h', '--help', action='store_true', dest='help', help='Print usage for the given action.') self.parser.add_argument( '--trace-tag', '--trace_tag', help='A trace tag string to track execution later.', dest='trace_tag', required=False) self.parser.add_argument('--trace-id', help='Existing trace id for this execution.', dest='trace_id', required=False) self.parser.add_argument('-a', '--async', action='store_true', dest='async', help='Do not wait for action to finish.') self.parser.add_argument( '-u', '--user', type=str, default=None, help='User under which to run the action (admins only).') self.parser.add_argument('--attr', nargs='+', default=self.display_attributes, help=('List of attributes to include in the ' 'output. "all" will return all ' 'attributes.')) self.parser.add_argument('-w', '--width', nargs='+', type=int, default=None, help=('Set the width of columns in output.'))
def __init__(self, resource, *args, **kwargs): super(InquiryRespondCommand, self).__init__( resource, "respond", "Respond to an %s." % resource.get_display_name().lower(), *args, **kwargs, ) self.parser.add_argument("id", metavar="id", help="Inquiry ID") self.parser.add_argument( "-r", "--response", type=str, dest="response", default=None, help=("Entire response payload as JSON string " "(bypass interactive mode)"), )
def __init__(self, resource, *args, **kwargs): super(KeyValuePairSetCommand, self).__init__( resource, 'set', 'Set an existing %s.' % resource.get_display_name().lower(), *args, **kwargs ) self.parser.add_argument('name', metavar='name', help='Name of the key value pair.') self.parser.add_argument('value', help='Value paired with the key.') self.parser.add_argument('-l', '--ttl', dest='ttl', type=int, default=None, help='TTL (in seconds) for this value.') self.parser.add_argument('-e', '--encrypt', dest='secret', action='store_true', help='Encrypt value before saving.') self.parser.add_argument('-s', '--scope', dest='scope', default=DEFAULT_SCOPE, help='Specify the scope under which you want ' + 'to place the item.') self.parser.add_argument('-u', '--user', dest='user', default=None, help='User for user scoped items (admin only).')
def __init__(self, resource, *args, **kwargs): help_string = "Get information about an available %s from the index." % resource.get_display_name().lower() super(PackShowCommand, self).__init__(resource, "show", help_string, *args, **kwargs) self.parser.add_argument("pack", help="Name of the %s to show." % resource.get_display_name().lower())