How to use the brewtils.decorators.parameter function in brewtils

To help you get started, we’ve selected a few brewtils 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 beer-garden / beer-garden / plugins / complex / complex / client.py View on Github external
    @parameter(key="list_of_s", type="String", description="Testing List of Strings", multi=True,
               display_name="A List of Strings", optional=True, default=['a', 'b', 'c'],
               choices=None, model=None,
               nullable=False)
    def echo_list_of_strings_with_default(self, list_of_s=None):
        list_of_s = list_of_s or ['a', 'b', 'c']
        for s in list_of_s:
            self.logger.info("%s" % s)
        return list_of_s
github beer-garden / beer-garden / plugins / complex / complex / client.py View on Github external
    @parameter(key="model", optional=False, description="A Model with a cool definition.",
               model=MyModelWithDefaults)
    def echo_model_with_nested_defaults_no_main(self, model):
        for k, v in model.items():
            self.logger.info('{"%s" : %s}' % (k, v))
        return model
github beer-garden / beer-garden / plugins / complex / complex / client.py View on Github external
    @parameter(key="message", optional=False, nullable=False, default="cannot be null",
               type="String")
    def echo_required_message_nullable_false_with_default(self, message="cannot be null"):
        if message is None:
            raise ValueError("Message cannot be None.")

        self.logger.info(message)
        return message
github beer-garden / beer-garden / plugins / complex / complex / client.py View on Github external
    @parameter(key="message", optional=True, nullable=True, default=None, type="String")
    def echo_optional_message_nullable_true_null_default(self, message=None):
        if not message:
            self.logger.info("No message provided, and that's okay.")
        else:
            self.logger.info(message)

        return message
github beer-garden / beer-garden / plugins / dynamic / main.py View on Github external
    @parameter(key="message", type="String", description="I depend on 'dict_key'", nullable=True,
               choices={'type': 'static', 'value': STATIC_CHOICES_DICTIONARY,
                        'key_reference': '${dict_key}'})
    def say_specific_dictionary_with_key_reference(self, message, **_):
        return message
github beer-garden / beer-garden / plugins / complex / complex / client.py View on Github external
    @parameter(key="echo_max_value", type="Integer",
               description="Testing integer maximum constraint", multi=False,
               display_name="An Integer", optional=False, nullable=False, maximum=20)
    def echo_with_max_value(self, echo_max_value):
        self.logger.info(echo_max_value)
        return echo_max_value
github beer-garden / beer-garden / plugins / custom-display / main.py View on Github external
    @parameter(key='message', type='Dictionary', optional=False, nullable=False,
               form_input_type='textarea')
    def echo_message_dictionary(self, message):
        return message
github beer-garden / beer-garden / plugins / multi-echo-sleeper / multi_echo_sleeper / client.py View on Github external
    @parameter(key="loud", description="Determines if Exclamation marks are added", optional=True,
               type="Boolean",
               default=False)
    @parameter(key="amount", description="How long to sleep", optional=True, type="Integer",
               default=10)
    def say_sleep(self, message=DEFAULT_MESSAGE, loud=False, amount=10):
        """Echos using Echo and sleeps using Multi-Sleeper"""

        echo_request = self.echo_client.say(message=message, loud=loud)
        sleep_request = self.sleeper_client.sleep(amount=amount)

        if echo_request.status != 'SUCCESS':
            self.logger.error("Echo plugin returned with non-success status")
            raise RuntimeError(echo_request.output)

        if sleep_request.status != 'SUCCESS':
            self.logger.error("Sleeper plugin returned with non-success status")
github beer-garden / beer-garden / plugins / custom-display / main.py View on Github external
    @parameter(key="loud", type="Boolean")
    def echo_message_custom_form_from_file(self, message='Hello world!', loud=False):
        """form='./resources/say_form.json'"""
        return message + '!!!!!!!!!' if loud else message
github beer-garden / beer-garden / plugins / complex / complex / client.py View on Github external
    @parameter(key='param', optional=True, nullable=True, multi=True, model=MyNestedModel,
               default=[{'my_nested_string': 'hi', 'my_nested_int': 2}])
    def echo_optional_multi_nullable_model_with_multi_defaults(self, param):
        return param