Skip to content

Commit

Permalink
Expand garden model (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog authored Jan 8, 2024
1 parent 383b0d5 commit 345c535
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
Brewtils Changelog
==================

3.24.0
------
TBD

- Expanding Garden model to include children gardens
- Added Source/Target Garden labels on Request model

3.23.1
------
TBD

- Fixed self reference bug that was returning back output instead of Request object.
- Added Source/Target Garden labels on Request model

3.23.0
------
Expand All @@ -29,6 +35,7 @@ TBD
- Adding default topic for PublishClient to Plugins {Namespace}.{System}.{Version}.{Instance}
- Removed Python 12 support until we upgrade Marshmallow dependency to 3.15 or greater


3.21.0
------
11/16/2023
Expand Down
18 changes: 17 additions & 1 deletion brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,9 @@ def __init__(
systems=None,
connection_type=None,
connection_params=None,
has_parent=None,
parent=None,
children=None,
):
self.id = id
self.name = name
Expand All @@ -1463,11 +1466,24 @@ def __init__(
self.connection_type = connection_type
self.connection_params = connection_params

self.has_parent = has_parent
self.parent = parent
self.children = children

def __str__(self):
return "%s" % self.name

def __repr__(self):
return "<Garden: garden_name=%s, status=%s>" % (self.name, self.status)
return (
"<Garden: garden_name=%s, status=%s, parent=%s, has_parent=%s, connection_type=%s>"
% (
self.name,
self.status,
self.parent,
self.has_parent,
self.connection_type,
)
)


class Operation(BaseModel):
Expand Down
5 changes: 5 additions & 0 deletions brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,11 @@ class GardenSchema(BaseSchema):
connection_params = fields.Dict(allow_none=True)
namespaces = fields.List(fields.Str(), allow_none=True)
systems = fields.Nested("SystemSchema", many=True, allow_none=True)
has_parent = fields.Bool(allow_none=True)
parent = fields.Str(allow_none=True)
children = fields.Nested(
"self", exclude=("parent"), many=True, default=None, allow_none=True
)


class GardenDomainIdentifierSchema(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 @@ -763,6 +763,9 @@ def garden_dict(ts_epoch, system_dict):
"systems": [system_dict],
"connection_type": "http",
"connection_params": {},
"parent": None,
"has_parent": False,
"children": [],
}


Expand Down

0 comments on commit 345c535

Please sign in to comment.