Skip to content

feat(telemetrylink): v1api and waiters#7520

Open
ozanichkovsky wants to merge 2 commits into
stackitcloud:mainfrom
ozanichkovsky:telemetrylink-waiters
Open

feat(telemetrylink): v1api and waiters#7520
ozanichkovsky wants to merge 2 commits into
stackitcloud:mainfrom
ozanichkovsky:telemetrylink-waiters

Conversation

@ozanichkovsky

Copy link
Copy Markdown
Contributor

Description

v1api and waiters

Checklist

  • Issue was linked above
  • No generated code was adjusted manually (check comments in file header)
  • Changelogs
    • Changelog in the root directory was adjusted (see here)
    • Changelog(s) of the service(s) were adjusted (see e.g. here)
  • VERSION file(s) of the service(s) were adjusted
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@ozanichkovsky ozanichkovsky requested a review from a team as a code owner May 27, 2026 10:58
@ozanichkovsky ozanichkovsky changed the title Telemetrylink waiters feat(telemetrylink): v1api and waiters May 27, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

@github-actions github-actions Bot added the Stale label Jun 5, 2026
@github-actions

Copy link
Copy Markdown

This PR was closed automatically because it has been stalled for 7 days with no activity. Feel free to re-open it at any time.

@github-actions github-actions Bot closed this Jun 12, 2026
@Fyusel Fyusel reopened this Jun 12, 2026
@Fyusel Fyusel removed the Stale label Jun 12, 2026
Comment on lines +13 to +17
const (
// Deprecated: symbol is not used anymore, use the packages enum instead, will be removed 2026-12, use `go fix` for automatic fixing
//go:fix inline
TELEMETRYLINK_ACTIVE = telemetrylink.TELEMETRYLINKRESPONSESTATUS_ACTIVE
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can be removed, because for the v1api package the const was never released :)

Suggested change
const (
// Deprecated: symbol is not used anymore, use the packages enum instead, will be removed 2026-12, use `go fix` for automatic fixing
//go:fix inline
TELEMETRYLINK_ACTIVE = telemetrylink.TELEMETRYLINKRESPONSESTATUS_ACTIVE
)

Comment on lines +19 to +35
// CreateOrUpdateOrganizationTelemetryLinkWaitHandler will wait for organization TelemetryLink creation or update
func CreateOrUpdateOrganizationTelemetryLinkWaitHandler(ctx context.Context, a telemetrylink.DefaultAPI, organizationId, region string) *wait.AsyncActionHandler[telemetrylink.TelemetryLinkResponse] {
waitConfig := wait.WaiterHelper[telemetrylink.TelemetryLinkResponse, telemetrylink.TelemetryLinkResponseStatus]{
FetchInstance: a.GetOrganizationTelemetryLink(ctx, organizationId, region).Execute,
GetState: func(d *telemetrylink.TelemetryLinkResponse) (telemetrylink.TelemetryLinkResponseStatus, error) {
if d == nil {
return "", errors.New("empty response")
}
return d.Status, nil
},
ActiveState: []telemetrylink.TelemetryLinkResponseStatus{telemetrylink.TELEMETRYLINKRESPONSESTATUS_ACTIVE},
}

handler := wait.New(waitConfig.Wait())
handler.SetTimeout(10 * time.Minute)
return handler
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you separate the WaitHandler to one for creation and one for update? You can also keep one private function, which you call in these dedicated Waithandler. But we want to be prepared in case the API will be separated in the future.

So it should be similar like here: 6c8df70

I also recognize, that only the ActiveState is defined, but ErrorState is missing. So in case an operation fails, it would always continue to wait until it runs into a timeout. Please extend it

		ErrorState:  []telemetrylink.TelemetryLinkResponseStatus{telemetrylink.TELEMETRYLINKRESPONSESTATUS_FAILED},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment applies also to the other waithandlers. I saw that in most cases there is already a dedicated waithandler for PartialUpdate, so it should be fine if you just change the prefix CreateOrUpdate to Create and share the logic between Create and PartialUpdate, because they behave the same.

Comment on lines +64 to +65
},
DeleteHttpErrorStatusCodes: []int{http.StatusNotFound},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

here also the ErrorStates are missing, but the GetState function reads them. Please extend here the errorStates

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

applies also to the other Delete WaitHandler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants