How to use the st2client.models function in st2client

To help you get started, we’ve selected a few st2client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StackStorm / st2 / st2tests / integration / orquesta / test_wiring_functions_st2kv.py View on Github external
def del_kvp(cls, name, scope='system'):
        kvp = models.KeyValuePair(id=name, name=name, scope=scope)

        cls.st2client.keys.delete(kvp)
github StackStorm / st2 / st2tests / integration / mistral / test_st2kv.py View on Github external
def del_kvp(cls, name, scope='system'):
        kvp = models.KeyValuePair(id=name, name=name, scope=scope)

        cls.st2client.keys.delete(kvp)
github StackStorm / st2 / st2client / st2client / base.py View on Github external
def _authenticate_and_retrieve_auth_token(self, client, username, password):
        manager = models.ResourceManager(
            models.Token, client.endpoints['auth'], cacert=client.cacert, debug=client.debug
        )
        instance = models.Token()
        instance = manager.create(instance, auth=(username, password))
        return instance
github StackStorm / st2 / st2client / st2client / base.py View on Github external
def _authenticate_and_retrieve_auth_token(self, client, username, password):
        manager = models.ResourceManager(
            models.Token, client.endpoints['auth'], cacert=client.cacert, debug=client.debug
        )
        instance = models.Token()
        instance = manager.create(instance, auth=(username, password))
        return instance
github StackStorm / st2 / st2client / st2client / commands / policy.py View on Github external
def __init__(self, description, app, subparsers, parent_parser=None):
        super(PolicyBranch, self).__init__(
            models.Policy,
            description,
            app,
            subparsers,
            parent_parser=parent_parser,
            commands={
                'list': PolicyListCommand,
                'get': PolicyGetCommand,
                'update': PolicyUpdateCommand,
                'delete': PolicyDeleteCommand,
            },
github StackStorm / st2 / st2client / st2client / shell.py View on Github external
self.commands = {}

        self.commands['run'] = action.ActionRunCommand(
            models.Action, self, self.subparsers, name='run', add_help=False
        )

        self.commands['action'] = action.ActionBranch(
            'An activity that happens as a response to the external event.', self, self.subparsers
        )

        self.commands['action-alias'] = action_alias.ActionAliasBranch(
            'Action aliases.', self, self.subparsers
        )

        self.commands['auth'] = auth.TokenCreateCommand(
            models.Token, self, self.subparsers, name='auth'
        )

        self.commands['login'] = auth.LoginCommand(
            models.Token, self, self.subparsers, name='login'
        )

        self.commands['whoami'] = auth.WhoamiCommand(
            models.Token, self, self.subparsers, name='whoami'
        )

        self.commands['api-key'] = auth.ApiKeyBranch('API Keys.', self, self.subparsers)

        self.commands['execution'] = action.ActionExecutionBranch(
            'An invocation of an action.', self, self.subparsers
        )
github StackStorm / st2 / st2client / st2client / shell.py View on Github external
dest='skip_config',
            default=False,
            help='Don\'t parse and use the CLI config file',
        )

        self.parser.add_argument(
            '--debug', action='store_true', dest='debug', default=False, help='Enable debug mode'
        )

        # Set up list of commands and subcommands.
        self.subparsers = self.parser.add_subparsers(dest='parser')
        self.subparsers.required = True
        self.commands = {}

        self.commands['run'] = action.ActionRunCommand(
            models.Action, self, self.subparsers, name='run', add_help=False
        )

        self.commands['action'] = action.ActionBranch(
            'An activity that happens as a response to the external event.', self, self.subparsers
        )

        self.commands['action-alias'] = action_alias.ActionAliasBranch(
            'Action aliases.', self, self.subparsers
        )

        self.commands['auth'] = auth.TokenCreateCommand(
            models.Token, self, self.subparsers, name='auth'
        )

        self.commands['login'] = auth.LoginCommand(
            models.Token, self, self.subparsers, name='login'
github StackStorm / st2 / st2client / st2client / commands / auth.py View on Github external
def __init__(self, description, app, subparsers, parent_parser=None):
        super(ApiKeyBranch, self).__init__(
            models.ApiKey,
            description,
            app,
            subparsers,
            parent_parser=parent_parser,
            commands={
                'list': ApiKeyListCommand,
                'get': ApiKeyGetCommand,
                'create': ApiKeyCreateCommand,
                'update': NoopCommand,
                'delete': ApiKeyDeleteCommand,
            },
        )

        self.commands['enable'] = ApiKeyEnableCommand(self.resource, self.app, self.subparsers)
        self.commands['disable'] = ApiKeyDisableCommand(self.resource, self.app, self.subparsers)
        self.commands['load'] = ApiKeyLoadCommand(self.resource, self.app, self.subparsers)
github StackStorm / st2 / st2client / st2client / commands / action.py View on Github external
def __init__(self, description, app, subparsers, parent_parser=None):
        super(ActionBranch, self).__init__(
            models.Action, description, app, subparsers,
            parent_parser=parent_parser,
            commands={
                'list': ActionListCommand,
                'get': ActionGetCommand,
                'update': ActionUpdateCommand,
                'delete': ActionDeleteCommand
            })

        # Registers extended commands
        self.commands['enable'] = ActionEnableCommand(self.resource, self.app, self.subparsers)
        self.commands['disable'] = ActionDisableCommand(self.resource, self.app, self.subparsers)
        self.commands['execute'] = ActionRunCommand(
            self.resource, self.app, self.subparsers,
            add_help=False)
github StackStorm / st2 / st2client / st2client / client.py View on Github external
self.managers['Inquiry'] = InquiryResourceManager(
            models.Inquiry, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Pack'] = PackResourceManager(
            models.Pack, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Policy'] = ResourceManager(
            models.Policy, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['PolicyType'] = ResourceManager(
            models.PolicyType, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Rule'] = ResourceManager(
            models.Rule, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Sensor'] = ResourceManager(
            models.Sensor, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['TriggerType'] = ResourceManager(
            models.TriggerType, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Trigger'] = ResourceManager(
            models.Trigger, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['TriggerInstance'] = TriggerInstanceResourceManager(
            models.TriggerInstance, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['KeyValuePair'] = ResourceManager(
            models.KeyValuePair, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Webhook'] = WebhookManager(
            models.Webhook, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Timer'] = ResourceManager(
            models.Timer, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Trace'] = ResourceManager(
            models.Trace, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['RuleEnforcement'] = ResourceManager(
            models.RuleEnforcement, self.endpoints['api'], cacert=self.cacert, debug=self.debug)
        self.managers['Stream'] = StreamManager(
            self.endpoints['stream'], cacert=self.cacert, debug=self.debug)
        self.managers['Workflow'] = WorkflowManager(
            self.endpoints['api'], cacert=self.cacert, debug=self.debug)