Skip to content
Merged
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_alb_pool_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ stackit beta alb pool update [flags]

```
Update an application target pool from a configuration file (the name of the pool is read from the file)
$ stackit beta alb update --configuration my-target-pool.json --name my-load-balancer
$ stackit beta alb pool update --configuration my-target-pool.json --name my-load-balancer
```

### Options

```
-c, --configuration string Filename of the input configuration file
-h, --help Help for "stackit beta alb pool update"
-n, --name string Name of the target pool name to update
-n, --name string Name of the application load balancer
```

### Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.21.0
github.com/stackitcloud/stackit-sdk-go/core v0.26.0
github.com/stackitcloud/stackit-sdk-go/services/alb v0.10.0
github.com/stackitcloud/stackit-sdk-go/services/alb v0.14.2
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.10.0
github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ github.com/stackitcloud/stackit-sdk-go/core v0.26.0 h1:jQEb9gkehfp6VCP6TcYk7BI10
github.com/stackitcloud/stackit-sdk-go/core v0.26.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA=
github.com/stackitcloud/stackit-sdk-go/services/alb v0.10.0 h1:V9+885qkSv621rZZatg1YE5ENM1ElALxQDJsh+hDIUg=
github.com/stackitcloud/stackit-sdk-go/services/alb v0.10.0/go.mod h1:V6+MolxM/M2FWyWZA+FRFKEzzUe10MU9eEVfMvxHGi8=
github.com/stackitcloud/stackit-sdk-go/services/alb v0.14.2 h1:hGzfOJjlCRoFpri5eYIiwhE27qu02pKZLprKvbsTC/w=
github.com/stackitcloud/stackit-sdk-go/services/alb v0.14.2/go.mod h1:eK6oRB5Tmpt6KbXQ4UYBGg2LgW5bPtVoncL9E8JSRww=
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0 h1:HxPgBu04j5tj6nfZ2r0l6v4VXC0/tYOGe4sA5Addra8=
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0/go.mod h1:uYI9pHAA2g84jJN25ejFUxa0/JtfpPZqMDkctQ1BzJk=
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.10.0 h1:YALzjYAApyQMKyt4C2LKhPRZHa6brmbFeKuuwl+KOTs=
Expand Down
8 changes: 4 additions & 4 deletions internal/cmd/beta/alb/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

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

const (
Expand Down Expand Up @@ -86,7 +86,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
// Wait for async operation, if async mode not enabled
if !model.Async {
err := spinner.Run(params.Printer, "Creating loadbalancer", func() error {
_, err := wait.CreateOrUpdateLoadbalancerWaitHandler(ctx, apiClient, model.ProjectId, model.Region, *resp.Name).WaitWithContext(ctx)
_, err := wait.CreateOrUpdateLoadbalancerWaitHandler(ctx, apiClient.DefaultAPI, model.ProjectId, model.Region, *resp.Name).WaitWithContext(ctx)
return err
})
if err != nil {
Expand Down Expand Up @@ -123,7 +123,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *alb.APIClient) (req alb.ApiCreateLoadBalancerRequest, err error) {
req = apiClient.CreateLoadBalancer(ctx, model.ProjectId, model.Region)
req = apiClient.DefaultAPI.CreateLoadBalancer(ctx, model.ProjectId, model.Region)
payload, err := readPayload(ctx, model)
if err != nil {
return req, err
Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/beta/alb/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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/alb"
alb "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"

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

Expand All @@ -27,7 +27,7 @@ var projectIdFlag = globalflags.ProjectIdFlag
type testCtxKey struct{}

var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
var testClient = &alb.APIClient{}
var testClient = &alb.APIClient{DefaultAPI: &alb.DefaultAPIService{}}
var testProjectId = uuid.NewString()
var testRegion = "eu01"
var testConfig = "testdata/testconfig.json"
Expand Down Expand Up @@ -69,7 +69,7 @@ func fixturePayload(mods ...func(payload *alb.CreateLoadBalancerPayload)) (paylo
}

func fixtureRequest(mods ...func(request *alb.ApiCreateLoadBalancerRequest)) alb.ApiCreateLoadBalancerRequest {
request := testClient.CreateLoadBalancer(testCtx, testProjectId, testRegion)
request := testClient.DefaultAPI.CreateLoadBalancer(testCtx, testProjectId, testRegion)

request = request.CreateLoadBalancerPayload(fixturePayload())
for _, mod := range mods {
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestBuildRequest(t *testing.T) {
},
Configuration: &testConfig,
},
expectedRequest: testClient.
expectedRequest: testClient.DefaultAPI.
CreateLoadBalancer(testCtx, testProjectId, testRegion).
CreateLoadBalancerPayload(fixturePayload()),
},
Expand All @@ -177,7 +177,7 @@ func TestBuildRequest(t *testing.T) {
}

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmp.AllowUnexported(tt.expectedRequest, alb.DefaultAPIService{}),
cmpopts.EquateComparable(testCtx),
)
if diff != "" {
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/beta/alb/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/services/alb/client"

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

const (
Expand Down Expand Up @@ -70,7 +70,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
return fmt.Errorf("delete loadbalancer: %w", err)
}

params.Printer.Outputf("Load balancer %q deleted.", model.Name)
params.Printer.Outputf("Load balancer %q deleted.\n", model.Name)
return nil
},
}
Expand All @@ -91,5 +91,5 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *alb.APIClient) alb.ApiDeleteLoadBalancerRequest {
return apiClient.DeleteLoadBalancer(ctx, model.ProjectId, model.Region, model.Name)
return apiClient.DefaultAPI.DeleteLoadBalancer(ctx, model.ProjectId, model.Region, model.Name)
}
8 changes: 4 additions & 4 deletions internal/cmd/beta/alb/delete/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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/alb"
alb "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"
)

