Skip to content

Commit aa13c4c

Browse files
Merge branch 'main' into oas-bot-19860006378/logs
2 parents 46bde6a + d5d2646 commit aa13c4c

15 files changed

+322
-179
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@
3737
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
3838
- `dns`: [v0.17.2](services/dns/CHANGELOG.md#v0172)
3939
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
40-
- `git`: [v0.9.1](services/git/CHANGELOG.md#v091)
41-
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
40+
- `git`:
41+
- [v0.10.0](services/git/CHANGELOG.md#v0100)
42+
- **Breaking Change:** Replace `PatchOperation` by `PatchInstancePayload` in `ApiPatchInstanceRequest` struct
43+
- **Breaking Change:** Replace `CreateInstancePayloadFlavor` enums by `InstanceFlavor`
44+
- [v0.9.1](services/git/CHANGELOG.md#v091)
45+
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
4246
- `iaas`:
4347
- [v1.2.2](services/iaas/CHANGELOG.md#v122)
4448
- Bump STACKIT SDK resourcemanager module from `v0.18.0` to `v0.18.1`

core/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.20.1
2+
- **Improvement:** Improve error message when passing a PEM encoded file to as service account key
3+
14
## v0.20.0
25
- **New:** Added new `GetTraceId` function
36

core/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.20.0
1+
v0.20.1

core/auth/auth.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http"
77
"os"
88
"path/filepath"
9+
"strings"
910

1011
"github.com/stackitcloud/stackit-sdk-go/core/clients"
1112
"github.com/stackitcloud/stackit-sdk-go/core/config"
@@ -172,7 +173,11 @@ func KeyAuth(cfg *config.Configuration) (http.RoundTripper, error) {
172173
var serviceAccountKey = &clients.ServiceAccountKeyResponse{}
173174
err = json.Unmarshal([]byte(cfg.ServiceAccountKey), serviceAccountKey)
174175
if err != nil {
175-
return nil, fmt.Errorf("unmarshalling service account key: %w", err)
176+
var errorSuffix string
177+
if strings.HasPrefix(cfg.ServiceAccountKey, "-----BEGIN") {
178+
errorSuffix = " - it seems like the provided service account key is in PEM format. Please provide it in JSON format."
179+
}
180+
return nil, fmt.Errorf("unmarshalling service account key: %w%s", err, errorSuffix)
176181
}
177182

178183
// Try to get private key from configuration, environment or credentials file

core/auth/auth_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/http"
1010
"os"
1111
"reflect"
12+
"strings"
1213
"testing"
1314
"time"
1415

@@ -668,6 +669,19 @@ func TestKeyAuth(t *testing.T) {
668669
}
669670
}
670671

672+
func TestKeyAuthPemInsteadOfJsonKeyErrorHandling(t *testing.T) {
673+
cfg := &config.Configuration{
674+
ServiceAccountKey: "-----BEGIN PRIVATE KEY",
675+
}
676+
_, err := KeyAuth(cfg)
677+
if err == nil {
678+
t.Fatalf("error expected")
679+
}
680+
if !strings.HasSuffix(err.Error(), "Please provide it in JSON format.") {
681+
t.Fatalf("expected to end with JSON format hint: %s", err)
682+
}
683+
}
684+
671685
func TestNoAuth(t *testing.T) {
672686
for _, test := range []struct {
673687
desc string

services/git/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
## v0.10.0
2+
- **Breaking Change:** Replace `PatchOperation` by `PatchInstancePayload` in `ApiPatchInstanceRequest` struct
3+
- **Breaking Change:** Replace `CreateInstancePayloadFlavor` enums by `InstanceFlavor`
4+
15
## v0.9.1
2-
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
6+
- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0`
37

48
## v0.9.0
59
- **Feature:** Add support for list runner labels operation

services/git/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.9.1
1+
v0.10.0

services/git/api_default.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/git/api_default_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/git/model_create_instance_payload.go

Lines changed: 6 additions & 112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)