Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
31 changes: 8 additions & 23 deletions 31 linode_api4/objects/nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,19 @@ class NodeBalancerConfig(DerivedBase):
"proxy_protocol": Property(mutable=True),
}

def save(self, force=True) -> bool:
def _serialize(self, is_put: bool = False):
"""
Send this NodeBalancerConfig's mutable values to the server in a PUT request.
:param force: If true, this method will always send a PUT request regardless of
whether the field has been explicitly updated. For optimization
purposes, this field should be set to false for typical update
operations. (Defaults to True)
:type force: bool
This override removes the `cipher_suite` field from the PUT request
body on calls to save(...) for UDP configs, which is rejected by
the API.
"""

if not force and not self._changed:
return False
result = super()._serialize(is_put)

data = self._serialize()
if is_put and result["protocol"] == "udp" and "cipher_suite" in result:
del result["cipher_suite"]

if data.get("protocol") == "udp" and "cipher_suite" in data:
data.pop("cipher_suite")

result = self._client.put(
NodeBalancerConfig.api_endpoint, model=self, data=data
)

if "error" in result:
return False

self._populate(result)

return True
return result

@property
def nodes(self):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.