type testCtxKey struct{}
Expand All @@ -19,7 +19,7 @@ var (
testCtx = context.WithValue(context.Background(), testCtxKey{}, "test")
testProjectId = uuid.NewString()
testRegion = "eu01"
testClient = &alb.APIClient{}
testClient = &alb.APIClient{DefaultAPI: &alb.DefaultAPIService{}}
testLoadBalancerName = "my-test-loadbalancer"
)

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

func fixtureRequest(mods ...func(request *alb.ApiDeleteLoadBalancerRequest)) alb.ApiDeleteLoadBalancerRequest {
request := testClient.DeleteLoadBalancer(testCtx, testProjectId, testRegion, testLoadBalancerName)
request := testClient.DefaultAPI.DeleteLoadBalancer(testCtx, testProjectId, testRegion, testLoadBalancerName)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestBuildRequest(t *testing.T) {
request := buildRequest(testCtx, tt.model, testClient)

diff := cmp.Diff(request, tt.expectedResult,
cmp.AllowUnexported(tt.expectedResult),
cmp.AllowUnexported(tt.expectedResult, alb.DefaultAPIService{}),
cmpopts.EquateComparable(testCtx),
)
if diff != "" {
Expand Down
20 changes: 10 additions & 10 deletions internal/cmd/beta/alb/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"

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

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

func buildRequest(ctx context.Context, model *inputModel, apiClient *alb.APIClient) alb.ApiGetLoadBalancerRequest {
return apiClient.GetLoadBalancer(ctx, model.ProjectId, model.Region, model.Name)
return apiClient.DefaultAPI.GetLoadBalancer(ctx, model.ProjectId, model.Region, model.Name)
}

func outputResult(p *print.Printer, outputFormat string, loadbalancer *alb.LoadBalancer) error {
Expand All @@ -95,11 +95,11 @@ func outputResult(p *print.Printer, outputFormat string, loadbalancer *alb.LoadB
content = append(content, buildLoadBalancerTable(loadbalancer))

if loadbalancer.Listeners != nil {
content = append(content, buildListenersTable(*loadbalancer.Listeners))
content = append(content, buildListenersTable(loadbalancer.Listeners))
}

if loadbalancer.TargetPools != nil {
content = append(content, buildTargetPoolsTable(*loadbalancer.TargetPools))
content = append(content, buildTargetPoolsTable(loadbalancer.TargetPools))
}

err := tables.DisplayTables(p, content)
Expand All @@ -116,7 +116,7 @@ func buildLoadBalancerTable(loadbalancer *alb.LoadBalancer) tables.Table {
privateAccessOnly := false
if loadbalancer.Options != nil {
if loadbalancer.Options.AccessControl != nil && loadbalancer.Options.AccessControl.AllowedSourceRanges != nil {
acl = *loadbalancer.Options.AccessControl.AllowedSourceRanges
acl = loadbalancer.Options.AccessControl.AllowedSourceRanges
}

if loadbalancer.Options.PrivateNetworkOnly != nil {
Expand All @@ -125,16 +125,16 @@ func buildLoadBalancerTable(loadbalancer *alb.LoadBalancer) tables.Table {
}

networkId := "-"
if loadbalancer.Networks != nil && len(*loadbalancer.Networks) > 0 {
networks := *loadbalancer.Networks
if len(loadbalancer.Networks) > 0 {
networks := loadbalancer.Networks
networkId = *networks[0].NetworkId
}

externalAddress := utils.PtrStringDefault(loadbalancer.ExternalAddress, "-")

errorDescriptions := []string{}
if loadbalancer.Errors != nil && len((*loadbalancer.Errors)) > 0 {
for _, err := range *loadbalancer.Errors {
if len(loadbalancer.Errors) > 0 {
for _, err := range loadbalancer.Errors {
errorDescriptions = append(errorDescriptions, *err.Description)
}
}
Expand Down Expand Up @@ -179,7 +179,7 @@ func buildTargetPoolsTable(targetPools []alb.TargetPool) tables.Table {
table.SetTitle("Target Pools")
table.SetHeader("NAME", "PORT", "TARGETS")
for _, targetPool := range targetPools {
table.AddRow(utils.PtrString(targetPool.Name), utils.PtrString(targetPool.TargetPort), len(*targetPool.Targets))
table.AddRow(utils.PtrString(targetPool.Name), utils.PtrString(targetPool.TargetPort), len(targetPool.Targets))
}
return table
}
8 changes: 4 additions & 4 deletions internal/cmd/beta/alb/describe/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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/alb"
alb "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"
)

type testCtxKey struct{}
Expand All @@ -20,7 +20,7 @@ var (
testCtx = context.WithValue(context.Background(), testCtxKey{}, "test")
testProjectId = uuid.NewString()
testRegion = "eu01"
testClient = &alb.APIClient{}
testClient = &alb.APIClient{DefaultAPI: &alb.DefaultAPIService{}}
testLoadBalancerName = "my-test-loadbalancer"
)

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

func fixtureRequest(mods ...func(request *alb.ApiGetLoadBalancerRequest)) alb.ApiGetLoadBalancerRequest {
request := testClient.GetLoadBalancer(testCtx, testProjectId, testRegion, testLoadBalancerName)
request := testClient.DefaultAPI.GetLoadBalancer(testCtx, testProjectId, testRegion, testLoadBalancerName)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestBuildRequest(t *testing.T) {
request := buildRequest(testCtx, tt.model, testClient)

diff := cmp.Diff(request, tt.expectedResult,
cmp.AllowUnexported(tt.expectedResult),
cmp.AllowUnexported(tt.expectedResult, alb.DefaultAPIService{}),
cmpopts.EquateComparable(testCtx),
)
if diff != "" {
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/beta/alb/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/alb"
alb "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"

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

func buildRequest(ctx context.Context, model *inputModel, apiClient *alb.APIClient) alb.ApiListLoadBalancersRequest {
request := apiClient.ListLoadBalancers(ctx, model.ProjectId, model.Region)
request := apiClient.DefaultAPI.ListLoadBalancers(ctx, model.ProjectId, model.Region)

return request
}
Expand All @@ -135,7 +135,7 @@ func outputResult(p *print.Printer, outputFormat, projectLabel string, items []a

var errNo int
if item.Errors != nil {
errNo = len(*item.Errors)
errNo = len(item.Errors)
}
table.AddRow(utils.PtrString(item.Name),
utils.PtrString(item.ExternalAddress),
Expand Down
8 changes: 4 additions & 4 deletions internal/cmd/beta/alb/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/alb"
alb "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"
)

type testCtxKey struct{}

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

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

func fixtureRequest(mods ...func(request *alb.ApiListLoadBalancersRequest)) alb.ApiListLoadBalancersRequest {
request := testClient.ListLoadBalancers(testCtx, testProjectId, testRegion)
request := testClient.DefaultAPI.ListLoadBalancers(testCtx, testProjectId, testRegion)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestBuildRequest(t *testing.T) {
t.Run(tt.description, func(t *testing.T) {
request := buildRequest(testCtx, tt.model, testClient)
diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmp.AllowUnexported(tt.expectedRequest, alb.DefaultAPIService{}),
cmpopts.EquateComparable(testCtx),
)
if diff != "" {
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/beta/alb/observability-credentials/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

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

const (
Expand Down Expand Up @@ -100,7 +100,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *alb.APIClient) alb.ApiCreateCredentialsRequest {
req := apiClient.CreateCredentials(ctx, model.ProjectId, model.Region)
req := apiClient.DefaultAPI.CreateCredentials(ctx, model.ProjectId, model.Region)
payload := alb.CreateCredentialsPayload{
DisplayName: model.Displayname,
Password: model.Password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ 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/alb"
alb "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"
)

type testCtxKey struct{}

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

var (
testProjectId = uuid.NewString()
Expand Down Expand Up @@ -59,7 +59,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *alb.ApiCreateCredentialsRequest)) alb.ApiCreateCredentialsRequest {
request := testClient.CreateCredentials(testCtx, testProjectId, testRegion)
request := testClient.DefaultAPI.CreateCredentials(testCtx, testProjectId, testRegion)
request = request.CreateCredentialsPayload(fixturePayload())
for _, mod := range mods {
mod(&request)
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestBuildRequest(t *testing.T) {
request := buildRequest(testCtx, tt.model, testClient)

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmp.AllowUnexported(tt.expectedRequest, alb.DefaultAPIService{}),
cmpopts.EquateComparable(testCtx),
cmp.AllowUnexported(alb.NullableString{}),
)
Expand Down
Loading
Loading