Skip to content

networking: add constants for statuses#3329

Merged
pierreprinetti merged 1 commit intogophercloud:mainfrom
shiftstack:networking-status-const
May 16, 2025
Merged

networking: add constants for statuses#3329
pierreprinetti merged 1 commit intogophercloud:mainfrom
shiftstack:networking-status-const

Conversation

@mandre
Copy link
Copy Markdown
Contributor

@mandre mandre commented Mar 12, 2025

This avoids the need to define these constants in consumer code.

Router also has a status field, but there's no documentation for it, so
let's not guess what the valid statuses are.

@github-actions github-actions bot added edit:networking This PR updates networking code semver:major Breaking change labels Mar 12, 2025
@mandre
Copy link
Copy Markdown
Contributor Author

mandre commented Mar 18, 2025

I'm leaning towards just providing the constants without changing the types, because that's going to be a pain for users as shown with the failing CI unit tests.

Copy link
Copy Markdown
Member

@pierreprinetti pierreprinetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My opinion is that these constants can be of type string without additional typing. If designed from scratch they could be numeric Go enums, but as a retrofit I don't see a lot of value balancing the lack of backwards compatibility.

PortStatusActive PortStatus = "ACTIVE"
PortStatusBuild PortStatus = "BUILD"
PortStatusDown PortStatus = "DOWN"
PortStatusError PortStatus = "ERROR"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the package name "ports", the identifiers for these constants can be just "StatusActive" without fear of confusion.

This avoids the need to define these constants in consumer code.

Router also has a status field, but there's no documentation for it, so
let's not guess what the valid statuses are.
@mandre mandre force-pushed the networking-status-const branch from ced40b2 to eda8452 Compare March 19, 2025 16:11
@github-actions github-actions bot added semver:minor Backwards-compatible change and removed semver:major Breaking change labels Mar 19, 2025
@mandre mandre changed the title WIP: networking: add constants for statuses networking: add constants for statuses Mar 19, 2025
@mandre mandre marked this pull request as ready for review March 19, 2025 16:12
@mandre mandre added the backport-v2 This PR will be backported to v2 label Mar 19, 2025
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 78.69%. remained the same
when pulling eda8452 on shiftstack:networking-status-const
into 9e4535f on gophercloud:main.

@pierreprinetti pierreprinetti merged commit cf6f660 into gophercloud:main May 16, 2025
21 checks passed
@pierreprinetti pierreprinetti deleted the networking-status-const branch May 16, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v2 This PR will be backported to v2 edit:networking This PR updates networking code semver:minor Backwards-compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants