Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
- **Breaking Change:** `Value` field of `Label`/`CreateLabelPayload` is no longer required. `NewLabel`/`NewCreateLabelPayload` drop the `value` param
- `v1api`:
- **Breaking Change:** `Value` field of `Label`/`CreateLabelPayload` changed from `string` to `*string` and is no longer required. `NewLabel`/`NewCreateLabelPayload` drop the `value` param
- `dremio`:
- [v0.5.0](services/dremio/CHANGELOG.md#v050)
- `v1beta`:
- Add support for the new api version
- `logme`:
- [v1.2.0](services/logme/CHANGELOG.md#v120)
- **Breaking Change/Fix:** `ListBackups` operation now returns `[]Backup` instead of `*ListBackupsResponse` (response type also removed)
Expand Down
4 changes: 2 additions & 2 deletions examples/dremio/dremio.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/core/utils"
dremio "github.com/stackitcloud/stackit-sdk-go/services/dremio/v1alphaapi"
"github.com/stackitcloud/stackit-sdk-go/services/dremio/v1alphaapi/wait"
dremio "github.com/stackitcloud/stackit-sdk-go/services/dremio/v1betaapi"
"github.com/stackitcloud/stackit-sdk-go/services/dremio/v1betaapi/wait"
)

func main() {
Expand Down
5 changes: 4 additions & 1 deletion services/dremio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.5.0
- Add support for v1beta version of the API

## v0.4.0
- `v1alphaapi`: Align package to latest API specification

Expand All @@ -11,4 +14,4 @@

- Manage your STACKIT Dremio resources: `DremioInstance`, `DremioUser`
- Waiters for async operations: `CreateDremioInstanceWaitHandler`, `UpdateDremioInstanceWaitHandler`, `DeleteDremioInstanceWaitHandler`, `CreateDremioUserWaitHandler`, `UpdateDremioUserWaitHandler`, `DeleteDremioUserWaitHandler`
- [Usage example](https://github.com/stackitcloud/stackit-sdk-go/tree/main/examples/dremio)
- [Usage example](https://github.com/stackitcloud/stackit-sdk-go/tree/main/examples/dremio)
2 changes: 1 addition & 1 deletion services/dremio/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.4.0
v0.5.0
141 changes: 141 additions & 0 deletions services/dremio/v1betaapi/wait/wait.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package wait

import (
"context"
"errors"
"net/http"
"time"

"github.com/stackitcloud/stackit-sdk-go/core/wait"
dremio "github.com/stackitcloud/stackit-sdk-go/services/dremio/v1betaapi"
)

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
DREMIOSTATE_ACTIVE = dremio.DREMIORESPONSESTATE_ACTIVE
// 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
DREMIOSTATE_ERROR = dremio.DREMIORESPONSESTATE_ERROR

// 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
DREMIOUSERSTATE_ACTIVE = dremio.DREMIOUSERRESPONSESTATE_ACTIVE
// 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
DREMIOUSERSTATE_ERROR = dremio.DREMIOUSERRESPONSESTATE_ERROR
)

// CreateDremioWaitHandler will wait for the creation of a Dremio instance
func CreateDremioWaitHandler(ctx context.Context, a dremio.DefaultAPI, projectId, regionId, dremioId string) *wait.AsyncActionHandler[dremio.DremioResponse] {
waitConfig := wait.WaiterHelper[dremio.DremioResponse, dremio.DremioResponseState]{
FetchInstance: a.GetDremioInstance(ctx, projectId, regionId, dremioId).Execute,
GetState: func(dremioResp *dremio.DremioResponse) (dremio.DremioResponseState, error) {
if dremioResp == nil {
return "", errors.New("empty response")
}
return dremioResp.State, nil
},
ActiveState: []dremio.DremioResponseState{dremio.DREMIORESPONSESTATE_ACTIVE},
ErrorState: []dremio.DremioResponseState{dremio.DREMIORESPONSESTATE_ERROR},
}

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

// UpdateDremioWaitHandler will wait an update of a Dremio instance
func UpdateDremioWaitHandler(ctx context.Context, a dremio.DefaultAPI, projectId, regionId, dremioId string) *wait.AsyncActionHandler[dremio.DremioResponse] {
waitConfig := wait.WaiterHelper[dremio.DremioResponse, dremio.DremioResponseState]{
FetchInstance: a.GetDremioInstance(ctx, projectId, regionId, dremioId).Execute,
GetState: func(dremioResp *dremio.DremioResponse) (dremio.DremioResponseState, error) {
if dremioResp == nil {
return "", errors.New("empty response")
}
return dremioResp.State, nil
},
ActiveState: []dremio.DremioResponseState{dremio.DREMIORESPONSESTATE_ACTIVE},
ErrorState: []dremio.DremioResponseState{dremio.DREMIORESPONSESTATE_ERROR},
}

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

// DeleteDremioWaitHandler will wait for the deletion of a Dremio instance
func DeleteDremioWaitHandler(ctx context.Context, a dremio.DefaultAPI, projectId, regionId, dremioId string) *wait.AsyncActionHandler[dremio.DremioResponse] {
waitConfig := wait.WaiterHelper[dremio.DremioResponse, dremio.DremioResponseState]{
FetchInstance: a.GetDremioInstance(ctx, projectId, regionId, dremioId).Execute,
GetState: func(dremioResp *dremio.DremioResponse) (dremio.DremioResponseState, error) {
if dremioResp == nil {
return "", errors.New("empty response")
}
return dremioResp.State, nil
},
ErrorState: []dremio.DremioResponseState{dremio.DREMIORESPONSESTATE_ERROR},
DeleteHttpErrorStatusCodes: []int{http.StatusNotFound},
}

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

// CreateDremioUserWaitHandler will wait for the creation of a Dremio user
func CreateDremioUserWaitHandler(ctx context.Context, a dremio.DefaultAPI, projectId, regionId, dremioId, dremioUserId string) *wait.AsyncActionHandler[dremio.DremioUserResponse] {
waitConfig := wait.WaiterHelper[dremio.DremioUserResponse, dremio.DremioUserResponseState]{
FetchInstance: a.GetDremioUser(ctx, projectId, regionId, dremioId, dremioUserId).Execute,
GetState: func(user *dremio.DremioUserResponse) (dremio.DremioUserResponseState, error) {
if user == nil {
return "", errors.New("empty response")
}
return user.State, nil
},
ActiveState: []dremio.DremioUserResponseState{dremio.DREMIOUSERRESPONSESTATE_ACTIVE},
ErrorState: []dremio.DremioUserResponseState{dremio.DREMIOUSERRESPONSESTATE_ERROR},
}

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

// UpdateDremioUserWaitHandler will wait for an update to a Dremio user
func UpdateDremioUserWaitHandler(ctx context.Context, a dremio.DefaultAPI, projectId, regionId, dremioId, dremioUserId string) *wait.AsyncActionHandler[dremio.DremioUserResponse] {
waitConfig := wait.WaiterHelper[dremio.DremioUserResponse, dremio.DremioUserResponseState]{
FetchInstance: a.GetDremioUser(ctx, projectId, regionId, dremioId, dremioUserId).Execute,
GetState: func(user *dremio.DremioUserResponse) (dremio.DremioUserResponseState, error) {
if user == nil {
return "", errors.New("empty response")
}
return user.State, nil
},
ActiveState: []dremio.DremioUserResponseState{dremio.DREMIOUSERRESPONSESTATE_ACTIVE},
ErrorState: []dremio.DremioUserResponseState{dremio.DREMIOUSERRESPONSESTATE_ERROR},
}

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

// DeleteDremioUserWaitHandler will wait for a deletion of a Dremio user
func DeleteDremioUserWaitHandler(ctx context.Context, a dremio.DefaultAPI, projectId, regionId, dremioId, dremioUserId string) *wait.AsyncActionHandler[dremio.DremioUserResponse] {
waitConfig := wait.WaiterHelper[dremio.DremioUserResponse, dremio.DremioUserResponseState]{
FetchInstance: a.GetDremioUser(ctx, projectId, regionId, dremioId, dremioUserId).Execute,
GetState: func(user *dremio.DremioUserResponse) (dremio.DremioUserResponseState, error) {
if user == nil {
return "", errors.New("empty response")
}
return user.State, nil
},
ErrorState: []dremio.DremioUserResponseState{dremio.DREMIOUSERRESPONSESTATE_ERROR},
DeleteHttpErrorStatusCodes: []int{http.StatusNotFound},
}

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