Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parameter support for filename #522

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Brewtils Changelog
------
TBD

- Update Parameter and Resolvable to add file_name
- Added support for display name to command decorator
- Updated Wait Timeout Exception expected HTTP code from 408 to 504
- Dropping Official Python 2.7 Support
Expand Down
6 changes: 6 additions & 0 deletions brewtils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def parameter(
display_name=None, # type: Optional[str]
optional=None, # type: Optional[bool]
default=None, # type: Optional[Any]
file_name=None, # type: Optional[str]
description=None, # type: Optional[str]
choices=None, # type: Optional[Union[Callable, Dict, Iterable, str]]
parameters=None, # type: Optional[List[Parameter]]
Expand Down Expand Up @@ -288,6 +289,7 @@ def echo(self, message):
optional: Boolean indicating if this parameter must be specified.
default: The value this parameter will be assigned if not overridden when
creating a request.
file_name: Default string value for file input.
description: An additional string that will be displayed in the user interface.
choices: List or dictionary specifying allowed values. See documentation for
more information.
Expand Down Expand Up @@ -335,6 +337,7 @@ def echo(self, message):
display_name=display_name,
optional=optional,
default=default,
file_name=file_name,
description=description,
choices=choices,
parameters=parameters,
Expand All @@ -355,6 +358,7 @@ def echo(self, message):
display_name=display_name,
optional=optional,
default=default,
file_name=file_name,
description=description,
choices=choices,
parameters=parameters,
Expand Down Expand Up @@ -890,6 +894,7 @@ def _initialize_parameter(
display_name=None,
optional=None,
default=None,
file_name=None,
description=None,
choices=None,
parameters=None,
Expand Down Expand Up @@ -931,6 +936,7 @@ def _initialize_parameter(
display_name=display_name,
optional=optional,
default=default,
file_name=file_name,
description=description,
choices=choices,
parameters=parameters,
Expand Down
4 changes: 4 additions & 0 deletions brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def __init__(
display_name=None,
optional=None,
default=None,
file_name=None,
description=None,
choices=None,
parameters=None,
Expand All @@ -345,6 +346,7 @@ def __init__(
self.display_name = display_name
self.optional = optional
self.default = default
self.file_name = file_name
self.description = description
self.choices = choices
self.parameters = parameters or []
Expand Down Expand Up @@ -1697,11 +1699,13 @@ def __init__(
self,
id=None, # noqa # shadows built-in
type=None, # noqa # shadows built-in
file_name=None,
storage=None,
details=None,
):
self.id = id
self.type = type
self.file_name = file_name
self.storage = storage
self.details = details or {}

Expand Down
2 changes: 2 additions & 0 deletions brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class ParameterSchema(BaseSchema):
display_name = fields.Str(allow_none=True)
optional = fields.Bool(allow_none=True)
default = fields.Raw(allow_none=True)
file_name = fields.Str(allow_none=True)
description = fields.Str(allow_none=True)
choices = fields.Nested("ChoicesSchema", allow_none=True, many=False)
parameters = fields.Nested("self", many=True, allow_none=True)
Expand Down Expand Up @@ -577,6 +578,7 @@ class ResolvableSchema(BaseSchema):
type = fields.Str(allow_none=True)
storage = fields.Str(allow_none=True)
details = fields.Dict(allow_none=True)
file_name = fields.Str(allow_none=True)


class RoleSchema(BaseSchema):
Expand Down
3 changes: 3 additions & 0 deletions brewtils/test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def nested_parameter_dict():
"display_name": "nested",
"optional": True,
"default": None,
"file_name": None,
"description": None,
"choices": None,
"parameters": [],
Expand All @@ -144,6 +145,7 @@ def parameter_dict(nested_parameter_dict, choices_dict):
"display_name": "display",
"optional": True,
"default": "default",
"file_name": None,
"description": "desc",
"choices": choices_dict,
"parameters": [nested_parameter_dict],
Expand Down Expand Up @@ -1106,6 +1108,7 @@ def resolvable_dict():
"type": "bytes",
"storage": "gridfs",
"details": {"random": "detail"},
"file_name": None,
}


Expand Down
Loading