Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
42eacb3
feat (intake): refactor wait handler to use helper struct
GokceGK May 6, 2026
eb9d9da
Update services/intake/VERSION
GokceGK May 6, 2026
0d778e1
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 6, 2026
6902f4c
feat(intake): update versions in the changelogs
GokceGK May 6, 2026
4082397
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 6, 2026
d8b940b
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 12, 2026
c958575
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 12, 2026
1f87304
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 13, 2026
ba4e042
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 13, 2026
2b0c501
feat(intake): seperate wait handlers for create and update operations
GokceGK May 13, 2026
da795c6
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 18, 2026
1419a34
feat(intake): improve unit tests
GokceGK May 19, 2026
ad19881
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 19, 2026
28da2a2
feat(intake): fix linter issues
GokceGK May 19, 2026
5c7f5e6
Merge remote-tracking branch 'origin/feat/STACKITSDK-375-intake-refac…
GokceGK May 19, 2026
e3c76fe
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 19, 2026
85d4b33
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 20, 2026
b8e417b
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 20, 2026
9def96d
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 20, 2026
e471910
Merge branch 'main' into feat/STACKITSDK-375-intake-refactor-wait-han…
GokceGK May 20, 2026
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@
- **Dependencies:** Bump STACKIT SDK core module from `v0.25.0` to `v0.26.0`
- [v0.9.0](services/intake/CHANGELOG.md#v090)
- **Feature:** Added `_UNKNOWN_DEFAULT_OPEN_API` fallback value to all enums to handle unknown API values gracefully.
- [v0.10.0](services/intake/CHANGELOG.md#v0100)
- `v1betaapi`: **Improvement**: Use new `WaiterHandler` struct in the Git WaitHandler
- `kms`:
- [v1.6.2](services/kms/CHANGELOG.md#v162)
- **Dependencies:** Bump STACKIT SDK core module from `v0.24.0` to `v0.24.1`
Expand Down
3 changes: 3 additions & 0 deletions services/intake/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.10.0
- `v1betaapi`: **Improvement**: Use new `WaiterHandler` struct in the Intake WaitHandler

## v0.9.0
- **Feature:** Added `_UNKNOWN_DEFAULT_OPEN_API` fallback value to all enums to handle unknown API values gracefully.

Expand Down
2 changes: 1 addition & 1 deletion services/intake/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.9.0
v0.10.0
218 changes: 115 additions & 103 deletions services/intake/v1betaapi/wait/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ package wait
import (
"context"
"errors"
"fmt"
"net/http"
"time"

"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
"github.com/stackitcloud/stackit-sdk-go/core/wait"
intake "github.com/stackitcloud/stackit-sdk-go/services/intake/v1betaapi"
)
Expand All @@ -27,133 +25,147 @@ const (
INTAKEUSERRESPONSESTATE_DELETING = "deleting"
)

func CreateOrUpdateIntakeRunnerWaitHandler(ctx context.Context, a intake.DefaultAPI, projectId, region, intakeRunnerId string) *wait.AsyncActionHandler[intake.IntakeRunnerResponse] {
handler := wait.New(func() (waitFinished bool, response *intake.IntakeRunnerResponse, err error) {
runner, err := a.GetIntakeRunner(ctx, projectId, region, intakeRunnerId).Execute()
if err != nil {
return false, nil, err
}

if runner == nil {
return false, nil, fmt.Errorf("API returned a nil response for Intake Runner %s", intakeRunnerId)
}

if runner.Id == intakeRunnerId && runner.State == INTAKERUNNERRESPONSESTATE_ACTIVE {
return true, runner, nil
}

// Deprecated: Will be removed after 2026-11-13. Use the CreateIntakeRunnerWaitHandler or UpdateIntakeRunnerWaitHandler instead
func CreateOrUpdateIntakeRunnerWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeRunnerId string) *wait.AsyncActionHandler[intake.IntakeRunnerResponse] {
Comment thread
GokceGK marked this conversation as resolved.
// TODO: mark function as private after deprecation period
waitConfig := wait.WaiterHelper[intake.IntakeRunnerResponse, string]{
FetchInstance: client.GetIntakeRunner(ctx, projectId, region, intakeRunnerId).Execute,
GetState: func(response *intake.IntakeRunnerResponse) (string, error) {
if response == nil {
return "", errors.New("empty response")
}
return response.State, nil
},
ActiveState: []string{INTAKERUNNERRESPONSESTATE_ACTIVE},
ErrorState: []string{},
// The API does not have a dedicated failure state for this resource,
// so we rely on the timeout for cases where it never becomes active.
return false, nil, nil
})
}

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

func DeleteIntakeRunnerWaitHandler(ctx context.Context, a intake.DefaultAPI, projectId, region, intakeRunnerId string) *wait.AsyncActionHandler[intake.IntakeRunnerResponse] {
handler := wait.New(func() (waitFinished bool, response *intake.IntakeRunnerResponse, err error) {
_, err = a.GetIntakeRunner(ctx, projectId, region, intakeRunnerId).Execute()
if err == nil {
// Resource still exists
return false, nil, nil
}

var oapiError *oapierror.GenericOpenAPIError
if errors.As(err, &oapiError) {
if oapiError.StatusCode == http.StatusNotFound {
// Success: Resource is gone
return true, nil, nil
func CreateIntakeRunnerWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeRunnerId string) *wait.AsyncActionHandler[intake.IntakeRunnerResponse] {
return CreateOrUpdateIntakeRunnerWaitHandler(ctx, client, projectId, region, intakeRunnerId)
}

func UpdateIntakeRunnerWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeRunnerId string) *wait.AsyncActionHandler[intake.IntakeRunnerResponse] {
return CreateOrUpdateIntakeRunnerWaitHandler(ctx, client, projectId, region, intakeRunnerId)
}

func DeleteIntakeRunnerWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeRunnerId string) *wait.AsyncActionHandler[intake.IntakeRunnerResponse] {
waitConfig := wait.WaiterHelper[intake.IntakeRunnerResponse, string]{
FetchInstance: client.GetIntakeRunner(ctx, projectId, region, intakeRunnerId).Execute,
GetState: func(response *intake.IntakeRunnerResponse) (string, error) {
if response == nil {
return "", errors.New("empty response")
}
}
// An unexpected error occurred
return false, nil, err
})
return response.State, nil
},
ActiveState: []string{},
ErrorState: []string{},
DeleteHttpErrorStatusCodes: []int{http.StatusNotFound},
}

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

func CreateOrUpdateIntakeWaitHandler(ctx context.Context, a intake.DefaultAPI, projectId, region, intakeId string) *wait.AsyncActionHandler[intake.IntakeResponse] {
handler := wait.New(func() (waitFinished bool, response *intake.IntakeResponse, err error) {
ik, err := a.GetIntake(ctx, projectId, region, intakeId).Execute()
if err != nil {
return false, nil, err
}

if ik == nil {
return false, nil, fmt.Errorf("API returned a nil response for Intake %s", intakeId)
}

if ik.Id == intakeId && ik.State == INTAKERESPONSESTATE_ACTIVE {
return true, ik, nil
}

if ik.Id == intakeId && ik.State == INTAKERESPONSESTATE_FAILED {
return true, ik, fmt.Errorf("create/update failed for Intake %s", intakeId)
}
// Deprecated: Will be removed after 2026-11-13. Use the CreateIntakeWaitHandler or UpdateIntakeWaitHandler instead
func CreateOrUpdateIntakeWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId string) *wait.AsyncActionHandler[intake.IntakeResponse] {
Comment thread
GokceGK marked this conversation as resolved.
// TODO: mark function as private after deprecation period
waitConfig := wait.WaiterHelper[intake.IntakeResponse, string]{
FetchInstance: client.GetIntake(ctx, projectId, region, intakeId).Execute,
GetState: func(response *intake.IntakeResponse) (string, error) {
if response == nil {
return "", errors.New("empty response")
}
return response.State, nil
},
ActiveState: []string{INTAKERUNNERRESPONSESTATE_ACTIVE},
ErrorState: []string{INTAKERESPONSESTATE_FAILED},
}

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

func DeleteIntakeWaitHandler(ctx context.Context, a intake.DefaultAPI, projectId, region, intakeId string) *wait.AsyncActionHandler[intake.IntakeResponse] {
handler := wait.New(func() (waitFinished bool, response *intake.IntakeResponse, err error) {
_, err = a.GetIntake(ctx, projectId, region, intakeId).Execute()
if err == nil {
return false, nil, nil
}

var oapiError *oapierror.GenericOpenAPIError
if errors.As(err, &oapiError) {
if oapiError.StatusCode == http.StatusNotFound {
return true, nil, nil
func CreateIntakeWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId string) *wait.AsyncActionHandler[intake.IntakeResponse] {
return CreateOrUpdateIntakeWaitHandler(ctx, client, projectId, region, intakeId)
}

func UpdateIntakeWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId string) *wait.AsyncActionHandler[intake.IntakeResponse] {
return CreateOrUpdateIntakeWaitHandler(ctx, client, projectId, region, intakeId)
}

func DeleteIntakeWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId string) *wait.AsyncActionHandler[intake.IntakeResponse] {
waitConfig := wait.WaiterHelper[intake.IntakeResponse, string]{
FetchInstance: client.GetIntake(ctx, projectId, region, intakeId).Execute,
GetState: func(response *intake.IntakeResponse) (string, error) {
if response == nil {
return "", errors.New("empty response")
}
}
return false, nil, err
})
return response.State, nil
},
ActiveState: []string{},
ErrorState: []string{},
DeleteHttpErrorStatusCodes: []int{http.StatusNotFound},
}

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

func CreateOrUpdateIntakeUserWaitHandler(ctx context.Context, a intake.DefaultAPI, projectId, region, intakeId, intakeUserId string) *wait.AsyncActionHandler[intake.IntakeUserResponse] {
handler := wait.New(func() (waitFinished bool, response *intake.IntakeUserResponse, err error) {
user, err := a.GetIntakeUser(ctx, projectId, region, intakeId, intakeUserId).Execute()
if err != nil {
return false, nil, err
}

if user == nil {
return false, nil, fmt.Errorf("API returned a nil response for Intake User %s", intakeUserId)
}

if user.Id == intakeUserId && user.State == INTAKEUSERRESPONSESTATE_ACTIVE {
return true, user, nil
}

// The API does not have a dedicated failure state for this resource, we rely on the timeout for cases where
// it never becomes active.
return false, nil, nil
})
// Deprecated: Will be removed after 2026-11-13. Use the CreateIntakeUserWaitHandler or UpdateIntakeUserWaitHandler instead
func CreateOrUpdateIntakeUserWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId, intakeUserId string) *wait.AsyncActionHandler[intake.IntakeUserResponse] {
Comment thread
GokceGK marked this conversation as resolved.
// TODO: mark function as private after deprecation period
waitConfig := wait.WaiterHelper[intake.IntakeUserResponse, string]{
FetchInstance: client.GetIntakeUser(ctx, projectId, region, intakeId, intakeUserId).Execute,
GetState: func(response *intake.IntakeUserResponse) (string, error) {
if response == nil {
return "", errors.New("empty response")
}
return response.State, nil
},
ActiveState: []string{INTAKEUSERRESPONSESTATE_ACTIVE},
ErrorState: []string{},
// The API does not have a dedicated failure state for this resource,
// so we rely on the timeout for cases where it never becomes active.
}

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

func DeleteIntakeUserWaitHandler(ctx context.Context, a intake.DefaultAPI, projectId, region, intakeId, intakeUserId string) *wait.AsyncActionHandler[intake.IntakeUserResponse] {
handler := wait.New(func() (waitFinished bool, response *intake.IntakeUserResponse, err error) {
_, err = a.GetIntakeUser(ctx, projectId, region, intakeId, intakeUserId).Execute()
if err == nil {
return false, nil, nil
}

var oapiError *oapierror.GenericOpenAPIError
if errors.As(err, &oapiError) {
if oapiError.StatusCode == http.StatusNotFound {
return true, nil, nil
func CreateIntakeUserWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId, intakeUserId string) *wait.AsyncActionHandler[intake.IntakeUserResponse] {
return CreateOrUpdateIntakeUserWaitHandler(ctx, client, projectId, region, intakeId, intakeUserId)
}

func UpdateIntakeUserWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId, intakeUserId string) *wait.AsyncActionHandler[intake.IntakeUserResponse] {
return CreateOrUpdateIntakeUserWaitHandler(ctx, client, projectId, region, intakeId, intakeUserId)
}

func DeleteIntakeUserWaitHandler(ctx context.Context, client intake.DefaultAPI, projectId, region, intakeId, intakeUserId string) *wait.AsyncActionHandler[intake.IntakeUserResponse] {
waitConfig := wait.WaiterHelper[intake.IntakeUserResponse, string]{
FetchInstance: client.GetIntakeUser(ctx, projectId, region, intakeId, intakeUserId).Execute,
GetState: func(response *intake.IntakeUserResponse) (string, error) {
if response == nil {
return "", errors.New("empty response")
}
}
return false, nil, err
})
return response.State, nil
},
ActiveState: []string{},
ErrorState: []string{},
DeleteHttpErrorStatusCodes: []int{http.StatusNotFound},
}

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