Skip to content

Commit 915a9bb

Browse files
Merge branch 'main' into fix/timeout-usage-in-rest-client
2 parents 781d4f4 + 2c40924 commit 915a9bb

50 files changed

Lines changed: 2830 additions & 945 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,22 @@ jobs:
101101
uses: ./.github/actions/build/python
102102
- name: Generate SDK
103103
uses: ./.github/actions/generate-sdk/python
104-
- name: Install Python ${{ matrix.python-version }}
105-
uses: actions/setup-python@v5
106104
with:
107-
python-version: ${{ matrix.python-version }}
105+
python-version: ${{ matrix.python-version }}
106+
- name: install uv
107+
uses: astral-sh/setup-uv@v7
108+
with:
109+
version: "0.10.4"
110+
python-version: ${{ matrix.python-version }}
108111
- name: Install sdk
109112
working-directory: ./sdk-repo-updated
110-
run: |
111-
pip install poetry
112-
poetry config virtualenvs.create false
113-
python -m venv .venv
114-
. .venv/bin/activate
115-
python -m pip install --upgrade pip
116-
make install-dev
113+
run: make install-dev
117114
- name: Lint
118115
working-directory: ./sdk-repo-updated
119-
run: |
120-
. .venv/bin/activate
121-
make lint
116+
run: make lint
122117
- name: Test
123118
working-directory: ./sdk-repo-updated
124-
run: |
125-
. .venv/bin/activate
126-
make test
119+
run: make test
127120

128121
main-java:
129122
name: CI [Java]

.github/workflows/sdk-pr.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,15 @@ jobs:
6565
uses: ./.github/actions/build/python
6666
- name: Generate SDK
6767
uses: ./.github/actions/generate-sdk/python
68+
- name: install uv
69+
uses: astral-sh/setup-uv@v7
70+
with:
71+
version: "0.10.4"
6872
- name: Push SDK
6973
env:
7074
GH_REPO: "stackitcloud/stackit-sdk-python"
7175
GH_TOKEN: ${{ secrets.SDK_PR_TOKEN }}
7276
run: |
73-
set -e
74-
python -m venv .venv
75-
. .venv/bin/activate
76-
python -m pip install --upgrade pip
77-
pip install poetry
78-
poetry config virtualenvs.create false
7977
(cd ./sdk-repo-updated && make install-dev)
8078
scripts/sdk-create-pr.sh "generator-bot-${{ github.run_id }}" "Generated from GitHub run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" "git@github.com:stackitcloud/stackit-sdk-python.git" "python"
8179
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1+
README.md
12
git_push.sh
23
.travis.yml
34
.gitignore
4-
#utils.go
5-
README.md
6-
response.go
75
api/openapi.yaml
8-
.openapi-generator/*
9-
.gitlab-ci.yml
10-
setup.cfg
11-
setup.py
12-
test-requirements.txt
13-
requirements.txt
14-
tox.ini
15-
*/.github/*

languages/golang/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# STACKIT Golang SDK Generator
2+
3+
## Template adjustments
4+
5+
The following templates were customized but don't need to be adjusted when updating the Go SDK generator to a new a newer upstream version:
6+
7+
- `configuration.mustache`: This template was entirely overwritten so we can use our custom [configuration struct](https://github.com/stackitcloud/stackit-sdk-go/blob/c3b04bc3cb8bf93de351fd7b1b04ac11de78ff89/core/config/config.go#L78) from our Go SDK core module. By default the OpenAPI generator would generate a new configuration struct for each service API version.
8+
9+
The following templates were customized and need to be checked for adjustments when updating the Go SDK generator to a newer upstream version:
10+
11+
- `client.mustache`:
12+
- Removed the generation of the `GenericOpenAPIError` struct which would be generated for each service API version by default. Instead use the `GenericOpenAPIError` struct from the [Go SDK core module](https://github.com/stackitcloud/stackit-sdk-go/blob/c3b04bc3cb8bf93de351fd7b1b04ac11de78ff89/core/oapierror/oapierror.go#L15).
13+
- Our custom `GenericOpenAPIError` struct from the core module has additional fields like the http status code, ... which the default one doesn't have.
14+
- Customized the `NewAPIClient` func to use the configuration struct and the authentication from the core SDK module.
15+
- `api.mustache`
16+
- Added customization to capture the HTTP request and response in the context (like it was done before the multi API version support was implemented in the Go SDK generator).
17+
- Use the `GenericOpenAPIError` struct from the core module instead of the default one (see previous section of `client.mustache`).
18+
- Don't return the `http.Response` param which the OpenAPI generator returns by default.
19+
- It was done like that before the multi API version support was implemented in the Go SDK generator.
20+
- Furthermore, it would when using the STACKIT Go SDK require a lot of boilerplate code after each SDK API call to do a nil check, close the http response body and handle the potential error.
21+
22+
## Custom templates
23+
24+
The custom templates don't need to be adjusted when updating the Go SDK generator to a new a newer upstream version.
25+
26+
- `custom/api_mock.mustache`: This template was added to allow easy mocking of SDK API calls in unit test implementations.
27+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
git_push.sh
2+
.travis.yml
3+
.gitignore
4+
README.md
5+
response.go
6+
api/openapi.yaml
7+
.openapi-generator/*
8+
.gitlab-ci.yml
9+
setup.cfg
10+
setup.py
11+
test-requirements.txt
12+
requirements.txt
13+
tox.ini
14+
*/.github/*
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Transitional file to enable compatibility layer generation for selected services.
2+
# Note: It shouldn't be needed to add any services here!
3+
alb
4+
auditlog
5+
authorization
6+
cdn
7+
certificates
8+
dns
9+
edge
10+
git
11+
iaas
12+
intake
13+
kms
14+
loadbalancer
15+
logme
16+
logs
17+
mariadb
18+
modelserving
19+
mongodbflex
20+
objectstorage
21+
observability
22+
opensearch
23+
postgresflex
24+
rabbitmq
25+
redis
26+
resourcemanager
27+
runcommand
28+
scf
29+
secretsmanager
30+
serverbackup
31+
serverupdate
32+
serviceaccount
33+
serviceenablement
34+
sfs
35+
ske
36+
sqlserverflex
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
useOneOfDiscriminatorLookup: true
2+
templateDir: languages/golang/compat-layer/templates
3+
files:
4+
custom/model_test.mustache:
5+
# TODO: this should be 'ModelTests' instead of 'Model'
6+
# 'Model' was used because 'ModelTests' didn't stick to golangs file naming conventions
7+
templateType: Model
8+
destinationFilename: _test.go

regional-whitelist.txt renamed to languages/golang/compat-layer/regional-allowlist.txt

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)