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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/alb v0.17.1
github.com/stackitcloud/stackit-sdk-go/services/albwaf v0.13.1
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.15.2
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.19.0
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.20.0
github.com/stackitcloud/stackit-sdk-go/services/dns v0.22.1
github.com/stackitcloud/stackit-sdk-go/services/edge v0.13.1
github.com/stackitcloud/stackit-sdk-go/services/git v0.14.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ github.com/stackitcloud/stackit-sdk-go/services/albwaf v0.13.1 h1:NsUOizMbRrIyvx
github.com/stackitcloud/stackit-sdk-go/services/albwaf v0.13.1/go.mod h1:4M9G1I64kZwlXO32ZoIpt0GAN4SpZ1SYerwCVVIBGoE=
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.15.2 h1:b7WJ/vwxlVmNNX91kI3obqGcuoPAyaCbDL5aCMQ/sNg=
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.15.2/go.mod h1:T/JF25XGJ3GqER/1L2N//DgY8x5tY7gA3N+/0nvmOWY=
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.19.0 h1:k+KJ4gp9awhJMY5y55vDqRSr6G/S9+8haTNILGbgH9s=
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.19.0/go.mod h1:MHB1N3EQ9GuAduAQoNS+gb1MjrWJieszbpOso9TQv5s=
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.20.0 h1:p/8f/+Z+OtqX0cau2CqkidjfO3FkHPc7ymdrF1zv7UY=
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.20.0/go.mod h1:MHB1N3EQ9GuAduAQoNS+gb1MjrWJieszbpOso9TQv5s=
github.com/stackitcloud/stackit-sdk-go/services/dns v0.22.1 h1:vC0GpKVKH1Tce9VNyZTMWbheyGGS9a9GZWv6H5/z4Ek=
github.com/stackitcloud/stackit-sdk-go/services/dns v0.22.1/go.mod h1:FiYSv3D9rzgEVzi8Mpq5oYZBosrasa5uUYqVdEIbM1U=
github.com/stackitcloud/stackit-sdk-go/services/edge v0.13.1 h1:N36I7MavPdDUb0GJXmwNzjEdypJEizW4eQi+/YOzedM=
Expand Down
14 changes: 8 additions & 6 deletions internal/cmd/beta/cdn/distribution/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,15 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *cdn.APIClie
payload.DefaultCacheDuration = utils.Ptr(model.DefaultCacheDuration)
}
if model.Loki != nil {
payload.LogSink = &cdn.LokiLogSinkCreate{
Credentials: cdn.LokiLogSinkCredentials{
Password: model.Loki.Password,
Username: model.Loki.Username,
payload.LogSink = &cdn.CreateDistributionPayloadLogSink{
LokiLogSinkCreate: &cdn.LokiLogSinkCreate{
Credentials: cdn.LokiLogSinkCredentials{
Password: model.Loki.Password,
Username: model.Loki.Username,
},
PushUrl: model.Loki.PushURL,
Type: "loki",
},
PushUrl: model.Loki.PushURL,
Type: "loki",
}
}
payload.MonthlyLimitBytes = model.MonthlyLimitBytes
Expand Down
10 changes: 6 additions & 4 deletions internal/cmd/beta/cdn/distribution/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ func payloadBucketBackend() func(payload *cdn.CreateDistributionPayload) {

func payloadLoki() func(payload *cdn.CreateDistributionPayload) {
return func(payload *cdn.CreateDistributionPayload) {
payload.LogSink = &cdn.LokiLogSinkCreate{
Type: "loki",
PushUrl: "https://loki.example.com",
Credentials: *cdn.NewLokiLogSinkCredentials("", "loki-user"),
payload.LogSink = &cdn.CreateDistributionPayloadLogSink{
LokiLogSinkCreate: &cdn.LokiLogSinkCreate{
Type: "loki",
PushUrl: "https://loki.example.com",
Credentials: *cdn.NewLokiLogSinkCredentials("", "loki-user"),
},
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/beta/cdn/distribution/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ func buildDistributionTable(d *cdn.Distribution) tables.Table {
defaultCacheDuration = *d.Config.DefaultCacheDuration.Get()
}
logSinkPushUrl := ""
if d.Config.LogSink != nil && d.Config.LogSink.PushUrl != "" {
logSinkPushUrl = d.Config.LogSink.PushUrl
if d.Config.LogSink != nil && d.Config.LogSink.LokiLogSink != nil && d.Config.LogSink.LokiLogSink.PushUrl != "" {
logSinkPushUrl = d.Config.LogSink.LokiLogSink.PushUrl
}
monthlyLimitBytes := ""
if d.Config.MonthlyLimitBytes.IsSet() && d.Config.MonthlyLimitBytes.Get() != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,10 @@ func TestOutputResult(t *testing.T) {
r.Distribution.Config.BlockedCountries = []string{"US", "CN"}
r.Distribution.Config.BlockedIps = []string{"127.0.0.1"}
r.Distribution.Config.DefaultCacheDuration = *cdn.NewNullableString(utils.Ptr("P1DT2H30M"))
r.Distribution.Config.LogSink = &cdn.LokiLogSink{
PushUrl: "https://logs.example.com",
r.Distribution.Config.LogSink = &cdn.ConfigLogSink{
LokiLogSink: &cdn.LokiLogSink{
PushUrl: "https://logs.example.com",
},
}
monthlyLimit := int64(104857600)
r.Distribution.Config.MonthlyLimitBytes = *cdn.NewNullableInt64(&monthlyLimit)
Expand Down
3 changes: 2 additions & 1 deletion internal/cmd/beta/cdn/distribution/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ func buildRequest(ctx context.Context, apiClient *cdn.APIClient, model *inputMod
}
if model.Loki != nil {
loki := &cdn.LokiLogSinkPatch{}
cfg.LogSink = *cdn.NewNullableLokiLogSinkPatch(loki)
logSink := cdn.LokiLogSinkPatchAsConfigPatchLogSink(loki)
cfg.LogSink = *cdn.NewNullableConfigPatchLogSink(&logSink)
if model.Loki.PushURL != "" {
loki.PushUrl = utils.Ptr(model.Loki.PushURL)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/cmd/beta/cdn/distribution/update/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,13 @@ func TestBuildRequest(t *testing.T) {
payload.Config.DefaultCacheDuration = *cdn.NewNullableString(utils.Ptr(testCacheDuration))
monthlyLimitBytes := testMonthlyLimitBytes
payload.Config.MonthlyLimitBytes = *cdn.NewNullableInt64(&monthlyLimitBytes)
payload.Config.LogSink = *cdn.NewNullableLokiLogSinkPatch(
logSink := cdn.LokiLogSinkPatchAsConfigPatchLogSink(
&cdn.LokiLogSinkPatch{
Credentials: cdn.NewLokiLogSinkCredentials("loki-pass", "loki-user"),
PushUrl: utils.Ptr("https://loki.example.com"),
},
)
payload.Config.LogSink = *cdn.NewNullableConfigPatchLogSink(&logSink)
payload.Config.Optimizer = &cdn.OptimizerPatch{
Enabled: utils.Ptr(true),
}
Expand Down Expand Up @@ -315,7 +316,7 @@ func TestBuildRequest(t *testing.T) {
cdn.ApiPatchDistributionRequest{},
cdn.NullableString{},
cdn.NullableInt64{},
cdn.NullableLokiLogSinkPatch{},
cdn.NullableConfigPatchLogSink{},
cdn.DefaultAPIService{},
),
cmpopts.EquateComparable(testCtx),
Expand Down