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

networking: add constants for statuses #3329

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

mandre
Copy link
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
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
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
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

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.