Skip to content
Open
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: 2 additions & 2 deletions docs/stackit_beta_sqlserverflex_instance_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ stackit beta sqlserverflex instance create [flags]
```
--acl strings The access control list (ACL). Must contain at least one valid subnet, for instance '0.0.0.0/0' for open access (discouraged), '1.2.3.0/24 for a public IP range of an organization, '1.2.3.4/32' for a single IP range, etc. (default [])
--backup-schedule string Backup schedule
--cpu int Number of CPUs
--cpu int32 Number of CPUs
--edition string Edition of the SQLServer instance
--flavor-id string ID of the flavor
-h, --help Help for "stackit beta sqlserverflex instance create"
-n, --name string Instance name
--ram int Amount of RAM (in GB)
--ram int32 Amount of RAM (in GB)
--retention-days int The days for how long the backup files should be stored before being cleaned up
--storage-class string Storage class
--storage-size int Storage size (in GB)
Expand Down
4 changes: 2 additions & 2 deletions docs/stackit_beta_sqlserverflex_instance_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ stackit beta sqlserverflex instance update INSTANCE_ID [flags]
```
--acl strings Lists of IP networks in CIDR notation which are allowed to access this instance (default [])
--backup-schedule string Backup schedule
--cpu int Number of CPUs
--cpu int32 Number of CPUs
--flavor-id string ID of the flavor
-h, --help Help for "stackit beta sqlserverflex instance update"
-n, --name string Instance name
--ram int Amount of RAM (in GB)
--ram int32 Amount of RAM (in GB)
--version string Version
```

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.12.0
github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.2.7
github.com/stackitcloud/stackit-sdk-go/services/ske v1.11.0
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.3
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.11.0
github.com/zalando/go-keyring v0.2.6
golang.org/x/mod v0.34.0
golang.org/x/oauth2 v0.35.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ github.com/stackitcloud/stackit-sdk-go/services/ske v1.11.0 h1:QoKyQPe8FqDqJLNgE
github.com/stackitcloud/stackit-sdk-go/services/ske v1.11.0/go.mod h1:KhVYCR58wETqdI7Quwhe3OR3BhB2T/b7DzaMsfDnr8g=
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.3 h1:AQrcr+qeIuZob+3TT2q1L4WOPtpsu5SEpkTnOUHDqfE=
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.3/go.mod h1:8BBGC69WFXWWmKgzSjgE4HvsI7pEgO0RN2cASwuPJ18=
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.11.0 h1:PwjQeupEnXxhu+uWCUzO/hUfL4yqNblOcZbP2jvaQtU=
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.11.0/go.mod h1:AiUoMAqQcOlMgDtkVJlqI7P/VGD5xjN3dYjERGnwN/M=
github.com/stbenjam/no-sprintf-host-port v0.3.1 h1:AyX7+dxI4IdLBPtDbsGAyqiTSLpCP9hWRrXQDU4Cm/g=
github.com/stbenjam/no-sprintf-host-port v0.3.1/go.mod h1:ODbZesTCHMVKthBHskvUUexdcNHAQRXk9NpSsL8p/HQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
14 changes: 6 additions & 8 deletions internal/cmd/beta/sqlserverflex/database/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/stackitcloud/stackit-cli/internal/pkg/types"

"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
Expand Down Expand Up @@ -69,9 +69,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {

// Call API
req := buildRequest(ctx, model, apiClient)
resp, err := spinner.Run2(params.Printer, "Creating database", func() (*sqlserverflex.CreateDatabaseResponse, error) {
return req.Execute()
})
resp, err := spinner.Run2(params.Printer, "Creating database", req.Execute)
if err != nil {
return fmt.Errorf("create SQLServer Flex database: %w", err)
}
Expand Down Expand Up @@ -110,11 +108,11 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *sqlserverflex.APIClient) sqlserverflex.ApiCreateDatabaseRequest {
req := apiClient.CreateDatabase(ctx, model.ProjectId, model.InstanceId, model.Region)
req := apiClient.DefaultAPI.CreateDatabase(ctx, model.ProjectId, model.InstanceId, model.Region)
payload := sqlserverflex.CreateDatabasePayload{
Name: &model.DatabaseName,
Options: &sqlserverflex.DatabaseDocumentationCreateDatabaseRequestOptions{
Owner: &model.Owner,
Name: model.DatabaseName,
Options: sqlserverflex.DatabaseDocumentationCreateDatabaseRequestOptions{
Owner: model.Owner,
},
}
req = req.CreateDatabasePayload(payload)
Expand Down
15 changes: 8 additions & 7 deletions internal/cmd/beta/sqlserverflex/database/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/testparams"

Expand All @@ -18,7 +18,8 @@ import (
type testCtxKey struct{}

var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
var testClient = &sqlserverflex.APIClient{}
var testClient = &sqlserverflex.APIClient{DefaultAPI: &sqlserverflex.DefaultAPIService{}}

var testProjectId = uuid.NewString()
var testInstanceId = uuid.NewString()
var testDatabaseName = "my-database"
Expand Down Expand Up @@ -66,11 +67,11 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *sqlserverflex.ApiCreateDatabaseRequest)) sqlserverflex.ApiCreateDatabaseRequest {
request := testClient.CreateDatabase(testCtx, testProjectId, testInstanceId, testRegion)
request := testClient.DefaultAPI.CreateDatabase(testCtx, testProjectId, testInstanceId, testRegion)
payload := sqlserverflex.CreateDatabasePayload{
Name: &testDatabaseName,
Options: &sqlserverflex.DatabaseDocumentationCreateDatabaseRequestOptions{
Owner: &testOwner,
Name: testDatabaseName,
Options: sqlserverflex.DatabaseDocumentationCreateDatabaseRequestOptions{
Owner: testOwner,
},
}
request = request.CreateDatabasePayload(payload)
Expand Down Expand Up @@ -203,7 +204,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, sqlserverflex.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/beta/sqlserverflex/database/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/spinner"

"github.com/spf13/cobra"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"
)

const (
Expand Down Expand Up @@ -107,6 +107,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *sqlserverflex.APIClient) sqlserverflex.ApiDeleteDatabaseRequest {
req := apiClient.DeleteDatabase(ctx, model.ProjectId, model.InstanceId, model.DatabaseName, model.Region)
req := apiClient.DefaultAPI.DeleteDatabase(ctx, model.ProjectId, model.InstanceId, model.DatabaseName, model.Region)
return req
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
Expand All @@ -17,7 +17,8 @@ import (
type testCtxKey struct{}

var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
var testClient = &sqlserverflex.APIClient{}
var testClient = &sqlserverflex.APIClient{DefaultAPI: &sqlserverflex.DefaultAPIService{}}

var testProjectId = uuid.NewString()
var testInstanceId = uuid.NewString()
var testDatabaseName = "my-database"
Expand Down Expand Up @@ -62,7 +63,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *sqlserverflex.ApiDeleteDatabaseRequest)) sqlserverflex.ApiDeleteDatabaseRequest {
request := testClient.DeleteDatabase(testCtx, testProjectId, testInstanceId, testDatabaseName, testRegion)
request := testClient.DefaultAPI.DeleteDatabase(testCtx, testProjectId, testInstanceId, testDatabaseName, testRegion)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -184,7 +185,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, sqlserverflex.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/types"

"github.com/spf13/cobra"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
Expand Down Expand Up @@ -98,7 +98,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *sqlserverflex.APIClient) sqlserverflex.ApiGetDatabaseRequest {
req := apiClient.GetDatabase(ctx, model.ProjectId, model.InstanceId, model.DatabaseName, model.Region)
req := apiClient.DefaultAPI.GetDatabase(ctx, model.ProjectId, model.InstanceId, model.DatabaseName, model.Region)
return req
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/testparams"

Expand All @@ -18,7 +18,8 @@ import (
type testCtxKey struct{}

var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
var testClient = &sqlserverflex.APIClient{}
var testClient = &sqlserverflex.APIClient{DefaultAPI: &sqlserverflex.DefaultAPIService{}}

var testProjectId = uuid.NewString()
var testInstanceId = uuid.NewString()
var testDatabaseName = "my-database"
Expand Down Expand Up @@ -63,7 +64,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *sqlserverflex.ApiGetDatabaseRequest)) sqlserverflex.ApiGetDatabaseRequest {
request := testClient.GetDatabase(testCtx, testProjectId, testInstanceId, testDatabaseName, testRegion)
request := testClient.DefaultAPI.GetDatabase(testCtx, testProjectId, testInstanceId, testDatabaseName, testRegion)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -185,7 +186,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, sqlserverflex.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/beta/sqlserverflex/database/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/types"

"github.com/spf13/cobra"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
Expand Down Expand Up @@ -122,7 +122,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *sqlserverflex.APIClient) sqlserverflex.ApiListDatabasesRequest {
req := apiClient.ListDatabases(ctx, model.ProjectId, model.InstanceId, model.Region)
req := apiClient.DefaultAPI.ListDatabases(ctx, model.ProjectId, model.InstanceId, model.Region)
return req
}

Expand Down
9 changes: 5 additions & 4 deletions internal/cmd/beta/sqlserverflex/database/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
sqlserverflex "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v2api"

"github.com/stackitcloud/stackit-cli/internal/pkg/testparams"

Expand All @@ -19,7 +19,8 @@ import (
type testCtxKey struct{}

var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
var testClient = &sqlserverflex.APIClient{}
var testClient = &sqlserverflex.APIClient{DefaultAPI: &sqlserverflex.DefaultAPIService{}}

var testProjectId = uuid.NewString()
var testInstanceId = uuid.NewString()

Expand Down Expand Up @@ -55,7 +56,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *sqlserverflex.ApiListDatabasesRequest)) sqlserverflex.ApiListDatabasesRequest {
request := testClient.ListDatabases(testCtx, testProjectId, testInstanceId, testRegion)
request := testClient.DefaultAPI.ListDatabases(testCtx, testProjectId, testInstanceId, testRegion)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -165,7 +166,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, sqlserverflex.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand Down
Loading
Loading