diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76547aac4..9691a7c6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,25 +11,55 @@ # limitations under the License. name: Build + on: push: branches: - master pull_request: + +# Cancel redundant runs on the same ref (e.g. rapid pushes to a PR branch). +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +# Minimal read-only permissions; CI does not publish anything. +permissions: + contents: read + jobs: ci: runs-on: ubuntu-latest + timeout-minutes: 20 steps: - - name: Checkout - uses: actions/checkout@master - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '^1.21.0' - - name: Run make check - run: | - export PATH=${PATH}:`go env GOPATH`/bin - go version - make check - - name: Run unit tests - run: go test ./... + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + # Reads the go directive from go.mod — no hard-coded version + go-version-file: go.mod + cache: true + + - name: Lint + uses: golangci/golangci-lint-action@v9 + with: + version: latest + args: --timeout=10m --modules-download-mode=vendor + + - name: Check license headers + run: | + go build -o "$(go env GOPATH)/bin/addlicense" github.com/google/addlicense + addlicense -check \ + -ignore ".git/**" \ + -ignore "vendor/**" \ + -ignore "hack/**" \ + -ignore "**/*.yaml" \ + -ignore "**/*.yml" \ + -ignore "resources/demo-config-files/**" \ + -ignore "**/*.proto" \ + . + + - name: Test + run: go test ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b648812e..af9901b3f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,77 +1,75 @@ -name: releaser +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release on: release: types: - published + +# Only allow one release workflow to run at a time; never cancel an in-flight +# publish since that could leave a partial release. +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +# Minimum permissions at workflow level; the release job declares what it needs. +permissions: + contents: read + jobs: - update_kubeswitch_in_homebrew_tap: + release: + name: Release environment: Release runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + # Required to upload release assets + contents: write steps: - - uses: actions/checkout@v2 - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '^1.21.0' - - name: Build the binary-files - id: build_binary_files - run: | - sudo apt-get update - sudo apt-get install make -y - export PATH=${PATH}:`go env GOPATH`/bin - make check - make build-switcher - echo ::set-output name=latest_release_filtered_tag::${GITHUB_REF##*/} - - name: Upload mac binaries to release - uses: AButler/upload-release-assets@v2.0 + - name: Checkout + uses: actions/checkout@v4 with: - files: 'hack/switch/switcher_darwin_amd64' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ steps.build_binary_files.outputs.latest_release_filtered_tag }} - - name: Upload mac (ARM) binaries to release - uses: AButler/upload-release-assets@v2.0 - with: - files: 'hack/switch/switcher_darwin_arm64' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ steps.build_binary_files.outputs.latest_release_filtered_tag }} - - name: Upload Linux binaries to release - uses: AButler/upload-release-assets@v2.0 - with: - files: 'hack/switch/switcher_linux_amd64' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ steps.build_binary_files.outputs.latest_release_filtered_tag }} - - name: Upload Linux (ARM) binaries to release - uses: AButler/upload-release-assets@v2.0 - with: - files: 'hack/switch/switcher_linux_arm64' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ steps.build_binary_files.outputs.latest_release_filtered_tag }} - - name: Upload Windows binaries to release - uses: AButler/upload-release-assets@v2.0 + # goreleaser needs the full tag history to generate changelogs + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 with: - files: 'hack/switch/switcher_windows_amd64.exe' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ steps.build_binary_files.outputs.latest_release_filtered_tag }} - - name: Upload switch script to release - uses: AButler/upload-release-assets@v2.0 + # Reads the go directive from go.mod — no hard-coded version + go-version-file: go.mod + cache: true + + - name: Run goreleaser + uses: goreleaser/goreleaser-action@v7 with: - files: 'hack/switch/switch.sh' - repo-token: ${{ secrets.GITHUB_TOKEN }} - release-tag: ${{ steps.build_binary_files.outputs.latest_release_filtered_tag }} - - name: Send update with latest versions to danielfoehrkn/homebrew-switch + version: latest + args: release --clean env: - ACCESS_TOKEN: ${{ secrets.KUBESWITCH_ACCESS_TOKEN }} - run: | - mac_sha256sum=$(sha256sum hack/switch/switcher_darwin_amd64 | awk '{print $1}') - mac_arm_sha256sum=$(sha256sum hack/switch/switcher_darwin_arm64 | awk '{print $1}') - linux_sha256sum=$(sha256sum hack/switch/switcher_linux_amd64 | awk '{print $1}') - linux_arm_sha256sum=$(sha256sum hack/switch/switcher_linux_arm64 | awk '{print $1}') - switch_script_sha256sum=$(sha256sum hack/switch/switch.sh | awk '{print $1}') + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Send update with latest versions to danielfoehrkn/homebrew-switch + # env: + # ACCESS_TOKEN: ${{ secrets.KUBESWITCH_ACCESS_TOKEN }} + # run: | + # mac_sha256sum=$(sha256sum hack/switch/switcher_darwin_amd64 | awk '{print $1}') + # mac_arm_sha256sum=$(sha256sum hack/switch/switcher_darwin_arm64 | awk '{print $1}') + # linux_sha256sum=$(sha256sum hack/switch/switcher_linux_amd64 | awk '{print $1}') + # linux_arm_sha256sum=$(sha256sum hack/switch/switcher_linux_arm64 | awk '{print $1}') + # switch_script_sha256sum=$(sha256sum hack/switch/switch.sh | awk '{print $1}') - echo '{"event_type": "update", "client_payload": { "tag": "'"${{ steps.build_binary_files.outputs.latest_release_filtered_tag }}"'", "mac_sha": "'"$mac_sha256sum"'", "mac_arm_sha": "'"$mac_arm_sha256sum"'", "linux_sha": "'"$linux_sha256sum"'", "linux_arm_sha": "'"$linux_arm_sha256sum"'", "switch_script_sha": "'"$switch_script_sha256sum"'"}}' + # echo '{"event_type": "update", "client_payload": { "tag": "'"${{ steps.build_binary_files.outputs.latest_release_filtered_tag }}"'", "mac_sha": "'"$mac_sha256sum"'", "mac_arm_sha": "'"$mac_arm_sha256sum"'", "linux_sha": "'"$linux_sha256sum"'", "linux_arm_sha": "'"$linux_arm_sha256sum"'", "switch_script_sha": "'"$switch_script_sha256sum"'"}}' - curl -X POST https://api.github.com/repos/danielfoehrKn/homebrew-switch/dispatches \ - -H 'Accept: application/vnd.github.everest-preview+json' \ - -u "$ACCESS_TOKEN" \ - --data '{"event_type": "update", "client_payload": { "tag": "'"${{ steps.build_binary_files.outputs.latest_release_filtered_tag }}"'", "mac_sha": "'"$mac_sha256sum"'", "mac_arm_sha": "'"$mac_arm_sha256sum"'", "linux_sha": "'"$linux_sha256sum"'", "linux_arm_sha": "'"$linux_arm_sha256sum"'", "switch_script_sha": "'"$switch_script_sha256sum"'"}}' \ No newline at end of file + # curl -X POST https://api.github.com/repos/danielfoehrKn/homebrew-switch/dispatches \ + # -H 'Accept: application/vnd.github.everest-preview+json' \ + # -u "$ACCESS_TOKEN" \ + # --data '{"event_type": "update", "client_payload": { "tag": "'"${{ steps.build_binary_files.outputs.latest_release_filtered_tag }}"'", "mac_sha": "'"$mac_sha256sum"'", "mac_arm_sha": "'"$mac_arm_sha256sum"'", "linux_sha": "'"$linux_sha256sum"'", "linux_arm_sha": "'"$linux_arm_sha256sum"'", "switch_script_sha": "'"$switch_script_sha256sum"'"}}' \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml index 7ef00f5b6..0c145ea35 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,10 +1,14 @@ +version: "2" +run: + timeout: 10m linters: enable: - errcheck - - gosimple - govet - ineffassign - staticcheck - unused +formatters: + enable: - gofmt - goimports diff --git a/.golangci.yaml.bak b/.golangci.yaml.bak new file mode 100644 index 000000000..6558176aa --- /dev/null +++ b/.golangci.yaml.bak @@ -0,0 +1,11 @@ +linters: + enable: + - errcheck + - govet + - ineffassign + - staticcheck + - unused +formatters: + enable: + - gofmt + - goimports diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 000000000..fafd6e406 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,58 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: 2 + +project_name: switcher + +builds: + - id: switcher + main: ./cmd + # Binary is just "switcher"; the archive name_template below applies the + # platform suffix, matching the original naming: switcher_{os}_{arch} + binary: switcher + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + ldflags: + - -w + -X github.com/danielfoehrkn/kubeswitch/cmd/switcher.version={{.Version}} + -X github.com/danielfoehrkn/kubeswitch/cmd/switcher.buildDate={{.Date}} + +# Upload raw binaries (no archives/tarballs). +# name_template matches the original release asset naming: switcher_{os}_{arch} +# (goreleaser automatically appends .exe for windows) +archives: + - formats: + - binary + name_template: "switcher_{{ .Os }}_{{ .Arch }}" + +checksum: + name_template: checksums.txt + algorithm: sha256 + +release: + # Upload switch.sh alongside the binaries + extra_files: + - glob: hack/switch/switch.sh + +snapshot: + version_template: "{{ .Tag }}-next" diff --git a/cmd/switcher/context.go b/cmd/switcher/context.go index 85fd1cfa0..00f8c80d0 100644 --- a/cmd/switcher/context.go +++ b/cmd/switcher/context.go @@ -15,7 +15,6 @@ package switcher import ( "fmt" - "os" delete_context "github.com/danielfoehrkn/kubeswitch/pkg/subcommands/delete-context" "github.com/danielfoehrkn/kubeswitch/pkg/subcommands/history" @@ -247,7 +246,7 @@ func setFlagsForContextCommands(command *cobra.Command) { command.Flags().StringVar( &configPath, "config-path", - os.ExpandEnv("$HOME/.kube/switch-config.yaml"), + getDefaultConfigPath(), "path on the local filesystem to the configuration file.") // not used for setContext command. Makes call in switch.sh script easier (no need to exclude flag from call) command.Flags().BoolVar( diff --git a/cmd/switcher/gardener.go b/cmd/switcher/gardener.go index 5d0855e44..dc7347610 100644 --- a/cmd/switcher/gardener.go +++ b/cmd/switcher/gardener.go @@ -14,8 +14,6 @@ package switcher import ( - "os" - gardenercontrolplane "github.com/danielfoehrkn/kubeswitch/pkg/subcommands/gardener" "github.com/spf13/cobra" ) @@ -47,7 +45,7 @@ func init() { controlplaneCmd.Flags().StringVar( &configPath, "config-path", - os.ExpandEnv("$HOME/.kube/switch-config.yaml"), + getDefaultConfigPath(), "path on the local filesystem to the configuration file.") gardenerCmd.AddCommand(controlplaneCmd) diff --git a/cmd/switcher/hooks.go b/cmd/switcher/hooks.go index 1a73d5881..bdf49748a 100644 --- a/cmd/switcher/hooks.go +++ b/cmd/switcher/hooks.go @@ -49,7 +49,7 @@ func init() { hookLsCmd.Flags().StringVar( &configPath, "config-path", - os.ExpandEnv("$HOME/.kube/switch-config.yaml"), + getDefaultConfigPath(), "path on the local filesystem to the configuration file.") hookLsCmd.Flags().StringVar( @@ -63,7 +63,7 @@ func init() { hookCmd.Flags().StringVar( &configPath, "config-path", - os.ExpandEnv("$HOME/.kube/switch-config.yaml"), + getDefaultConfigPath(), "path on the local filesystem to the configuration file.") hookCmd.Flags().StringVar( diff --git a/cmd/switcher/switcher.go b/cmd/switcher/switcher.go index 056f831a6..5367c901a 100644 --- a/cmd/switcher/switcher.go +++ b/cmd/switcher/switcher.go @@ -334,6 +334,15 @@ func initialize() ([]storetypes.KubeconfigStore, *types.Config, error) { return nil, nil, err } s = pluginStore + case types.StoreKindSKE: + skeStore, err := store.NewSKEStore(kubeconfigStoreFromConfig) + if err != nil { + if kubeconfigStoreFromConfig.Required != nil && !*kubeconfigStoreFromConfig.Required { + continue + } + return nil, nil, err + } + s = skeStore default: return nil, nil, fmt.Errorf("unknown store %q", kubeconfigStoreFromConfig.Kind) } @@ -441,6 +450,13 @@ func getKubeconfigPathFromFlag() string { return os.ExpandEnv(kubeconfigPath) } +func getDefaultConfigPath() string { + if env := os.Getenv("KUBESWITCHCONFIG"); env != "" { + return env + } + return os.ExpandEnv("$HOME/.kube/switch-config.yaml") +} + // isDuplicatePath searches through all kubeconfig stores in the switch-config.yaml and checks if the // given path is already configured in any of these stores // returns true if it is already configureed diff --git a/docs/stores/ske/ske.md b/docs/stores/ske/ske.md new file mode 100644 index 000000000..0a1806032 --- /dev/null +++ b/docs/stores/ske/ske.md @@ -0,0 +1,91 @@ +# STACKIT Kubernetes Engine (SKE) store + +The SKE store discovers and provides access to all [STACKIT Kubernetes Engine](https://www.stackit.de/en/product/kubernetes-engine/) clusters in a given STACKIT project. + +## Prerequisites + +An authentication method must be configured. The SKE store supports the following options (evaluated in order): + +1. **STACKIT CLI** – Browser-based personal account login. Requires the [`stackit` CLI](https://github.com/stackitcloud/stackit-cli) to be installed and a one-time `stackit auth login`. Token refresh is handled automatically. Enable with `useStackitCLIAuth: true`. +2. **Service Account Token** – Set directly in the store config or via the `STACKIT_SERVICE_ACCOUNT_TOKEN` environment variable. +3. **Service Account Key File** – A JSON key file created via the [STACKIT portal](https://portal.stackit.cloud/). + + +## Configuration + +The SKE store configuration is defined in the `kubeswitch` configuration file. An example is shown below: + +```yaml +kind: SwitchConfig +version: v1alpha1 +kubeconfigStores: +- kind: ske + # Optional: cache the cluster list for 1 hour; omit to always fetch from the API + refreshIndexAfter: 1h + config: + # Required: the STACKIT project ID to search for SKE clusters + projectID: "your-stackit-project-id" + + # Optional: human-readable project label used in context paths. + # Context paths become: ske// + # Falls back to projectID if not set. + projectName: "my-project" + + # Optional: region (default: "eu01") + region: "eu01" + + # --- Authentication (choose one) --- + + # Option 1: delegate to the STACKIT CLI (browser-based personal account login) + # Requires: stackit auth login + useStackitCLIAuth: true + + # Option 2: service account token + # serviceAccountToken: "your-service-account-token" + # (or set STACKIT_SERVICE_ACCOUNT_TOKEN env variable) + + # Option 3: path to a STACKIT service account key JSON file + # serviceAccountKeyPath: "/path/to/sa-key.json" +``` + +### Personal account login (STACKIT CLI) + +The easiest way to authenticate as a personal account is to install the STACKIT CLI and log in once: + +```bash +stackit auth login # opens browser for OAuth login +``` + +Then set `useStackitCLIAuth: true` in your store config. The CLI manages token refresh transparently — no manual credential management is needed. + + + +### Multiple projects + +To discover clusters across multiple STACKIT projects, configure one store per project: + +```yaml +kind: SwitchConfig +version: v1alpha1 +kubeconfigStores: +- kind: ske + id: project-a + refreshIndexAfter: 1h + config: + projectID: "project-a-id" + projectName: "Project A" + useStackitCLIAuth: true +- kind: ske + id: project-b + refreshIndexAfter: 1h + config: + projectID: "project-b-id" + projectName: "Project B" + useStackitCLIAuth: true +``` + +Context paths follow the pattern `ske//` (or `//` when an explicit store `id` is set). + +### Caching + +Setting `refreshIndexAfter` causes kubeswitch to write a local index file (e.g. `~/.kube/switch-state/switch.ske.default.index`) after the first search. Subsequent runs read from this index instead of hitting the STACKIT API, until the duration expires. diff --git a/go.mod b/go.mod index 3bc890795..48f67f37f 100644 --- a/go.mod +++ b/go.mod @@ -48,10 +48,13 @@ require ( require ( github.com/digitalocean/doctl v1.105.0 github.com/digitalocean/godo v1.113.0 + github.com/exoscale/egoscale/v3 v3.1.9 github.com/hashicorp/go-plugin v1.6.2 github.com/linode/linodego v1.42.0 github.com/ovh/go-ovh v1.4.3 github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21 + github.com/stackitcloud/stackit-sdk-go/core v0.22.0 + github.com/stackitcloud/stackit-sdk-go/services/ske v1.9.0 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 golang.org/x/oauth2 v0.25.0 google.golang.org/grpc v1.69.2 @@ -97,7 +100,6 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect - github.com/exoscale/egoscale/v3 v3.1.9 // indirect github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect @@ -118,10 +120,11 @@ require ( github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobuffalo/flect v1.0.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect diff --git a/go.sum b/go.sum index c759968e9..10aac4fcf 100644 --- a/go.sum +++ b/go.sum @@ -160,6 +160,7 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= @@ -178,6 +179,8 @@ github.com/gobuffalo/flect v1.0.2 h1:eqjPGSo2WmjgY2XlpGwo2NXgL3RucAKo4k4qQMNA5sA github.com/gobuffalo/flect v1.0.2/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -201,8 +204,8 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -447,6 +450,10 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/services/ske v1.9.0 h1:pNEIQdUJMP5oMsBV/U9ENGBbzsFedb/3ZRC+Mw7bcYc= +github.com/stackitcloud/stackit-sdk-go/services/ske v1.9.0/go.mod h1:VW6csYWkytVufoiDMquVEdyF0amYICzOzSe6ynRRDsI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -505,8 +512,6 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= diff --git a/pkg/config/config.go b/pkg/config/config.go index 93ff3f97e..f5277c8ad 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -65,7 +65,7 @@ func MigrateConfig(old types.ConfigOld, filename string) (*types.Config, error) if err != nil { return nil, fmt.Errorf("failed to migrate SwitchConfig file: %w", err) } - defer file.Close() + defer file.Close() //nolint:errcheck output, err := yaml.Marshal(old) if err != nil { @@ -83,7 +83,7 @@ func MigrateConfig(old types.ConfigOld, filename string) (*types.Config, error) if err != nil { return nil, fmt.Errorf("failed to migrate SwitchConfig file: %w", err) } - defer fileNew.Close() + defer fileNew.Close() //nolint:errcheck output, err = yaml.Marshal(new) if err != nil { diff --git a/pkg/config/validation/validation.go b/pkg/config/validation/validation.go index 10fee970b..e6d2dc3bf 100644 --- a/pkg/config/validation/validation.go +++ b/pkg/config/validation/validation.go @@ -22,6 +22,7 @@ import ( gardenerstore "github.com/danielfoehrkn/kubeswitch/pkg/store/gardener" gkestore "github.com/danielfoehrkn/kubeswitch/pkg/store/gke" + skestore "github.com/danielfoehrkn/kubeswitch/pkg/store/ske" "github.com/danielfoehrkn/kubeswitch/types" ) @@ -81,6 +82,11 @@ func ValidateConfig(config *types.Config) field.ErrorList { errors = append(errors, errorList...) } + if kubeconfigStore.Kind == types.StoreKindSKE { + errorList := skestore.ValidateSKEStoreConfiguration(indexFieldPath, kubeconfigStore) + errors = append(errors, errorList...) + } + // if the kubeconfig store uses an index, we need to specify a unique ID for the kubeconfigStore to write a unique index file name if storeUsesIndex && storeKinds.Has(fmt.Sprintf("%s:%s", kubeconfigStore.Kind, *id)) { errors = append(errors, field.Invalid(indexFieldPath.Child("id"), id, fmt.Sprintf("there are multiple kubeconfig stores with the same Kind %q configured. "+ diff --git a/pkg/config/validation/validation_test.go b/pkg/config/validation/validation_test.go index 176f65704..dc95b6778 100644 --- a/pkg/config/validation/validation_test.go +++ b/pkg/config/validation/validation_test.go @@ -449,4 +449,147 @@ var _ = Describe("ValidateConfig", func() { )) }) }) + + Context("SKE store", func() { + It("should successfully validate a minimal SKE store config", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + Config: types.StoreConfigSKE{ + ProjectID: "my-project-id", + }, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).To(BeEmpty()) + }) + + It("should successfully validate an SKE store config with all fields set", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + Config: types.StoreConfigSKE{ + ProjectID: "my-project-id", + ProjectName: "my-project", + Region: "eu01", + UseStackitCLIAuth: true, + }, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).To(BeEmpty()) + }) + + It("should throw error - config is required", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).ToNot(BeEmpty()) + Expect(errorList).To(ConsistOf( + PointTo(MatchFields(IgnoreExtras, Fields{ + "Type": Equal(field.ErrorTypeRequired), + "Field": Equal("kubeconfigStores[0].config"), + })), + )) + }) + + It("should throw error - projectID is required", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + Config: types.StoreConfigSKE{}, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).ToNot(BeEmpty()) + Expect(errorList).To(ConsistOf( + PointTo(MatchFields(IgnoreExtras, Fields{ + "Type": Equal(field.ErrorTypeRequired), + "Field": Equal("kubeconfigStores[0].config.projectID"), + })), + )) + }) + + It("should throw error - paths are not allowed", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + Paths: []string{"some/path"}, + Config: types.StoreConfigSKE{ + ProjectID: "my-project-id", + }, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).ToNot(BeEmpty()) + Expect(errorList).To(ConsistOf( + PointTo(MatchFields(IgnoreExtras, Fields{ + "Type": Equal(field.ErrorTypeForbidden), + "Field": Equal("kubeconfigStores[0].paths"), + })), + )) + }) + + It("should throw error - config cannot be parsed", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + Config: []string{"wrong-config"}, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).ToNot(BeEmpty()) + Expect(errorList).To(ConsistOf( + PointTo(MatchFields(IgnoreExtras, Fields{ + "Type": Equal(field.ErrorTypeInvalid), + "Field": Equal("kubeconfigStores[0].config"), + })), + )) + }) + + It("should throw error - multiple auth methods specified", func() { + config := &types.Config{ + Version: "v1alpha1", + KubeconfigStores: []types.KubeconfigStore{ + { + Kind: types.StoreKindSKE, + Config: types.StoreConfigSKE{ + ProjectID: "my-project-id", + UseStackitCLIAuth: true, + ServiceAccountToken: "my-token", + }, + }, + }, + } + errorList := validation.ValidateConfig(config) + Expect(errorList).ToNot(BeEmpty()) + Expect(errorList).To(ConsistOf( + PointTo(MatchFields(IgnoreExtras, Fields{ + "Type": Equal(field.ErrorTypeInvalid), + "Field": Equal("kubeconfigStores[0].config"), + })), + )) + }) + }) }) diff --git a/pkg/index/index.go b/pkg/index/index.go index a08b77b09..70b33e76d 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -141,7 +141,7 @@ func (i *SearchIndex) WriteState(toWrite types.IndexState) error { if err != nil { return err } - defer file.Close() + defer file.Close() //nolint:errcheck output, err := yaml.Marshal(toWrite) if err != nil { @@ -162,7 +162,7 @@ func (i *SearchIndex) Write(toWrite types.Index) error { if err != nil { return err } - defer file.Close() + defer file.Close() //nolint:errcheck output, err := yaml.Marshal(toWrite) if err != nil { diff --git a/pkg/state/state.go b/pkg/state/state.go index bec3f83b7..2135e0b60 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -59,7 +59,7 @@ func UpdateHookState(hookName, stateFileName string) error { if err != nil { return err } - defer file.Close() + defer file.Close() //nolint:errcheck state := &types.HookState{ HookName: hookName, diff --git a/pkg/store/kubeconfig_store_azure.go b/pkg/store/kubeconfig_store_azure.go index 9cddbdda3..46afdd37c 100644 --- a/pkg/store/kubeconfig_store_azure.go +++ b/pkg/store/kubeconfig_store_azure.go @@ -115,7 +115,7 @@ func (s *AzureStore) StartSearch(channel chan storetypes.SearchResult) { for pager.NextPage(ctx) { s.Logger.Debugf("next page found for resource group %q", resourceGroup) - s.returnSearchResultsForClusters(channel, pager.PageResponse().ManagedClusterListResult.Value) + s.returnSearchResultsForClusters(channel, pager.PageResponse().Value) } if pager.Err() != nil { @@ -136,7 +136,7 @@ func (s *AzureStore) StartSearch(channel chan storetypes.SearchResult) { for pager.NextPage(ctx) { s.Logger.Debugf("next page found") - s.returnSearchResultsForClusters(channel, pager.PageResponse().ManagedClusterListResult.Value) + s.returnSearchResultsForClusters(channel, pager.PageResponse().Value) } s.Logger.Debugf("Search done for AKS") } @@ -153,7 +153,7 @@ func handleAzureError(channel chan storetypes.SearchResult, err error) { if err != nil { channel <- storetypes.SearchResult{ - Error: fmt.Errorf("Failed to list AKS clusters: %w", err), + Error: fmt.Errorf("failed to list AKS clusters: %w", err), } return } @@ -166,8 +166,8 @@ func (s *AzureStore) returnSearchResultsForClusters(channel chan storetypes.Sear continue } - if cluster.Resource.Name == nil { - s.Logger.Debugf("Resource name for cluster %q not set", *cluster.Resource.Name) + if cluster.Name == nil { + s.Logger.Debugf("Resource name for cluster %q not set", *cluster.Name) continue } @@ -181,7 +181,7 @@ func (s *AzureStore) returnSearchResultsForClusters(channel chan storetypes.Sear // - /subscriptions//resourcegroups/kubeswitch/providers/Microsoft.ContainerService/managedClusters/kubeswitch_test split := strings.Split(*cluster.ID, "/") if len(split) <= 4 { - s.Logger.Debugf("Unable to obtain resource group for cluster %q from cluster ID %q", *cluster.Resource.Name, *cluster.ID) + s.Logger.Debugf("Unable to obtain resource group for cluster %q from cluster ID %q", *cluster.Name, *cluster.ID) continue } diff --git a/pkg/store/kubeconfig_store_gardener.go b/pkg/store/kubeconfig_store_gardener.go index 1c878ee26..27a0a3a21 100644 --- a/pkg/store/kubeconfig_store_gardener.go +++ b/pkg/store/kubeconfig_store_gardener.go @@ -194,7 +194,7 @@ func writeGardenloginConfig(path string, config *GardenloginConfig) error { if err != nil { return err } - defer file.Close() + defer file.Close() //nolint:errcheck output, err := yaml.Marshal(config) if err != nil { diff --git a/pkg/store/kubeconfig_store_ovh.go b/pkg/store/kubeconfig_store_ovh.go index e093ab51f..584475c48 100644 --- a/pkg/store/kubeconfig_store_ovh.go +++ b/pkg/store/kubeconfig_store_ovh.go @@ -41,15 +41,15 @@ func NewOVHStore(store types.KubeconfigStore) (*OVHStore, error) { ovhApplicationKey := ovhStoreConfig.OVHApplicationKey if len(ovhApplicationKey) == 0 { - return nil, fmt.Errorf("When using the OVH kubeconfig store, the application key for OVH has to be provided via a SwitchConfig file") + return nil, fmt.Errorf("when using the OVH kubeconfig store, the application key for OVH has to be provided via a SwitchConfig file") } ovhApplicationSecret := ovhStoreConfig.OVHApplicationSecret if len(ovhApplicationSecret) == 0 { - return nil, fmt.Errorf("When using the OVH kubeconfig store, the application secret for OVH has to be provided via a SwitchConfig file") + return nil, fmt.Errorf("when using the OVH kubeconfig store, the application secret for OVH has to be provided via a SwitchConfig file") } ovhConsumerKey := ovhStoreConfig.OVHConsumerKey if len(ovhConsumerKey) == 0 { - return nil, fmt.Errorf("When using the OVH kubeconfig store, the consumer key for OVH has to be provided via a SwitchConfig file") + return nil, fmt.Errorf("when using the OVH kubeconfig store, the consumer key for OVH has to be provided via a SwitchConfig file") } ovhEndpoint := ovhStoreConfig.OVHEndpoint if len(ovhEndpoint) == 0 { @@ -58,7 +58,7 @@ func NewOVHStore(store types.KubeconfigStore) (*OVHStore, error) { ovhClient, err := ovh.NewClient(ovhEndpoint, ovhApplicationKey, ovhApplicationSecret, ovhConsumerKey) if err != nil { - return nil, fmt.Errorf("Failed to initialize OVH client due to error: %w", err) + return nil, fmt.Errorf("failed to initialize OVH client due to error: %w", err) } return &OVHStore{ diff --git a/pkg/store/kubeconfig_store_scaleway.go b/pkg/store/kubeconfig_store_scaleway.go index 2f2c21d93..027ecb98b 100644 --- a/pkg/store/kubeconfig_store_scaleway.go +++ b/pkg/store/kubeconfig_store_scaleway.go @@ -44,15 +44,15 @@ func NewScalewayStore(store types.KubeconfigStore) (*ScalewayStore, error) { scalewayAccessKey := scalewayStoreConfig.ScalewayAccessKey if len(scalewayAccessKey) == 0 { - return nil, fmt.Errorf("When using the Scaleway kubeconfig store, the access key for Scaleway has to be provided via a SwitchConfig file") + return nil, fmt.Errorf("when using the Scaleway kubeconfig store, the access key for Scaleway has to be provided via a SwitchConfig file") } scalewayOrganizationID := scalewayStoreConfig.ScalewayOrganizationID if len(scalewayOrganizationID) == 0 { - return nil, fmt.Errorf("When using the Scaleway kubeconfig store, the organization ID for Scaleway has to be provided via a SwitchConfig file") + return nil, fmt.Errorf("when using the Scaleway kubeconfig store, the organization ID for Scaleway has to be provided via a SwitchConfig file") } scalewaySecretKey := scalewayStoreConfig.ScalewaySecretKey if len(scalewaySecretKey) == 0 { - return nil, fmt.Errorf("When using the Scaleway kubeconfig store, the secret key for Scaleway has to be provided via a SwitchConfig file") + return nil, fmt.Errorf("when using the Scaleway kubeconfig store, the secret key for Scaleway has to be provided via a SwitchConfig file") } scalewayRegion := scalewayStoreConfig.ScalewayRegion if len(scalewayRegion) == 0 { @@ -66,7 +66,7 @@ func NewScalewayStore(store types.KubeconfigStore) (*ScalewayStore, error) { scw.WithDefaultRegion(scw.Region(scalewayRegion)), ) if err != nil { - return nil, fmt.Errorf("Failed to initialize Scaleway client due to error: %w", err) + return nil, fmt.Errorf("failed to initialize Scaleway client due to error: %w", err) } return &ScalewayStore{ @@ -122,7 +122,7 @@ func (s *ScalewayStore) StartSearch(channel chan storetypes.SearchResult) { if papi == nil { channel <- storetypes.SearchResult{ KubeconfigPath: "", - Error: fmt.Errorf("Failed to create scaleway project API"), + Error: fmt.Errorf("failed to create scaleway project API"), } return } @@ -132,7 +132,7 @@ func (s *ScalewayStore) StartSearch(channel chan storetypes.SearchResult) { if err != nil { channel <- storetypes.SearchResult{ KubeconfigPath: "", - Error: fmt.Errorf("Could no list projects in Scaleway err: %w", err), + Error: fmt.Errorf("could no list projects in Scaleway err: %w", err), } return } @@ -142,7 +142,7 @@ func (s *ScalewayStore) StartSearch(channel chan storetypes.SearchResult) { if kapi == nil { channel <- storetypes.SearchResult{ KubeconfigPath: "", - Error: fmt.Errorf("Failed to create Kubernetes API instance for scaleway err: %w", err), + Error: fmt.Errorf("failed to create Kubernetes API instance for scaleway err: %w", err), } return } @@ -152,7 +152,7 @@ func (s *ScalewayStore) StartSearch(channel chan storetypes.SearchResult) { if err != nil { channel <- storetypes.SearchResult{ KubeconfigPath: "", - Error: fmt.Errorf("Failed to retrieve Kubernetes cluster for project %v err: %w", project.Name, err), + Error: fmt.Errorf("failed to retrieve Kubernetes cluster for project %v err: %w", project.Name, err), } return } diff --git a/pkg/store/kubeconfig_store_ske.go b/pkg/store/kubeconfig_store_ske.go new file mode 100644 index 000000000..1868bba8e --- /dev/null +++ b/pkg/store/kubeconfig_store_ske.go @@ -0,0 +1,212 @@ +// Copyright 2021 The Kubeswitch authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package store + +import ( + "bytes" + "context" + "fmt" + "net/http" + "os/exec" + "strings" + + "github.com/sirupsen/logrus" + stackitconfig "github.com/stackitcloud/stackit-sdk-go/core/config" + ske "github.com/stackitcloud/stackit-sdk-go/services/ske" //nolint:staticcheck + "gopkg.in/yaml.v3" + + storetypes "github.com/danielfoehrkn/kubeswitch/pkg/store/types" + "github.com/danielfoehrkn/kubeswitch/types" +) + +// stackitCLIRoundTripper is an http.RoundTripper that obtains a fresh bearer token +// by invoking the STACKIT CLI (`stackit auth get-access-token`) on every request. +// The CLI manages the token lifecycle (refresh, expiry) transparently, so this +// works as long as the user has previously run `stackit auth login`. +type stackitCLIRoundTripper struct { + next http.RoundTripper +} + +func (rt *stackitCLIRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + var stdout, stderr bytes.Buffer + cmd := exec.CommandContext(req.Context(), "stackit", "auth", "get-access-token") + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + return nil, fmt.Errorf("stackit auth get-access-token failed: %w: %s", err, stderr.String()) + } + token := strings.TrimSpace(stdout.String()) + if token == "" { + return nil, fmt.Errorf("stackit auth get-access-token returned an empty token") + } + + reqClone := req.Clone(req.Context()) + reqClone.Header.Set("Authorization", "Bearer "+token) + + next := rt.next + if next == nil { + next = http.DefaultTransport + } + return next.RoundTrip(reqClone) +} + +const skeDefaultRegion = "eu01" + +// NewSKEStore creates a new SKE (STACKIT Kubernetes Engine) store. +func NewSKEStore(store types.KubeconfigStore) (*SKEStore, error) { + skeStoreConfig := &types.StoreConfigSKE{} + if store.Config != nil { + buf, err := yaml.Marshal(store.Config) + if err != nil { + return nil, fmt.Errorf("failed to process SKE store config: %w", err) + } + if err = yaml.Unmarshal(buf, skeStoreConfig); err != nil { + return nil, fmt.Errorf("failed to unmarshal SKE store config: %w", err) + } + } + + if skeStoreConfig.ProjectID == "" { + return nil, fmt.Errorf("when using the SKE kubeconfig store, a STACKIT project ID must be provided via the store config (projectID)") + } + + if skeStoreConfig.Region == "" { + skeStoreConfig.Region = skeDefaultRegion + } + + // Build client options + var opts []stackitconfig.ConfigurationOption + if skeStoreConfig.UseStackitCLIAuth { + // Verify the CLI is available + if _, err := exec.LookPath("stackit"); err != nil { + return nil, fmt.Errorf("useStackitCLIAuth is enabled but the 'stackit' CLI was not found in PATH: %w", err) + } + opts = append(opts, stackitconfig.WithCustomAuth(&stackitCLIRoundTripper{})) + } else if skeStoreConfig.ServiceAccountToken != "" { + opts = append(opts, stackitconfig.WithToken(skeStoreConfig.ServiceAccountToken)) + } else if skeStoreConfig.ServiceAccountKeyPath != "" { + opts = append(opts, stackitconfig.WithServiceAccountKeyPath(skeStoreConfig.ServiceAccountKeyPath)) + } + // If none of the above, the SDK will use environment variables or ~/.stackit/credentials.json + + client, err := ske.NewAPIClient(opts...) + if err != nil { + return nil, fmt.Errorf("failed to initialize STACKIT SKE client: %w", err) + } + + logger := logrus.New().WithField("store", types.StoreKindSKE) + + return &SKEStore{ + Logger: logger, + KubeconfigStore: store, + Client: client, + Config: skeStoreConfig, + }, nil +} + +func (s *SKEStore) GetID() string { + id := "default" + if s.KubeconfigStore.ID != nil { + id = *s.KubeconfigStore.ID + } + return fmt.Sprintf("%s.%s", types.StoreKindSKE, id) +} + +func (s *SKEStore) GetContextPrefix(path string) string { + if s.GetStoreConfig().ShowPrefix != nil && !*s.GetStoreConfig().ShowPrefix { + return "" + } + + storePrefix := string(types.StoreKindSKE) + if s.GetStoreConfig().ID != nil { + storePrefix = *s.GetStoreConfig().ID + } + + projectLabel := s.Config.ProjectID + if s.Config.ProjectName != "" { + projectLabel = s.Config.ProjectName + } + + return storePrefix + "/" + projectLabel +} + +func (s *SKEStore) GetKind() types.StoreKind { + return types.StoreKindSKE +} + +func (s *SKEStore) GetStoreConfig() types.KubeconfigStore { + return s.KubeconfigStore +} + +func (s *SKEStore) GetLogger() *logrus.Entry { + return s.Logger +} + +func (s *SKEStore) StartSearch(channel chan storetypes.SearchResult) { + s.Logger.Debug("SKE: start search") + + ctx := context.Background() + resp, err := s.Client.ListClustersExecute(ctx, s.Config.ProjectID, s.Config.Region) //nolint:staticcheck + if err != nil { + channel <- storetypes.SearchResult{ + KubeconfigPath: "", + Error: fmt.Errorf("SKE: failed to list clusters for project %q in region %q: %w", s.Config.ProjectID, s.Config.Region, err), + } + return + } + + if resp == nil || !resp.HasItems() { + s.Logger.Debugf("SKE: no clusters found in project %q region %q", s.Config.ProjectID, s.Config.Region) + return + } + + projectLabel := s.Config.ProjectID + if s.Config.ProjectName != "" { + projectLabel = s.Config.ProjectName + } + s.Logger.Debugf("SKE: using project label %q for display", projectLabel) + + for _, cluster := range resp.GetItems() { + name := cluster.GetName() + if name == "" { + continue + } + channel <- storetypes.SearchResult{ + KubeconfigPath: name, + Error: nil, + } + } +} + +func (s *SKEStore) GetKubeconfigForPath(clusterName string, _ map[string]string) ([]byte, error) { + s.Logger.Debugf("SKE: getting kubeconfig for cluster %q", clusterName) + + ctx := context.Background() + kubeconfigResp, err := s.Client.CreateKubeconfig(ctx, s.Config.ProjectID, s.Config.Region, clusterName). //nolint:staticcheck + CreateKubeconfigPayload(*ske.NewCreateKubeconfigPayload()). + Execute() //nolint:staticcheck + if err != nil { + return nil, fmt.Errorf("SKE: failed to create kubeconfig for cluster %q: %w", clusterName, err) + } + + if kubeconfigResp == nil || !kubeconfigResp.HasKubeconfig() { + return nil, fmt.Errorf("SKE: received empty kubeconfig for cluster %q", clusterName) + } + + return []byte(kubeconfigResp.GetKubeconfig()), nil +} + +func (s *SKEStore) VerifyKubeconfigPaths() error { + return nil +} diff --git a/pkg/store/kubeconfig_store_vault.go b/pkg/store/kubeconfig_store_vault.go index 0c9130c88..181fdc60c 100644 --- a/pkg/store/kubeconfig_store_vault.go +++ b/pkg/store/kubeconfig_store_vault.go @@ -20,14 +20,12 @@ import ( "fmt" "log" "os" - "path" paths "path" "path/filepath" "sort" "strings" "sync" - "github.com/hashicorp/vault/api" vaultapi "github.com/hashicorp/vault/api" "github.com/sirupsen/logrus" "gopkg.in/yaml.v3" @@ -148,7 +146,7 @@ func (s *VaultStore) GetLogger() *logrus.Entry { // and calls the `visit` functor for each of the directory and leaf paths. // Note: for kv-v2, a "metadata" path is expected and "metadata" paths will be // returned in the visit functor. -func (s *VaultStore) recursivePathTraversal(wg *sync.WaitGroup, ctx context.Context, client *api.Client, path string, visit func(path string, directory bool) error) { +func (s *VaultStore) recursivePathTraversal(wg *sync.WaitGroup, ctx context.Context, client *vaultapi.Client, path string, visit func(path string, directory bool) error) { defer wg.Done() resp, err := client.Logical().ListWithContext(ctx, path) @@ -309,7 +307,7 @@ func (s *VaultStore) GetKubeconfigForPath(path string, _ map[string]string) ([]b } } else { if secret.Data["data"] == nil { - return nil, fmt.Errorf("cannot read kubeconfig from %q. Secret is empty.", secretsPath) + return nil, fmt.Errorf("cannot read kubeconfig from %q. secret is empty", secretsPath) } value, ok := secret.Data["data"].(map[string]interface{})[s.VaultKeyKubeconfig] if ok { @@ -358,7 +356,7 @@ func (s *VaultStore) VerifyKubeconfigPaths() error { func shimKVv2Path(rawPath, mountPath string) string { switch { case rawPath == mountPath, rawPath == strings.TrimSuffix(mountPath, "/"): - return path.Join(mountPath, "data") + return paths.Join(mountPath, "data") default: p := strings.TrimPrefix(rawPath, mountPath) @@ -367,7 +365,7 @@ func shimKVv2Path(rawPath, mountPath string) string { if strings.HasPrefix(p, "data/") || strings.HasPrefix(p, "metadata/") { return rawPath } - return path.Join(mountPath, "data", p) + return paths.Join(mountPath, "data", p) } } @@ -376,21 +374,21 @@ func shimKVv2Path(rawPath, mountPath string) string { func shimKvV2ListPath(rawPath, mountPath string) string { mountPath = strings.TrimSuffix(mountPath, "/") - if strings.HasPrefix(rawPath, path.Join(mountPath, "metadata")) { + if strings.HasPrefix(rawPath, paths.Join(mountPath, "metadata")) { // It doesn't need modifying. return rawPath } - switch { - case rawPath == mountPath: - return path.Join(mountPath, "metadata") + switch rawPath { + case mountPath: + return paths.Join(mountPath, "metadata") default: rawPath = strings.TrimPrefix(rawPath, mountPath) - return path.Join(mountPath, "metadata", rawPath) + return paths.Join(mountPath, "metadata", rawPath) } } // shimKVv2Metadata removes metadata/ from the path func shimKVv2Metadata(path string) string { - return strings.Replace(path, "metadata/", "", -1) + return strings.ReplaceAll(path, "metadata/", "") } diff --git a/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store.pb.go b/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store.pb.go index 7d84df947..dc015e9a1 100644 --- a/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store.pb.go +++ b/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store.pb.go @@ -7,10 +7,11 @@ package kubeconfigstorev1 import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store_grpc.pb.go b/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store_grpc.pb.go index dc1a4c0c5..599d800fc 100644 --- a/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store_grpc.pb.go +++ b/pkg/store/plugins/kubeconfigstore/v1/kubeconfig_store_grpc.pb.go @@ -8,6 +8,7 @@ package kubeconfigstorev1 import ( context "context" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/pkg/store/ske/validation.go b/pkg/store/ske/validation.go new file mode 100644 index 000000000..cbeb76743 --- /dev/null +++ b/pkg/store/ske/validation.go @@ -0,0 +1,80 @@ +// Copyright 2021 The Kubeswitch authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ske + +import ( + "fmt" + + "gopkg.in/yaml.v3" + "k8s.io/apimachinery/pkg/util/validation/field" + + "github.com/danielfoehrkn/kubeswitch/types" +) + +// ValidateSKEStoreConfiguration validates the store configuration for SKE. +// It is tested as part of the validation test suite. +func ValidateSKEStoreConfiguration(path *field.Path, store types.KubeconfigStore) field.ErrorList { + var errors field.ErrorList + + if len(store.Paths) > 0 { + errors = append(errors, field.Forbidden(path.Child("paths"), "Configuring paths for the SKE store is not allowed")) + } + + configPath := path.Child("config") + if store.Config == nil { + errors = append(errors, field.Required(configPath, "The SKE store requires a config block with at least a projectID")) + return errors + } + + config, err := getStoreConfig(store) + if err != nil { + errors = append(errors, field.Invalid(configPath, store.Config, err.Error())) + return errors + } + + if config.ProjectID == "" { + errors = append(errors, field.Required(configPath.Child("projectID"), "A STACKIT project ID must be provided")) + } + + authMethods := 0 + if config.UseStackitCLIAuth { + authMethods++ + } + if config.ServiceAccountToken != "" { + authMethods++ + } + if config.ServiceAccountKeyPath != "" { + authMethods++ + } + if authMethods > 1 { + errors = append(errors, field.Invalid(configPath, store.Config, + "Only one authentication method may be specified: useStackitCLIAuth, serviceAccountToken, or serviceAccountKeyPath")) + } + + return errors +} + +// getStoreConfig unmarshals the raw store config into StoreConfigSKE. +func getStoreConfig(store types.KubeconfigStore) (*types.StoreConfigSKE, error) { + buf, err := yaml.Marshal(store.Config) + if err != nil { + return nil, fmt.Errorf("failed to marshal store config: %w", err) + } + config := &types.StoreConfigSKE{} + if err := yaml.Unmarshal(buf, config); err != nil { + return nil, fmt.Errorf("failed to unmarshal store config: %w", err) + } + return config, nil +} diff --git a/pkg/store/types.go b/pkg/store/types.go index 14e66d307..7bcdcae4c 100644 --- a/pkg/store/types.go +++ b/pkg/store/types.go @@ -36,6 +36,7 @@ import ( managementClient "github.com/rancher/rancher/pkg/client/generated/management/v3" "github.com/scaleway/scaleway-sdk-go/scw" "github.com/sirupsen/logrus" + ske "github.com/stackitcloud/stackit-sdk-go/services/ske" //nolint:staticcheck gkev1 "google.golang.org/api/container/v1" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -179,3 +180,10 @@ type PluginStore struct { Config *types.StoreConfigPlugin Client plugins.Store } + +type SKEStore struct { + Logger *logrus.Entry + KubeconfigStore types.KubeconfigStore + Client *ske.APIClient + Config *types.StoreConfigSKE +} diff --git a/pkg/subcommands/alias/state/alias.go b/pkg/subcommands/alias/state/alias.go index 06f3ed26b..22fa5a712 100644 --- a/pkg/subcommands/alias/state/alias.go +++ b/pkg/subcommands/alias/state/alias.go @@ -111,7 +111,7 @@ func (a *Alias) WriteAllAliases() error { if err != nil { return err } - defer file.Close() + defer file.Close() //nolint:errcheck output, err := yaml.Marshal(a.Content) if err != nil { diff --git a/pkg/subcommands/history/util/util.go b/pkg/subcommands/history/util/util.go index 217d57ff6..6e45c8d48 100644 --- a/pkg/subcommands/history/util/util.go +++ b/pkg/subcommands/history/util/util.go @@ -35,7 +35,7 @@ func ReadHistory() ([]string, error) { } return nil, err } - defer file.Close() + defer file.Close() //nolint:errcheck var lines []string scanner := bufio.NewScanner(file) @@ -54,7 +54,7 @@ func AppendToHistory(context, namespace string) error { if err != nil { return err } - defer f.Close() + defer f.Close() //nolint:errcheck historyEntry := fmt.Sprintf("%s:: %s\n", context, namespace) @@ -96,7 +96,7 @@ func getLastLineWithSeek(filepath string) (string, error) { if err != nil { return "", fmt.Errorf("cannot open file: %v", err) } - defer fileHandle.Close() + defer fileHandle.Close() //nolint:errcheck line := "" var cursor int64 = 0 diff --git a/pkg/subcommands/ns/ns_index.go b/pkg/subcommands/ns/ns_index.go index 7ec4148c6..43ce13782 100644 --- a/pkg/subcommands/ns/ns_index.go +++ b/pkg/subcommands/ns/ns_index.go @@ -80,7 +80,7 @@ func (i *NamespaceCache) loadFromFile() ([]string, error) { if err != nil { return nil, err } - defer file.Close() + defer file.Close() //nolint:errcheck var lines []string scanner := bufio.NewScanner(file) @@ -96,7 +96,7 @@ func (i *NamespaceCache) Write(toWrite []string) error { if err != nil { return err } - defer file.Close() + defer file.Close() //nolint:errcheck // print values to f, one per line for _, value := range toWrite { diff --git a/types/config.go b/types/config.go index 810b59e08..5838c9f01 100644 --- a/types/config.go +++ b/types/config.go @@ -24,7 +24,7 @@ import ( type StoreKind string // ValidStoreKinds contains all valid store kinds -var ValidStoreKinds = sets.NewString(string(StoreKindVault), string(StoreKindFilesystem), string(StoreKindGardener), string(StoreKindGKE), string(StoreKindAzure), string(StoreKindEKS), string(StoreKindExoscale), string(StoreKindRancher), string(StoreKindOVH), string(StoreKindScaleway), string(StoreKindDigitalOcean), string(StoreKindAkamai), string(StoreKindCapi), string(StoreKindPlugin)) +var ValidStoreKinds = sets.NewString(string(StoreKindVault), string(StoreKindFilesystem), string(StoreKindGardener), string(StoreKindGKE), string(StoreKindAzure), string(StoreKindEKS), string(StoreKindExoscale), string(StoreKindRancher), string(StoreKindOVH), string(StoreKindScaleway), string(StoreKindDigitalOcean), string(StoreKindAkamai), string(StoreKindCapi), string(StoreKindPlugin), string(StoreKindSKE)) // ValidConfigVersions contains all valid config versions var ValidConfigVersions = sets.NewString("v1alpha1") @@ -58,6 +58,8 @@ const ( StoreKindCapi StoreKind = "capi" // StoreKindPlugin is an identifier for the Plugin store StoreKindPlugin StoreKind = "plugin" + // StoreKindSKE is an identifier for the STACKIT Kubernetes Engine store + StoreKindSKE StoreKind = "ske" ) type Config struct { @@ -288,3 +290,29 @@ type StoreConfigPlugin struct { CmdPath string `yaml:"cmdPath"` Args []string `yaml:"args"` } + +type StoreConfigSKE struct { + // ProjectID is the STACKIT project ID to list SKE clusters from + ProjectID string `yaml:"projectID"` + // ProjectName is an optional human-readable label for the project. + // If set, it is used in the displayed context path instead of the project ID: + // ske//. Falls back to projectID if not set. + // + optional + ProjectName string `yaml:"projectName"` + // Region is the STACKIT region, e.g. "eu01" (default: "eu01") + // + optional + Region string `yaml:"region"` + // ServiceAccountToken is the STACKIT service account token used for authentication. + // If not set, will fall back to STACKIT_SERVICE_ACCOUNT_TOKEN env variable or + // the credentials configured in ServiceAccountKeyPath. + // + optional + ServiceAccountToken string `yaml:"serviceAccountToken"` + // ServiceAccountKeyPath is the path to a STACKIT service account key JSON file. + // + optional + ServiceAccountKeyPath string `yaml:"serviceAccountKeyPath"` + // UseStackitCLIAuth delegates authentication to the STACKIT CLI session. + // Requires the `stackit` CLI to be installed and the user to have run `stackit auth login`. + // The CLI transparently handles token refresh, so no manual credential management is needed. + // + optional + UseStackitCLIAuth bool `yaml:"useStackitCLIAuth"` +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/.gitignore b/vendor/github.com/golang-jwt/jwt/v5/.gitignore new file mode 100644 index 000000000..09573e016 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +bin +.idea/ + diff --git a/vendor/github.com/golang-jwt/jwt/v5/LICENSE b/vendor/github.com/golang-jwt/jwt/v5/LICENSE new file mode 100644 index 000000000..35dbc2520 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) 2012 Dave Grijalva +Copyright (c) 2021 golang-jwt maintainers + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md new file mode 100644 index 000000000..b3178e751 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md @@ -0,0 +1,195 @@ +# Migration Guide (v5.0.0) + +Version `v5` contains a major rework of core functionalities in the `jwt-go` +library. This includes support for several validation options as well as a +re-design of the `Claims` interface. Lastly, we reworked how errors work under +the hood, which should provide a better overall developer experience. + +Starting from [v5.0.0](https://github.com/golang-jwt/jwt/releases/tag/v5.0.0), +the import path will be: + + "github.com/golang-jwt/jwt/v5" + +For most users, changing the import path *should* suffice. However, since we +intentionally changed and cleaned some of the public API, existing programs +might need to be updated. The following sections describe significant changes +and corresponding updates for existing programs. + +## Parsing and Validation Options + +Under the hood, a new `Validator` struct takes care of validating the claims. A +long awaited feature has been the option to fine-tune the validation of tokens. +This is now possible with several `ParserOption` functions that can be appended +to most `Parse` functions, such as `ParseWithClaims`. The most important options +and changes are: + * Added `WithLeeway` to support specifying the leeway that is allowed when + validating time-based claims, such as `exp` or `nbf`. + * Changed default behavior to not check the `iat` claim. Usage of this claim + is OPTIONAL according to the JWT RFC. The claim itself is also purely + informational according to the RFC, so a strict validation failure is not + recommended. If you want to check for sensible values in these claims, + please use the `WithIssuedAt` parser option. + * Added `WithAudience`, `WithSubject` and `WithIssuer` to support checking for + expected `aud`, `sub` and `iss`. + * Added `WithStrictDecoding` and `WithPaddingAllowed` options to allow + previously global settings to enable base64 strict encoding and the parsing + of base64 strings with padding. The latter is strictly speaking against the + standard, but unfortunately some of the major identity providers issue some + of these incorrect tokens. Both options are disabled by default. + +## Changes to the `Claims` interface + +### Complete Restructuring + +Previously, the claims interface was satisfied with an implementation of a +`Valid() error` function. This had several issues: + * The different claim types (struct claims, map claims, etc.) then contained + similar (but not 100 % identical) code of how this validation was done. This + lead to a lot of (almost) duplicate code and was hard to maintain + * It was not really semantically close to what a "claim" (or a set of claims) + really is; which is a list of defined key/value pairs with a certain + semantic meaning. + +Since all the validation functionality is now extracted into the validator, all +`VerifyXXX` and `Valid` functions have been removed from the `Claims` interface. +Instead, the interface now represents a list of getters to retrieve values with +a specific meaning. This allows us to completely decouple the validation logic +with the underlying storage representation of the claim, which could be a +struct, a map or even something stored in a database. + +```go +type Claims interface { + GetExpirationTime() (*NumericDate, error) + GetIssuedAt() (*NumericDate, error) + GetNotBefore() (*NumericDate, error) + GetIssuer() (string, error) + GetSubject() (string, error) + GetAudience() (ClaimStrings, error) +} +``` + +Users that previously directly called the `Valid` function on their claims, +e.g., to perform validation independently of parsing/verifying a token, can now +use the `jwt.NewValidator` function to create a `Validator` independently of the +`Parser`. + +```go +var v = jwt.NewValidator(jwt.WithLeeway(5*time.Second)) +v.Validate(myClaims) +``` + +### Supported Claim Types and Removal of `StandardClaims` + +The two standard claim types supported by this library, `MapClaims` and +`RegisteredClaims` both implement the necessary functions of this interface. The +old `StandardClaims` struct, which has already been deprecated in `v4` is now +removed. + +Users using custom claims, in most cases, will not experience any changes in the +behavior as long as they embedded `RegisteredClaims`. If they created a new +claim type from scratch, they now need to implemented the proper getter +functions. + +### Migrating Application Specific Logic of the old `Valid` + +Previously, users could override the `Valid` method in a custom claim, for +example to extend the validation with application-specific claims. However, this +was always very dangerous, since once could easily disable the standard +validation and signature checking. + +In order to avoid that, while still supporting the use-case, a new +`ClaimsValidator` interface has been introduced. This interface consists of the +`Validate() error` function. If the validator sees, that a `Claims` struct +implements this interface, the errors returned to the `Validate` function will +be *appended* to the regular standard validation. It is not possible to disable +the standard validation anymore (even only by accident). + +Usage examples can be found in [example_test.go](./example_test.go), to build +claims structs like the following. + +```go +// MyCustomClaims includes all registered claims, plus Foo. +type MyCustomClaims struct { + Foo string `json:"foo"` + jwt.RegisteredClaims +} + +// Validate can be used to execute additional application-specific claims +// validation. +func (m MyCustomClaims) Validate() error { + if m.Foo != "bar" { + return errors.New("must be foobar") + } + + return nil +} +``` + +## Changes to the `Token` and `Parser` struct + +The previously global functions `DecodeSegment` and `EncodeSegment` were moved +to the `Parser` and `Token` struct respectively. This will allow us in the +future to configure the behavior of these two based on options supplied on the +parser or the token (creation). This also removes two previously global +variables and moves them to parser options `WithStrictDecoding` and +`WithPaddingAllowed`. + +In order to do that, we had to adjust the way signing methods work. Previously +they were given a base64 encoded signature in `Verify` and were expected to +return a base64 encoded version of the signature in `Sign`, both as a `string`. +However, this made it necessary to have `DecodeSegment` and `EncodeSegment` +global and was a less than perfect design because we were repeating +encoding/decoding steps for all signing methods. Now, `Sign` and `Verify` +operate on a decoded signature as a `[]byte`, which feels more natural for a +cryptographic operation anyway. Lastly, `Parse` and `SignedString` take care of +the final encoding/decoding part. + +In addition to that, we also changed the `Signature` field on `Token` from a +`string` to `[]byte` and this is also now populated with the decoded form. This +is also more consistent, because the other parts of the JWT, mainly `Header` and +`Claims` were already stored in decoded form in `Token`. Only the signature was +stored in base64 encoded form, which was redundant with the information in the +`Raw` field, which contains the complete token as base64. + +```go +type Token struct { + Raw string // Raw contains the raw token + Method SigningMethod // Method is the signing method used or to be used + Header map[string]any // Header is the first segment of the token in decoded form + Claims Claims // Claims is the second segment of the token in decoded form + Signature []byte // Signature is the third segment of the token in decoded form + Valid bool // Valid specifies if the token is valid +} +``` + +Most (if not all) of these changes should not impact the normal usage of this +library. Only users directly accessing the `Signature` field as well as +developers of custom signing methods should be affected. + +# Migration Guide (v4.0.0) + +Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), +the import path will be: + + "github.com/golang-jwt/jwt/v4" + +The `/v4` version will be backwards compatible with existing `v3.x.y` tags in +this repo, as well as `github.com/dgrijalva/jwt-go`. For most users this should +be a drop-in replacement, if you're having troubles migrating, please open an +issue. + +You can replace all occurrences of `github.com/dgrijalva/jwt-go` or +`github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually +or by using tools such as `sed` or `gofmt`. + +And then you'd typically run: + +``` +go get github.com/golang-jwt/jwt/v4 +go mod tidy +``` + +# Older releases (before v3.2.0) + +The original migration guide for older releases can be found at +https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md. diff --git a/vendor/github.com/golang-jwt/jwt/v5/README.md b/vendor/github.com/golang-jwt/jwt/v5/README.md new file mode 100644 index 000000000..17e7ea766 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/README.md @@ -0,0 +1,168 @@ +# jwt-go + +[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml) +[![Go +Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v5.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) +[![Coverage Status](https://coveralls.io/repos/github/golang-jwt/jwt/badge.svg?branch=main)](https://coveralls.io/github/golang-jwt/jwt?branch=main) + +A [go](http://www.golang.org) (or 'golang' for search engine friendliness) +implementation of [JSON Web +Tokens](https://datatracker.ietf.org/doc/html/rfc7519). + +Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) +this project adds Go module support, but maintains backward compatibility with +older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`. See the +[`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information. Version +v5.0.0 introduces major improvements to the validation of tokens, but is not +entirely backward compatible. + +> After the original author of the library suggested migrating the maintenance +> of `jwt-go`, a dedicated team of open source maintainers decided to clone the +> existing library into this repository. See +> [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a +> detailed discussion on this topic. + + +**SECURITY NOTICE:** Some older versions of Go have a security issue in the +crypto/elliptic. The recommendation is to upgrade to at least 1.15 See issue +[dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more +detail. + +**SECURITY NOTICE:** It's important that you [validate the `alg` presented is +what you +expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). +This library attempts to make it easy to do the right thing by requiring key +types to match the expected alg, but you should take the extra step to verify it in +your usage. See the examples provided. + +### Supported Go versions + +Our support of Go versions is aligned with Go's [version release +policy](https://golang.org/doc/devel/release#policy). So we will support a major +version of Go until there are two newer major releases. We no longer support +building jwt-go with unsupported Go versions, as these contain security +vulnerabilities that will not be fixed. + +## What the heck is a JWT? + +JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web +Tokens. + +In short, it's a signed JSON object that does something useful (for example, +authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is +made of three parts, separated by `.`'s. The first two parts are JSON objects, +that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) +encoded. The last part is the signature, encoded the same way. + +The first part is called the header. It contains the necessary information for +verifying the last part, the signature. For example, which encryption method +was used for signing and what key was used. + +The part in the middle is the interesting bit. It's called the Claims and +contains the actual stuff you care about. Refer to [RFC +7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about +reserved keys and the proper way to add your own. + +## What's in the box? + +This library supports the parsing and verification as well as the generation and +signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, +RSA-PSS, and ECDSA, though hooks are present for adding your own. + +## Installation Guidelines + +1. To install the jwt package, you first need to have + [Go](https://go.dev/doc/install) installed, then you can use the command + below to add `jwt-go` as a dependency in your Go program. + +```sh +go get -u github.com/golang-jwt/jwt/v5 +``` + +2. Import it in your code: + +```go +import "github.com/golang-jwt/jwt/v5" +``` + +## Usage + +A detailed usage guide, including how to sign and verify tokens can be found on +our [documentation website](https://golang-jwt.github.io/jwt/usage/create/). + +## Examples + +See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) +for examples of usage: + +* [Simple example of parsing and validating a + token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-Parse-Hmac) +* [Simple example of building and signing a + token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-New-Hmac) +* [Directory of + Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#pkg-examples) + +## Compliance + +This library was last reviewed to comply with [RFC +7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few +notable differences: + +* In order to protect against accidental use of [Unsecured + JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using + `alg=none` will only be accepted if the constant + `jwt.UnsafeAllowNoneSignatureType` is provided as the key. + +## Project Status & Versioning + +This library is considered production ready. Feedback and feature requests are +appreciated. The API should be considered stable. There should be very few +backward-incompatible changes outside of major version updates (and only with +good reason). + +This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull +requests will land on `main`. Periodically, versions will be tagged from +`main`. You can find all the releases on [the project releases +page](https://github.com/golang-jwt/jwt/releases). + +**BREAKING CHANGES:** A full list of breaking changes is available in +`VERSION_HISTORY.md`. See [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information on updating +your code. + +## Extensions + +This library publishes all the necessary components for adding your own signing +methods or key functions. Simply implement the `SigningMethod` interface and +register a factory method using `RegisterSigningMethod` or provide a +`jwt.Keyfunc`. + +A common use case would be integrating with different 3rd party signature +providers, like key management services from various cloud providers or Hardware +Security Modules (HSMs) or to implement additional standards. + +| Extension | Purpose | Repo | +| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | +| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go | +| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms | +| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc | +| TPM | Integrates with Trusted Platform Module (TPM) | https://github.com/salrashid123/golang-jwt-tpm | + +*Disclaimer*: Unless otherwise specified, these integrations are maintained by +third parties and should not be considered as a primary offer by any of the +mentioned cloud providers + +## More + +Go package documentation can be found [on +pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v5). Additional +documentation can be found on [our project +page](https://golang-jwt.github.io/jwt/). + +The command line utility included in this project (cmd/jwt) provides a +straightforward example of token creation and parsing as well as a useful tool +for debugging your own integration. You'll also find several implementation +examples in the documentation. + +[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version +of the JWT logo, which is distributed under the terms of the [MIT +License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt). diff --git a/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md new file mode 100644 index 000000000..2740597f1 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md @@ -0,0 +1,19 @@ +# Security Policy + +## Supported Versions + +As of November 2024 (and until this document is updated), the latest version `v5` is supported. In critical cases, we might supply back-ported patches for `v4`. + +## Reporting a Vulnerability + +If you think you found a vulnerability, and even if you are not sure, please report it a [GitHub Security Advisory](https://github.com/golang-jwt/jwt/security/advisories/new). Please try be explicit, describe steps to reproduce the security issue with code example(s). + +You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem. + +## Public Discussions + +Please avoid publicly discussing a potential security vulnerability. + +Let's take this offline and find a solution first, this limits the potential impact as much as possible. + +We appreciate your help! diff --git a/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md new file mode 100644 index 000000000..e39ca8efc --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md @@ -0,0 +1,137 @@ +# `jwt-go` Version History + +The following version history is kept for historic purposes. To retrieve the current changes of each version, please refer to the change-log of the specific release versions on https://github.com/golang-jwt/jwt/releases. + +## 4.0.0 + +* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`. + +## 3.2.2 + +* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)). +* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)). +* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)). +* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)). + +## 3.2.1 + +* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code + * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt` +* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160 + +#### 3.2.0 + +* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation +* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate +* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before. +* Deprecated `ParseFromRequestWithClaims` to simplify API in the future. + +#### 3.1.0 + +* Improvements to `jwt` command line tool +* Added `SkipClaimsValidation` option to `Parser` +* Documentation updates + +#### 3.0.0 + +* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code + * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. + * `ParseFromRequest` has been moved to `request` subpackage and usage has changed + * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. +* Other Additions and Changes + * Added `Claims` interface type to allow users to decode the claims into a custom type + * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. + * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage + * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` + * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. + * Added several new, more specific, validation errors to error type bitmask + * Moved examples from README to executable example files + * Signing method registry is now thread safe + * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) + +#### 2.7.0 + +This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. + +* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying +* Error text for expired tokens includes how long it's been expired +* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` +* Documentation updates + +#### 2.6.0 + +* Exposed inner error within ValidationError +* Fixed validation errors when using UseJSONNumber flag +* Added several unit tests + +#### 2.5.0 + +* Added support for signing method none. You shouldn't use this. The API tries to make this clear. +* Updated/fixed some documentation +* Added more helpful error message when trying to parse tokens that begin with `BEARER ` + +#### 2.4.0 + +* Added new type, Parser, to allow for configuration of various parsing parameters + * You can now specify a list of valid signing methods. Anything outside this set will be rejected. + * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON +* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) +* Fixed some bugs with ECDSA parsing + +#### 2.3.0 + +* Added support for ECDSA signing methods +* Added support for RSA PSS signing methods (requires go v1.4) + +#### 2.2.0 + +* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. + +#### 2.1.0 + +Backwards compatible API change that was missed in 2.0.0. + +* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` + +#### 2.0.0 + +There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. + +The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibility has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. + +It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. + +* **Compatibility Breaking Changes** + * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` + * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` + * `KeyFunc` now returns `interface{}` instead of `[]byte` + * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key + * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key +* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodHS256` + * Added public package global `SigningMethodHS384` + * Added public package global `SigningMethodHS512` +* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodRS256` + * Added public package global `SigningMethodRS384` + * Added public package global `SigningMethodRS512` +* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. +* Refactored the RSA implementation to be easier to read +* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` + +## 1.0.2 + +* Fixed bug in parsing public keys from certificates +* Added more tests around the parsing of keys for RS256 +* Code refactoring in RS256 implementation. No functional changes + +## 1.0.1 + +* Fixed panic if RS256 signing method was passed an invalid key + +## 1.0.0 + +* First versioned release +* API stabilized +* Supports creating, signing, parsing, and validating JWT tokens +* Supports RS256 and HS256 signing methods diff --git a/vendor/github.com/golang-jwt/jwt/v5/claims.go b/vendor/github.com/golang-jwt/jwt/v5/claims.go new file mode 100644 index 000000000..d50ff3dad --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/claims.go @@ -0,0 +1,16 @@ +package jwt + +// Claims represent any form of a JWT Claims Set according to +// https://datatracker.ietf.org/doc/html/rfc7519#section-4. In order to have a +// common basis for validation, it is required that an implementation is able to +// supply at least the claim names provided in +// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 namely `exp`, +// `iat`, `nbf`, `iss`, `sub` and `aud`. +type Claims interface { + GetExpirationTime() (*NumericDate, error) + GetIssuedAt() (*NumericDate, error) + GetNotBefore() (*NumericDate, error) + GetIssuer() (string, error) + GetSubject() (string, error) + GetAudience() (ClaimStrings, error) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/doc.go b/vendor/github.com/golang-jwt/jwt/v5/doc.go new file mode 100644 index 000000000..a86dc1a3b --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/doc.go @@ -0,0 +1,4 @@ +// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html +// +// See README.md for more info. +package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go new file mode 100644 index 000000000..06cd94d23 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go @@ -0,0 +1,134 @@ +package jwt + +import ( + "crypto" + "crypto/ecdsa" + "crypto/rand" + "errors" + "math/big" +) + +var ( + // Sadly this is missing from crypto/ecdsa compared to crypto/rsa + ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") +) + +// SigningMethodECDSA implements the ECDSA family of signing methods. +// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification +type SigningMethodECDSA struct { + Name string + Hash crypto.Hash + KeySize int + CurveBits int +} + +// Specific instances for EC256 and company +var ( + SigningMethodES256 *SigningMethodECDSA + SigningMethodES384 *SigningMethodECDSA + SigningMethodES512 *SigningMethodECDSA +) + +func init() { + // ES256 + SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} + RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { + return SigningMethodES256 + }) + + // ES384 + SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} + RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { + return SigningMethodES384 + }) + + // ES512 + SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} + RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { + return SigningMethodES512 + }) +} + +func (m *SigningMethodECDSA) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an ecdsa.PublicKey struct +func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key any) error { + // Get the key + var ecdsaKey *ecdsa.PublicKey + switch k := key.(type) { + case *ecdsa.PublicKey: + ecdsaKey = k + default: + return newError("ECDSA verify expects *ecdsa.PublicKey", ErrInvalidKeyType) + } + + if len(sig) != 2*m.KeySize { + return ErrECDSAVerification + } + + r := big.NewInt(0).SetBytes(sig[:m.KeySize]) + s := big.NewInt(0).SetBytes(sig[m.KeySize:]) + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus { + return nil + } + + return ErrECDSAVerification +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an ecdsa.PrivateKey struct +func (m *SigningMethodECDSA) Sign(signingString string, key any) ([]byte, error) { + // Get the key + var ecdsaKey *ecdsa.PrivateKey + switch k := key.(type) { + case *ecdsa.PrivateKey: + ecdsaKey = k + default: + return nil, newError("ECDSA sign expects *ecdsa.PrivateKey", ErrInvalidKeyType) + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return r, s + if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { + curveBits := ecdsaKey.Curve.Params().BitSize + + if m.CurveBits != curveBits { + return nil, ErrInvalidKey + } + + keyBytes := curveBits / 8 + if curveBits%8 > 0 { + keyBytes += 1 + } + + // We serialize the outputs (r and s) into big-endian byte arrays + // padded with zeros on the left to make sure the sizes work out. + // Output must be 2*keyBytes long. + out := make([]byte, 2*keyBytes) + r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output. + s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output. + + return out, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go new file mode 100644 index 000000000..44a3b7a1c --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go @@ -0,0 +1,69 @@ +package jwt + +import ( + "crypto/ecdsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") + ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") +) + +// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure +func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *ecdsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { + return nil, ErrNotECPrivateKey + } + + return pkey, nil +} + +// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key +func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + return nil, err + } + } + + var pkey *ecdsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { + return nil, ErrNotECPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go new file mode 100644 index 000000000..4159e57bf --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go @@ -0,0 +1,79 @@ +package jwt + +import ( + "crypto" + "crypto/ed25519" + "crypto/rand" + "errors" +) + +var ( + ErrEd25519Verification = errors.New("ed25519: verification error") +) + +// SigningMethodEd25519 implements the EdDSA family. +// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification +type SigningMethodEd25519 struct{} + +// Specific instance for EdDSA +var ( + SigningMethodEdDSA *SigningMethodEd25519 +) + +func init() { + SigningMethodEdDSA = &SigningMethodEd25519{} + RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod { + return SigningMethodEdDSA + }) +} + +func (m *SigningMethodEd25519) Alg() string { + return "EdDSA" +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an ed25519.PublicKey +func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key any) error { + var ed25519Key ed25519.PublicKey + var ok bool + + if ed25519Key, ok = key.(ed25519.PublicKey); !ok { + return newError("Ed25519 verify expects ed25519.PublicKey", ErrInvalidKeyType) + } + + if len(ed25519Key) != ed25519.PublicKeySize { + return ErrInvalidKey + } + + // Verify the signature + if !ed25519.Verify(ed25519Key, []byte(signingString), sig) { + return ErrEd25519Verification + } + + return nil +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an ed25519.PrivateKey +func (m *SigningMethodEd25519) Sign(signingString string, key any) ([]byte, error) { + var ed25519Key crypto.Signer + var ok bool + + if ed25519Key, ok = key.(crypto.Signer); !ok { + return nil, newError("Ed25519 sign expects crypto.Signer", ErrInvalidKeyType) + } + + if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok { + return nil, ErrInvalidKey + } + + // Sign the string and return the result. ed25519 performs a two-pass hash + // as part of its algorithm. Therefore, we need to pass a non-prehashed + // message into the Sign function, as indicated by crypto.Hash(0) + sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0)) + if err != nil { + return nil, err + } + + return sig, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go new file mode 100644 index 000000000..6f46e8860 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go @@ -0,0 +1,64 @@ +package jwt + +import ( + "crypto" + "crypto/ed25519" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key") + ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key") +) + +// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key +func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PrivateKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok { + return nil, ErrNotEdPrivateKey + } + + return pkey, nil +} + +// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key +func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PublicKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PublicKey); !ok { + return nil, ErrNotEdPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go new file mode 100644 index 000000000..14e007516 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/errors.go @@ -0,0 +1,89 @@ +package jwt + +import ( + "errors" + "fmt" + "strings" +) + +var ( + ErrInvalidKey = errors.New("key is invalid") + ErrInvalidKeyType = errors.New("key is of invalid type") + ErrHashUnavailable = errors.New("the requested hash function is unavailable") + ErrTokenMalformed = errors.New("token is malformed") + ErrTokenUnverifiable = errors.New("token is unverifiable") + ErrTokenSignatureInvalid = errors.New("token signature is invalid") + ErrTokenRequiredClaimMissing = errors.New("token is missing required claim") + ErrTokenInvalidAudience = errors.New("token has invalid audience") + ErrTokenExpired = errors.New("token is expired") + ErrTokenUsedBeforeIssued = errors.New("token used before issued") + ErrTokenInvalidIssuer = errors.New("token has invalid issuer") + ErrTokenInvalidSubject = errors.New("token has invalid subject") + ErrTokenNotValidYet = errors.New("token is not valid yet") + ErrTokenInvalidId = errors.New("token has invalid id") + ErrTokenInvalidClaims = errors.New("token has invalid claims") + ErrInvalidType = errors.New("invalid type for claim") +) + +// joinedError is an error type that works similar to what [errors.Join] +// produces, with the exception that it has a nice error string; mainly its +// error messages are concatenated using a comma, rather than a newline. +type joinedError struct { + errs []error +} + +func (je joinedError) Error() string { + msg := []string{} + for _, err := range je.errs { + msg = append(msg, err.Error()) + } + + return strings.Join(msg, ", ") +} + +// joinErrors joins together multiple errors. Useful for scenarios where +// multiple errors next to each other occur, e.g., in claims validation. +func joinErrors(errs ...error) error { + return &joinedError{ + errs: errs, + } +} + +// Unwrap implements the multiple error unwrapping for this error type, which is +// possible in Go 1.20. +func (je joinedError) Unwrap() []error { + return je.errs +} + +// newError creates a new error message with a detailed error message. The +// message will be prefixed with the contents of the supplied error type. +// Additionally, more errors, that provide more context can be supplied which +// will be appended to the message. This makes use of Go 1.20's possibility to +// include more than one %w formatting directive in [fmt.Errorf]. +// +// For example, +// +// newError("no keyfunc was provided", ErrTokenUnverifiable) +// +// will produce the error string +// +// "token is unverifiable: no keyfunc was provided" +func newError(message string, err error, more ...error) error { + var format string + var args []any + if message != "" { + format = "%w: %s" + args = []any{err, message} + } else { + format = "%w" + args = []any{err} + } + + for _, e := range more { + format += ": %w" + args = append(args, e) + } + + err = fmt.Errorf(format, args...) + return err +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/hmac.go b/vendor/github.com/golang-jwt/jwt/v5/hmac.go new file mode 100644 index 000000000..1bef138c3 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/hmac.go @@ -0,0 +1,104 @@ +package jwt + +import ( + "crypto" + "crypto/hmac" + "errors" +) + +// SigningMethodHMAC implements the HMAC-SHA family of signing methods. +// Expects key type of []byte for both signing and validation +type SigningMethodHMAC struct { + Name string + Hash crypto.Hash +} + +// Specific instances for HS256 and company +var ( + SigningMethodHS256 *SigningMethodHMAC + SigningMethodHS384 *SigningMethodHMAC + SigningMethodHS512 *SigningMethodHMAC + ErrSignatureInvalid = errors.New("signature is invalid") +) + +func init() { + // HS256 + SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { + return SigningMethodHS256 + }) + + // HS384 + SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { + return SigningMethodHS384 + }) + + // HS512 + SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { + return SigningMethodHS512 + }) +} + +func (m *SigningMethodHMAC) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod. Returns nil if +// the signature is valid. Key must be []byte. +// +// Note it is not advised to provide a []byte which was converted from a 'human +// readable' string using a subset of ASCII characters. To maximize entropy, you +// should ideally be providing a []byte key which was produced from a +// cryptographically random source, e.g. crypto/rand. Additional information +// about this, and why we intentionally are not supporting string as a key can +// be found on our usage guide +// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types. +func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key any) error { + // Verify the key is the right type + keyBytes, ok := key.([]byte) + if !ok { + return newError("HMAC verify expects []byte", ErrInvalidKeyType) + } + + // Can we use the specified hashing method? + if !m.Hash.Available() { + return ErrHashUnavailable + } + + // This signing method is symmetric, so we validate the signature + // by reproducing the signature from the signing string and key, then + // comparing that against the provided signature. + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + if !hmac.Equal(sig, hasher.Sum(nil)) { + return ErrSignatureInvalid + } + + // No validation errors. Signature is good. + return nil +} + +// Sign implements token signing for the SigningMethod. Key must be []byte. +// +// Note it is not advised to provide a []byte which was converted from a 'human +// readable' string using a subset of ASCII characters. To maximize entropy, you +// should ideally be providing a []byte key which was produced from a +// cryptographically random source, e.g. crypto/rand. Additional information +// about this, and why we intentionally are not supporting string as a key can +// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/. +func (m *SigningMethodHMAC) Sign(signingString string, key any) ([]byte, error) { + if keyBytes, ok := key.([]byte); ok { + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + + return hasher.Sum(nil), nil + } + + return nil, newError("HMAC sign expects []byte", ErrInvalidKeyType) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go new file mode 100644 index 000000000..3b9205272 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go @@ -0,0 +1,109 @@ +package jwt + +import ( + "encoding/json" + "fmt" +) + +// MapClaims is a claims type that uses the map[string]any for JSON +// decoding. This is the default claims type if you don't supply one +type MapClaims map[string]any + +// GetExpirationTime implements the Claims interface. +func (m MapClaims) GetExpirationTime() (*NumericDate, error) { + return m.parseNumericDate("exp") +} + +// GetNotBefore implements the Claims interface. +func (m MapClaims) GetNotBefore() (*NumericDate, error) { + return m.parseNumericDate("nbf") +} + +// GetIssuedAt implements the Claims interface. +func (m MapClaims) GetIssuedAt() (*NumericDate, error) { + return m.parseNumericDate("iat") +} + +// GetAudience implements the Claims interface. +func (m MapClaims) GetAudience() (ClaimStrings, error) { + return m.parseClaimsString("aud") +} + +// GetIssuer implements the Claims interface. +func (m MapClaims) GetIssuer() (string, error) { + return m.parseString("iss") +} + +// GetSubject implements the Claims interface. +func (m MapClaims) GetSubject() (string, error) { + return m.parseString("sub") +} + +// parseNumericDate tries to parse a key in the map claims type as a number +// date. This will succeed, if the underlying type is either a [float64] or a +// [json.Number]. Otherwise, nil will be returned. +func (m MapClaims) parseNumericDate(key string) (*NumericDate, error) { + v, ok := m[key] + if !ok { + return nil, nil + } + + switch exp := v.(type) { + case float64: + if exp == 0 { + return nil, nil + } + + return newNumericDateFromSeconds(exp), nil + case json.Number: + v, _ := exp.Float64() + + return newNumericDateFromSeconds(v), nil + } + + return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) +} + +// parseClaimsString tries to parse a key in the map claims type as a +// [ClaimsStrings] type, which can either be a string or an array of string. +func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) { + var cs []string + switch v := m[key].(type) { + case string: + cs = append(cs, v) + case []string: + cs = v + case []any: + for _, a := range v { + vs, ok := a.(string) + if !ok { + return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) + } + cs = append(cs, vs) + } + } + + return cs, nil +} + +// parseString tries to parse a key in the map claims type as a [string] type. +// If the key does not exist, an empty string is returned. If the key has the +// wrong type, an error is returned. +func (m MapClaims) parseString(key string) (string, error) { + var ( + ok bool + raw any + iss string + ) + raw, ok = m[key] + if !ok { + return "", nil + } + + iss, ok = raw.(string) + if !ok { + return "", newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) + } + + return iss, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/none.go b/vendor/github.com/golang-jwt/jwt/v5/none.go new file mode 100644 index 000000000..624ad55e8 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/none.go @@ -0,0 +1,50 @@ +package jwt + +// SigningMethodNone implements the none signing method. This is required by the spec +// but you probably should never use it. +var SigningMethodNone *signingMethodNone + +const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" + +var NoneSignatureTypeDisallowedError error + +type signingMethodNone struct{} +type unsafeNoneMagicConstant string + +func init() { + SigningMethodNone = &signingMethodNone{} + NoneSignatureTypeDisallowedError = newError("'none' signature type is not allowed", ErrTokenUnverifiable) + + RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { + return SigningMethodNone + }) +} + +func (m *signingMethodNone) Alg() string { + return "none" +} + +// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Verify(signingString string, sig []byte, key any) (err error) { + // Key must be UnsafeAllowNoneSignatureType to prevent accidentally + // accepting 'none' signing method + if _, ok := key.(unsafeNoneMagicConstant); !ok { + return NoneSignatureTypeDisallowedError + } + // If signing method is none, signature must be an empty string + if len(sig) != 0 { + return newError("'none' signing method with non-empty signature", ErrTokenUnverifiable) + } + + // Accept 'none' signing method. + return nil +} + +// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Sign(signingString string, key any) ([]byte, error) { + if _, ok := key.(unsafeNoneMagicConstant); ok { + return []byte{}, nil + } + + return nil, NoneSignatureTypeDisallowedError +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser.go b/vendor/github.com/golang-jwt/jwt/v5/parser.go new file mode 100644 index 000000000..5f803965c --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/parser.go @@ -0,0 +1,270 @@ +package jwt + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "strings" +) + +const tokenDelimiter = "." + +type Parser struct { + // If populated, only these methods will be considered valid. + validMethods []string + + // Use JSON Number format in JSON decoder. + useJSONNumber bool + + // Skip claims validation during token parsing. + skipClaimsValidation bool + + validator *Validator + + decodeStrict bool + + decodePaddingAllowed bool +} + +// NewParser creates a new Parser with the specified options +func NewParser(options ...ParserOption) *Parser { + p := &Parser{ + validator: &Validator{}, + } + + // Loop through our parsing options and apply them + for _, option := range options { + option(p) + } + + return p +} + +// Parse parses, validates, verifies the signature and returns the parsed token. +// keyFunc will receive the parsed token and should return the key for validating. +func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { + return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) +} + +// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims +// interface. This provides default values which can be overridden and allows a caller to use their own type, rather +// than the default MapClaims implementation of Claims. +// +// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims), +// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the +// proper memory for it before passing in the overall claims, otherwise you might run into a panic. +func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { + token, parts, err := p.ParseUnverified(tokenString, claims) + if err != nil { + return token, err + } + + // Verify signing method is in the required set + if p.validMethods != nil { + var signingMethodValid = false + var alg = token.Method.Alg() + for _, m := range p.validMethods { + if m == alg { + signingMethodValid = true + break + } + } + if !signingMethodValid { + // signing method is not in the listed set + return token, newError(fmt.Sprintf("signing method %v is invalid", alg), ErrTokenSignatureInvalid) + } + } + + // Lookup key(s) + if keyFunc == nil { + // keyFunc was not provided. short circuiting validation + return token, newError("no keyfunc was provided", ErrTokenUnverifiable) + } + + got, err := keyFunc(token) + if err != nil { + return token, newError("error while executing keyfunc", ErrTokenUnverifiable, err) + } + + // Join together header and claims in order to verify them with the signature + text := strings.Join(parts[0:2], ".") + switch have := got.(type) { + case VerificationKeySet: + if len(have.Keys) == 0 { + return token, newError("keyfunc returned empty verification key set", ErrTokenUnverifiable) + } + + // Iterate through keys and verify signature, skipping the rest when a match is found. + // Return the last error if no match is found. + for _, key := range have.Keys { + if err = token.Method.Verify(text, token.Signature, key); err == nil { + break + } + } + default: + err = token.Method.Verify(text, token.Signature, have) + } + if err != nil { + return token, newError("", ErrTokenSignatureInvalid, err) + } + + // Validate Claims + if !p.skipClaimsValidation { + // Make sure we have at least a default validator + if p.validator == nil { + p.validator = NewValidator() + } + + if err := p.validator.Validate(claims); err != nil { + return token, newError("", ErrTokenInvalidClaims, err) + } + } + + // No errors so far, token is valid. + token.Valid = true + + return token, nil +} + +// ParseUnverified parses the token but does not validate the signature. +// +// WARNING: Don't use this method unless you know what you're doing. +// +// It's only ever useful in cases where you know the signature is valid (since it has already +// been or will be checked elsewhere in the stack) and you want to extract values from it. +func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) { + var ok bool + parts, ok = splitToken(tokenString) + if !ok { + return nil, nil, newError("token contains an invalid number of segments", ErrTokenMalformed) + } + + token = &Token{Raw: tokenString} + + // Parse Header + var headerBytes []byte + if headerBytes, err = p.DecodeSegment(parts[0]); err != nil { + return token, parts, newError("could not base64 decode header", ErrTokenMalformed, err) + } + if err = json.Unmarshal(headerBytes, &token.Header); err != nil { + return token, parts, newError("could not JSON decode header", ErrTokenMalformed, err) + } + + // Parse Claims + token.Claims = claims + + claimBytes, err := p.DecodeSegment(parts[1]) + if err != nil { + return token, parts, newError("could not base64 decode claim", ErrTokenMalformed, err) + } + + // If `useJSONNumber` is enabled then we must use *json.Decoder to decode + // the claims. However, this comes with a performance penalty so only use + // it if we must and, otherwise, simple use json.Unmarshal. + if !p.useJSONNumber { + // JSON Unmarshal. Special case for map type to avoid weird pointer behavior. + if c, ok := token.Claims.(MapClaims); ok { + err = json.Unmarshal(claimBytes, &c) + } else { + err = json.Unmarshal(claimBytes, &claims) + } + } else { + dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) + dec.UseNumber() + // JSON Decode. Special case for map type to avoid weird pointer behavior. + if c, ok := token.Claims.(MapClaims); ok { + err = dec.Decode(&c) + } else { + err = dec.Decode(&claims) + } + } + if err != nil { + return token, parts, newError("could not JSON decode claim", ErrTokenMalformed, err) + } + + // Lookup signature method + if method, ok := token.Header["alg"].(string); ok { + if token.Method = GetSigningMethod(method); token.Method == nil { + return token, parts, newError("signing method (alg) is unavailable", ErrTokenUnverifiable) + } + } else { + return token, parts, newError("signing method (alg) is unspecified", ErrTokenUnverifiable) + } + + // Parse token signature + token.Signature, err = p.DecodeSegment(parts[2]) + if err != nil { + return token, parts, newError("could not base64 decode signature", ErrTokenMalformed, err) + } + + return token, parts, nil +} + +// splitToken splits a token string into three parts: header, claims, and signature. It will only +// return true if the token contains exactly two delimiters and three parts. In all other cases, it +// will return nil parts and false. +func splitToken(token string) ([]string, bool) { + parts := make([]string, 3) + header, remain, ok := strings.Cut(token, tokenDelimiter) + if !ok { + return nil, false + } + parts[0] = header + claims, remain, ok := strings.Cut(remain, tokenDelimiter) + if !ok { + return nil, false + } + parts[1] = claims + // One more cut to ensure the signature is the last part of the token and there are no more + // delimiters. This avoids an issue where malicious input could contain additional delimiters + // causing unnecessary overhead parsing tokens. + signature, _, unexpected := strings.Cut(remain, tokenDelimiter) + if unexpected { + return nil, false + } + parts[2] = signature + + return parts, true +} + +// DecodeSegment decodes a JWT specific base64url encoding. This function will +// take into account whether the [Parser] is configured with additional options, +// such as [WithStrictDecoding] or [WithPaddingAllowed]. +func (p *Parser) DecodeSegment(seg string) ([]byte, error) { + encoding := base64.RawURLEncoding + + if p.decodePaddingAllowed { + if l := len(seg) % 4; l > 0 { + seg += strings.Repeat("=", 4-l) + } + encoding = base64.URLEncoding + } + + if p.decodeStrict { + encoding = encoding.Strict() + } + return encoding.DecodeString(seg) +} + +// Parse parses, validates, verifies the signature and returns the parsed token. +// keyFunc will receive the parsed token and should return the cryptographic key +// for verifying the signature. The caller is strongly encouraged to set the +// WithValidMethods option to validate the 'alg' claim in the token matches the +// expected algorithm. For more details about the importance of validating the +// 'alg' claim, see +// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/ +func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { + return NewParser(options...).Parse(tokenString, keyFunc) +} + +// ParseWithClaims is a shortcut for NewParser().ParseWithClaims(). +// +// Note: If you provide a custom claim implementation that embeds one of the +// standard claims (such as RegisteredClaims), make sure that a) you either +// embed a non-pointer version of the claims or b) if you are using a pointer, +// allocate the proper memory for it before passing in the overall claims, +// otherwise you might run into a panic. +func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { + return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go new file mode 100644 index 000000000..af42fd3a7 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go @@ -0,0 +1,151 @@ +package jwt + +import "time" + +// ParserOption is used to implement functional-style options that modify the +// behavior of the parser. +type ParserOption func(*Parser) + +// WithValidMethods is an option to supply algorithm methods that the parser +// will check. Only those methods will be considered valid. It is heavily +// encouraged to use this option in order to prevent attacks such as +// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/. +func WithValidMethods(methods []string) ParserOption { + return func(p *Parser) { + p.validMethods = methods + } +} + +// WithJSONNumber is an option to configure the underlying JSON parser with +// UseNumber. +func WithJSONNumber() ParserOption { + return func(p *Parser) { + p.useJSONNumber = true + } +} + +// WithoutClaimsValidation is an option to disable claims validation. This +// option should only be used if you exactly know what you are doing. +func WithoutClaimsValidation() ParserOption { + return func(p *Parser) { + p.skipClaimsValidation = true + } +} + +// WithLeeway returns the ParserOption for specifying the leeway window. +func WithLeeway(leeway time.Duration) ParserOption { + return func(p *Parser) { + p.validator.leeway = leeway + } +} + +// WithTimeFunc returns the ParserOption for specifying the time func. The +// primary use-case for this is testing. If you are looking for a way to account +// for clock-skew, WithLeeway should be used instead. +func WithTimeFunc(f func() time.Time) ParserOption { + return func(p *Parser) { + p.validator.timeFunc = f + } +} + +// WithIssuedAt returns the ParserOption to enable verification +// of issued-at. +func WithIssuedAt() ParserOption { + return func(p *Parser) { + p.validator.verifyIat = true + } +} + +// WithExpirationRequired returns the ParserOption to make exp claim required. +// By default exp claim is optional. +func WithExpirationRequired() ParserOption { + return func(p *Parser) { + p.validator.requireExp = true + } +} + +// WithNotBeforeRequired returns the ParserOption to make nbf claim required. +// By default nbf claim is optional. +func WithNotBeforeRequired() ParserOption { + return func(p *Parser) { + p.validator.requireNbf = true + } +} + +// WithAudience configures the validator to require any of the specified +// audiences in the `aud` claim. Validation will fail if the audience is not +// listed in the token or the `aud` claim is missing. +// +// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an audience is expected. +func WithAudience(aud ...string) ParserOption { + return func(p *Parser) { + p.validator.expectedAud = aud + } +} + +// WithAllAudiences configures the validator to require all the specified +// audiences in the `aud` claim. Validation will fail if the specified audiences +// are not listed in the token or the `aud` claim is missing. Duplicates within +// the list are de-duplicated since internally, we use a map to look up the +// audiences. +// +// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an audience is expected. +func WithAllAudiences(aud ...string) ParserOption { + return func(p *Parser) { + p.validator.expectedAud = aud + p.validator.expectAllAud = true + } +} + +// WithIssuer configures the validator to require the specified issuer in the +// `iss` claim. Validation will fail if a different issuer is specified in the +// token or the `iss` claim is missing. +// +// NOTE: While the `iss` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an issuer is expected. +func WithIssuer(iss string) ParserOption { + return func(p *Parser) { + p.validator.expectedIss = iss + } +} + +// WithSubject configures the validator to require the specified subject in the +// `sub` claim. Validation will fail if a different subject is specified in the +// token or the `sub` claim is missing. +// +// NOTE: While the `sub` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if a subject is expected. +func WithSubject(sub string) ParserOption { + return func(p *Parser) { + p.validator.expectedSub = sub + } +} + +// WithPaddingAllowed will enable the codec used for decoding JWTs to allow +// padding. Note that the JWS RFC7515 states that the tokens will utilize a +// Base64url encoding with no padding. Unfortunately, some implementations of +// JWT are producing non-standard tokens, and thus require support for decoding. +func WithPaddingAllowed() ParserOption { + return func(p *Parser) { + p.decodePaddingAllowed = true + } +} + +// WithStrictDecoding will switch the codec used for decoding JWTs into strict +// mode. In this mode, the decoder requires that trailing padding bits are zero, +// as described in RFC 4648 section 3.5. +func WithStrictDecoding() ParserOption { + return func(p *Parser) { + p.decodeStrict = true + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go new file mode 100644 index 000000000..77951a531 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go @@ -0,0 +1,63 @@ +package jwt + +// RegisteredClaims are a structured version of the JWT Claims Set, +// restricted to Registered Claim Names, as referenced at +// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 +// +// This type can be used on its own, but then additional private and +// public claims embedded in the JWT will not be parsed. The typical use-case +// therefore is to embedded this in a user-defined claim type. +// +// See examples for how to use this with your own claim types. +type RegisteredClaims struct { + // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 + Issuer string `json:"iss,omitempty"` + + // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 + Subject string `json:"sub,omitempty"` + + // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 + Audience ClaimStrings `json:"aud,omitempty"` + + // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 + ExpiresAt *NumericDate `json:"exp,omitempty"` + + // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5 + NotBefore *NumericDate `json:"nbf,omitempty"` + + // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6 + IssuedAt *NumericDate `json:"iat,omitempty"` + + // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7 + ID string `json:"jti,omitempty"` +} + +// GetExpirationTime implements the Claims interface. +func (c RegisteredClaims) GetExpirationTime() (*NumericDate, error) { + return c.ExpiresAt, nil +} + +// GetNotBefore implements the Claims interface. +func (c RegisteredClaims) GetNotBefore() (*NumericDate, error) { + return c.NotBefore, nil +} + +// GetIssuedAt implements the Claims interface. +func (c RegisteredClaims) GetIssuedAt() (*NumericDate, error) { + return c.IssuedAt, nil +} + +// GetAudience implements the Claims interface. +func (c RegisteredClaims) GetAudience() (ClaimStrings, error) { + return c.Audience, nil +} + +// GetIssuer implements the Claims interface. +func (c RegisteredClaims) GetIssuer() (string, error) { + return c.Issuer, nil +} + +// GetSubject implements the Claims interface. +func (c RegisteredClaims) GetSubject() (string, error) { + return c.Subject, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa.go b/vendor/github.com/golang-jwt/jwt/v5/rsa.go new file mode 100644 index 000000000..98b960a78 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa.go @@ -0,0 +1,93 @@ +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// SigningMethodRSA implements the RSA family of signing methods. +// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation +type SigningMethodRSA struct { + Name string + Hash crypto.Hash +} + +// Specific instances for RS256 and company +var ( + SigningMethodRS256 *SigningMethodRSA + SigningMethodRS384 *SigningMethodRSA + SigningMethodRS512 *SigningMethodRSA +) + +func init() { + // RS256 + SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { + return SigningMethodRS256 + }) + + // RS384 + SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { + return SigningMethodRS384 + }) + + // RS512 + SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { + return SigningMethodRS512 + }) +} + +func (m *SigningMethodRSA) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod +// For this signing method, must be an *rsa.PublicKey structure. +func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key any) error { + var rsaKey *rsa.PublicKey + var ok bool + + if rsaKey, ok = key.(*rsa.PublicKey); !ok { + return newError("RSA verify expects *rsa.PublicKey", ErrInvalidKeyType) + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) +} + +// Sign implements token signing for the SigningMethod +// For this signing method, must be an *rsa.PrivateKey structure. +func (m *SigningMethodRSA) Sign(signingString string, key any) ([]byte, error) { + var rsaKey *rsa.PrivateKey + var ok bool + + // Validate type of key + if rsaKey, ok = key.(*rsa.PrivateKey); !ok { + return nil, newError("RSA sign expects *rsa.PrivateKey", ErrInvalidKeyType) + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { + return sigBytes, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go new file mode 100644 index 000000000..f17590cc4 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go @@ -0,0 +1,132 @@ +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods +type SigningMethodRSAPSS struct { + *SigningMethodRSA + Options *rsa.PSSOptions + // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS. + // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow + // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously. + // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details. + VerifyOptions *rsa.PSSOptions +} + +// Specific instances for RS/PS and company. +var ( + SigningMethodPS256 *SigningMethodRSAPSS + SigningMethodPS384 *SigningMethodRSAPSS + SigningMethodPS512 *SigningMethodRSAPSS +) + +func init() { + // PS256 + SigningMethodPS256 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS256", + Hash: crypto.SHA256, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { + return SigningMethodPS256 + }) + + // PS384 + SigningMethodPS384 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS384", + Hash: crypto.SHA384, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { + return SigningMethodPS384 + }) + + // PS512 + SigningMethodPS512 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS512", + Hash: crypto.SHA512, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { + return SigningMethodPS512 + }) +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an rsa.PublicKey struct +func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key any) error { + var rsaKey *rsa.PublicKey + switch k := key.(type) { + case *rsa.PublicKey: + rsaKey = k + default: + return newError("RSA-PSS verify expects *rsa.PublicKey", ErrInvalidKeyType) + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + opts := m.Options + if m.VerifyOptions != nil { + opts = m.VerifyOptions + } + + return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts) +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an rsa.PrivateKey struct +func (m *SigningMethodRSAPSS) Sign(signingString string, key any) ([]byte, error) { + var rsaKey *rsa.PrivateKey + + switch k := key.(type) { + case *rsa.PrivateKey: + rsaKey = k + default: + return nil, newError("RSA-PSS sign expects *rsa.PrivateKey", ErrInvalidKeyType) + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { + return sigBytes, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go new file mode 100644 index 000000000..f22c3d068 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go @@ -0,0 +1,107 @@ +package jwt + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") + ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") + ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") +) + +// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key +func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey any + if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password +// +// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock +// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative +// in the Go standard library for now. See https://github.com/golang/go/issues/8860. +func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey any + + var blockDecrypted []byte + if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil { + return nil, err + } + + if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// ParseRSAPublicKeyFromPEM parses a certificate or a PEM encoded PKCS1 or PKIX public key +func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil { + return nil, err + } + } + } + + var pkey *rsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { + return nil, ErrNotRSAPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go new file mode 100644 index 000000000..096d0ed4c --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go @@ -0,0 +1,49 @@ +package jwt + +import ( + "sync" +) + +var signingMethods = map[string]func() SigningMethod{} +var signingMethodLock = new(sync.RWMutex) + +// SigningMethod can be used add new methods for signing or verifying tokens. It +// takes a decoded signature as an input in the Verify function and produces a +// signature in Sign. The signature is then usually base64 encoded as part of a +// JWT. +type SigningMethod interface { + Verify(signingString string, sig []byte, key any) error // Returns nil if signature is valid + Sign(signingString string, key any) ([]byte, error) // Returns signature or error + Alg() string // returns the alg identifier for this method (example: 'HS256') +} + +// RegisterSigningMethod registers the "alg" name and a factory function for signing method. +// This is typically done during init() in the method's implementation +func RegisterSigningMethod(alg string, f func() SigningMethod) { + signingMethodLock.Lock() + defer signingMethodLock.Unlock() + + signingMethods[alg] = f +} + +// GetSigningMethod retrieves a signing method from an "alg" string +func GetSigningMethod(alg string) (method SigningMethod) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + if methodF, ok := signingMethods[alg]; ok { + method = methodF() + } + return +} + +// GetAlgorithms returns a list of registered "alg" names +func GetAlgorithms() (algs []string) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + for alg := range signingMethods { + algs = append(algs, alg) + } + return +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf new file mode 100644 index 000000000..53745d51d --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf @@ -0,0 +1 @@ +checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"] diff --git a/vendor/github.com/golang-jwt/jwt/v5/token.go b/vendor/github.com/golang-jwt/jwt/v5/token.go new file mode 100644 index 000000000..d9f6c9d25 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/token.go @@ -0,0 +1,102 @@ +package jwt + +import ( + "crypto" + "encoding/base64" + "encoding/json" +) + +// Keyfunc will be used by the Parse methods as a callback function to supply +// the key for verification. The function receives the parsed, but unverified +// Token. This allows you to use properties in the Header of the token (such as +// `kid`) to identify which key to use. +// +// The returned any may be a single key or a VerificationKeySet containing +// multiple keys. +type Keyfunc func(*Token) (any, error) + +// VerificationKey represents a public or secret key for verifying a token's signature. +type VerificationKey interface { + crypto.PublicKey | []uint8 +} + +// VerificationKeySet is a set of public or secret keys. It is used by the parser to verify a token. +type VerificationKeySet struct { + Keys []VerificationKey +} + +// Token represents a JWT Token. Different fields will be used depending on +// whether you're creating or parsing/verifying a token. +type Token struct { + Raw string // Raw contains the raw token. Populated when you [Parse] a token + Method SigningMethod // Method is the signing method used or to be used + Header map[string]any // Header is the first segment of the token in decoded form + Claims Claims // Claims is the second segment of the token in decoded form + Signature []byte // Signature is the third segment of the token in decoded form. Populated when you [Parse] or sign a token + Valid bool // Valid specifies if the token is valid. Populated when you [Parse] a token +} + +// New creates a new [Token] with the specified signing method and an empty map +// of claims. Additional options can be specified, but are currently unused. +func New(method SigningMethod, opts ...TokenOption) *Token { + return NewWithClaims(method, MapClaims{}, opts...) +} + +// NewWithClaims creates a new [Token] with the specified signing method and +// claims. Additional options can be specified, but are currently unused. +func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token { + return &Token{ + Header: map[string]any{ + "typ": "JWT", + "alg": method.Alg(), + }, + Claims: claims, + Method: method, + } +} + +// SignedString creates and returns a complete, signed JWT. The token is signed +// using the SigningMethod specified in the token. Please refer to +// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types +// for an overview of the different signing methods and their respective key +// types. +func (t *Token) SignedString(key any) (string, error) { + sstr, err := t.SigningString() + if err != nil { + return "", err + } + + sig, err := t.Method.Sign(sstr, key) + if err != nil { + return "", err + } + + t.Signature = sig + + return sstr + "." + t.EncodeSegment(sig), nil +} + +// SigningString generates the signing string. This is the most expensive part +// of the whole deal. Unless you need this for something special, just go +// straight for the SignedString. +func (t *Token) SigningString() (string, error) { + h, err := json.Marshal(t.Header) + if err != nil { + return "", err + } + + c, err := json.Marshal(t.Claims) + if err != nil { + return "", err + } + + return t.EncodeSegment(h) + "." + t.EncodeSegment(c), nil +} + +// EncodeSegment encodes a JWT specific base64url encoding with padding +// stripped. In the future, this function might take into account a +// [TokenOption]. Therefore, this function exists as a method of [Token], rather +// than a global function. +func (*Token) EncodeSegment(seg []byte) string { + return base64.RawURLEncoding.EncodeToString(seg) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/token_option.go b/vendor/github.com/golang-jwt/jwt/v5/token_option.go new file mode 100644 index 000000000..b4ae3badf --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/token_option.go @@ -0,0 +1,5 @@ +package jwt + +// TokenOption is a reserved type, which provides some forward compatibility, +// if we ever want to introduce token creation-related options. +type TokenOption func(*Token) diff --git a/vendor/github.com/golang-jwt/jwt/v5/types.go b/vendor/github.com/golang-jwt/jwt/v5/types.go new file mode 100644 index 000000000..a3e0ef121 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/types.go @@ -0,0 +1,149 @@ +package jwt + +import ( + "encoding/json" + "fmt" + "math" + "strconv" + "time" +) + +// TimePrecision sets the precision of times and dates within this library. This +// has an influence on the precision of times when comparing expiry or other +// related time fields. Furthermore, it is also the precision of times when +// serializing. +// +// For backwards compatibility the default precision is set to seconds, so that +// no fractional timestamps are generated. +var TimePrecision = time.Second + +// MarshalSingleStringAsArray modifies the behavior of the ClaimStrings type, +// especially its MarshalJSON function. +// +// If it is set to true (the default), it will always serialize the type as an +// array of strings, even if it just contains one element, defaulting to the +// behavior of the underlying []string. If it is set to false, it will serialize +// to a single string, if it contains one element. Otherwise, it will serialize +// to an array of strings. +var MarshalSingleStringAsArray = true + +// NumericDate represents a JSON numeric date value, as referenced at +// https://datatracker.ietf.org/doc/html/rfc7519#section-2. +type NumericDate struct { + time.Time +} + +// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct. +// It will truncate the timestamp according to the precision specified in TimePrecision. +func NewNumericDate(t time.Time) *NumericDate { + return &NumericDate{t.Truncate(TimePrecision)} +} + +// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a +// UNIX epoch with the float fraction representing non-integer seconds. +func newNumericDateFromSeconds(f float64) *NumericDate { + round, frac := math.Modf(f) + return NewNumericDate(time.Unix(int64(round), int64(frac*1e9))) +} + +// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch +// represented in NumericDate to a byte array, using the precision specified in TimePrecision. +func (date NumericDate) MarshalJSON() (b []byte, err error) { + var prec int + if TimePrecision < time.Second { + prec = int(math.Log10(float64(time.Second) / float64(TimePrecision))) + } + truncatedDate := date.Truncate(TimePrecision) + + // For very large timestamps, UnixNano would overflow an int64, but this + // function requires nanosecond level precision, so we have to use the + // following technique to get round the issue: + // + // 1. Take the normal unix timestamp to form the whole number part of the + // output, + // 2. Take the result of the Nanosecond function, which returns the offset + // within the second of the particular unix time instance, to form the + // decimal part of the output + // 3. Concatenate them to produce the final result + seconds := strconv.FormatInt(truncatedDate.Unix(), 10) + nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64) + + output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...) + + return output, nil +} + +// UnmarshalJSON is an implementation of the json.RawMessage interface and +// deserializes a [NumericDate] from a JSON representation, i.e. a +// [json.Number]. This number represents an UNIX epoch with either integer or +// non-integer seconds. +func (date *NumericDate) UnmarshalJSON(b []byte) (err error) { + var ( + number json.Number + f float64 + ) + + if err = json.Unmarshal(b, &number); err != nil { + return fmt.Errorf("could not parse NumericData: %w", err) + } + + if f, err = number.Float64(); err != nil { + return fmt.Errorf("could not convert json number value to float: %w", err) + } + + n := newNumericDateFromSeconds(f) + *date = *n + + return nil +} + +// ClaimStrings is basically just a slice of strings, but it can be either +// serialized from a string array or just a string. This type is necessary, +// since the "aud" claim can either be a single string or an array. +type ClaimStrings []string + +func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) { + var value any + + if err = json.Unmarshal(data, &value); err != nil { + return err + } + + var aud []string + + switch v := value.(type) { + case string: + aud = append(aud, v) + case []string: + aud = ClaimStrings(v) + case []any: + for _, vv := range v { + vs, ok := vv.(string) + if !ok { + return ErrInvalidType + } + aud = append(aud, vs) + } + case nil: + return nil + default: + return ErrInvalidType + } + + *s = aud + + return +} + +func (s ClaimStrings) MarshalJSON() (b []byte, err error) { + // This handles a special case in the JWT RFC. If the string array, e.g. + // used by the "aud" field, only contains one element, it MAY be serialized + // as a single string. This may or may not be desired based on the ecosystem + // of other JWT library used, so we make it configurable by the variable + // MarshalSingleStringAsArray. + if len(s) == 1 && !MarshalSingleStringAsArray { + return json.Marshal(s[0]) + } + + return json.Marshal([]string(s)) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/validator.go b/vendor/github.com/golang-jwt/jwt/v5/validator.go new file mode 100644 index 000000000..c82dfcae6 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/validator.go @@ -0,0 +1,330 @@ +package jwt + +import ( + "fmt" + "slices" + "time" +) + +// ClaimsValidator is an interface that can be implemented by custom claims who +// wish to execute any additional claims validation based on +// application-specific logic. The Validate function is then executed in +// addition to the regular claims validation and any error returned is appended +// to the final validation result. +// +// type MyCustomClaims struct { +// Foo string `json:"foo"` +// jwt.RegisteredClaims +// } +// +// func (m MyCustomClaims) Validate() error { +// if m.Foo != "bar" { +// return errors.New("must be foobar") +// } +// return nil +// } +type ClaimsValidator interface { + Claims + Validate() error +} + +// Validator is the core of the new Validation API. It is automatically used by +// a [Parser] during parsing and can be modified with various parser options. +// +// The [NewValidator] function should be used to create an instance of this +// struct. +type Validator struct { + // leeway is an optional leeway that can be provided to account for clock skew. + leeway time.Duration + + // timeFunc is used to supply the current time that is needed for + // validation. If unspecified, this defaults to time.Now. + timeFunc func() time.Time + + // requireExp specifies whether the exp claim is required + requireExp bool + + // requireNbf specifies whether the nbf claim is required + requireNbf bool + + // verifyIat specifies whether the iat (Issued At) claim will be verified. + // According to https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 this + // only specifies the age of the token, but no validation check is + // necessary. However, if wanted, it can be checked if the iat is + // unrealistic, i.e., in the future. + verifyIat bool + + // expectedAud contains the audience this token expects. Supplying an empty + // slice will disable aud checking. + expectedAud []string + + // expectAllAud specifies whether all expected audiences must be present in + // the token. If false, only one of the expected audiences must be present. + expectAllAud bool + + // expectedIss contains the issuer this token expects. Supplying an empty + // string will disable iss checking. + expectedIss string + + // expectedSub contains the subject this token expects. Supplying an empty + // string will disable sub checking. + expectedSub string +} + +// NewValidator can be used to create a stand-alone validator with the supplied +// options. This validator can then be used to validate already parsed claims. +// +// Note: Under normal circumstances, explicitly creating a validator is not +// needed and can potentially be dangerous; instead functions of the [Parser] +// class should be used. +// +// The [Validator] is only checking the *validity* of the claims, such as its +// expiration time, but it does NOT perform *signature verification* of the +// token. +func NewValidator(opts ...ParserOption) *Validator { + p := NewParser(opts...) + return p.validator +} + +// Validate validates the given claims. It will also perform any custom +// validation if claims implements the [ClaimsValidator] interface. +// +// Note: It will NOT perform any *signature verification* on the token that +// contains the claims and expects that the [Claim] was already successfully +// verified. +func (v *Validator) Validate(claims Claims) error { + var ( + now time.Time + errs = make([]error, 0, 6) + err error + ) + + // Check, if we have a time func + if v.timeFunc != nil { + now = v.timeFunc() + } else { + now = time.Now() + } + + // We always need to check the expiration time, but usage of the claim + // itself is OPTIONAL by default. requireExp overrides this behavior + // and makes the exp claim mandatory. + if err = v.verifyExpiresAt(claims, now, v.requireExp); err != nil { + errs = append(errs, err) + } + + // We always need to check not-before, but usage of the claim itself is + // OPTIONAL by default. requireNbf overrides this behavior and makes + // the nbf claim mandatory. + if err = v.verifyNotBefore(claims, now, v.requireNbf); err != nil { + errs = append(errs, err) + } + + // Check issued-at if the option is enabled + if v.verifyIat { + if err = v.verifyIssuedAt(claims, now, false); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected audience, we also require the audience claim + if len(v.expectedAud) > 0 { + if err = v.verifyAudience(claims, v.expectedAud, v.expectAllAud); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected issuer, we also require the issuer claim + if v.expectedIss != "" { + if err = v.verifyIssuer(claims, v.expectedIss, true); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected subject, we also require the subject claim + if v.expectedSub != "" { + if err = v.verifySubject(claims, v.expectedSub, true); err != nil { + errs = append(errs, err) + } + } + + // Finally, we want to give the claim itself some possibility to do some + // additional custom validation based on a custom Validate function. + cvt, ok := claims.(ClaimsValidator) + if ok { + if err := cvt.Validate(); err != nil { + errs = append(errs, err) + } + } + + if len(errs) == 0 { + return nil + } + + return joinErrors(errs...) +} + +// verifyExpiresAt compares the exp claim in claims against cmp. This function +// will succeed if cmp < exp. Additional leeway is taken into account. +// +// If exp is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool) error { + exp, err := claims.GetExpirationTime() + if err != nil { + return err + } + + if exp == nil { + return errorIfRequired(required, "exp") + } + + return errorIfFalse(cmp.Before((exp.Time).Add(+v.leeway)), ErrTokenExpired) +} + +// verifyIssuedAt compares the iat claim in claims against cmp. This function +// will succeed if cmp >= iat. Additional leeway is taken into account. +// +// If iat is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool) error { + iat, err := claims.GetIssuedAt() + if err != nil { + return err + } + + if iat == nil { + return errorIfRequired(required, "iat") + } + + return errorIfFalse(!cmp.Before(iat.Add(-v.leeway)), ErrTokenUsedBeforeIssued) +} + +// verifyNotBefore compares the nbf claim in claims against cmp. This function +// will return true if cmp >= nbf. Additional leeway is taken into account. +// +// If nbf is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyNotBefore(claims Claims, cmp time.Time, required bool) error { + nbf, err := claims.GetNotBefore() + if err != nil { + return err + } + + if nbf == nil { + return errorIfRequired(required, "nbf") + } + + return errorIfFalse(!cmp.Before(nbf.Add(-v.leeway)), ErrTokenNotValidYet) +} + +// verifyAudience compares the aud claim against cmp. +// +// If aud is not set or an empty list, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyAudience(claims Claims, cmp []string, expectAllAud bool) error { + aud, err := claims.GetAudience() + if err != nil { + return err + } + + // Check that aud exists and is not empty. We only require the aud claim + // if we expect at least one audience to be present. + if len(aud) == 0 || len(aud) == 1 && aud[0] == "" { + required := len(v.expectedAud) > 0 + return errorIfRequired(required, "aud") + } + + if !expectAllAud { + for _, a := range aud { + // If we only expect one match, we can stop early if we find a match + if slices.Contains(cmp, a) { + return nil + } + } + + return ErrTokenInvalidAudience + } + + // Note that we are looping cmp here to ensure that all expected audiences + // are present in the aud claim. + for _, a := range cmp { + if !slices.Contains(aud, a) { + return ErrTokenInvalidAudience + } + } + + return nil +} + +// verifyIssuer compares the iss claim in claims against cmp. +// +// If iss is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyIssuer(claims Claims, cmp string, required bool) error { + iss, err := claims.GetIssuer() + if err != nil { + return err + } + + if iss == "" { + return errorIfRequired(required, "iss") + } + + return errorIfFalse(iss == cmp, ErrTokenInvalidIssuer) +} + +// verifySubject compares the sub claim against cmp. +// +// If sub is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifySubject(claims Claims, cmp string, required bool) error { + sub, err := claims.GetSubject() + if err != nil { + return err + } + + if sub == "" { + return errorIfRequired(required, "sub") + } + + return errorIfFalse(sub == cmp, ErrTokenInvalidSubject) +} + +// errorIfFalse returns the error specified in err, if the value is true. +// Otherwise, nil is returned. +func errorIfFalse(value bool, err error) error { + if value { + return nil + } else { + return err + } +} + +// errorIfRequired returns an ErrTokenRequiredClaimMissing error if required is +// true. Otherwise, nil is returned. +func errorIfRequired(required bool, claim string) error { + if required { + return newError(fmt.Sprintf("%s claim is required", claim), ErrTokenRequiredClaimMissing) + } else { + return nil + } +} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go index d127d4362..def01a6be 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go @@ -19,6 +19,7 @@ const ( tbFunc // func(T) bool ttbFunc // func(T, T) bool + ttiFunc // func(T, T) int trbFunc // func(T, R) bool tibFunc // func(T, I) bool trFunc // func(T) R @@ -28,11 +29,13 @@ const ( Transformer = trFunc // func(T) R ValueFilter = ttbFunc // func(T, T) bool Less = ttbFunc // func(T, T) bool + Compare = ttiFunc // func(T, T) int ValuePredicate = tbFunc // func(T) bool KeyValuePredicate = trbFunc // func(T, R) bool ) var boolType = reflect.TypeOf(true) +var intType = reflect.TypeOf(0) // IsType reports whether the reflect.Type is of the specified function type. func IsType(t reflect.Type, ft funcType) bool { @@ -49,6 +52,10 @@ func IsType(t reflect.Type, ft funcType) bool { if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == boolType { return true } + case ttiFunc: // func(T, T) int + if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == intType { + return true + } case trbFunc: // func(T, R) bool if ni == 2 && no == 1 && t.Out(0) == boolType { return true diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go index 754496f3b..ba3fce81f 100644 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ b/vendor/github.com/google/go-cmp/cmp/options.go @@ -232,7 +232,15 @@ func (validator) apply(s *state, vx, vy reflect.Value) { if t := s.curPath.Index(-2).Type(); t.Name() != "" { // Named type with unexported fields. name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType - if _, ok := reflect.New(t).Interface().(error); ok { + isProtoMessage := func(t reflect.Type) bool { + m, ok := reflect.PointerTo(t).MethodByName("ProtoReflect") + return ok && m.Type.NumIn() == 1 && m.Type.NumOut() == 1 && + m.Type.Out(0).PkgPath() == "google.golang.org/protobuf/reflect/protoreflect" && + m.Type.Out(0).Name() == "Message" + } + if isProtoMessage(t) { + help = `consider using "google.golang.org/protobuf/testing/protocmp".Transform to compare proto.Message types` + } else if _, ok := reflect.New(t).Interface().(error); ok { help = "consider using cmpopts.EquateErrors to compare error values" } else if t.Comparable() { help = "consider using cmpopts.EquateComparable to compare comparable Go types" diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/LICENSE.md b/vendor/github.com/stackitcloud/stackit-sdk-go/core/LICENSE.md new file mode 100644 index 000000000..c77bb37a1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2024 - 2026 Schwarz IT KG + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/NOTICE.txt b/vendor/github.com/stackitcloud/stackit-sdk-go/core/NOTICE.txt new file mode 100644 index 000000000..f6989594c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/NOTICE.txt @@ -0,0 +1,2 @@ +STACKIT Core SDK for Go +Copyright 2024 - 2026 Schwarz IT KG \ No newline at end of file diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/auth/auth.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/auth/auth.go new file mode 100644 index 000000000..b393afbb7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/auth/auth.go @@ -0,0 +1,396 @@ +package auth + +import ( + "encoding/json" + "fmt" + "net/http" + "os" + "path/filepath" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/clients" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +type credentialType string + +type Credentials struct { + STACKIT_SERVICE_ACCOUNT_EMAIL string // Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. + STACKIT_SERVICE_ACCOUNT_TOKEN string + STACKIT_SERVICE_ACCOUNT_KEY_PATH string + STACKIT_PRIVATE_KEY_PATH string + STACKIT_SERVICE_ACCOUNT_KEY string + STACKIT_PRIVATE_KEY string +} + +const ( + credentialsFilePath = ".stackit/credentials.json" //nolint:gosec // linter false positive + tokenCredentialType credentialType = "token" + serviceAccountKeyCredentialType credentialType = "service_account_key" + serviceAccountKeyPathCredentialType credentialType = "service_account_key_path" + privateKeyCredentialType credentialType = "private_key" + privateKeyPathCredentialType credentialType = "private_key_path" +) + +var userHomeDir = os.UserHomeDir + +// SetupAuth sets up authentication based on the configuration. The different options are +// custom authentication, no authentication, explicit key flow, explicit token flow or default authentication +func SetupAuth(cfg *config.Configuration) (rt http.RoundTripper, err error) { + if cfg == nil { + cfg = &config.Configuration{} + email := getServiceAccountEmail(cfg) + cfg.ServiceAccountEmail = email + } + + if cfg.CustomAuth != nil { + return cfg.CustomAuth, nil + } else if cfg.NoAuth { + noAuthRoundTripper, err := NoAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring no auth client: %w", err) + } + return noAuthRoundTripper, nil + } else if cfg.WorkloadIdentityFederation { + wifRoundTripper, err := WorkloadIdentityFederationAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring no auth client: %w", err) + } + return wifRoundTripper, nil + } else if cfg.ServiceAccountKey != "" || cfg.ServiceAccountKeyPath != "" { + keyRoundTripper, err := KeyAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring key authentication: %w", err) + } + return keyRoundTripper, nil + } else if cfg.Token != "" { + tokenRoundTripper, err := TokenAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring token authentication: %w", err) + } + return tokenRoundTripper, nil + } + authRoundTripper, err := DefaultAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring default authentication: %w", err) + } + return authRoundTripper, nil +} + +// DefaultAuth will search for a valid service account key or token in several locations. +// It will first try to use the key flow, by looking into the variables STACKIT_SERVICE_ACCOUNT_KEY, STACKIT_SERVICE_ACCOUNT_KEY_PATH, +// STACKIT_PRIVATE_KEY and STACKIT_PRIVATE_KEY_PATH. If the keys cannot be retrieved, it will check the credentials file located in STACKIT_CREDENTIALS_PATH, if specified, or in +// $HOME/.stackit/credentials.json as a fallback. If the key are found and are valid, the KeyAuth flow is used. +// If the key flow cannot be used, it will try to find a token in the STACKIT_SERVICE_ACCOUNT_TOKEN. If not present, it will +// search in the credentials file. If the token is found, the TokenAuth flow is used. +// DefaultAuth returns an http.RoundTripper that can be used to make authenticated requests. +// In case the token is not found, DefaultAuth fails. +func DefaultAuth(cfg *config.Configuration) (rt http.RoundTripper, err error) { + if cfg == nil { + cfg = &config.Configuration{} + } + + // WIF flow + rt, err = WorkloadIdentityFederationAuth(cfg) + if err != nil { + // Key flow + rt, err = KeyAuth(cfg) + if err != nil { + keyFlowErr := err + // Token flow + rt, err = TokenAuth(cfg) + if err != nil { + return nil, fmt.Errorf("no valid credentials were found: trying key flow: %s, trying token flow: %w", keyFlowErr.Error(), err) + } + } + } + return rt, nil +} + +// NoAuth configures a flow without authentication and returns an http.RoundTripper +// that can be used to make unauthenticated requests +func NoAuth(cfgs ...*config.Configuration) (rt http.RoundTripper, err error) { + noAuthConfig := clients.NoAuthFlowConfig{} + noAuthRoundTripper := &clients.NoAuthFlow{} + + var cfg *config.Configuration + + if len(cfgs) > 0 { + cfg = cfgs[0] + } else { + cfg = &config.Configuration{} + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + noAuthConfig.HTTPTransport = cfg.HTTPClient.Transport + } + + if err := noAuthRoundTripper.Init(noAuthConfig); err != nil { + return nil, fmt.Errorf("initializing client: %w", err) + } + return noAuthRoundTripper, nil +} + +// TokenAuth configures the token flow and returns an http.RoundTripper +// that can be used to make authenticated requests using a token +func TokenAuth(cfg *config.Configuration) (http.RoundTripper, error) { + // Check token + if cfg.Token == "" { + token, tokenSet := os.LookupEnv("STACKIT_SERVICE_ACCOUNT_TOKEN") + if !tokenSet || token == "" { + credentials, err := readCredentialsFile(cfg.CredentialsFilePath) + if err != nil { + return nil, fmt.Errorf("reading from credentials file: %w", err) + } + token, err = readCredential(tokenCredentialType, credentials) + if err != nil { + return nil, fmt.Errorf("STACKIT_SERVICE_ACCOUNT_TOKEN not set. Trying to read from credentials file: %w", err) + } + } + cfg.Token = token + } + + tokenCfg := clients.TokenFlowConfig{ + ServiceAccountToken: cfg.Token, + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + tokenCfg.HTTPTransport = cfg.HTTPClient.Transport + } + + client := &clients.TokenFlow{} + if err := client.Init(&tokenCfg); err != nil { + return nil, fmt.Errorf("error initializing client: %w", err) + } + + return client, nil +} + +// KeyAuth configures the key flow and returns an http.RoundTripper +// that can be used to make authenticated requests using an access token +// The KeyFlow requires a service account key and a private key. +// +// If the private key is not provided explicitly, KeyAuth will check if there is one included +// in the service account key and use that one. An explicitly provided private key takes +// precedence over the one on the service account key. +func KeyAuth(cfg *config.Configuration) (http.RoundTripper, error) { + err := getServiceAccountKey(cfg) + if err != nil { + return nil, fmt.Errorf("configuring key authentication: service account key could not be found: %w", err) + } + + // Unmarshal service account key to check if private key is present + var serviceAccountKey = &clients.ServiceAccountKeyResponse{} + err = json.Unmarshal([]byte(cfg.ServiceAccountKey), serviceAccountKey) + if err != nil { + var errorSuffix string + if strings.HasPrefix(cfg.ServiceAccountKey, "-----BEGIN") { + errorSuffix = " - it seems like the provided service account key is in PEM format. Please provide it in JSON format." + } + return nil, fmt.Errorf("unmarshalling service account key: %w%s", err, errorSuffix) + } + + // Try to get private key from configuration, environment or credentials file + err = getPrivateKey(cfg) + if err != nil { + // If the private key is not provided explicitly, try to extract private key from the service account key + // and use it if present + var extractedPrivateKey string + if serviceAccountKey.Credentials != nil && serviceAccountKey.Credentials.PrivateKey != nil { + extractedPrivateKey = *serviceAccountKey.Credentials.PrivateKey + } + if extractedPrivateKey == "" { + return nil, fmt.Errorf("configuring key authentication: private key is not part of the service account key and could not be found: %w", err) + } + cfg.PrivateKey = extractedPrivateKey + } + + if cfg.TokenCustomUrl == "" { + tokenCustomUrl, tokenUrlSet := os.LookupEnv("STACKIT_TOKEN_BASEURL") + if tokenUrlSet { + cfg.TokenCustomUrl = tokenCustomUrl + } + } + + keyCfg := clients.KeyFlowConfig{ + ServiceAccountKey: serviceAccountKey, + PrivateKey: cfg.PrivateKey, + TokenUrl: cfg.TokenCustomUrl, + BackgroundTokenRefreshContext: cfg.BackgroundTokenRefreshContext, + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + keyCfg.HTTPTransport = cfg.HTTPClient.Transport + } + + client := &clients.KeyFlow{} + if err := client.Init(&keyCfg); err != nil { + return nil, fmt.Errorf("error initializing client: %w", err) + } + + return client, nil +} + +// WorkloadIdentityFederationAuth configures the wif flow and returns an http.RoundTripper +// that can be used to make authenticated requests using an access token +func WorkloadIdentityFederationAuth(cfg *config.Configuration) (http.RoundTripper, error) { + wifConfig := clients.WorkloadIdentityFederationFlowConfig{ + TokenUrl: cfg.TokenCustomUrl, + BackgroundTokenRefreshContext: cfg.BackgroundTokenRefreshContext, + ClientID: cfg.ServiceAccountEmail, + TokenExpiration: cfg.ServiceAccountFederatedTokenExpiration, + FederatedTokenFunction: cfg.ServiceAccountFederatedTokenFunc, + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + wifConfig.HTTPTransport = cfg.HTTPClient.Transport + } + + client := &clients.WorkloadIdentityFederationFlow{} + if err := client.Init(&wifConfig); err != nil { + return nil, fmt.Errorf("error initializing client: %w", err) + } + + return client, nil +} + +// readCredentialsFile reads the credentials file from the specified path and returns Credentials +func readCredentialsFile(path string) (*Credentials, error) { + if path == "" { + customPath, customPathSet := os.LookupEnv("STACKIT_CREDENTIALS_PATH") + if !customPathSet || customPath == "" { + path = credentialsFilePath + home, err := userHomeDir() + if err != nil { + return nil, fmt.Errorf("getting home directory: %w", err) + } + path = filepath.Join(home, path) + } else { + path = customPath + } + } + + credentialsRaw, err := os.ReadFile(path) + if err != nil { + return nil, fmt.Errorf("opening file: %w", err) + } + + var credentials Credentials + err = json.Unmarshal(credentialsRaw, &credentials) + if err != nil { + return nil, fmt.Errorf("unmaPrivateKeyrshalling credentials: %w", err) + } + return &credentials, nil +} + +// readCredential reads the specified credentialType from Credentials and returns it as a string +func readCredential(cred credentialType, credentials *Credentials) (string, error) { + var credentialValue string + switch cred { + case tokenCredentialType: + credentialValue = credentials.STACKIT_SERVICE_ACCOUNT_TOKEN + if credentialValue == "" { + return credentialValue, fmt.Errorf("token is empty or not set") + } + case serviceAccountKeyPathCredentialType: + credentialValue = credentials.STACKIT_SERVICE_ACCOUNT_KEY_PATH + if credentialValue == "" { + return credentialValue, fmt.Errorf("service account key path is empty or not set") + } + case privateKeyPathCredentialType: + credentialValue = credentials.STACKIT_PRIVATE_KEY_PATH + if credentialValue == "" { + return credentialValue, fmt.Errorf("private key path is empty or not set") + } + case serviceAccountKeyCredentialType: + credentialValue = credentials.STACKIT_SERVICE_ACCOUNT_KEY + if credentialValue == "" { + return credentialValue, fmt.Errorf("service account key is empty or not set") + } + case privateKeyCredentialType: + credentialValue = credentials.STACKIT_PRIVATE_KEY + if credentialValue == "" { + return credentialValue, fmt.Errorf("private key is empty or not set") + } + default: + return "", fmt.Errorf("invalid credential type: %s", cred) + } + + return credentialValue, nil +} + +// getServiceAccountEmail searches for an email in the following order: client configuration, environment variable, credentials file. +// is not required for authentication, so it can be empty. +// +// Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. +func getServiceAccountEmail(cfg *config.Configuration) string { + if cfg.ServiceAccountEmail != "" { + return cfg.ServiceAccountEmail + } + + email, emailSet := os.LookupEnv("STACKIT_SERVICE_ACCOUNT_EMAIL") + if !emailSet || email == "" { + credentials, err := readCredentialsFile(cfg.CredentialsFilePath) + if err != nil { + // email is not required for authentication, so it shouldnt block it + return "" + } + return credentials.STACKIT_SERVICE_ACCOUNT_EMAIL + } + return email +} + +// getKey searches for a key in the following order: client configuration, environment variable, credentials file. +func getKey(cfgKey, cfgKeyPath *string, envVarKeyPath, envVarKey string, credTypePath, credTypeKey credentialType, cfgCredFilePath string) error { + if *cfgKey != "" { + return nil + } + if *cfgKeyPath == "" { + // check environment variable: path + keyPath, keyPathSet := os.LookupEnv(envVarKeyPath) + // check environment variable: key + key, keySet := os.LookupEnv(envVarKey) + // if both are not set -> read from credentials file + if (!keyPathSet || keyPath == "") && (!keySet || key == "") { + credentials, err := readCredentialsFile(cfgCredFilePath) + if err != nil { + return fmt.Errorf("reading from credentials file: %w", err) + } + // read key path from credentials file + keyPath, err = readCredential(credTypePath, credentials) + if err != nil || keyPath == "" { + // key path was not provided, read key from credentials file + key, err = readCredential(credTypeKey, credentials) + if err != nil || key == "" { + return fmt.Errorf("neither key nor path is provided in the configuration, environment variable, or credentials file: %w", err) + } + *cfgKey = key + return nil + } + } else if !keyPathSet || keyPath == "" { + // key path was not provided, use key + *cfgKey = key + return nil + } + *cfgKeyPath = keyPath + } + keyBytes, err := os.ReadFile(*cfgKeyPath) + if err != nil { + return fmt.Errorf("reading key from file path: %w", err) + } + if len(keyBytes) == 0 { + return fmt.Errorf("key path points to an empty file") + } + *cfgKey = string(keyBytes) + return nil +} + +// getServiceAccountKey configures the service account key in the provided configuration +func getServiceAccountKey(cfg *config.Configuration) error { + return getKey(&cfg.ServiceAccountKey, &cfg.ServiceAccountKeyPath, "STACKIT_SERVICE_ACCOUNT_KEY_PATH", "STACKIT_SERVICE_ACCOUNT_KEY", serviceAccountKeyPathCredentialType, serviceAccountKeyCredentialType, cfg.CredentialsFilePath) +} + +// getPrivateKey configures the private key in the provided configuration +func getPrivateKey(cfg *config.Configuration) error { + return getKey(&cfg.PrivateKey, &cfg.PrivateKeyPath, "STACKIT_PRIVATE_KEY_PATH", "STACKIT_PRIVATE_KEY", privateKeyPathCredentialType, privateKeyCredentialType, cfg.CredentialsFilePath) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/auth_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/auth_flow.go new file mode 100644 index 000000000..5a0c18960 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/auth_flow.go @@ -0,0 +1,88 @@ +package clients + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "time" + + "github.com/golang-jwt/jwt/v5" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +const ( + defaultTokenExpirationLeeway = time.Second * 5 +) + +type AuthFlow interface { + RoundTrip(req *http.Request) (*http.Response, error) + GetAccessToken() (string, error) + getBackgroundTokenRefreshContext() context.Context + refreshAccessToken() error +} + +// TokenResponseBody is the API response +// when requesting a new token +type TokenResponseBody struct { + AccessToken string `json:"access_token"` + ExpiresIn int `json:"expires_in"` + // Deprecated: RefreshToken is no longer used and the SDK will not attempt to refresh tokens using it but will instead use the AuthFlow implementation to get new tokens. + // This will be removed after 2026-07-01. + RefreshToken string `json:"refresh_token"` + Scope string `json:"scope"` + TokenType string `json:"token_type"` +} + +func parseTokenResponse(res *http.Response) (*TokenResponseBody, error) { + if res == nil { + return nil, fmt.Errorf("received bad response from API") + } + if res.StatusCode != http.StatusOK { + body, err := io.ReadAll(res.Body) + if err != nil { + // Fail silently, omit body from error + // We're trying to show error details, so it's unnecessary to fail because of this err + body = []byte{} + } + return nil, &oapierror.GenericOpenAPIError{ + StatusCode: res.StatusCode, + Body: body, + } + } + body, err := io.ReadAll(res.Body) + if err != nil { + return nil, err + } + + token := &TokenResponseBody{} + err = json.Unmarshal(body, token) + if err != nil { + return nil, fmt.Errorf("unmarshal token response: %w", err) + } + return token, nil +} + +func tokenExpired(token string, tokenExpirationLeeway time.Duration) (bool, error) { + if token == "" { + return true, nil + } + + // We can safely use ParseUnverified because we are not authenticating the user at this point. + // We're just checking the expiration time + tokenParsed, _, err := jwt.NewParser().ParseUnverified(token, &jwt.RegisteredClaims{}) + if err != nil { + return false, fmt.Errorf("parse token: %w", err) + } + + expirationTimestampNumeric, err := tokenParsed.Claims.GetExpirationTime() + if err != nil { + return false, fmt.Errorf("get expiration timestamp: %w", err) + } + + // Pretend to be `tokenExpirationLeeway` into the future to avoid token expiring + // between retrieving the token and upstream systems validating it. + now := time.Now().Add(tokenExpirationLeeway) + return now.After(expirationTimestampNumeric.Time), nil +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/clients.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/clients.go new file mode 100644 index 000000000..9d7fed6dc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/clients.go @@ -0,0 +1,22 @@ +package clients + +import ( + "time" +) + +const ( + DefaultClientTimeout = time.Minute +) + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. +type RetryConfig struct { + MaxRetries int // Max retries + WaitBetweenCalls time.Duration // Time to wait between requests + RetryTimeout time.Duration // Max time to re-try + ClientTimeout time.Duration // HTTP Client timeout +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. +func NewRetryConfig() *RetryConfig { + return &RetryConfig{} +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/continuous_refresh.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/continuous_refresh.go new file mode 100644 index 000000000..effb5e668 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/continuous_refresh.go @@ -0,0 +1,133 @@ +package clients + +import ( + "errors" + "fmt" + "os" + "time" + + "github.com/golang-jwt/jwt/v5" + + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +var ( + defaultTimeStartBeforeTokenExpiration = 30 * time.Minute + defaultTimeBetweenContextCheck = time.Second + defaultTimeBetweenTries = 5 * time.Minute +) + +// Continuously refreshes the token of an auth flow, retrying if the token API returns 5xx errrors. Writes to stderr when it terminates. +// +// To terminate this routine, close the context in flow.getBackgroundTokenRefreshContext(). +func continuousRefreshToken(flow AuthFlow) { + refresher := &continuousTokenRefresher{ + flow: flow, + timeStartBeforeTokenExpiration: defaultTimeStartBeforeTokenExpiration, + timeBetweenContextCheck: defaultTimeBetweenContextCheck, + timeBetweenTries: defaultTimeBetweenTries, + } + err := refresher.continuousRefreshToken() + fmt.Fprintf(os.Stderr, "Token refreshing terminated: %v", err) +} + +type continuousTokenRefresher struct { + flow AuthFlow + // Token refresh tries start at [Access token expiration timestamp] - [This duration] + timeStartBeforeTokenExpiration time.Duration + timeBetweenContextCheck time.Duration + timeBetweenTries time.Duration +} + +// Continuously refreshes the token of an auth flow, retrying if the token API returns 5xx errrors. Always returns with a non-nil error. +// +// To terminate this routine, close the context in refresher.flow.getBackgroundTokenRefreshContext(). +func (refresher *continuousTokenRefresher) continuousRefreshToken() error { + // Compute timestamp where we'll refresh token + // Access token may be empty at this point, we have to check it + var startRefreshTimestamp time.Time + + expirationTimestamp, err := refresher.getAccessTokenExpirationTimestamp() + if err != nil { + return fmt.Errorf("get access token expiration timestamp: %w", err) + } + startRefreshTimestamp = expirationTimestamp.Add(-refresher.timeStartBeforeTokenExpiration) + + for { + err := refresher.waitUntilTimestamp(startRefreshTimestamp) + if err != nil { + return err + } + + err = refresher.flow.getBackgroundTokenRefreshContext().Err() + if err != nil { + return fmt.Errorf("check context: %w", err) + } + + ok, err := refresher.refreshToken() + if err != nil { + return fmt.Errorf("refresh tokens: %w", err) + } + if !ok { + startRefreshTimestamp = startRefreshTimestamp.Add(refresher.timeBetweenTries) + continue + } + + expirationTimestamp, err := refresher.getAccessTokenExpirationTimestamp() + if err != nil { + return fmt.Errorf("get access token expiration timestamp: %w", err) + } + startRefreshTimestamp = expirationTimestamp.Add(-refresher.timeStartBeforeTokenExpiration) + } +} + +func (refresher *continuousTokenRefresher) getAccessTokenExpirationTimestamp() (*time.Time, error) { + accessToken, err := refresher.flow.GetAccessToken() + if err != nil { + return nil, err + } + + // We can safely use ParseUnverified because we are not doing authentication of any kind + // We're just checking the expiration time + tokenParsed, _, err := jwt.NewParser().ParseUnverified(accessToken, &jwt.RegisteredClaims{}) + if err != nil { + return nil, fmt.Errorf("parse token: %w", err) + } + expirationTimestampNumeric, err := tokenParsed.Claims.GetExpirationTime() + if err != nil { + return nil, fmt.Errorf("get expiration timestamp: %w", err) + } + return &expirationTimestampNumeric.Time, nil +} + +func (refresher *continuousTokenRefresher) waitUntilTimestamp(timestamp time.Time) error { + for time.Now().Before(timestamp) { + err := refresher.flow.getBackgroundTokenRefreshContext().Err() + if err != nil { + return fmt.Errorf("check context: %w", err) + } + time.Sleep(refresher.timeBetweenContextCheck) + } + return nil +} + +// Returns: +// - (true, nil) if successful. +// - (false, nil) if not successful but should be retried. +// - (_, err) if not successful and shouldn't be retried. +func (refresher *continuousTokenRefresher) refreshToken() (bool, error) { + err := refresher.flow.refreshAccessToken() + if err == nil { + return true, nil + } + + // Should be retried if this is an API error with status code 5xx + oapiErr := &oapierror.GenericOpenAPIError{} + if !errors.As(err, &oapiErr) { + return false, err + } + if oapiErr.StatusCode < 500 { + return false, err + } + return false, nil +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/doc.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/doc.go new file mode 100644 index 000000000..a60f3d4bd --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/doc.go @@ -0,0 +1,6 @@ +/* +This package is a fork from the Community STACKIT Go Client + +See: https://github.com/SchwarzIT/community-stackit-go-client +*/ +package clients diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow.go new file mode 100644 index 000000000..bac4022cd --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow.go @@ -0,0 +1,387 @@ +package clients + +import ( + "context" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" + "fmt" + "net/http" + "net/url" + "regexp" + "strings" + "sync" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" + + "github.com/golang-jwt/jwt/v5" + "github.com/google/uuid" +) + +const ( + // Service Account Key Flow + // Auth flow env variables + ServiceAccountKey = "STACKIT_SERVICE_ACCOUNT_KEY" + PrivateKey = "STACKIT_PRIVATE_KEY" + ServiceAccountKeyPath = "STACKIT_SERVICE_ACCOUNT_KEY_PATH" + PrivateKeyPath = "STACKIT_PRIVATE_KEY_PATH" + tokenAPI = "https://service-account.api.stackit.cloud/token" //nolint:gosec // linter false positive + defaultTokenType = "Bearer" + defaultScope = "" +) + +var _ AuthFlow = &KeyFlow{} + +// KeyFlow handles auth with SA key +type KeyFlow struct { + rt http.RoundTripper + authClient *http.Client + config *KeyFlowConfig + key *ServiceAccountKeyResponse + privateKey *rsa.PrivateKey + privateKeyPEM []byte + + tokenMutex sync.RWMutex + token *TokenResponseBody + + // If the current access token would expire in less than TokenExpirationLeeway, + // the client will refresh it early to prevent clock skew or other timing issues. + tokenExpirationLeeway time.Duration +} + +// KeyFlowConfig is the flow config +type KeyFlowConfig struct { + ServiceAccountKey *ServiceAccountKeyResponse + PrivateKey string + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. + ClientRetry *RetryConfig + TokenUrl string + BackgroundTokenRefreshContext context.Context // Functionality is enabled if this isn't nil + HTTPTransport http.RoundTripper + AuthHTTPClient *http.Client +} + +// ServiceAccountKeyResponse is the API response +// when creating a new SA key +type ServiceAccountKeyResponse struct { + Active bool `json:"active"` + CreatedAt time.Time `json:"createdAt"` + Credentials *ServiceAccountKeyCredentials `json:"credentials"` + ID uuid.UUID `json:"id"` + KeyAlgorithm string `json:"keyAlgorithm"` + KeyOrigin string `json:"keyOrigin"` + KeyType string `json:"keyType"` + PublicKey string `json:"publicKey"` + ValidUntil *time.Time `json:"validUntil,omitempty"` +} + +type ServiceAccountKeyCredentials struct { + Aud string `json:"aud"` + Iss string `json:"iss"` + Kid string `json:"kid"` + PrivateKey *string `json:"privateKey,omitempty"` + Sub uuid.UUID `json:"sub"` +} + +// GetConfig returns the flow configuration +func (c *KeyFlow) GetConfig() KeyFlowConfig { + if c.config == nil { + return KeyFlowConfig{} + } + return *c.config +} + +// GetServiceAccountEmail returns the service account email +func (c *KeyFlow) GetServiceAccountEmail() string { + if c.key == nil { + return "" + } + return c.key.Credentials.Iss +} + +// GetToken returns the token field +// +// Deprecated: Use GetAccessToken instead. +// This will be removed after 2026-07-01. +func (c *KeyFlow) GetToken() TokenResponseBody { + c.tokenMutex.RLock() + defer c.tokenMutex.RUnlock() + + if c.token == nil { + return TokenResponseBody{} + } + // Returned struct is passed by value (because it's a struct) + // So no deepy copy needed + return *c.token +} + +func (c *KeyFlow) Init(cfg *KeyFlowConfig) error { + // No concurrency at this point, so no mutex check needed + c.token = &TokenResponseBody{} + c.config = cfg + + if c.config.TokenUrl == "" { + c.config.TokenUrl = tokenAPI + } + + c.tokenExpirationLeeway = defaultTokenExpirationLeeway + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + if c.authClient = cfg.AuthHTTPClient; cfg.AuthHTTPClient == nil { + c.authClient = &http.Client{ + Transport: c.rt, + Timeout: DefaultClientTimeout, + } + } + + err := c.validate() + if err != nil { + return err + } + if c.config.BackgroundTokenRefreshContext != nil { + go continuousRefreshToken(c) + } + return nil +} + +// SetToken can be used to set an access and refresh token manually in the client. +// The other fields in the token field are determined by inspecting the token or setting default values. +// +// Deprecated: This method will be removed in future versions. Access tokens are going to be automatically managed by the client. +// This will be removed after 2026-07-01. +func (c *KeyFlow) SetToken(accessToken, refreshToken string) error { + // We can safely use ParseUnverified because we are not authenticating the user, + // We are parsing the token just to get the expiration time claim + parsedAccessToken, _, err := jwt.NewParser().ParseUnverified(accessToken, &jwt.RegisteredClaims{}) + if err != nil { + return fmt.Errorf("parse access token to read expiration time: %w", err) + } + exp, err := parsedAccessToken.Claims.GetExpirationTime() + if err != nil { + return fmt.Errorf("get expiration time from access token: %w", err) + } + + c.tokenMutex.Lock() + c.token = &TokenResponseBody{ + AccessToken: accessToken, + ExpiresIn: int(exp.Time.Unix()), + RefreshToken: refreshToken, + Scope: defaultScope, + TokenType: defaultTokenType, + } + c.tokenMutex.Unlock() + return nil +} + +// Roundtrip performs the request +func (c *KeyFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + + accessToken, err := c.GetAccessToken() + if err != nil { + return nil, err + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", accessToken)) + return c.rt.RoundTrip(req) +} + +// GetAccessToken returns a short-lived access token and saves the access and refresh tokens in the token field +func (c *KeyFlow) GetAccessToken() (string, error) { + if c.rt == nil { + return "", fmt.Errorf("nil http round tripper, please run Init()") + } + var accessToken string + + c.tokenMutex.RLock() + if c.token != nil { + accessToken = c.token.AccessToken + } + c.tokenMutex.RUnlock() + + accessTokenExpired, err := tokenExpired(accessToken, c.tokenExpirationLeeway) + if err != nil { + return "", fmt.Errorf("check access token is expired: %w", err) + } + if !accessTokenExpired { + return accessToken, nil + } + if err = c.recreateAccessToken(); err != nil { + var oapiErr *oapierror.GenericOpenAPIError + if ok := errors.As(err, &oapiErr); ok { + reg := regexp.MustCompile("Key with kid .*? was not found") + if reg.Match(oapiErr.Body) { + err = fmt.Errorf("check if your configured key is valid and if the token endpoint is configured correct: %w", err) + } + } + return "", fmt.Errorf("get new access token: %w", err) + } + + c.tokenMutex.RLock() + accessToken = c.token.AccessToken + c.tokenMutex.RUnlock() + + return accessToken, nil +} + +func (c *KeyFlow) refreshAccessToken() error { + return c.recreateAccessToken() +} + +func (c *KeyFlow) getBackgroundTokenRefreshContext() context.Context { + return c.config.BackgroundTokenRefreshContext +} + +// validate the client is configured well +func (c *KeyFlow) validate() error { + if c.config.ServiceAccountKey == nil { + return fmt.Errorf("service account access key cannot be empty") + } + if c.config.PrivateKey == "" { + return fmt.Errorf("private key cannot be empty") + } + + c.key = c.config.ServiceAccountKey + var err error + c.privateKey, err = jwt.ParseRSAPrivateKeyFromPEM([]byte(c.config.PrivateKey)) + if err != nil { + return fmt.Errorf("parse private key from PEM file: %w", err) + } + + // Encode the private key in PEM format + privKeyPEM := &pem.Block{ + Type: "RSA PRIVATE KEY", + Bytes: x509.MarshalPKCS1PrivateKey(c.privateKey), + } + c.privateKeyPEM = pem.EncodeToMemory(privKeyPEM) + + if c.tokenExpirationLeeway < 0 { + return fmt.Errorf("token expiration leeway cannot be negative") + } + + return nil +} + +// Flow auth functions + +// recreateAccessToken is used to create a new access token +// when the existing one isn't valid anymore +func (c *KeyFlow) recreateAccessToken() error { + var refreshToken string + + c.tokenMutex.RLock() + if c.token != nil { + refreshToken = c.token.RefreshToken + } + c.tokenMutex.RUnlock() + + refreshTokenExpired, err := tokenExpired(refreshToken, c.tokenExpirationLeeway) + if err != nil { + return err + } + if !refreshTokenExpired { + return c.createAccessTokenWithRefreshToken() + } + return c.createAccessToken() +} + +// createAccessToken creates an access token using self signed JWT +func (c *KeyFlow) createAccessToken() (err error) { + grant := "urn:ietf:params:oauth:grant-type:jwt-bearer" + assertion, err := c.generateSelfSignedJWT() + if err != nil { + return err + } + res, err := c.requestToken(grant, assertion) + if err != nil { + return err + } + defer func() { + tempErr := res.Body.Close() + if tempErr != nil && err == nil { + err = fmt.Errorf("close request access token response: %w", tempErr) + } + }() + token, err := parseTokenResponse(res) + if err != nil { + return err + } + c.tokenMutex.Lock() + c.token = token + c.tokenMutex.Unlock() + return nil +} + +// createAccessTokenWithRefreshToken creates an access token using +// an existing pre-validated refresh token +// Deprecated: This method will be removed in future versions. Access tokens are going to be refreshed without refresh token. +// This will be removed after 2026-07-01. +func (c *KeyFlow) createAccessTokenWithRefreshToken() (err error) { + c.tokenMutex.RLock() + refreshToken := c.token.RefreshToken + c.tokenMutex.RUnlock() + + res, err := c.requestToken("refresh_token", refreshToken) + if err != nil { + return err + } + defer func() { + tempErr := res.Body.Close() + if tempErr != nil && err == nil { + err = fmt.Errorf("close request access token with refresh token response: %w", tempErr) + } + }() + token, err := parseTokenResponse(res) + if err != nil { + return err + } + c.tokenMutex.Lock() + c.token = token + c.tokenMutex.Unlock() + return nil +} + +// generateSelfSignedJWT generates JWT token +func (c *KeyFlow) generateSelfSignedJWT() (string, error) { + claims := jwt.MapClaims{ + "iss": c.key.Credentials.Iss, + "sub": c.key.Credentials.Sub, + "jti": uuid.New(), + "aud": c.key.Credentials.Aud, + "iat": jwt.NewNumericDate(time.Now()), + "exp": jwt.NewNumericDate(time.Now().Add(1 * time.Hour)), + } + token := jwt.NewWithClaims(jwt.SigningMethodRS512, claims) + token.Header["kid"] = c.key.Credentials.Kid + tokenString, err := token.SignedString(c.privateKey) + if err != nil { + return "", err + } + return tokenString, nil +} + +// requestToken makes a request to the SA token API +func (c *KeyFlow) requestToken(grant, assertion string) (*http.Response, error) { + body := url.Values{} + body.Set("grant_type", grant) + if grant == "refresh_token" { + body.Set("refresh_token", assertion) + } else { + body.Set("assertion", assertion) + } + + payload := strings.NewReader(body.Encode()) + req, err := http.NewRequest(http.MethodPost, c.config.TokenUrl, payload) + if err != nil { + return nil, err + } + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + return c.authClient.Do(req) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/no_auth_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/no_auth_flow.go new file mode 100644 index 000000000..b0b2406ce --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/no_auth_flow.go @@ -0,0 +1,45 @@ +package clients + +import ( + "fmt" + "net/http" +) + +type NoAuthFlow struct { + rt http.RoundTripper + config *NoAuthFlowConfig +} + +// NoAuthFlowConfig holds the configuration for the unauthenticated flow +type NoAuthFlowConfig struct { + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. + ClientRetry *RetryConfig + HTTPTransport http.RoundTripper +} + +// GetConfig returns the flow configuration +func (c *NoAuthFlow) GetConfig() NoAuthFlowConfig { + if c.config == nil { + return NoAuthFlowConfig{} + } + return *c.config +} + +func (c *NoAuthFlow) Init(cfg NoAuthFlowConfig) error { + c.config = &NoAuthFlowConfig{} + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + return nil +} + +// RoundTrip performs the request +func (c *NoAuthFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + + return c.rt.RoundTrip(req) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/token_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/token_flow.go new file mode 100644 index 000000000..ac1ff779a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/token_flow.go @@ -0,0 +1,63 @@ +package clients + +import ( + "fmt" + "net/http" +) + +const ( + // Service Account Token Flow + // Auth flow env variables + ServiceAccountToken = "STACKIT_SERVICE_ACCOUNT_TOKEN" +) + +// TokenFlow handles auth with SA static token +type TokenFlow struct { + rt http.RoundTripper + config *TokenFlowConfig +} + +// TokenFlowConfig is the flow config +type TokenFlowConfig struct { + // Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. + ServiceAccountEmail string + ServiceAccountToken string + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. + ClientRetry *RetryConfig + HTTPTransport http.RoundTripper +} + +// GetConfig returns the flow configuration +func (c *TokenFlow) GetConfig() TokenFlowConfig { + if c.config == nil { + return TokenFlowConfig{} + } + return *c.config +} + +func (c *TokenFlow) Init(cfg *TokenFlowConfig) error { + c.config = cfg + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + return c.validate() +} + +// validate the client is configured well +func (c *TokenFlow) validate() error { + if c.config.ServiceAccountToken == "" { + return fmt.Errorf("service account access token cannot be empty") + } + return nil +} + +// RoundTrip performs the request +func (c *TokenFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.config.ServiceAccountToken)) + return c.rt.RoundTrip(req) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/workload_identity_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/workload_identity_flow.go new file mode 100644 index 000000000..73a1ed272 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/workload_identity_flow.go @@ -0,0 +1,223 @@ +package clients + +import ( + "context" + "fmt" + "net/http" + "net/url" + "strings" + "sync" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/oidcadapters" + "github.com/stackitcloud/stackit-sdk-go/core/utils" +) + +const ( + clientIDEnv = "STACKIT_SERVICE_ACCOUNT_EMAIL" + FederatedTokenFileEnv = "STACKIT_FEDERATED_TOKEN_FILE" //nolint:gosec // This is not a secret, just the env variable name + wifTokenEndpointEnv = "STACKIT_IDP_TOKEN_ENDPOINT" //nolint:gosec // This is not a secret, just the env variable name + wifTokenExpirationEnv = "STACKIT_IDP_TOKEN_EXPIRATION_SECONDS" //nolint:gosec // This is not a secret, just the env variable name + + wifClientAssertionType = "urn:schwarz:params:oauth:client-assertion-type:workload-jwt" + wifGrantType = "client_credentials" + defaultWifTokenEndpoint = "https://accounts.stackit.cloud/oauth/v2/token" //nolint:gosec // This is not a secret, just the public endpoint for default value + defaultFederatedTokenPath = "/var/run/secrets/stackit.cloud/serviceaccount/token" //nolint:gosec // This is not a secret, just the default path for workload identity token + defaultWifExpirationToken = "1h" +) + +var ( + _ = utils.GetEnvOrDefault(wifTokenExpirationEnv, defaultWifExpirationToken) // Not used yet +) + +var _ AuthFlow = &WorkloadIdentityFederationFlow{} + +// WorkloadIdentityFlow handles auth with Workload Identity Federation +type WorkloadIdentityFederationFlow struct { + rt http.RoundTripper + authClient *http.Client + config *WorkloadIdentityFederationFlowConfig + + tokenMutex sync.RWMutex + token *TokenResponseBody + + // If the current access token would expire in less than TokenExpirationLeeway, + // the client will refresh it early to prevent clock skew or other timing issues. + tokenExpirationLeeway time.Duration +} + +// KeyFlowConfig is the flow config +type WorkloadIdentityFederationFlowConfig struct { + TokenUrl string + ClientID string + TokenExpiration string // Not supported yet + BackgroundTokenRefreshContext context.Context // Functionality is enabled if this isn't nil + HTTPTransport http.RoundTripper + AuthHTTPClient *http.Client + FederatedTokenFunction oidcadapters.OIDCTokenFunc // Function to get the federated token +} + +// GetConfig returns the flow configuration +func (c *WorkloadIdentityFederationFlow) GetConfig() WorkloadIdentityFederationFlowConfig { + if c.config == nil { + return WorkloadIdentityFederationFlowConfig{} + } + return *c.config +} + +// GetAccessToken implements AuthFlow. +func (c *WorkloadIdentityFederationFlow) GetAccessToken() (string, error) { + if c.rt == nil { + return "", fmt.Errorf("nil http round tripper, please run Init()") + } + var accessToken string + + c.tokenMutex.RLock() + if c.token != nil { + accessToken = c.token.AccessToken + } + c.tokenMutex.RUnlock() + + accessTokenExpired, err := tokenExpired(accessToken, c.tokenExpirationLeeway) + if err != nil { + return "", fmt.Errorf("check access token is expired: %w", err) + } + if !accessTokenExpired { + return accessToken, nil + } + if err = c.createAccessToken(); err != nil { + return "", fmt.Errorf("get new access token: %w", err) + } + + c.tokenMutex.RLock() + accessToken = c.token.AccessToken + c.tokenMutex.RUnlock() + + return accessToken, nil +} + +func (c *WorkloadIdentityFederationFlow) refreshAccessToken() error { + return c.createAccessToken() +} + +// RoundTrip implements the http.RoundTripper interface. +// It gets a token, adds it to the request's authorization header, and performs the request. +func (c *WorkloadIdentityFederationFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + + accessToken, err := c.GetAccessToken() + if err != nil { + return nil, err + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", accessToken)) + return c.rt.RoundTrip(req) +} + +// getBackgroundTokenRefreshContext implements AuthFlow. +func (c *WorkloadIdentityFederationFlow) getBackgroundTokenRefreshContext() context.Context { + return c.config.BackgroundTokenRefreshContext +} + +func (c *WorkloadIdentityFederationFlow) Init(cfg *WorkloadIdentityFederationFlowConfig) error { + // No concurrency at this point, so no mutex check needed + c.token = &TokenResponseBody{} + c.config = cfg + + if c.config.TokenUrl == "" { + c.config.TokenUrl = utils.GetEnvOrDefault(wifTokenEndpointEnv, defaultWifTokenEndpoint) + } + + if c.config.ClientID == "" { + c.config.ClientID = utils.GetEnvOrDefault(clientIDEnv, "") + } + + if c.config.FederatedTokenFunction == nil { + c.config.FederatedTokenFunction = oidcadapters.ReadJWTFromFileSystem(utils.GetEnvOrDefault(FederatedTokenFileEnv, defaultFederatedTokenPath)) + } + + c.tokenExpirationLeeway = defaultTokenExpirationLeeway + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + if c.authClient = cfg.AuthHTTPClient; cfg.AuthHTTPClient == nil { + c.authClient = &http.Client{ + Transport: c.rt, + Timeout: DefaultClientTimeout, + } + } + + err := c.validate() + if err != nil { + return err + } + + if c.config.BackgroundTokenRefreshContext != nil { + go continuousRefreshToken(c) + } + return nil +} + +// validate the client is configured well +func (c *WorkloadIdentityFederationFlow) validate() error { + if c.config.ClientID == "" { + return fmt.Errorf("client ID cannot be empty") + } + if c.config.TokenUrl == "" { + return fmt.Errorf("token URL cannot be empty") + } + if _, err := c.config.FederatedTokenFunction(context.Background()); err != nil { + return fmt.Errorf("error reading federated token file - %w", err) + } + if c.tokenExpirationLeeway < 0 { + return fmt.Errorf("token expiration leeway cannot be negative") + } + + return nil +} + +// createAccessToken creates an access token using self signed JWT +func (c *WorkloadIdentityFederationFlow) createAccessToken() error { + clientAssertion, err := c.config.FederatedTokenFunction(context.Background()) + if err != nil { + return err + } + res, err := c.requestToken(c.config.ClientID, clientAssertion) + if err != nil { + return err + } + defer func() { + tempErr := res.Body.Close() + if tempErr != nil && err == nil { + err = fmt.Errorf("close request access token response: %w", tempErr) + } + }() + token, err := parseTokenResponse(res) + if err != nil { + return err + } + c.tokenMutex.Lock() + c.token = token + c.tokenMutex.Unlock() + return nil +} + +func (c *WorkloadIdentityFederationFlow) requestToken(clientID, assertion string) (*http.Response, error) { + body := url.Values{} + body.Set("grant_type", wifGrantType) + body.Set("client_assertion_type", wifClientAssertionType) + body.Set("client_assertion", assertion) + body.Set("client_id", clientID) + + payload := strings.NewReader(body.Encode()) + req, err := http.NewRequest(http.MethodPost, c.config.TokenUrl, payload) + if err != nil { + return nil, err + } + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + return c.authClient.Do(req) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/config/config.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/config/config.go new file mode 100644 index 000000000..ec3bae10e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/config/config.go @@ -0,0 +1,611 @@ +// Part of this code is taken from the client.go file +// generated by the OpenApi generator for each API client +package config + +import ( + "context" + "fmt" + "net/http" + "os" + "strings" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/clients" + "github.com/stackitcloud/stackit-sdk-go/core/oidcadapters" +) + +const ( + global = "global" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). +type contextKey string + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") + + // ContextHTTPResponse holds the raw HTTP response after the request has completed. + ContextHTTPResponse = contextKey("httpResponse") + + // ContextHTTPRequest holds the raw HTTP request. + ContextHTTPRequest = contextKey("httpRequest") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// Middleware is a function that wraps an http.RoundTripper to provide additional functionality +// such as logging, authentication, etc. +type Middleware func(http.RoundTripper) http.RoundTripper + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + NoAuth bool `json:"noAuth,omitempty"` + WorkloadIdentityFederation bool `json:"workloadIdentityFederation,omitempty"` + ServiceAccountFederatedTokenExpiration string `json:"serviceAccountFederatedTokenExpiration,omitempty"` + ServiceAccountFederatedTokenFunc oidcadapters.OIDCTokenFunc `json:"serviceAccountFederatedTokenFunc,omitempty"` + ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` + Token string `json:"token,omitempty"` + ServiceAccountKey string `json:"serviceAccountKey,omitempty"` + PrivateKey string `json:"privateKey,omitempty"` + ServiceAccountKeyPath string `json:"serviceAccountKeyPath,omitempty"` + PrivateKeyPath string `json:"privateKeyPath,omitempty"` + CredentialsFilePath string `json:"credentialsFilePath,omitempty"` + TokenCustomUrl string `json:"tokenCustomUrl,omitempty"` + Region string `json:"region,omitempty"` + CustomAuth http.RoundTripper + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client + Middleware []Middleware + + // If != nil, a goroutine will be launched that will refresh the service account's access token when it's close to being expired. + // The goroutine is killed whenever this context is canceled. + // + // Only has effect for key flow + BackgroundTokenRefreshContext context.Context + + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This field has no effect, and will be removed in a later update + RetryOptions *clients.RetryConfig //nolint:staticcheck //will be removed in a later update + + setCustomEndpoint bool +} + +// ConfigurationOption is an option for an API client. The options are executed sequentially, so +// if you use withHTTPClient with a custom client that has a timeout of 1 minute and then you use +// withTimeout with a timeout of 2 minutes, the HTTP client timeout will be last one to be set. +// In the same way, if you use withHTTPClient as the last option, it will override all of the +// previous configurations to the HTTPClient +type ConfigurationOption func(*Configuration) error + +// WithHTTPClient returns a ConfigurationOption that specifies the HTTP client to use +// as basis for the communication. +// Warning: providing this option overrides authentication, if you just want to customize the http client parameters except Transport, +// you can use the WithCheckRedirect, WithJar and WithTimeout +func WithHTTPClient(client *http.Client) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient = client + return nil + } +} + +// WithCustomAuth returns a ConfigurationOption that provides a custom http.Roundtripper +// for making authenticated requests +func WithCustomAuth(rt http.RoundTripper) ConfigurationOption { + return func(config *Configuration) error { + config.CustomAuth = rt + return nil + } +} + +// WithUserAgent returns a ConfigurationOption that defines the User-Agent +func WithUserAgent(userAgent string) ConfigurationOption { + return func(config *Configuration) error { + config.UserAgent = userAgent + return nil + } +} + +// WithRegion returns a ConfigurationOption that specifies the region to be used +func WithRegion(region string) ConfigurationOption { + return func(config *Configuration) error { + config.Region = region + return nil + } +} + +// WithEndpoint returns a ConfigurationOption that overrides the default endpoint to be used for the client +// This option takes precedence over withRegion +func WithEndpoint(endpoint string) ConfigurationOption { + return func(config *Configuration) error { + customServers := ServerConfigurations{ + { + URL: endpoint, + Description: "User provided URL", + }, + } + config.Servers = customServers + config.setCustomEndpoint = true + return nil + } +} + +// WithTokenEndpoint returns a ConfigurationOption that overrides the default url to be used to get a token when using the key flow +func WithTokenEndpoint(url string) ConfigurationOption { + return func(config *Configuration) error { + config.TokenCustomUrl = url + return nil + } +} + +// WithServiceAccountEmail returns a ConfigurationOption that sets the service account email +func WithServiceAccountEmail(serviceAccountEmail string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountEmail = serviceAccountEmail + return nil + } +} + +// WithServiceAccountKey returns a ConfigurationOption that sets the service account key +// This option takes precedence over WithServiceAccountKeyPath +func WithServiceAccountKey(serviceAccountKey string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountKey = serviceAccountKey + return nil + } +} + +// WithServiceAccountKeyPath returns a ConfigurationOption that sets the service account key path +func WithServiceAccountKeyPath(serviceAccountKeyPath string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountKeyPath = serviceAccountKeyPath + return nil + } +} + +// WithPrivateKey returns a ConfigurationOption that sets the private key +// This option takes precedence over WithPrivateKeyPath +func WithPrivateKey(privateKey string) ConfigurationOption { + return func(config *Configuration) error { + config.PrivateKey = privateKey + return nil + } +} + +// WithPrivateKeyPath returns a ConfigurationOption that sets the private key path +func WithPrivateKeyPath(privateKeyPath string) ConfigurationOption { + return func(config *Configuration) error { + config.PrivateKeyPath = privateKeyPath + return nil + } +} + +// WithRetryTimeout returns a ConfigurationOption that specifies the maximum time for ret +// WithoutAuthentication returns a ConfigurationOption that disables authentication. +// This option takes precedence over the WithToken option +func WithoutAuthentication() ConfigurationOption { + return func(config *Configuration) error { + config.NoAuth = true + return nil + } +} + +// WithToken returns a ConfigurationOption that sets a token to be used for authentication in API calls +func WithToken(token string) ConfigurationOption { + return func(config *Configuration) error { + config.Token = token + return nil + } +} + +// WithWorkloadIdentityFederationAuth returns a ConfigurationOption that sets workload identity flow to be used for authentication in API calls +func WithWorkloadIdentityFederationAuth() ConfigurationOption { + return func(config *Configuration) error { + config.WorkloadIdentityFederation = true + return nil + } +} + +// WithWorkloadIdentityFederationFunc returns a ConfigurationOption that sets the function to get the federated token for workload identity federation flow +func WithWorkloadIdentityFederationFunc(function oidcadapters.OIDCTokenFunc) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountFederatedTokenFunc = function + return nil + } +} + +// WithWorkloadIdentityFederationPath returns a ConfigurationOption that sets the custom path to the federated token file for workload identity federation flow +func WithWorkloadIdentityFederationPath(path string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountFederatedTokenFunc = oidcadapters.ReadJWTFromFileSystem(path) + return nil + } +} + +// WithWorkloadIdentityFederationFunc returns a ConfigurationOption that sets the id token for workload identity federation flow +func WithWorkloadIdentityFederationToken(token string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountFederatedTokenFunc = func(context.Context) (string, error) { + return token, nil + } + return nil + } +} + +// WithWorkloadIdentityFederationTokenExpiration returns a ConfigurationOption that sets the token expiration for workload identity federation flow +func WithWorkloadIdentityFederationTokenExpiration(expiration string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountFederatedTokenExpiration = expiration + return nil + } +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update +func WithMaxRetries(_ int) ConfigurationOption { + return func(_ *Configuration) error { + return nil + } +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update +func WithWaitBetweenCalls(_ time.Duration) ConfigurationOption { + return func(_ *Configuration) error { + return nil + } +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update +func WithRetryTimeout(_ time.Duration) ConfigurationOption { + return func(_ *Configuration) error { + return nil + } +} + +// WithTimeout returns a ConfigurationOption that specifies the HTTP client timeout +func WithTimeout(timeout time.Duration) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient.Timeout = timeout + return nil + } +} + +// WithCheckRedirect returns a ConfigurationOption that specifies the HTTP client checkRedirect function +func WithCheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient.CheckRedirect = checkRedirect + return nil + } +} + +// WithJar returns a ConfigurationOption that specifies the HTTP client cookie jar +func WithJar(jar http.CookieJar) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient.Jar = jar + return nil + } +} + +// WithMiddleware returns a ConfigurationOption that adds a Middleware to the client. +// The Middleware is prepended to the list of Middlewares so that the last added Middleware is the first to be executed. +// Warning: Providing this option may overide the authentication performed by the SDK if the middlewares provided break the chain. +// If changes are made to the authentication header and the chain is preserved, they will be overwritten. If you wish to overwrite authentication, use WithCustomAuth. +func WithMiddleware(m Middleware) ConfigurationOption { + // Prepend m to the list of middlewares + return func(config *Configuration) error { + config.Middleware = append([]Middleware{m}, config.Middleware...) + return nil + } +} + +// WithBackgroundTokenRefresh returns a ConfigurationOption that enables access token refreshing in backgound. +// +// If enabled, a goroutine will be launched that will refresh the service account's access token when it's close to being expired. +// The goroutine is killed whenever the given context is canceled. +// +// Only has effect for key flow +func WithBackgroundTokenRefresh(ctx context.Context) ConfigurationOption { + return func(c *Configuration) error { + if ctx == nil { + return fmt.Errorf("context for token refresh in background cannot be empty") + } + c.BackgroundTokenRefreshContext = ctx + return nil + } +} + +// WithCustomConfiguration returns a ConfigurationOption that sets a custom Configuration +func WithCustomConfiguration(cfg *Configuration) ConfigurationOption { + return func(config *Configuration) error { + config.Host = cfg.Host + config.Scheme = cfg.Scheme + config.DefaultHeader = cfg.DefaultHeader + config.UserAgent = cfg.UserAgent + config.Debug = cfg.Debug + config.NoAuth = cfg.NoAuth + config.Token = cfg.Token + config.ServiceAccountKey = cfg.ServiceAccountKey + config.ServiceAccountKeyPath = cfg.ServiceAccountKeyPath + config.PrivateKey = cfg.PrivateKey + config.PrivateKeyPath = cfg.PrivateKeyPath + config.Region = cfg.Region + config.CredentialsFilePath = cfg.CredentialsFilePath + config.CustomAuth = cfg.CustomAuth + config.Servers = cfg.Servers + config.setCustomEndpoint = (len(cfg.Servers) > 0) + config.OperationServers = cfg.OperationServers + config.HTTPClient = cfg.HTTPClient + config.BackgroundTokenRefreshContext = cfg.BackgroundTokenRefreshContext + return nil + } +} + +// WithCaptureHTTPResponse adds the raw HTTP response retrieval annotation to the parent context. +// The resp parameter will contain the raw HTTP response after the request has completed. +// +// Deprecated: Use runtime.WithCaptureHTTPResponse instead +func WithCaptureHTTPResponse(parent context.Context, resp **http.Response) context.Context { + return context.WithValue(parent, ContextHTTPResponse, resp) +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + serverUrl := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + serverUrl = strings.Replace(serverUrl, "{"+name+"}", value, -1) + } else { + serverUrl = strings.Replace(serverUrl, "{"+name+"}", variable.DefaultValue, -1) + } + } + return serverUrl, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, fmt.Errorf("invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + operationIndices, ok := osi.(map[string]int) + if !ok { + return 0, fmt.Errorf("invalid type %T should be map[string]int", osi) + } + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, fmt.Errorf("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + operationVariables, ok := osv.(map[string]map[string]string) + if !ok { + return nil, fmt.Errorf("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} + +// ConfigureRegion configures the API server urls with the user specified region. +// Does nothing if a custom endpoint is provided. +// Throws an error if no region is given or if the region is not valid +// Throws an error if a region is given for a global url. +func ConfigureRegion(cfg *Configuration) error { + if cfg.setCustomEndpoint { + return nil + } + + servers := cfg.Servers + oasRegion, ok := servers[0].Variables["region"] + if !ok { + // No region variable found + return fmt.Errorf("no region was found in the API configuration") + } + + var availableRegions []string + for _, regionWithDotSuffix := range oasRegion.EnumValues { + availableRegions = append(availableRegions, strings.TrimSuffix(regionWithDotSuffix, ".")) + } + + isRegionSetByEnv := false + if cfg.Region == "" { + // Check region + envVarRegion, _ := os.LookupEnv("STACKIT_REGION") + cfg.Region = envVarRegion + isRegionSetByEnv = true + } + + if oasRegion.DefaultValue != "" && oasRegion.DefaultValue != global { + if cfg.Region == "" { + return fmt.Errorf("no region was provided, available regions are: %s", availableRegions) + } + // API is regional (not global) + if containsCaseSensitive(availableRegions, cfg.Region) { + cfgUrl := strings.Replace(servers[0].URL, "{region}", fmt.Sprintf("%s.", cfg.Region), -1) + cfg.Servers = ServerConfigurations{ + { + URL: cfgUrl, + Description: servers[0].Description, + }, + } + return nil + } + // Region is not available. + return fmt.Errorf("the provided region is not available for this API, available regions are: %s", availableRegions) + } + // Global API. + // If a region is provided by the user via WithRegion() return an error. + // The region is provided as a function argument instead of being set in the client configuration. + if cfg.Region != "" && !isRegionSetByEnv { + return fmt.Errorf("this API does not support setting a region in the the client configuration, please check if the region can be specified as a function parameter") + } + // If the url is a template, generated using deprecated config.json, the region variable is replaced + // If the url is already configured, there is no region variable and it remains the same + cfgUrl := strings.Replace(servers[0].URL, "{region}", "", -1) + cfg.Servers = ServerConfigurations{ + { + URL: cfgUrl, + Description: servers[0].Description, + }, + } + return nil +} + +// containsCaseSensitive is a case sensitive match, finding needle in a haystack +func containsCaseSensitive(haystack []string, needle string) bool { + for _, a := range haystack { + if needle == a { + return true + } + } + return false +} + +// ChainMiddleware chains multiple middlewares to create a single http.RoundTripper +// The middlewares are applied in reverse order, so the last middleware provided in the arguments is the first to be executed +// If the root http.RoundTripper is nil, http.DefaultTransport is used +func ChainMiddleware(rt http.RoundTripper, middlewares ...Middleware) http.RoundTripper { + if rt == nil { + rt = http.DefaultTransport + } + + // Apply middlewares in reverse order + for i := len(middlewares) - 1; i >= 0; i-- { + rt = middlewares[i](rt) + } + + return rt +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/oapierror/oapierror.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oapierror/oapierror.go new file mode 100644 index 000000000..205abc17f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oapierror/oapierror.go @@ -0,0 +1,98 @@ +package oapierror + +import ( + "fmt" + "reflect" + "strings" +) + +var ( + // When a response has a bad status, this limits the number of characters that are shown from the response Body + ApiErrorMaxCharacterLimit = 500 +) + +// GenericOpenAPIError Provides access to the Body, errorMessage and Model on returned Errors. +type GenericOpenAPIError struct { + StatusCode int + Body []byte + ErrorMessage string + Model interface{} +} + +func NewError(code int, status string) *GenericOpenAPIError { + return &GenericOpenAPIError{ + StatusCode: code, + ErrorMessage: status, + Model: map[string]any{}, + } +} + +func NewErrorWithBody(code int, status string, body []byte, model any) *GenericOpenAPIError { + return &GenericOpenAPIError{ + StatusCode: code, + ErrorMessage: status, + Body: body, + Model: model, + } +} + +// Error returns non-empty string if there was an errorMessage. +func (e GenericOpenAPIError) Error() string { + // Prevent panic in case of negative value + if ApiErrorMaxCharacterLimit < 0 { + ApiErrorMaxCharacterLimit = 500 + } + + if len(e.Body) <= ApiErrorMaxCharacterLimit { + return fmt.Sprintf("%s, status code %d, Body: %s\n", e.ErrorMessage, e.StatusCode, string(e.Body)) + } + indexStart := ApiErrorMaxCharacterLimit / 2 + indexEnd := len(e.Body) - ApiErrorMaxCharacterLimit/2 + numberTruncatedCharacters := indexEnd - indexStart + return fmt.Sprintf( + "%s, status code %d, Body: %s [...truncated %d characters...] %s", + e.ErrorMessage, + e.StatusCode, + string(e.Body[:indexStart]), + numberTruncatedCharacters, + string(e.Body[indexEnd:]), + ) +} + +// StatusCode returns the status code of the response +func (e GenericOpenAPIError) GetStatusCode() int { + return e.StatusCode +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) GetBody() []byte { + return e.Body +} + +// Model returns the unpacked Model of the errorMessage +func (e GenericOpenAPIError) GetModel() interface{} { + return e.Model +} + +// Format errorMessage message using title and detail when Model implements rfc7807 +func FormatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + switch metaValue.Kind() { + case reflect.Map: + return status + case reflect.Struct: + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + + // status title (detail) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) + } + return status +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/azuredevops.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/azuredevops.go new file mode 100644 index 000000000..12617dbd2 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/azuredevops.go @@ -0,0 +1,73 @@ +package oidcadapters + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" +) + +const ( + adoPipelineOIDCAPIVersion = "7.1" + adoAudience = "api://AzureADTokenExchange" +) + +func RequestAzureDevOpsOIDCToken(oidcRequestUrl, oidcRequestToken, serviceConnectionID string) OIDCTokenFunc { + return func(ctx context.Context) (string, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodPost, oidcRequestUrl, http.NoBody) + if err != nil { + return "", fmt.Errorf("azureDevOpsAssertion: failed to build request: %w", err) + } + + query, err := url.ParseQuery(req.URL.RawQuery) + if err != nil { + return "", fmt.Errorf("azureDevOpsAssertion: cannot parse URL query") + } + + if query.Get("api-version") == "" { + query.Add("api-version", adoPipelineOIDCAPIVersion) + } + + if query.Get("serviceConnectionId") == "" && serviceConnectionID != "" { + query.Add("serviceConnectionId", serviceConnectionID) + } + + if query.Get("audience") == "" { + query.Set("audience", adoAudience) // Azure DevOps requires this specific audience for OIDC tokens + } + + req.URL.RawQuery = query.Encode() + + req.Header.Set("Accept", "application/json") + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", oidcRequestToken)) + req.Header.Set("Content-Type", "application/json") + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return "", fmt.Errorf("azureDevOpsAssertion: cannot request token: %w", err) + } + + defer func() { + _ = resp.Body.Close() + }() + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return "", fmt.Errorf("azureDevOpsAssertion: cannot parse response: %w", err) + } + + if c := resp.StatusCode; c < 200 || c > 299 { + return "", fmt.Errorf("azureDevOpsAssertion: received HTTP status %d with response: %s", resp.StatusCode, body) + } + + var tokenRes struct { + Value *string `json:"oidcToken"` + } + if err := json.Unmarshal(body, &tokenRes); err != nil || tokenRes.Value == nil { + return "", fmt.Errorf("azureDevOpsAssertion: cannot unmarshal response: %w", err) + } + + return *tokenRes.Value, nil + } +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/filesystem.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/filesystem.go new file mode 100644 index 000000000..9947d4088 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/filesystem.go @@ -0,0 +1,27 @@ +package oidcadapters + +import ( + "context" + "os" + + "github.com/golang-jwt/jwt/v5" +) + +var ( + parser *jwt.Parser = jwt.NewParser() +) + +func ReadJWTFromFileSystem(tokenFilePath string) OIDCTokenFunc { + return func(context.Context) (string, error) { + token, err := os.ReadFile(tokenFilePath) + if err != nil { + return "", err + } + tokenStr := string(token) + _, _, err = parser.ParseUnverified(tokenStr, jwt.MapClaims{}) + if err != nil { + return "", err + } + return tokenStr, nil + } +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/githubactions.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/githubactions.go new file mode 100644 index 000000000..589c74ca6 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/githubactions.go @@ -0,0 +1,59 @@ +package oidcadapters + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" +) + +func RequestGHOIDCToken(oidcRequestUrl, oidcRequestToken string) OIDCTokenFunc { + return func(ctx context.Context) (string, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodGet, oidcRequestUrl, http.NoBody) + if err != nil { + return "", fmt.Errorf("githubAssertion: failed to build request: %w", err) + } + + query, err := url.ParseQuery(req.URL.RawQuery) + if err != nil { + return "", fmt.Errorf("githubAssertion: cannot parse URL query") + } + + if query.Get("audience") == "" { + query.Set("audience", "sts.accounts.stackit.cloud") + req.URL.RawQuery = query.Encode() + } + + req.Header.Set("Accept", "application/json") + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", oidcRequestToken)) + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return "", fmt.Errorf("githubAssertion: cannot request token: %w", err) + } + + defer func() { + _ = resp.Body.Close() + }() + body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return "", fmt.Errorf("githubAssertion: cannot parse response: %w", err) + } + + if c := resp.StatusCode; c < 200 || c > 299 { + return "", fmt.Errorf("githubAssertion: received HTTP status %d with response: %s", resp.StatusCode, body) + } + + var tokenRes struct { + Value string `json:"value"` + } + if err := json.Unmarshal(body, &tokenRes); err != nil { + return "", fmt.Errorf("githubAssertion: cannot unmarshal response: %w", err) + } + + return tokenRes.Value, nil + } +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/types.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/types.go new file mode 100644 index 000000000..c1d92ef42 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oidcadapters/types.go @@ -0,0 +1,5 @@ +package oidcadapters + +import "context" + +type OIDCTokenFunc func(context.Context) (string, error) diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/utils/duration.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/utils/duration.go new file mode 100644 index 000000000..a0adb2db6 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/utils/duration.go @@ -0,0 +1,510 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2025 STACKIT GmbH & Co. KG + +package utils + +// Package utils provides general utility functions for common operations. +// +// The package includes utilities for: +// - Duration parsing and conversion with flexible unit support +// - Time-based calculations including calendar-aware month handling +// - Configurable validation with minimum/maximum boundaries +// +// Duration Conversion: +// +// The main function ConvertToSeconds parses time strings like "30m", "2h", "7d" +// and converts them to seconds. It supports both fixed-rate conversions and +// calendar-aware calculations for months. +// +// Supported units: +// - "s": seconds +// - "m": minutes +// - "h": hours +// - "d": days (24 hours) +// - "M": months (calendar-aware, handles varying month lengths) +// +// Example usage: +// +// // Basic conversion +// seconds, err := utils.ConvertToSeconds("30m") +// +// // With validation boundaries +// seconds, err := utils.ConvertToSeconds("2h", +// utils.WithMinSeconds(60), +// utils.WithMaxSeconds(7200)) +// +// // Calendar-aware month calculation +// seconds, err := utils.ConvertToSeconds("3M", utils.WithNow(time.Now())) +// +// The package uses the functional options pattern for flexible configuration +// and provides extensible interfaces for adding custom duration converters. + +import ( + "fmt" + "math" + "strconv" + "strings" + "time" + "unicode" +) + +// ============================================================================= +// Public Types and Interfaces +// ============================================================================= + +// DurationConverter defines the interface for converting a numeric value into a +// time.Duration. This abstraction supports both fixed-rate conversions (like +// seconds to minutes) and complex calendar-aware calculations (like adding months). +type DurationConverter interface { + // ToDuration converts a numeric value into a time.Duration. + // + // The function takes the following parameters: + // - value: The numeric value to convert (e.g., 30 for 30 days). + // - now: The reference time for calendar-based calculations. It can be + // ignored by implementations that are not calendar-dependent. + // + // It returns the calculated time.Duration and a nil error on success. On + // failure, it returns an error, for example if the value is too large to + // be processed. + ToDuration(value uint64, now time.Time) (time.Duration, error) +} + +// ValidationError represents errors that occur during input validation. +// It uses a Type field to distinguish between different validation failures. +type ValidationError struct { + Type ValidationErrorType // The specific type of validation error + Input string // The invalid input value + Reason string // Human-readable reason for the error + Context map[string]any // Additional context (min/max values, valid units, etc.) +} + +type ValidationErrorType string + +const ( + ValidationErrorInvalidFormat ValidationErrorType = "invalid_format" + ValidationErrorInvalidValue ValidationErrorType = "invalid_value" + ValidationErrorInvalidUnit ValidationErrorType = "invalid_unit" + ValidationErrorBelowMinimum ValidationErrorType = "below_minimum" + ValidationErrorAboveMaximum ValidationErrorType = "above_maximum" +) + +func (e *ValidationError) Error() string { + switch e.Type { + case ValidationErrorInvalidFormat: + if e.Reason != "" && e.Input != "" { + return fmt.Sprintf("invalid time string format %q: %s", e.Input, e.Reason) + } + if e.Input != "" { + return fmt.Sprintf("invalid time string format: %q", e.Input) + } + return "invalid time string format" + + case ValidationErrorInvalidValue: + if e.Reason != "" && e.Input != "" { + return fmt.Sprintf("invalid time value %q: %s", e.Input, e.Reason) + } + if e.Input != "" { + return fmt.Sprintf("invalid time value: %q", e.Input) + } + return "invalid time value" + + case ValidationErrorInvalidUnit: + if e.Input != "" { + if validUnits, ok := e.Context["validUnits"].([]string); ok { + return fmt.Sprintf("invalid time unit %q, supported units are %v", e.Input, validUnits) + } + return fmt.Sprintf("invalid time unit: %q", e.Input) + } + return "invalid time unit" + + case ValidationErrorBelowMinimum: + if minValue, ok := e.Context["minimum"].(uint64); ok { + if val, ok := e.Context["value"].(uint64); ok { + return fmt.Sprintf("duration is below minimum: %d seconds (minimum: %d seconds)", val, minValue) + } + } + return "duration is below the allowed minimum" + + case ValidationErrorAboveMaximum: + if maxValue, ok := e.Context["maximum"].(uint64); ok { + if val, ok := e.Context["value"].(uint64); ok { + return fmt.Sprintf("duration exceeds maximum: %d seconds (maximum: %d seconds)", val, maxValue) + } + } + return "duration exceeds the allowed maximum" + + default: + return fmt.Sprintf("validation error: %s", e.Input) + } +} + +// Is implements error matching for errors.Is() +func (e *ValidationError) Is(target error) bool { + if t, ok := target.(*ValidationError); ok { + return e.Type == t.Type + } + return false +} + +// CalculationError represents errors that occur during duration calculations. +type CalculationError struct { + Type CalculationErrorType // The specific type of calculation error + Value uint64 // The value that caused the error + Reason string // Human-readable reason + Context map[string]any // Additional context (multiplier, operation, etc.) +} + +type CalculationErrorType string + +const ( + CalculationErrorOutOfBounds CalculationErrorType = "out_of_bounds" + CalculationErrorNegativeResult CalculationErrorType = "negative_result" + CalculationErrorNegativeMultiplier CalculationErrorType = "negative_multiplier" +) + +func (e *CalculationError) Error() string { + switch e.Type { + case CalculationErrorOutOfBounds: + msg := "calculation result is out of bounds" + if e.Value > 0 { + msg += fmt.Sprintf(" (value: %d)", e.Value) + } + if operation, ok := e.Context["operation"].(string); ok { + msg += fmt.Sprintf(" during %s", operation) + } + if limit, ok := e.Context["limit"].(string); ok { + msg += fmt.Sprintf(" (exceeds %s)", limit) + } + return msg + + case CalculationErrorNegativeResult: + if result, ok := e.Context["result"].(float64); ok { + return fmt.Sprintf("calculated duration is negative: %f", result) + } + return "calculated duration is negative" + + case CalculationErrorNegativeMultiplier: + if multiplier, ok := e.Context["multiplier"].(time.Duration); ok { + return fmt.Sprintf("duration multiplier is negative: %v", multiplier) + } + return "duration multiplier is negative" + + default: + return fmt.Sprintf("calculation error with value %d", e.Value) + } +} + +// Is implements error matching for errors.Is() +func (e *CalculationError) Is(target error) bool { + if t, ok := target.(*CalculationError); ok { + return e.Type == t.Type + } + return false +} + +// ============================================================================= +// Public Functions +// ============================================================================= +// NewValidationError creates a new ValidationError with the specified type and details. +func NewValidationError(errorType ValidationErrorType, input, reason string, context map[string]any) *ValidationError { + return &ValidationError{ + Type: errorType, + Input: input, + Reason: reason, + Context: context, + } +} + +// NewCalculationError creates a new CalculationError with the specified type and details. +func NewCalculationError(errorType CalculationErrorType, value uint64, reason string, context map[string]any) *CalculationError { + return &CalculationError{ + Type: errorType, + Value: value, + Reason: reason, + Context: context, + } +} + +// Constructors for common error cases +func NewInvalidFormatError(input, reason string) *ValidationError { + return NewValidationError(ValidationErrorInvalidFormat, input, reason, nil) +} + +func NewInvalidValueError(input, reason string) *ValidationError { + return NewValidationError(ValidationErrorInvalidValue, input, reason, nil) +} + +func NewInvalidUnitError(unit string, validUnits []string) *ValidationError { + context := map[string]any{"validUnits": validUnits} + return NewValidationError(ValidationErrorInvalidUnit, unit, "", context) +} + +func NewBelowMinimumError(value, minimum uint64) *ValidationError { + context := map[string]any{"value": value, "minimum": minimum} + return NewValidationError(ValidationErrorBelowMinimum, "", "", context) +} + +func NewAboveMaximumError(value, maximum uint64) *ValidationError { + context := map[string]any{"value": value, "maximum": maximum} + return NewValidationError(ValidationErrorAboveMaximum, "", "", context) +} + +// An Option configures a ConvertToSeconds call. +type Option func(*converterConfig) + +// WithMinSeconds sets a minimum duration in seconds. A value of 0 means no limit. +func WithMinSeconds(minSeconds uint64) Option { + return func(c *converterConfig) { + c.minSeconds = &minSeconds + } +} + +// WithMaxSeconds sets a maximum duration in seconds. A value of 0 means no limit. +func WithMaxSeconds(maxSeconds uint64) Option { + return func(c *converterConfig) { + if maxSeconds == 0 { + c.maxSeconds = nil // Remove any previously set limit when 0 + } else { + c.maxSeconds = &maxSeconds + } + } +} + +// WithNow sets the current time to be used by the DurationConverter interface's ToDuration function. +// Useful for determenistic when testing calendar-dependent implementations of DurationConverter. +func WithNow(now time.Time) Option { + return func(c *converterConfig) { + c.now = &now + } +} + +// WithUnits provides a custom map of duration converters. +func WithUnits(units map[string]DurationConverter) Option { + return func(c *converterConfig) { + c.units = units + } +} + +// ConvertToSeconds converts a time string in the form of (e.g., "30m", "1h") into a total number of seconds as a uint64. +// +// The function uses a default set of units: +// - "s": seconds +// - "m": minutes +// - "h": hours +// - "d": days (24 hours) +// - "M": months (calendar-aware) +// +// Optional configurations can be provided using the Option type, such as setting +// minimum/maximum second boundaries (WithMinSeconds, WithMaxSeconds) or providing +// a custom set of units (WithUnits). +// +// It returns an error if the format is invalid, the unit is unsupported, or if the +// calculated value violates any provided boundaries. +func ConvertToSeconds(timeStr string, opts ...Option) (uint64, error) { + timeStr = strings.TrimSpace(timeStr) + + // Define a default config + cfg := &converterConfig{ + units: defaultUnits, + } + // Apply optional config settings, overwriting defaults + for _, opt := range opts { + opt(cfg) + } + + // Separate unit and value of timeStr + valueStr, unit, err := splitValueAndUnit(timeStr) + if err != nil { + return 0, err + } + + // Check for leading zeros, which are not allowed for values > 0 + if len(valueStr) > 1 && valueStr[0] == '0' { + return 0, NewInvalidFormatError(timeStr, "leading zeros are not allowed") + } + + // Parse Value, make sure it's a valid positive number that fit's a uint64 + value, err := strconv.ParseUint(valueStr, 10, 64) + if err != nil { + return 0, NewInvalidValueError(valueStr, err.Error()) + } + + // A value of 0 is not a valid duration. + if value == 0 { + return 0, NewInvalidValueError("0", "a value of 0 is not allowed") + } + + // Look up the DurationConverter to use + converter, ok := cfg.units[unit] + if !ok { + return 0, NewInvalidUnitError(unit, getKeys(cfg.units)) + } + + // Use the provided time.Time for 'now' if provided. Otherwise use system time. + var now time.Time + if cfg.now != nil { + now = *cfg.now + } else { + now = time.Now() + } + + // Calculate time.Duration using the DurationConverter interface + totalDuration, err := converter.ToDuration(value, now) + if err != nil { + return 0, err + } + // Convert time.Duration to Seconds + secondsFloat := totalDuration.Seconds() // float64 + + // Check for negative or overflow values and return an error if necessary + if secondsFloat < 0 { + context := map[string]any{"result": secondsFloat} + return 0, NewCalculationError(CalculationErrorNegativeResult, 0, "", context) + } + if secondsFloat > math.MaxUint64 { + // This case can only be tiggered if a new positive integer type bigger than MaxUint64 is added to Go + // because we currently can not have a custom converter returning bigger values than MaxUint64. + // Thus we currently can not fully test this path but will leave it here (defensive programming). + context := map[string]any{ + "operation": "final conversion", + "limit": "MaxUint64", + } + return 0, NewCalculationError(CalculationErrorOutOfBounds, 0, "result exceeds MaxUint64", context) + } + + // Cast to uint64 for boundary checks and final return + seconds := uint64(secondsFloat) + + // Check if the calculated duration is within the specified, optional boundaries. + if cfg.minSeconds != nil && seconds < *cfg.minSeconds { + return 0, NewBelowMinimumError(seconds, *cfg.minSeconds) + } + if cfg.maxSeconds != nil && seconds > *cfg.maxSeconds { + return 0, NewAboveMaximumError(seconds, *cfg.maxSeconds) + } + + return seconds, nil +} + +// ============================================================================= +// Private Types and Interfaces +// ============================================================================= + +// FixedMultiplier converts a value to a duration using a constant multiplier. +// It implements the DurationConverter interface. +type fixedMultiplier struct { + Multiplier time.Duration +} + +// fixedMultiplier.ToDuration calculates the duration by multiplying the value with the fixed multiplier. +// The `now` parameter is ignored as this calculation is not calendar-dependent. +func (fm fixedMultiplier) ToDuration(value uint64, _ time.Time) (time.Duration, error) { + // A negative multiplier is invalid as it would produce a negative duration and break the following overflow check. Fail early. + if fm.Multiplier < 0 { + context := map[string]any{"multiplier": fm.Multiplier} + return 0, NewCalculationError(CalculationErrorNegativeMultiplier, 0, "", context) + } + + // A zero multiplier will always result in a zero duration. + if fm.Multiplier == 0 { + return 0, nil + } + + // Check for overflow: both the value AND the multiplication result must fit in int64 + multiplierUint := uint64(fm.Multiplier) // #nosec G115 - already validated fm.Multiplier >= 0 + if value > math.MaxInt64 || value > math.MaxInt64/multiplierUint { + context := map[string]any{ + "operation": "multiplication", + "limit": "MaxInt64", + } + return 0, NewCalculationError(CalculationErrorOutOfBounds, value, "value or multiplication result exceeds MaxInt64", context) + } + + return time.Duration(int64(value)) * fm.Multiplier, nil +} + +// MonthCalculator implements calendar-aware month addition. +// Note: Results are normalized - adding 1 month to January 31st +// results in March 2nd/3rd (February 31st normalized). +// This matches the behavior of Go's time.AddDate(). +type monthCalculator struct{} + +// monthCalculator.ToDuration calculates the time.Duration between now and a future date N months from now. +func (mc monthCalculator) ToDuration(value uint64, now time.Time) (time.Duration, error) { + // Check if casting to int for AddDate would cause an overflow. + if value > math.MaxInt { + context := map[string]any{ + "operation": "month calculation", + "limit": "MaxInt", + } + return 0, NewCalculationError(CalculationErrorOutOfBounds, value, "value exceeds MaxInt", context) + } + future := now.AddDate(0, int(value), 0) + return future.Sub(now), nil +} + +// config holds the optional parameters for ConvertToSeconds. +type converterConfig struct { + minSeconds *uint64 + maxSeconds *uint64 + units map[string]DurationConverter + now *time.Time +} + +// ============================================================================= +// Private Variables and Constants +// ============================================================================= + +// DefaultUnits is a map of supported unit characters to their multipliers. +var defaultUnits = map[string]DurationConverter{ + "s": fixedMultiplier{Multiplier: time.Second}, + "m": fixedMultiplier{Multiplier: time.Minute}, + "h": fixedMultiplier{Multiplier: time.Hour}, + "d": fixedMultiplier{Multiplier: 24 * time.Hour}, // Day + "M": monthCalculator{}, // Month (calendar-aware) +} + +// ============================================================================= +// Private Functions +// ============================================================================= + +// Helper to get all keys of DurationConverter for error logging purposes. +func getKeys(m map[string]DurationConverter) []string { + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + return keys +} + +// splitValueAndUnit separates a time string like "30m" into its numeric ("30") and unit ("m") parts. It handles multi-character units. +func splitValueAndUnit(timeStr string) (valueStr, unitStr string, err error) { + if timeStr == "" { + return "", "", NewInvalidFormatError("", "input string is empty") + } + + // Find the first non-digit character in the string. + var splitIndex = -1 + for i, r := range timeStr { + if !unicode.IsDigit(r) { + // If the first non-digit is a '.' or ',' it's a float, which we don't support. + if r == '.' || r == ',' { + return "", "", NewInvalidValueError(timeStr, "floating-point values are not supported") + } + splitIndex = i + break + } + } + + // Check for invalid formats + if splitIndex == -1 { + return "", "", NewInvalidFormatError(timeStr, "contains no unit, expected format ") + } + if splitIndex == 0 { + return "", "", NewInvalidFormatError(timeStr, "must start with a number, expected format ") + } + + valueStr = timeStr[:splitIndex] + unitStr = timeStr[splitIndex:] + return valueStr, unitStr, nil +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/utils/utils.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/utils/utils.go new file mode 100644 index 000000000..9d5c8818e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/utils/utils.go @@ -0,0 +1,38 @@ +package utils + +import "os" + +// Ptr Returns the pointer to any type T +func Ptr[T any](v T) *T { + return &v +} + +func Contains[T comparable](slice []T, element T) bool { + for _, item := range slice { + if item == element { + return true + } + } + return false +} + +// EnumSliceToStringSlice is a generic function to convert a slice of any type T +// that has the underlying type 'string' to a slice of string. +// The constraint ~string allows T to be any type whose +// underlying type is string (like the enum types from the generated STACKIT SDK modules). +func EnumSliceToStringSlice[T ~string](inputSlice []T) []string { + result := make([]string, len(inputSlice)) + + for i, element := range inputSlice { + result[i] = string(element) + } + + return result +} + +func GetEnvOrDefault(envVar, defaultValue string) string { + if value := os.Getenv(envVar); value != "" { + return value + } + return defaultValue +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/CHANGELOG.md b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/CHANGELOG.md new file mode 100644 index 000000000..e073c3b75 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/CHANGELOG.md @@ -0,0 +1,219 @@ +## 1.9.0 +- Package `v2api`: + - **Feature:** New model structs: `Access`, `IDPKubeconfig` + - **Feature:** New field `Access` in `Cluster` and `CreateOrUpdateClusterPayload` model structs + - **Feature:** New API client method: `GetIDPKubeconfig` + - Added new possible values to description of `Code` field in the `ClusterError` model struct +- Deprecated SDK layer in root of the module: + - **Feature:** New model structs: `Access`, `IDPKubeconfig` + - **Feature:** New field `Access` in `Cluster` and `CreateOrUpdateClusterPayload` model structs + - **Feature:** New API client method: `GetIDPKubeconfig` + - Added new possible values to description of `Code` field in the `ClusterError` model struct + +## v1.8.0 +- **Feature:** Introduction of multi API version support for the ske SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062 +- `v1api`: New package which can be used for communication with the ske v1 API +- `v2api`: New package which can be used for communication with the ske v2 API +- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead. +- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0` + +## v1.7.0 +- **Feature:** new model `AccessScope` +- **Feature:** new model `V2ControlPlaneNetwork` +- **Feature:** added field `ControlPlane` of type `V2ControlPlaneNetwork` to model `Network` + +## v1.6.3 +- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1` + +## v1.6.2 +- **Dependencies**: Bump `github.com/golang-jwt/jwt/v5` from `v5.3.0` to `v5.3.1` + +## v1.6.1 +- **Bugfix:** Correctly handle file closing for file uploads +- Bump STACKIT SDK core module from `v0.20.1` to `v0.21.0` + +## v1.6.0 +- **Feature:** Add field `Identity` to model `ClusterStatus` + +## v1.5.1 +- Bump STACKIT SDK core module from `v0.20.0` to `v0.20.1` + +## v1.5.0 +- **Feature:** Add `versionState` field to ListProviderOptionsRequest struct +- **Feature:** Add new enum `GetProviderOptionsRequestVersionState` + +## v1.4.1 +- Bump STACKIT SDK core module from `v0.19.0` to `v0.20.0` + +## v1.4.0 +- **Feature:** Add new field `Kubernetes` to `Nodepool` model + +## v1.3.0 +- **Feature:** Add new wait handlers: `TriggerClusterHibernationWaitHandler`, `TriggerClusterMaintenanceWaitHandler`, `TriggerClusterReconciliationWaitHandler`, `TriggerClusterWakeupWaitHandler` + +## v1.2.0 +- **Feature:** Add new method `TriggerWakeup` + +## v1.1.1 +- **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` + +## v1.1.0 +- **Breaking Change:** `ClusterError.Code` field is now a string type instead of an enum. The field no longer validates against predefined enum values and accepts any string value. + +## v1.0.0 +- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request. + +## v0.27.0 +- **Feature:** Add new `ClusterErrorCode` types: `CLUSTERERRORCODE_INFRA_SNA_NETWORK_NOT_FOUND`, `CLUSTERERRORCODE_FETCHING_ERRORS_NOT_POSSIBLE` + +## v0.26.0 +- Add `required:"true"` tags to model structs + +## v0.25.0 (2025-06-10) +- **Feature:** Add new field `PodAddressRanges` to `ClusterStatus` + +## v0.24.1 (2025-06-04) +- **Bugfix:** Adjusted `UnmarshalJSON` function to use enum types and added tests for enums + +## v0.24.0 (2025-05-15) +- **Breaking change:** Introduce interfaces for `APIClient` and the request structs + +## v0.23.0 (2025-05-14) +- **Breaking change:** Introduce typed enum constants for status attributes + +## v0.22.4 (2025-05-13) +- **Feature:** Added `ClusterError` + +## v0.22.3 (2025-05-09) +- **Feature:** Update user-agent header + +## v0.22.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + +## v0.22.1 (2025-03-19) +- **Internal:** Backwards compatible change to generated code + +## v0.22.0 (2025-02-21) +- **New:** Minimal go version is now Go 1.21 + +## v0.21.1 (2025-01-23) +- Use current SKE API + +## v0.21.0 (2025-01-21) + +- **Removal:** The following methods were removed after deprecation (2024-04-16) and [`serviceenablement` SDK](https://github.com/stackitcloud/stackit-sdk-go/tree/main/services/serviceenablement) must be used instead. + - `DisableService` + - `EnableService` + - `GetServiceStatus` + +## v0.20.1 (2024-12-17) + +- **Bugfix:** Correctly handle nullable attributes in model types + +## v0.20.0 (2024-10-14) + +- **Feature:** Add support for nullable models + +## v0.19.0 (2024-07-18) + +- **Feature:** New fields for `Extension`: `Dns` + +## v0.18.0 (2024-07-10) + +- **Bugfix:** Fix marking of deprecated methods. Potential breaking change for users with linters that treat deprecations as errors. + +## v0.17.0 (2024-07-04) + +- **Feature:** Add new field `AllowSystemComponents` to the `Nodepool` model that configures whether system components are allowed to run on the node pool. + +## v0.16.0 (2024-05-27) + +- **Breaking change:** Renamed data types: + - `V1Network` is now `Network` + - `V1LoginKubeConfig` is now `LoginKubeConfig` + +## v0.15.0 (2024-05-14) + +- **Feature:** New operation `GetLoginKubeconfig` to get a Kubeconfig for use with the STACKIT CLI. A Kubeconfig retrieved using this endpoint does not contain any credentials and instead obtains valid credentials via the STACKIT CLI. + +## v0.14.0 (2024-05-03) + +- **Feature:** New fields for `MachineType`: `Architecture`, `Gpu` + +## v0.13.0 (2024-04-16) + +- **Deprecation:** The following methods have been deprecated and the [Service Enablement API](https://docs.api.stackit.cloud/documentation/service-enablement/version/v1) must be used instead. + - `DisableService` + - `EnableService` + - `GetServiceStatus` + +## v0.12.0 (2024-04-09) + +- Set config.ContextHTTPRequest in Execute method +- Support WithMiddleware configuration option in the client +- Update `core` to [`v0.12.0`](../../core/CHANGELOG.md#v0120-2024-04-11) + +## v0.11.1 (2024-04-09) + +- Remove unused model data types. + +## v0.11.0 (2024-03-28) + +- **Feature**: Waiters for async operation `StartCredentialsRotationWaitHandler` and `CompleteCredentialsRotationWaitHandler` + +## v0.10.1 (2024-02-28) + +- Update `core` to [`v0.10.0`](../../core/CHANGELOG.md#v0100-2024-02-27) + +## v0.10.0 (2024-02-06) + +- **Feature:** New endpoints for credentials rotation. + - `StartCredentialsRotation` + - `CompleteCredentialsRotation` + - `CreateKubeconfig` + - These endpoints replace `GetCredentials` and `TriggerRotateCredentials`, which are **deprecated** and will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/products/runtime/kubernetes-engine/how-tos/rotate-ske-credentials/). + +## v0.9.3 (2024-02-02) + +- **Improvement**: Fix state name in `CredentialsRotationState.Phase` +- Update `core` to `v0.7.7`. The `http.request` context is now passed in the client `Do` call. +- Increase timeout on `DeleteClusterWaitHandler` to 45 minutes + +## v0.9.2 (2024-01-24) + +- **Bug fix**: `NewAPIClient` now initializes a new client instead of using `http.DefaultClient` ([#236](https://github.com/stackitcloud/stackit-sdk-go/issues/236)) + +## v0.9.1 (2024-01-15) + +- Add license and notice files + +## v0.9.0 (2024-01-09) + +- **Feature:** `ClusterStatus` now has a field `CredentialsRotation` with credentials' details +- **Improvement:** Add details on credentials for old clusters +- Dependency updates + +## v0.8.1 (2023-12-22) + +- Dependency updates + +## v0.8.0 (2023-12-20) + +API methods, structs and waiters were renamed to have the same look and feel across all services and according to user feedback. + +- Changed methods: + - `CreateProject` renamed to `EnableService` + - `DeleteProject` renamed to `DisableService` + - `GetClusters` renamed to `ListClusters` + - `GetOptions` renamed to `ListProviderOptions` + - `GetProject` renamed to `GetServiceStatus` +- Changed structs: + - `ClusterResponse` renamed to `Cluster` + - `ClustersResponse` renamed to `ListClustersResponse` + - `CredentialsResponse` renamed to `Credentials` + +## v0.7.0 (2023-12-05) + +- Manage your STACKIT Kubernetes Engine resources: `Project`, `Cluster`, `Credentials`, `Options` +- Waiters for async operations: `CreateOrUpdateClusterWaitHandler`, `DeleteClusterWaitHandler`, `CreateProjectWaitHandler`, `DeleteProjectWaitHandler`, `RotateCredentialsWaitHandler` +- [Usage example](https://github.com/stackitcloud/stackit-sdk-go/tree/main/examples/ske) diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/LICENSE.md b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/LICENSE.md new file mode 100644 index 000000000..c77bb37a1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2024 - 2026 Schwarz IT KG + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/NOTICE.txt b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/NOTICE.txt new file mode 100644 index 000000000..153a16e4d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/NOTICE.txt @@ -0,0 +1,2 @@ +STACKIT Kubernetes SDK for Go +Copyright 2024 - 2026 Schwarz IT KG \ No newline at end of file diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/VERSION b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/VERSION new file mode 100644 index 000000000..295e37c0e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/VERSION @@ -0,0 +1 @@ +v1.9.0 diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/api_default.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/api_default.go new file mode 100644 index 000000000..2da0c192e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/api_default.go @@ -0,0 +1,2914 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DefaultApi interface { + /* + CompleteCredentialsRotation Complete cluster credentials rotation + Complete cluster credentials rotation. This is step 2 of a two-step process. Start the rotation using [start-credentials-rotation](#tag/Credentials/operation/SkeService_StartClusterCredentialsRotation). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiCompleteCredentialsRotationRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CompleteCredentialsRotation(ctx context.Context, projectId string, region string, clusterName string) ApiCompleteCredentialsRotationRequest + /* + CompleteCredentialsRotationExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CompleteCredentialsRotationExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) + /* + CreateKubeconfig Create an admin kubeconfig + Create a new admin kubeconfig for the cluster. You can specify the expiration (in seconds) in the request body. Its value must be in the range from 600 (10 min) to 15552000 (6 months). Defaults to 3600. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiCreateKubeconfigRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CreateKubeconfig(ctx context.Context, projectId string, region string, clusterName string) ApiCreateKubeconfigRequest + /* + CreateKubeconfigExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return Kubeconfig + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CreateKubeconfigExecute(ctx context.Context, projectId string, region string, clusterName string) (*Kubeconfig, error) + /* + CreateOrUpdateCluster Create or update a cluster + Create a new cluster in your project or modify an existing one. To get valid values for certain properties please check the [provider-options](#tag/ProviderOptions/operation/SkeService_GetProviderOptions) endpoint. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiCreateOrUpdateClusterRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CreateOrUpdateCluster(ctx context.Context, projectId string, region string, clusterName string) ApiCreateOrUpdateClusterRequest + /* + CreateOrUpdateClusterExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return Cluster + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + CreateOrUpdateClusterExecute(ctx context.Context, projectId string, region string, clusterName string) (*Cluster, error) + /* + DeleteCluster Delete a cluster + Delete Kubernetes cluster specified by the identifier, belonging to the project specified by `projectId`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiDeleteClusterRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + DeleteCluster(ctx context.Context, projectId string, region string, clusterName string) ApiDeleteClusterRequest + /* + DeleteClusterExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + DeleteClusterExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) + /* + GetCluster Get a cluster + Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiGetClusterRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetCluster(ctx context.Context, projectId string, region string, clusterName string) ApiGetClusterRequest + /* + GetClusterExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return Cluster + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetClusterExecute(ctx context.Context, projectId string, region string, clusterName string) (*Cluster, error) + /* + GetIDPKubeconfig Get a kubeconfig to authenticate via IDP for use with the STACKIT CLI + A kubeconfig retrieved using this endpoint does not contain any credentials and instead obtains valid credentials via the STACKIT CLI. Permissions must be granted to the user beforehand using an admin kubeconfig. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiGetIDPKubeconfigRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetIDPKubeconfig(ctx context.Context, projectId string, region string, clusterName string) ApiGetIDPKubeconfigRequest + /* + GetIDPKubeconfigExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return IDPKubeconfig + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetIDPKubeconfigExecute(ctx context.Context, projectId string, region string, clusterName string) (*IDPKubeconfig, error) + /* + GetLoginKubeconfig Get an admin kubeconfig for use with the STACKIT CLI + A admin kubeconfig retrieved using this endpoint does not contain any credentials and instead obtains valid credentials via the STACKIT CLI. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiGetLoginKubeconfigRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetLoginKubeconfig(ctx context.Context, projectId string, region string, clusterName string) ApiGetLoginKubeconfigRequest + /* + GetLoginKubeconfigExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return LoginKubeconfig + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + GetLoginKubeconfigExecute(ctx context.Context, projectId string, region string, clusterName string) (*LoginKubeconfig, error) + /* + ListClusters List all clusters + Return a list of Kubernetes clusters in the project specified by `projectId`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListClustersRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + ListClusters(ctx context.Context, projectId string, region string) ApiListClustersRequest + /* + ListClustersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListClustersResponse + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + ListClustersExecute(ctx context.Context, projectId string, region string) (*ListClustersResponse, error) + /* + ListProviderOptions List provider options + Returns available Kubernetes versions, availability zones, machine types, OS versions and volume types for the cluster nodes. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListProviderOptionsRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + ListProviderOptions(ctx context.Context, region string) ApiListProviderOptionsRequest + /* + ListProviderOptionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ProviderOptions + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + ListProviderOptionsExecute(ctx context.Context, region string) (*ProviderOptions, error) + /* + StartCredentialsRotation Start cluster credentials rotation + Start cluster credentials rotation. This is step 1 of a two-step process. Complete the rotation using [complete-credentials-rotation](#tag/Credentials/operation/SkeService_CompleteClusterCredentialsRotation). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiStartCredentialsRotationRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + StartCredentialsRotation(ctx context.Context, projectId string, region string, clusterName string) ApiStartCredentialsRotationRequest + /* + StartCredentialsRotationExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + StartCredentialsRotationExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) + /* + TriggerHibernate Trigger cluster hibernation + Trigger immediate hibernation of the cluster. If the cluster is already in hibernation state, this endpoint does nothing. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerHibernateRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerHibernate(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerHibernateRequest + /* + TriggerHibernateExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerHibernateExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) + /* + TriggerMaintenance Trigger cluster maintenance + Trigger immediate maintenance of the cluster. The autoUpdate configuration specified in the Maintenance object of the cluster spec defines what is updated during the immediate maintenance operation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerMaintenanceRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerMaintenance(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerMaintenanceRequest + /* + TriggerMaintenanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerMaintenanceExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) + /* + TriggerReconcile Trigger cluster reconciliation + Trigger immediate reconciliation of the complete cluster without changing the cluster specification. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerReconcileRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerReconcile(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerReconcileRequest + /* + TriggerReconcileExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerReconcileExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) + /* + TriggerWakeup Trigger cluster wakeup + Trigger immediate wake up of the cluster. If the cluster is already in running state, this endpoint does nothing. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerWakeupRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerWakeup(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerWakeupRequest + /* + TriggerWakeupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return map[string]interface{} + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + */ + TriggerWakeupExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiCompleteCredentialsRotationRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiCreateKubeconfigRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CreateKubeconfigPayload(createKubeconfigPayload CreateKubeconfigPayload) ApiCreateKubeconfigRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*Kubeconfig, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiCreateOrUpdateClusterRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CreateOrUpdateClusterPayload(createOrUpdateClusterPayload CreateOrUpdateClusterPayload) ApiCreateOrUpdateClusterRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*Cluster, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiDeleteClusterRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiGetClusterRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*Cluster, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiGetIDPKubeconfigRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*IDPKubeconfig, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiGetLoginKubeconfigRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*LoginKubeconfig, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiListClustersRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*ListClustersResponse, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiListProviderOptionsRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + VersionState(versionState string) ApiListProviderOptionsRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (*ProviderOptions, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiStartCredentialsRotationRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiTriggerHibernateRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiTriggerMaintenanceRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiTriggerReconcileRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ApiTriggerWakeupRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + Execute() (map[string]interface{}, error) +} + +// DefaultApiService DefaultApi service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DefaultApiService service + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CompleteCredentialsRotationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r CompleteCredentialsRotationRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CompleteCredentialsRotation") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/complete-credentials-rotation" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CompleteCredentialsRotation: Complete cluster credentials rotation + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiCompleteCredentialsRotationRequest +*/ +func (a *APIClient) CompleteCredentialsRotation(ctx context.Context, projectId string, region string, clusterName string) ApiCompleteCredentialsRotationRequest { + return CompleteCredentialsRotationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) CompleteCredentialsRotationExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := CompleteCredentialsRotationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateKubeconfigRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string + createKubeconfigPayload *CreateKubeconfigPayload +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r CreateKubeconfigRequest) CreateKubeconfigPayload(createKubeconfigPayload CreateKubeconfigPayload) ApiCreateKubeconfigRequest { + r.createKubeconfigPayload = &createKubeconfigPayload + return r +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r CreateKubeconfigRequest) Execute() (*Kubeconfig, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Kubeconfig + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKubeconfig") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/kubeconfig" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createKubeconfigPayload == nil { + return localVarReturnValue, fmt.Errorf("createKubeconfigPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createKubeconfigPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateKubeconfig: Create an admin kubeconfig + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiCreateKubeconfigRequest +*/ +func (a *APIClient) CreateKubeconfig(ctx context.Context, projectId string, region string, clusterName string) ApiCreateKubeconfigRequest { + return CreateKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) CreateKubeconfigExecute(ctx context.Context, projectId string, region string, clusterName string) (*Kubeconfig, error) { + r := CreateKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string + createOrUpdateClusterPayload *CreateOrUpdateClusterPayload +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r CreateOrUpdateClusterRequest) CreateOrUpdateClusterPayload(createOrUpdateClusterPayload CreateOrUpdateClusterPayload) ApiCreateOrUpdateClusterRequest { + r.createOrUpdateClusterPayload = &createOrUpdateClusterPayload + return r +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r CreateOrUpdateClusterRequest) Execute() (*Cluster, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Cluster + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateOrUpdateCluster") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createOrUpdateClusterPayload == nil { + return localVarReturnValue, fmt.Errorf("createOrUpdateClusterPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createOrUpdateClusterPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateOrUpdateCluster: Create or update a cluster + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiCreateOrUpdateClusterRequest +*/ +func (a *APIClient) CreateOrUpdateCluster(ctx context.Context, projectId string, region string, clusterName string) ApiCreateOrUpdateClusterRequest { + return CreateOrUpdateClusterRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) CreateOrUpdateClusterExecute(ctx context.Context, projectId string, region string, clusterName string) (*Cluster, error) { + r := CreateOrUpdateClusterRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DeleteClusterRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r DeleteClusterRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCluster") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteCluster: Delete a cluster + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiDeleteClusterRequest +*/ +func (a *APIClient) DeleteCluster(ctx context.Context, projectId string, region string, clusterName string) ApiDeleteClusterRequest { + return DeleteClusterRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) DeleteClusterExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := DeleteClusterRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetClusterRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r GetClusterRequest) Execute() (*Cluster, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Cluster + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCluster") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCluster: Get a cluster + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiGetClusterRequest +*/ +func (a *APIClient) GetCluster(ctx context.Context, projectId string, region string, clusterName string) ApiGetClusterRequest { + return GetClusterRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) GetClusterExecute(ctx context.Context, projectId string, region string, clusterName string) (*Cluster, error) { + r := GetClusterRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetIDPKubeconfigRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r GetIDPKubeconfigRequest) Execute() (*IDPKubeconfig, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IDPKubeconfig + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetIDPKubeconfig") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/kubeconfig/idp" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetIDPKubeconfig: Get a kubeconfig to authenticate via IDP for use with the STACKIT CLI + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiGetIDPKubeconfigRequest +*/ +func (a *APIClient) GetIDPKubeconfig(ctx context.Context, projectId string, region string, clusterName string) ApiGetIDPKubeconfigRequest { + return GetIDPKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) GetIDPKubeconfigExecute(ctx context.Context, projectId string, region string, clusterName string) (*IDPKubeconfig, error) { + r := GetIDPKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetLoginKubeconfigRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r GetLoginKubeconfigRequest) Execute() (*LoginKubeconfig, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginKubeconfig + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLoginKubeconfig") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/kubeconfig/login" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetLoginKubeconfig: Get an admin kubeconfig for use with the STACKIT CLI + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiGetLoginKubeconfigRequest +*/ +func (a *APIClient) GetLoginKubeconfig(ctx context.Context, projectId string, region string, clusterName string) ApiGetLoginKubeconfigRequest { + return GetLoginKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) GetLoginKubeconfigExecute(ctx context.Context, projectId string, region string, clusterName string) (*LoginKubeconfig, error) { + r := GetLoginKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListClustersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r ListClustersRequest) Execute() (*ListClustersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListClustersResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListClusters") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListClusters: List all clusters + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListClustersRequest +*/ +func (a *APIClient) ListClusters(ctx context.Context, projectId string, region string) ApiListClustersRequest { + return ListClustersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) ListClustersExecute(ctx context.Context, projectId string, region string) (*ListClustersResponse, error) { + r := ListClustersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListProviderOptionsRequest struct { + ctx context.Context + apiService *DefaultApiService + region string + versionState *string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r ListProviderOptionsRequest) VersionState(versionState string) ApiListProviderOptionsRequest { + r.versionState = &versionState + return r +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r ListProviderOptionsRequest) Execute() (*ProviderOptions, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProviderOptions + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListProviderOptions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/regions/{region}/provider-options" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.versionState != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "versionState", r.versionState, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListProviderOptions: List provider options + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListProviderOptionsRequest +*/ +func (a *APIClient) ListProviderOptions(ctx context.Context, region string) ApiListProviderOptionsRequest { + return ListProviderOptionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) ListProviderOptionsExecute(ctx context.Context, region string) (*ProviderOptions, error) { + r := ListProviderOptionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type StartCredentialsRotationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r StartCredentialsRotationRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StartCredentialsRotation") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/start-credentials-rotation" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +StartCredentialsRotation: Start cluster credentials rotation + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiStartCredentialsRotationRequest +*/ +func (a *APIClient) StartCredentialsRotation(ctx context.Context, projectId string, region string, clusterName string) ApiStartCredentialsRotationRequest { + return StartCredentialsRotationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) StartCredentialsRotationExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := StartCredentialsRotationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TriggerHibernateRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r TriggerHibernateRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.TriggerHibernate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/hibernate" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +TriggerHibernate: Trigger cluster hibernation + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerHibernateRequest +*/ +func (a *APIClient) TriggerHibernate(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerHibernateRequest { + return TriggerHibernateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) TriggerHibernateExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := TriggerHibernateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TriggerMaintenanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r TriggerMaintenanceRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.TriggerMaintenance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/maintenance" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +TriggerMaintenance: Trigger cluster maintenance + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerMaintenanceRequest +*/ +func (a *APIClient) TriggerMaintenance(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerMaintenanceRequest { + return TriggerMaintenanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) TriggerMaintenanceExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := TriggerMaintenanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TriggerReconcileRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r TriggerReconcileRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.TriggerReconcile") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/reconcile" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +TriggerReconcile: Trigger cluster reconciliation + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerReconcileRequest +*/ +func (a *APIClient) TriggerReconcile(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerReconcileRequest { + return TriggerReconcileRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) TriggerReconcileExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := TriggerReconcileRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TriggerWakeupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + clusterName string +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (r TriggerWakeupRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.TriggerWakeup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/wakeup" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v map[string]interface{} + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v RuntimeError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +TriggerWakeup: Trigger cluster wakeup + +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param clusterName + @return ApiTriggerWakeupRequest +*/ +func (a *APIClient) TriggerWakeup(ctx context.Context, projectId string, region string, clusterName string) ApiTriggerWakeupRequest { + return TriggerWakeupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (a *APIClient) TriggerWakeupExecute(ctx context.Context, projectId string, region string, clusterName string) (map[string]interface{}, error) { + r := TriggerWakeupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + clusterName: clusterName, + } + return r.Execute() +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/client.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/client.go new file mode 100644 index 000000000..d5bf1433d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/client.go @@ -0,0 +1,635 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Kubernetes Engine API API v2.0 +// In most cases there should be only one, shared, APIClient. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/configuration.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/configuration.go new file mode 100644 index 000000000..c8b76c54f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/configuration.go @@ -0,0 +1,40 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/ske", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://ske.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_access.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_access.go new file mode 100644 index 000000000..fedde1494 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_access.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Access type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Access{} + +/* + types and functions for idp +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AccessGetIdpAttributeType = *IDP + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AccessGetIdpArgType = IDP + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AccessGetIdpRetType = IDP + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getAccessGetIdpAttributeTypeOk(arg AccessGetIdpAttributeType) (ret AccessGetIdpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setAccessGetIdpAttributeType(arg *AccessGetIdpAttributeType, val AccessGetIdpRetType) { + *arg = &val +} + +// Access struct for Access +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Access struct { + Idp AccessGetIdpAttributeType `json:"idp,omitempty"` +} + +// NewAccess instantiates a new Access object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAccess() *Access { + this := Access{} + return &this +} + +// NewAccessWithDefaults instantiates a new Access object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAccessWithDefaults() *Access { + this := Access{} + return &this +} + +// GetIdp returns the Idp field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Access) GetIdp() (res AccessGetIdpRetType) { + res, _ = o.GetIdpOk() + return +} + +// GetIdpOk returns a tuple with the Idp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Access) GetIdpOk() (ret AccessGetIdpRetType, ok bool) { + return getAccessGetIdpAttributeTypeOk(o.Idp) +} + +// HasIdp returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Access) HasIdp() bool { + _, ok := o.GetIdpOk() + return ok +} + +// SetIdp gets a reference to the given IDP and assigns it to the Idp field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Access) SetIdp(v AccessGetIdpRetType) { + setAccessGetIdpAttributeType(&o.Idp, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Access) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAccessGetIdpAttributeTypeOk(o.Idp); ok { + toSerialize["Idp"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableAccess struct { + value *Access + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAccess) Get() *Access { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAccess) Set(val *Access) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAccess) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAccess) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableAccess(val *Access) *NullableAccess { + return &NullableAccess{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAccess) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAccess) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_access_scope.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_access_scope.go new file mode 100644 index 000000000..c1e1344e8 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_access_scope.go @@ -0,0 +1,132 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" +) + +// AccessScope The access scope of the Control Plane. It defines if the Kubernetes control plane is public or only available inside a STACKIT Network Area. ⚠️ Note: This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AccessScope string + +// List of AccessScope +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + ACCESSSCOPE_PUBLIC AccessScope = "PUBLIC" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + ACCESSSCOPE_SNA AccessScope = "SNA" +) + +// All allowed values of AccessScope enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedAccessScopeEnumValues = []AccessScope{ + "PUBLIC", + "SNA", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *AccessScope) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := AccessScope(value) + for _, existing := range AllowedAccessScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AccessScope", value) +} + +// NewAccessScopeFromValue returns a pointer to a valid AccessScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAccessScopeFromValue(v string) (*AccessScope, error) { + ev := AccessScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AccessScope: valid values are %v", v, AllowedAccessScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v AccessScope) IsValid() bool { + for _, existing := range AllowedAccessScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AccessScope value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v AccessScope) Ptr() *AccessScope { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableAccessScope struct { + value *AccessScope + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAccessScope) Get() *AccessScope { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAccessScope) Set(val *AccessScope) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAccessScope) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAccessScope) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableAccessScope(val *AccessScope) *NullableAccessScope { + return &NullableAccessScope{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAccessScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAccessScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_acl.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_acl.go new file mode 100644 index 000000000..7cc556437 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_acl.go @@ -0,0 +1,204 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the ACL type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ACL{} + +/* + types and functions for allowedCidrs +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACLGetAllowedCidrsAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACLGetAllowedCidrsArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACLGetAllowedCidrsRetType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getACLGetAllowedCidrsAttributeTypeOk(arg ACLGetAllowedCidrsAttributeType) (ret ACLGetAllowedCidrsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setACLGetAllowedCidrsAttributeType(arg *ACLGetAllowedCidrsAttributeType, val ACLGetAllowedCidrsRetType) { + *arg = &val +} + +/* + types and functions for enabled +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACLgetEnabledAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACLgetEnabledArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACLgetEnabledRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getACLgetEnabledAttributeTypeOk(arg ACLgetEnabledAttributeType) (ret ACLgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setACLgetEnabledAttributeType(arg *ACLgetEnabledAttributeType, val ACLgetEnabledRetType) { + *arg = &val +} + +// ACL struct for ACL +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ACL struct { + // Array of CIDRs to allow access to the kubernetes API. + // REQUIRED + AllowedCidrs ACLGetAllowedCidrsAttributeType `json:"allowedCidrs" required:"true"` + // Enables the acl extension. + // REQUIRED + Enabled ACLgetEnabledAttributeType `json:"enabled" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _ACL ACL + +// NewACL instantiates a new ACL object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewACL(allowedCidrs ACLGetAllowedCidrsArgType, enabled ACLgetEnabledArgType) *ACL { + this := ACL{} + setACLGetAllowedCidrsAttributeType(&this.AllowedCidrs, allowedCidrs) + setACLgetEnabledAttributeType(&this.Enabled, enabled) + return &this +} + +// NewACLWithDefaults instantiates a new ACL object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewACLWithDefaults() *ACL { + this := ACL{} + return &this +} + +// GetAllowedCidrs returns the AllowedCidrs field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ACL) GetAllowedCidrs() (ret ACLGetAllowedCidrsRetType) { + ret, _ = o.GetAllowedCidrsOk() + return ret +} + +// GetAllowedCidrsOk returns a tuple with the AllowedCidrs field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ACL) GetAllowedCidrsOk() (ret ACLGetAllowedCidrsRetType, ok bool) { + return getACLGetAllowedCidrsAttributeTypeOk(o.AllowedCidrs) +} + +// SetAllowedCidrs sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ACL) SetAllowedCidrs(v ACLGetAllowedCidrsRetType) { + setACLGetAllowedCidrsAttributeType(&o.AllowedCidrs, v) +} + +// GetEnabled returns the Enabled field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ACL) GetEnabled() (ret ACLgetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ACL) GetEnabledOk() (ret ACLgetEnabledRetType, ok bool) { + return getACLgetEnabledAttributeTypeOk(o.Enabled) +} + +// SetEnabled sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ACL) SetEnabled(v ACLgetEnabledRetType) { + setACLgetEnabledAttributeType(&o.Enabled, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o ACL) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getACLGetAllowedCidrsAttributeTypeOk(o.AllowedCidrs); ok { + toSerialize["AllowedCidrs"] = val + } + if val, ok := getACLgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableACL struct { + value *ACL + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableACL) Get() *ACL { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableACL) Set(val *ACL) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableACL) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableACL) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableACL(val *ACL) *NullableACL { + return &NullableACL{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableACL) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableACL) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_availability_zone.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_availability_zone.go new file mode 100644 index 000000000..5a4295064 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_availability_zone.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the AvailabilityZone type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AvailabilityZone{} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AvailabilityZoneGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getAvailabilityZoneGetNameAttributeTypeOk(arg AvailabilityZoneGetNameAttributeType) (ret AvailabilityZoneGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setAvailabilityZoneGetNameAttributeType(arg *AvailabilityZoneGetNameAttributeType, val AvailabilityZoneGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AvailabilityZoneGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AvailabilityZoneGetNameRetType = string + +// AvailabilityZone struct for AvailabilityZone +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type AvailabilityZone struct { + Name AvailabilityZoneGetNameAttributeType `json:"name,omitempty"` +} + +// NewAvailabilityZone instantiates a new AvailabilityZone object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAvailabilityZone() *AvailabilityZone { + this := AvailabilityZone{} + return &this +} + +// NewAvailabilityZoneWithDefaults instantiates a new AvailabilityZone object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewAvailabilityZoneWithDefaults() *AvailabilityZone { + this := AvailabilityZone{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *AvailabilityZone) GetName() (res AvailabilityZoneGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *AvailabilityZone) GetNameOk() (ret AvailabilityZoneGetNameRetType, ok bool) { + return getAvailabilityZoneGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *AvailabilityZone) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *AvailabilityZone) SetName(v AvailabilityZoneGetNameRetType) { + setAvailabilityZoneGetNameAttributeType(&o.Name, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o AvailabilityZone) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAvailabilityZoneGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableAvailabilityZone struct { + value *AvailabilityZone + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAvailabilityZone) Get() *AvailabilityZone { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAvailabilityZone) Set(val *AvailabilityZone) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAvailabilityZone) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAvailabilityZone) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableAvailabilityZone(val *AvailabilityZone) *NullableAvailabilityZone { + return &NullableAvailabilityZone{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableAvailabilityZone) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableAvailabilityZone) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster.go new file mode 100644 index 000000000..a46ee1e14 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster.go @@ -0,0 +1,608 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Cluster type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Cluster{} + +/* + types and functions for access +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetAccessAttributeType = *Access + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetAccessArgType = Access + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetAccessRetType = Access + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetAccessAttributeTypeOk(arg ClusterGetAccessAttributeType) (ret ClusterGetAccessRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetAccessAttributeType(arg *ClusterGetAccessAttributeType, val ClusterGetAccessRetType) { + *arg = &val +} + +/* + types and functions for extensions +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetExtensionsAttributeType = *Extension + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetExtensionsArgType = Extension + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetExtensionsRetType = Extension + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetExtensionsAttributeTypeOk(arg ClusterGetExtensionsAttributeType) (ret ClusterGetExtensionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetExtensionsAttributeType(arg *ClusterGetExtensionsAttributeType, val ClusterGetExtensionsRetType) { + *arg = &val +} + +/* + types and functions for hibernation +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetHibernationAttributeType = *Hibernation + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetHibernationArgType = Hibernation + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetHibernationRetType = Hibernation + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetHibernationAttributeTypeOk(arg ClusterGetHibernationAttributeType) (ret ClusterGetHibernationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetHibernationAttributeType(arg *ClusterGetHibernationAttributeType, val ClusterGetHibernationRetType) { + *arg = &val +} + +/* + types and functions for kubernetes +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetKubernetesAttributeType = *Kubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetKubernetesArgType = Kubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetKubernetesRetType = Kubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetKubernetesAttributeTypeOk(arg ClusterGetKubernetesAttributeType) (ret ClusterGetKubernetesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetKubernetesAttributeType(arg *ClusterGetKubernetesAttributeType, val ClusterGetKubernetesRetType) { + *arg = &val +} + +/* + types and functions for maintenance +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetMaintenanceAttributeType = *Maintenance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetMaintenanceArgType = Maintenance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetMaintenanceRetType = Maintenance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetMaintenanceAttributeTypeOk(arg ClusterGetMaintenanceAttributeType) (ret ClusterGetMaintenanceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetMaintenanceAttributeType(arg *ClusterGetMaintenanceAttributeType, val ClusterGetMaintenanceRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetNameAttributeTypeOk(arg ClusterGetNameAttributeType) (ret ClusterGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetNameAttributeType(arg *ClusterGetNameAttributeType, val ClusterGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNameRetType = string + +/* + types and functions for network +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNetworkAttributeType = *Network + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNetworkArgType = Network + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNetworkRetType = Network + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetNetworkAttributeTypeOk(arg ClusterGetNetworkAttributeType) (ret ClusterGetNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetNetworkAttributeType(arg *ClusterGetNetworkAttributeType, val ClusterGetNetworkRetType) { + *arg = &val +} + +/* + types and functions for nodepools +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNodepoolsAttributeType = *[]Nodepool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNodepoolsArgType = []Nodepool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetNodepoolsRetType = []Nodepool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetNodepoolsAttributeTypeOk(arg ClusterGetNodepoolsAttributeType) (ret ClusterGetNodepoolsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetNodepoolsAttributeType(arg *ClusterGetNodepoolsAttributeType, val ClusterGetNodepoolsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetStatusAttributeType = *ClusterStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetStatusArgType = ClusterStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterGetStatusRetType = ClusterStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterGetStatusAttributeTypeOk(arg ClusterGetStatusAttributeType) (ret ClusterGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterGetStatusAttributeType(arg *ClusterGetStatusAttributeType, val ClusterGetStatusRetType) { + *arg = &val +} + +// Cluster struct for Cluster +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Cluster struct { + Access ClusterGetAccessAttributeType `json:"access,omitempty"` + Extensions ClusterGetExtensionsAttributeType `json:"extensions,omitempty"` + Hibernation ClusterGetHibernationAttributeType `json:"hibernation,omitempty"` + // REQUIRED + Kubernetes ClusterGetKubernetesAttributeType `json:"kubernetes" required:"true"` + Maintenance ClusterGetMaintenanceAttributeType `json:"maintenance,omitempty"` + Name ClusterGetNameAttributeType `json:"name,omitempty"` + Network ClusterGetNetworkAttributeType `json:"network,omitempty"` + // REQUIRED + Nodepools ClusterGetNodepoolsAttributeType `json:"nodepools" required:"true"` + Status ClusterGetStatusAttributeType `json:"status,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Cluster Cluster + +// NewCluster instantiates a new Cluster object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCluster(kubernetes ClusterGetKubernetesArgType, nodepools ClusterGetNodepoolsArgType) *Cluster { + this := Cluster{} + setClusterGetKubernetesAttributeType(&this.Kubernetes, kubernetes) + setClusterGetNodepoolsAttributeType(&this.Nodepools, nodepools) + return &this +} + +// NewClusterWithDefaults instantiates a new Cluster object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewClusterWithDefaults() *Cluster { + this := Cluster{} + return &this +} + +// GetAccess returns the Access field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetAccess() (res ClusterGetAccessRetType) { + res, _ = o.GetAccessOk() + return +} + +// GetAccessOk returns a tuple with the Access field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetAccessOk() (ret ClusterGetAccessRetType, ok bool) { + return getClusterGetAccessAttributeTypeOk(o.Access) +} + +// HasAccess returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasAccess() bool { + _, ok := o.GetAccessOk() + return ok +} + +// SetAccess gets a reference to the given Access and assigns it to the Access field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetAccess(v ClusterGetAccessRetType) { + setClusterGetAccessAttributeType(&o.Access, v) +} + +// GetExtensions returns the Extensions field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetExtensions() (res ClusterGetExtensionsRetType) { + res, _ = o.GetExtensionsOk() + return +} + +// GetExtensionsOk returns a tuple with the Extensions field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetExtensionsOk() (ret ClusterGetExtensionsRetType, ok bool) { + return getClusterGetExtensionsAttributeTypeOk(o.Extensions) +} + +// HasExtensions returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasExtensions() bool { + _, ok := o.GetExtensionsOk() + return ok +} + +// SetExtensions gets a reference to the given Extension and assigns it to the Extensions field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetExtensions(v ClusterGetExtensionsRetType) { + setClusterGetExtensionsAttributeType(&o.Extensions, v) +} + +// GetHibernation returns the Hibernation field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetHibernation() (res ClusterGetHibernationRetType) { + res, _ = o.GetHibernationOk() + return +} + +// GetHibernationOk returns a tuple with the Hibernation field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetHibernationOk() (ret ClusterGetHibernationRetType, ok bool) { + return getClusterGetHibernationAttributeTypeOk(o.Hibernation) +} + +// HasHibernation returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasHibernation() bool { + _, ok := o.GetHibernationOk() + return ok +} + +// SetHibernation gets a reference to the given Hibernation and assigns it to the Hibernation field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetHibernation(v ClusterGetHibernationRetType) { + setClusterGetHibernationAttributeType(&o.Hibernation, v) +} + +// GetKubernetes returns the Kubernetes field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetKubernetes() (ret ClusterGetKubernetesRetType) { + ret, _ = o.GetKubernetesOk() + return ret +} + +// GetKubernetesOk returns a tuple with the Kubernetes field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetKubernetesOk() (ret ClusterGetKubernetesRetType, ok bool) { + return getClusterGetKubernetesAttributeTypeOk(o.Kubernetes) +} + +// SetKubernetes sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetKubernetes(v ClusterGetKubernetesRetType) { + setClusterGetKubernetesAttributeType(&o.Kubernetes, v) +} + +// GetMaintenance returns the Maintenance field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetMaintenance() (res ClusterGetMaintenanceRetType) { + res, _ = o.GetMaintenanceOk() + return +} + +// GetMaintenanceOk returns a tuple with the Maintenance field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetMaintenanceOk() (ret ClusterGetMaintenanceRetType, ok bool) { + return getClusterGetMaintenanceAttributeTypeOk(o.Maintenance) +} + +// HasMaintenance returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasMaintenance() bool { + _, ok := o.GetMaintenanceOk() + return ok +} + +// SetMaintenance gets a reference to the given Maintenance and assigns it to the Maintenance field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetMaintenance(v ClusterGetMaintenanceRetType) { + setClusterGetMaintenanceAttributeType(&o.Maintenance, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetName() (res ClusterGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetNameOk() (ret ClusterGetNameRetType, ok bool) { + return getClusterGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetName(v ClusterGetNameRetType) { + setClusterGetNameAttributeType(&o.Name, v) +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetNetwork() (res ClusterGetNetworkRetType) { + res, _ = o.GetNetworkOk() + return +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetNetworkOk() (ret ClusterGetNetworkRetType, ok bool) { + return getClusterGetNetworkAttributeTypeOk(o.Network) +} + +// HasNetwork returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasNetwork() bool { + _, ok := o.GetNetworkOk() + return ok +} + +// SetNetwork gets a reference to the given Network and assigns it to the Network field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetNetwork(v ClusterGetNetworkRetType) { + setClusterGetNetworkAttributeType(&o.Network, v) +} + +// GetNodepools returns the Nodepools field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetNodepools() (ret ClusterGetNodepoolsRetType) { + ret, _ = o.GetNodepoolsOk() + return ret +} + +// GetNodepoolsOk returns a tuple with the Nodepools field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetNodepoolsOk() (ret ClusterGetNodepoolsRetType, ok bool) { + return getClusterGetNodepoolsAttributeTypeOk(o.Nodepools) +} + +// SetNodepools sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetNodepools(v ClusterGetNodepoolsRetType) { + setClusterGetNodepoolsAttributeType(&o.Nodepools, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetStatus() (res ClusterGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) GetStatusOk() (ret ClusterGetStatusRetType, ok bool) { + return getClusterGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given ClusterStatus and assigns it to the Status field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Cluster) SetStatus(v ClusterGetStatusRetType) { + setClusterGetStatusAttributeType(&o.Status, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Cluster) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getClusterGetAccessAttributeTypeOk(o.Access); ok { + toSerialize["Access"] = val + } + if val, ok := getClusterGetExtensionsAttributeTypeOk(o.Extensions); ok { + toSerialize["Extensions"] = val + } + if val, ok := getClusterGetHibernationAttributeTypeOk(o.Hibernation); ok { + toSerialize["Hibernation"] = val + } + if val, ok := getClusterGetKubernetesAttributeTypeOk(o.Kubernetes); ok { + toSerialize["Kubernetes"] = val + } + if val, ok := getClusterGetMaintenanceAttributeTypeOk(o.Maintenance); ok { + toSerialize["Maintenance"] = val + } + if val, ok := getClusterGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getClusterGetNetworkAttributeTypeOk(o.Network); ok { + toSerialize["Network"] = val + } + if val, ok := getClusterGetNodepoolsAttributeTypeOk(o.Nodepools); ok { + toSerialize["Nodepools"] = val + } + if val, ok := getClusterGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCluster struct { + value *Cluster + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCluster) Get() *Cluster { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCluster) Set(val *Cluster) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCluster) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCluster) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCluster(val *Cluster) *NullableCluster { + return &NullableCluster{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCluster) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCluster) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_error.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_error.go new file mode 100644 index 000000000..f252f9a63 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_error.go @@ -0,0 +1,210 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the ClusterError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ClusterError{} + +/* + types and functions for code +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterErrorGetCodeAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterErrorGetCodeAttributeTypeOk(arg ClusterErrorGetCodeAttributeType) (ret ClusterErrorGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterErrorGetCodeAttributeType(arg *ClusterErrorGetCodeAttributeType, val ClusterErrorGetCodeRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterErrorGetCodeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterErrorGetCodeRetType = string + +/* + types and functions for message +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterErrorGetMessageAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterErrorGetMessageAttributeTypeOk(arg ClusterErrorGetMessageAttributeType) (ret ClusterErrorGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterErrorGetMessageAttributeType(arg *ClusterErrorGetMessageAttributeType, val ClusterErrorGetMessageRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterErrorGetMessageArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterErrorGetMessageRetType = string + +// ClusterError struct for ClusterError +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterError struct { + // Possible values: `\"SKE_INFRA_SNA_NETWORK_NOT_FOUND\"`, `\"SKE_INFRA_SNA_NETWORK_NO_ROUTER\"`, `\"SKE_NODE_NO_VALID_HOST_FOUND\"`, `\"SKE_NODE_MISCONFIGURED_PDB\"`, `\"SKE_NODE_MACHINE_TYPE_NOT_FOUND\"`, `\"SKE_NETWORK_NO_DNS_CONFIGURED\"`, `\"SKE_NETWORK_NO_AVAILABLE_IPS\"`, `\"SKE_NODE_MEMORY_PRESSURE\"`, `\"SKE_NODE_DISK_PRESSURE\"`, `\"SKE_NODE_PID_PRESSURE\"`, `\"SKE_OBSERVABILITY_INSTANCE_NOT_FOUND\"`, `\"SKE_OBSERVABILITY_INSTANCE_NOT_READY\"`, `\"SKE_DNS_ZONE_NOT_FOUND\"`, `\"SKE_FETCHING_ERRORS_NOT_POSSIBLE\"` + Code ClusterErrorGetCodeAttributeType `json:"code,omitempty"` + Message ClusterErrorGetMessageAttributeType `json:"message,omitempty"` +} + +// NewClusterError instantiates a new ClusterError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewClusterError() *ClusterError { + this := ClusterError{} + return &this +} + +// NewClusterErrorWithDefaults instantiates a new ClusterError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewClusterErrorWithDefaults() *ClusterError { + this := ClusterError{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) GetCode() (res ClusterErrorGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) GetCodeOk() (ret ClusterErrorGetCodeRetType, ok bool) { + return getClusterErrorGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) SetCode(v ClusterErrorGetCodeRetType) { + setClusterErrorGetCodeAttributeType(&o.Code, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) GetMessage() (res ClusterErrorGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) GetMessageOk() (ret ClusterErrorGetMessageRetType, ok bool) { + return getClusterErrorGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterError) SetMessage(v ClusterErrorGetMessageRetType) { + setClusterErrorGetMessageAttributeType(&o.Message, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o ClusterError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getClusterErrorGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getClusterErrorGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableClusterError struct { + value *ClusterError + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterError) Get() *ClusterError { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterError) Set(val *ClusterError) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterError) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterError) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableClusterError(val *ClusterError) *NullableClusterError { + return &NullableClusterError{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_status.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_status.go new file mode 100644 index 000000000..136dbecec --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_status.go @@ -0,0 +1,619 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "time" +) + +// checks if the ClusterStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ClusterStatus{} + +/* + types and functions for aggregated +*/ + +// isEnumRef +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetAggregatedAttributeType = *ClusterStatusState + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetAggregatedArgType = ClusterStatusState + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetAggregatedRetType = ClusterStatusState + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetAggregatedAttributeTypeOk(arg ClusterStatusGetAggregatedAttributeType) (ret ClusterStatusGetAggregatedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetAggregatedAttributeType(arg *ClusterStatusGetAggregatedAttributeType, val ClusterStatusGetAggregatedRetType) { + *arg = &val +} + +/* + types and functions for creationTime +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetCreationTimeAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetCreationTimeArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetCreationTimeRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetCreationTimeAttributeTypeOk(arg ClusterStatusGetCreationTimeAttributeType) (ret ClusterStatusGetCreationTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetCreationTimeAttributeType(arg *ClusterStatusGetCreationTimeAttributeType, val ClusterStatusGetCreationTimeRetType) { + *arg = &val +} + +/* + types and functions for credentialsRotation +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetCredentialsRotationAttributeType = *CredentialsRotationState + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetCredentialsRotationArgType = CredentialsRotationState + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetCredentialsRotationRetType = CredentialsRotationState + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetCredentialsRotationAttributeTypeOk(arg ClusterStatusGetCredentialsRotationAttributeType) (ret ClusterStatusGetCredentialsRotationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetCredentialsRotationAttributeType(arg *ClusterStatusGetCredentialsRotationAttributeType, val ClusterStatusGetCredentialsRotationRetType) { + *arg = &val +} + +/* + types and functions for egressAddressRanges +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetEgressAddressRangesAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetEgressAddressRangesArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetEgressAddressRangesRetType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetEgressAddressRangesAttributeTypeOk(arg ClusterStatusGetEgressAddressRangesAttributeType) (ret ClusterStatusGetEgressAddressRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetEgressAddressRangesAttributeType(arg *ClusterStatusGetEgressAddressRangesAttributeType, val ClusterStatusGetEgressAddressRangesRetType) { + *arg = &val +} + +/* + types and functions for error +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetErrorAttributeType = *RuntimeError + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetErrorArgType = RuntimeError + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetErrorRetType = RuntimeError + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetErrorAttributeTypeOk(arg ClusterStatusGetErrorAttributeType) (ret ClusterStatusGetErrorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetErrorAttributeType(arg *ClusterStatusGetErrorAttributeType, val ClusterStatusGetErrorRetType) { + *arg = &val +} + +/* + types and functions for errors +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetErrorsAttributeType = *[]ClusterError + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetErrorsArgType = []ClusterError + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetErrorsRetType = []ClusterError + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetErrorsAttributeTypeOk(arg ClusterStatusGetErrorsAttributeType) (ret ClusterStatusGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetErrorsAttributeType(arg *ClusterStatusGetErrorsAttributeType, val ClusterStatusGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for hibernated +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusgetHibernatedAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusgetHibernatedArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusgetHibernatedRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusgetHibernatedAttributeTypeOk(arg ClusterStatusgetHibernatedAttributeType) (ret ClusterStatusgetHibernatedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusgetHibernatedAttributeType(arg *ClusterStatusgetHibernatedAttributeType, val ClusterStatusgetHibernatedRetType) { + *arg = &val +} + +/* + types and functions for identity +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetIdentityAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetIdentityAttributeTypeOk(arg ClusterStatusGetIdentityAttributeType) (ret ClusterStatusGetIdentityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetIdentityAttributeType(arg *ClusterStatusGetIdentityAttributeType, val ClusterStatusGetIdentityRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetIdentityArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetIdentityRetType = string + +/* + types and functions for podAddressRanges +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetPodAddressRangesAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetPodAddressRangesArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusGetPodAddressRangesRetType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getClusterStatusGetPodAddressRangesAttributeTypeOk(arg ClusterStatusGetPodAddressRangesAttributeType) (ret ClusterStatusGetPodAddressRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setClusterStatusGetPodAddressRangesAttributeType(arg *ClusterStatusGetPodAddressRangesAttributeType, val ClusterStatusGetPodAddressRangesRetType) { + *arg = &val +} + +// ClusterStatus struct for ClusterStatus +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatus struct { + Aggregated ClusterStatusGetAggregatedAttributeType `json:"aggregated,omitempty"` + // Format: `2024-02-15T11:06:29Z` + CreationTime ClusterStatusGetCreationTimeAttributeType `json:"creationTime,omitempty"` + CredentialsRotation ClusterStatusGetCredentialsRotationAttributeType `json:"credentialsRotation,omitempty"` + // The outgoing network ranges (in CIDR notation) of traffic originating from workload on the cluster. + EgressAddressRanges ClusterStatusGetEgressAddressRangesAttributeType `json:"egressAddressRanges,omitempty"` + Error ClusterStatusGetErrorAttributeType `json:"error,omitempty"` + Errors ClusterStatusGetErrorsAttributeType `json:"errors,omitempty"` + Hibernated ClusterStatusgetHibernatedAttributeType `json:"hibernated,omitempty"` + Identity ClusterStatusGetIdentityAttributeType `json:"identity,omitempty"` + // The network ranges (in CIDR notation) used by pods of the cluster. + PodAddressRanges ClusterStatusGetPodAddressRangesAttributeType `json:"podAddressRanges,omitempty"` +} + +// NewClusterStatus instantiates a new ClusterStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewClusterStatus() *ClusterStatus { + this := ClusterStatus{} + return &this +} + +// NewClusterStatusWithDefaults instantiates a new ClusterStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewClusterStatusWithDefaults() *ClusterStatus { + this := ClusterStatus{} + return &this +} + +// GetAggregated returns the Aggregated field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetAggregated() (res ClusterStatusGetAggregatedRetType) { + res, _ = o.GetAggregatedOk() + return +} + +// GetAggregatedOk returns a tuple with the Aggregated field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetAggregatedOk() (ret ClusterStatusGetAggregatedRetType, ok bool) { + return getClusterStatusGetAggregatedAttributeTypeOk(o.Aggregated) +} + +// HasAggregated returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasAggregated() bool { + _, ok := o.GetAggregatedOk() + return ok +} + +// SetAggregated gets a reference to the given ClusterStatusState and assigns it to the Aggregated field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetAggregated(v ClusterStatusGetAggregatedRetType) { + setClusterStatusGetAggregatedAttributeType(&o.Aggregated, v) +} + +// GetCreationTime returns the CreationTime field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetCreationTime() (res ClusterStatusGetCreationTimeRetType) { + res, _ = o.GetCreationTimeOk() + return +} + +// GetCreationTimeOk returns a tuple with the CreationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetCreationTimeOk() (ret ClusterStatusGetCreationTimeRetType, ok bool) { + return getClusterStatusGetCreationTimeAttributeTypeOk(o.CreationTime) +} + +// HasCreationTime returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasCreationTime() bool { + _, ok := o.GetCreationTimeOk() + return ok +} + +// SetCreationTime gets a reference to the given time.Time and assigns it to the CreationTime field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetCreationTime(v ClusterStatusGetCreationTimeRetType) { + setClusterStatusGetCreationTimeAttributeType(&o.CreationTime, v) +} + +// GetCredentialsRotation returns the CredentialsRotation field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetCredentialsRotation() (res ClusterStatusGetCredentialsRotationRetType) { + res, _ = o.GetCredentialsRotationOk() + return +} + +// GetCredentialsRotationOk returns a tuple with the CredentialsRotation field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetCredentialsRotationOk() (ret ClusterStatusGetCredentialsRotationRetType, ok bool) { + return getClusterStatusGetCredentialsRotationAttributeTypeOk(o.CredentialsRotation) +} + +// HasCredentialsRotation returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasCredentialsRotation() bool { + _, ok := o.GetCredentialsRotationOk() + return ok +} + +// SetCredentialsRotation gets a reference to the given CredentialsRotationState and assigns it to the CredentialsRotation field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetCredentialsRotation(v ClusterStatusGetCredentialsRotationRetType) { + setClusterStatusGetCredentialsRotationAttributeType(&o.CredentialsRotation, v) +} + +// GetEgressAddressRanges returns the EgressAddressRanges field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetEgressAddressRanges() (res ClusterStatusGetEgressAddressRangesRetType) { + res, _ = o.GetEgressAddressRangesOk() + return +} + +// GetEgressAddressRangesOk returns a tuple with the EgressAddressRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetEgressAddressRangesOk() (ret ClusterStatusGetEgressAddressRangesRetType, ok bool) { + return getClusterStatusGetEgressAddressRangesAttributeTypeOk(o.EgressAddressRanges) +} + +// HasEgressAddressRanges returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasEgressAddressRanges() bool { + _, ok := o.GetEgressAddressRangesOk() + return ok +} + +// SetEgressAddressRanges gets a reference to the given []string and assigns it to the EgressAddressRanges field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetEgressAddressRanges(v ClusterStatusGetEgressAddressRangesRetType) { + setClusterStatusGetEgressAddressRangesAttributeType(&o.EgressAddressRanges, v) +} + +// GetError returns the Error field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetError() (res ClusterStatusGetErrorRetType) { + res, _ = o.GetErrorOk() + return +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetErrorOk() (ret ClusterStatusGetErrorRetType, ok bool) { + return getClusterStatusGetErrorAttributeTypeOk(o.Error) +} + +// HasError returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasError() bool { + _, ok := o.GetErrorOk() + return ok +} + +// SetError gets a reference to the given RuntimeError and assigns it to the Error field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetError(v ClusterStatusGetErrorRetType) { + setClusterStatusGetErrorAttributeType(&o.Error, v) +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetErrors() (res ClusterStatusGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetErrorsOk() (ret ClusterStatusGetErrorsRetType, ok bool) { + return getClusterStatusGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []ClusterError and assigns it to the Errors field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetErrors(v ClusterStatusGetErrorsRetType) { + setClusterStatusGetErrorsAttributeType(&o.Errors, v) +} + +// GetHibernated returns the Hibernated field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetHibernated() (res ClusterStatusgetHibernatedRetType) { + res, _ = o.GetHibernatedOk() + return +} + +// GetHibernatedOk returns a tuple with the Hibernated field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetHibernatedOk() (ret ClusterStatusgetHibernatedRetType, ok bool) { + return getClusterStatusgetHibernatedAttributeTypeOk(o.Hibernated) +} + +// HasHibernated returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasHibernated() bool { + _, ok := o.GetHibernatedOk() + return ok +} + +// SetHibernated gets a reference to the given bool and assigns it to the Hibernated field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetHibernated(v ClusterStatusgetHibernatedRetType) { + setClusterStatusgetHibernatedAttributeType(&o.Hibernated, v) +} + +// GetIdentity returns the Identity field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetIdentity() (res ClusterStatusGetIdentityRetType) { + res, _ = o.GetIdentityOk() + return +} + +// GetIdentityOk returns a tuple with the Identity field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetIdentityOk() (ret ClusterStatusGetIdentityRetType, ok bool) { + return getClusterStatusGetIdentityAttributeTypeOk(o.Identity) +} + +// HasIdentity returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasIdentity() bool { + _, ok := o.GetIdentityOk() + return ok +} + +// SetIdentity gets a reference to the given string and assigns it to the Identity field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetIdentity(v ClusterStatusGetIdentityRetType) { + setClusterStatusGetIdentityAttributeType(&o.Identity, v) +} + +// GetPodAddressRanges returns the PodAddressRanges field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetPodAddressRanges() (res ClusterStatusGetPodAddressRangesRetType) { + res, _ = o.GetPodAddressRangesOk() + return +} + +// GetPodAddressRangesOk returns a tuple with the PodAddressRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) GetPodAddressRangesOk() (ret ClusterStatusGetPodAddressRangesRetType, ok bool) { + return getClusterStatusGetPodAddressRangesAttributeTypeOk(o.PodAddressRanges) +} + +// HasPodAddressRanges returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) HasPodAddressRanges() bool { + _, ok := o.GetPodAddressRangesOk() + return ok +} + +// SetPodAddressRanges gets a reference to the given []string and assigns it to the PodAddressRanges field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ClusterStatus) SetPodAddressRanges(v ClusterStatusGetPodAddressRangesRetType) { + setClusterStatusGetPodAddressRangesAttributeType(&o.PodAddressRanges, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o ClusterStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getClusterStatusGetAggregatedAttributeTypeOk(o.Aggregated); ok { + toSerialize["Aggregated"] = val + } + if val, ok := getClusterStatusGetCreationTimeAttributeTypeOk(o.CreationTime); ok { + toSerialize["CreationTime"] = val + } + if val, ok := getClusterStatusGetCredentialsRotationAttributeTypeOk(o.CredentialsRotation); ok { + toSerialize["CredentialsRotation"] = val + } + if val, ok := getClusterStatusGetEgressAddressRangesAttributeTypeOk(o.EgressAddressRanges); ok { + toSerialize["EgressAddressRanges"] = val + } + if val, ok := getClusterStatusGetErrorAttributeTypeOk(o.Error); ok { + toSerialize["Error"] = val + } + if val, ok := getClusterStatusGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getClusterStatusgetHibernatedAttributeTypeOk(o.Hibernated); ok { + toSerialize["Hibernated"] = val + } + if val, ok := getClusterStatusGetIdentityAttributeTypeOk(o.Identity); ok { + toSerialize["Identity"] = val + } + if val, ok := getClusterStatusGetPodAddressRangesAttributeTypeOk(o.PodAddressRanges); ok { + toSerialize["PodAddressRanges"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableClusterStatus struct { + value *ClusterStatus + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterStatus) Get() *ClusterStatus { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterStatus) Set(val *ClusterStatus) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterStatus) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterStatus) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableClusterStatus(val *ClusterStatus) *NullableClusterStatus { + return &NullableClusterStatus{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_status_state.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_status_state.go new file mode 100644 index 000000000..5ec3af0bd --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cluster_status_state.go @@ -0,0 +1,150 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" +) + +// ClusterStatusState the model 'ClusterStatusState' +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ClusterStatusState string + +// List of ClusterStatusState +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_HEALTHY ClusterStatusState = "STATE_HEALTHY" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_CREATING ClusterStatusState = "STATE_CREATING" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_DELETING ClusterStatusState = "STATE_DELETING" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_UNHEALTHY ClusterStatusState = "STATE_UNHEALTHY" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_RECONCILING ClusterStatusState = "STATE_RECONCILING" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_HIBERNATED ClusterStatusState = "STATE_HIBERNATED" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_HIBERNATING ClusterStatusState = "STATE_HIBERNATING" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CLUSTERSTATUSSTATE_WAKINGUP ClusterStatusState = "STATE_WAKINGUP" +) + +// All allowed values of ClusterStatusState enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedClusterStatusStateEnumValues = []ClusterStatusState{ + "STATE_HEALTHY", + "STATE_CREATING", + "STATE_DELETING", + "STATE_UNHEALTHY", + "STATE_RECONCILING", + "STATE_HIBERNATED", + "STATE_HIBERNATING", + "STATE_WAKINGUP", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *ClusterStatusState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := ClusterStatusState(value) + for _, existing := range AllowedClusterStatusStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ClusterStatusState", value) +} + +// NewClusterStatusStateFromValue returns a pointer to a valid ClusterStatusState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewClusterStatusStateFromValue(v string) (*ClusterStatusState, error) { + ev := ClusterStatusState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ClusterStatusState: valid values are %v", v, AllowedClusterStatusStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v ClusterStatusState) IsValid() bool { + for _, existing := range AllowedClusterStatusStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ClusterStatusState value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v ClusterStatusState) Ptr() *ClusterStatusState { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableClusterStatusState struct { + value *ClusterStatusState + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterStatusState) Get() *ClusterStatusState { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterStatusState) Set(val *ClusterStatusState) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterStatusState) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterStatusState) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableClusterStatusState(val *ClusterStatusState) *NullableClusterStatusState { + return &NullableClusterStatusState{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableClusterStatusState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableClusterStatusState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_create_kubeconfig_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_create_kubeconfig_payload.go new file mode 100644 index 000000000..d6503a673 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_create_kubeconfig_payload.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the CreateKubeconfigPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateKubeconfigPayload{} + +/* + types and functions for expirationSeconds +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateKubeconfigPayloadGetExpirationSecondsAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateKubeconfigPayloadGetExpirationSecondsAttributeTypeOk(arg CreateKubeconfigPayloadGetExpirationSecondsAttributeType) (ret CreateKubeconfigPayloadGetExpirationSecondsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateKubeconfigPayloadGetExpirationSecondsAttributeType(arg *CreateKubeconfigPayloadGetExpirationSecondsAttributeType, val CreateKubeconfigPayloadGetExpirationSecondsRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateKubeconfigPayloadGetExpirationSecondsArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateKubeconfigPayloadGetExpirationSecondsRetType = string + +// CreateKubeconfigPayload struct for CreateKubeconfigPayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateKubeconfigPayload struct { + ExpirationSeconds CreateKubeconfigPayloadGetExpirationSecondsAttributeType `json:"expirationSeconds,omitempty"` +} + +// NewCreateKubeconfigPayload instantiates a new CreateKubeconfigPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCreateKubeconfigPayload() *CreateKubeconfigPayload { + this := CreateKubeconfigPayload{} + return &this +} + +// NewCreateKubeconfigPayloadWithDefaults instantiates a new CreateKubeconfigPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCreateKubeconfigPayloadWithDefaults() *CreateKubeconfigPayload { + this := CreateKubeconfigPayload{} + return &this +} + +// GetExpirationSeconds returns the ExpirationSeconds field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateKubeconfigPayload) GetExpirationSeconds() (res CreateKubeconfigPayloadGetExpirationSecondsRetType) { + res, _ = o.GetExpirationSecondsOk() + return +} + +// GetExpirationSecondsOk returns a tuple with the ExpirationSeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateKubeconfigPayload) GetExpirationSecondsOk() (ret CreateKubeconfigPayloadGetExpirationSecondsRetType, ok bool) { + return getCreateKubeconfigPayloadGetExpirationSecondsAttributeTypeOk(o.ExpirationSeconds) +} + +// HasExpirationSeconds returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateKubeconfigPayload) HasExpirationSeconds() bool { + _, ok := o.GetExpirationSecondsOk() + return ok +} + +// SetExpirationSeconds gets a reference to the given string and assigns it to the ExpirationSeconds field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateKubeconfigPayload) SetExpirationSeconds(v CreateKubeconfigPayloadGetExpirationSecondsRetType) { + setCreateKubeconfigPayloadGetExpirationSecondsAttributeType(&o.ExpirationSeconds, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o CreateKubeconfigPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateKubeconfigPayloadGetExpirationSecondsAttributeTypeOk(o.ExpirationSeconds); ok { + toSerialize["ExpirationSeconds"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCreateKubeconfigPayload struct { + value *CreateKubeconfigPayload + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateKubeconfigPayload) Get() *CreateKubeconfigPayload { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateKubeconfigPayload) Set(val *CreateKubeconfigPayload) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateKubeconfigPayload) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateKubeconfigPayload) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCreateKubeconfigPayload(val *CreateKubeconfigPayload) *NullableCreateKubeconfigPayload { + return &NullableCreateKubeconfigPayload{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateKubeconfigPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateKubeconfigPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_create_or_update_cluster_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_create_or_update_cluster_payload.go new file mode 100644 index 000000000..55164b44d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_create_or_update_cluster_payload.go @@ -0,0 +1,550 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the CreateOrUpdateClusterPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateOrUpdateClusterPayload{} + +/* + types and functions for access +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetAccessAttributeType = *Access + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetAccessArgType = Access + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetAccessRetType = Access + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetAccessAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetAccessAttributeType) (ret CreateOrUpdateClusterPayloadGetAccessRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetAccessAttributeType(arg *CreateOrUpdateClusterPayloadGetAccessAttributeType, val CreateOrUpdateClusterPayloadGetAccessRetType) { + *arg = &val +} + +/* + types and functions for extensions +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetExtensionsAttributeType = *Extension + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetExtensionsArgType = Extension + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetExtensionsRetType = Extension + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetExtensionsAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetExtensionsAttributeType) (ret CreateOrUpdateClusterPayloadGetExtensionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetExtensionsAttributeType(arg *CreateOrUpdateClusterPayloadGetExtensionsAttributeType, val CreateOrUpdateClusterPayloadGetExtensionsRetType) { + *arg = &val +} + +/* + types and functions for hibernation +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetHibernationAttributeType = *Hibernation + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetHibernationArgType = Hibernation + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetHibernationRetType = Hibernation + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetHibernationAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetHibernationAttributeType) (ret CreateOrUpdateClusterPayloadGetHibernationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetHibernationAttributeType(arg *CreateOrUpdateClusterPayloadGetHibernationAttributeType, val CreateOrUpdateClusterPayloadGetHibernationRetType) { + *arg = &val +} + +/* + types and functions for kubernetes +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetKubernetesAttributeType = *Kubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetKubernetesArgType = Kubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetKubernetesRetType = Kubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetKubernetesAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetKubernetesAttributeType) (ret CreateOrUpdateClusterPayloadGetKubernetesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetKubernetesAttributeType(arg *CreateOrUpdateClusterPayloadGetKubernetesAttributeType, val CreateOrUpdateClusterPayloadGetKubernetesRetType) { + *arg = &val +} + +/* + types and functions for maintenance +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetMaintenanceAttributeType = *Maintenance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetMaintenanceArgType = Maintenance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetMaintenanceRetType = Maintenance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetMaintenanceAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetMaintenanceAttributeType) (ret CreateOrUpdateClusterPayloadGetMaintenanceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetMaintenanceAttributeType(arg *CreateOrUpdateClusterPayloadGetMaintenanceAttributeType, val CreateOrUpdateClusterPayloadGetMaintenanceRetType) { + *arg = &val +} + +/* + types and functions for network +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetNetworkAttributeType = *Network + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetNetworkArgType = Network + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetNetworkRetType = Network + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetNetworkAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetNetworkAttributeType) (ret CreateOrUpdateClusterPayloadGetNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetNetworkAttributeType(arg *CreateOrUpdateClusterPayloadGetNetworkAttributeType, val CreateOrUpdateClusterPayloadGetNetworkRetType) { + *arg = &val +} + +/* + types and functions for nodepools +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetNodepoolsAttributeType = *[]Nodepool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetNodepoolsArgType = []Nodepool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetNodepoolsRetType = []Nodepool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetNodepoolsAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetNodepoolsAttributeType) (ret CreateOrUpdateClusterPayloadGetNodepoolsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetNodepoolsAttributeType(arg *CreateOrUpdateClusterPayloadGetNodepoolsAttributeType, val CreateOrUpdateClusterPayloadGetNodepoolsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetStatusAttributeType = *ClusterStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetStatusArgType = ClusterStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayloadGetStatusRetType = ClusterStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCreateOrUpdateClusterPayloadGetStatusAttributeTypeOk(arg CreateOrUpdateClusterPayloadGetStatusAttributeType) (ret CreateOrUpdateClusterPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCreateOrUpdateClusterPayloadGetStatusAttributeType(arg *CreateOrUpdateClusterPayloadGetStatusAttributeType, val CreateOrUpdateClusterPayloadGetStatusRetType) { + *arg = &val +} + +// CreateOrUpdateClusterPayload struct for CreateOrUpdateClusterPayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CreateOrUpdateClusterPayload struct { + Access CreateOrUpdateClusterPayloadGetAccessAttributeType `json:"access,omitempty"` + Extensions CreateOrUpdateClusterPayloadGetExtensionsAttributeType `json:"extensions,omitempty"` + Hibernation CreateOrUpdateClusterPayloadGetHibernationAttributeType `json:"hibernation,omitempty"` + // REQUIRED + Kubernetes CreateOrUpdateClusterPayloadGetKubernetesAttributeType `json:"kubernetes" required:"true"` + Maintenance CreateOrUpdateClusterPayloadGetMaintenanceAttributeType `json:"maintenance,omitempty"` + Network CreateOrUpdateClusterPayloadGetNetworkAttributeType `json:"network,omitempty"` + // REQUIRED + Nodepools CreateOrUpdateClusterPayloadGetNodepoolsAttributeType `json:"nodepools" required:"true"` + Status CreateOrUpdateClusterPayloadGetStatusAttributeType `json:"status,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _CreateOrUpdateClusterPayload CreateOrUpdateClusterPayload + +// NewCreateOrUpdateClusterPayload instantiates a new CreateOrUpdateClusterPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCreateOrUpdateClusterPayload(kubernetes CreateOrUpdateClusterPayloadGetKubernetesArgType, nodepools CreateOrUpdateClusterPayloadGetNodepoolsArgType) *CreateOrUpdateClusterPayload { + this := CreateOrUpdateClusterPayload{} + setCreateOrUpdateClusterPayloadGetKubernetesAttributeType(&this.Kubernetes, kubernetes) + setCreateOrUpdateClusterPayloadGetNodepoolsAttributeType(&this.Nodepools, nodepools) + return &this +} + +// NewCreateOrUpdateClusterPayloadWithDefaults instantiates a new CreateOrUpdateClusterPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCreateOrUpdateClusterPayloadWithDefaults() *CreateOrUpdateClusterPayload { + this := CreateOrUpdateClusterPayload{} + return &this +} + +// GetAccess returns the Access field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetAccess() (res CreateOrUpdateClusterPayloadGetAccessRetType) { + res, _ = o.GetAccessOk() + return +} + +// GetAccessOk returns a tuple with the Access field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetAccessOk() (ret CreateOrUpdateClusterPayloadGetAccessRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetAccessAttributeTypeOk(o.Access) +} + +// HasAccess returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) HasAccess() bool { + _, ok := o.GetAccessOk() + return ok +} + +// SetAccess gets a reference to the given Access and assigns it to the Access field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetAccess(v CreateOrUpdateClusterPayloadGetAccessRetType) { + setCreateOrUpdateClusterPayloadGetAccessAttributeType(&o.Access, v) +} + +// GetExtensions returns the Extensions field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetExtensions() (res CreateOrUpdateClusterPayloadGetExtensionsRetType) { + res, _ = o.GetExtensionsOk() + return +} + +// GetExtensionsOk returns a tuple with the Extensions field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetExtensionsOk() (ret CreateOrUpdateClusterPayloadGetExtensionsRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetExtensionsAttributeTypeOk(o.Extensions) +} + +// HasExtensions returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) HasExtensions() bool { + _, ok := o.GetExtensionsOk() + return ok +} + +// SetExtensions gets a reference to the given Extension and assigns it to the Extensions field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetExtensions(v CreateOrUpdateClusterPayloadGetExtensionsRetType) { + setCreateOrUpdateClusterPayloadGetExtensionsAttributeType(&o.Extensions, v) +} + +// GetHibernation returns the Hibernation field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetHibernation() (res CreateOrUpdateClusterPayloadGetHibernationRetType) { + res, _ = o.GetHibernationOk() + return +} + +// GetHibernationOk returns a tuple with the Hibernation field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetHibernationOk() (ret CreateOrUpdateClusterPayloadGetHibernationRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetHibernationAttributeTypeOk(o.Hibernation) +} + +// HasHibernation returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) HasHibernation() bool { + _, ok := o.GetHibernationOk() + return ok +} + +// SetHibernation gets a reference to the given Hibernation and assigns it to the Hibernation field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetHibernation(v CreateOrUpdateClusterPayloadGetHibernationRetType) { + setCreateOrUpdateClusterPayloadGetHibernationAttributeType(&o.Hibernation, v) +} + +// GetKubernetes returns the Kubernetes field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetKubernetes() (ret CreateOrUpdateClusterPayloadGetKubernetesRetType) { + ret, _ = o.GetKubernetesOk() + return ret +} + +// GetKubernetesOk returns a tuple with the Kubernetes field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetKubernetesOk() (ret CreateOrUpdateClusterPayloadGetKubernetesRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetKubernetesAttributeTypeOk(o.Kubernetes) +} + +// SetKubernetes sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetKubernetes(v CreateOrUpdateClusterPayloadGetKubernetesRetType) { + setCreateOrUpdateClusterPayloadGetKubernetesAttributeType(&o.Kubernetes, v) +} + +// GetMaintenance returns the Maintenance field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetMaintenance() (res CreateOrUpdateClusterPayloadGetMaintenanceRetType) { + res, _ = o.GetMaintenanceOk() + return +} + +// GetMaintenanceOk returns a tuple with the Maintenance field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetMaintenanceOk() (ret CreateOrUpdateClusterPayloadGetMaintenanceRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetMaintenanceAttributeTypeOk(o.Maintenance) +} + +// HasMaintenance returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) HasMaintenance() bool { + _, ok := o.GetMaintenanceOk() + return ok +} + +// SetMaintenance gets a reference to the given Maintenance and assigns it to the Maintenance field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetMaintenance(v CreateOrUpdateClusterPayloadGetMaintenanceRetType) { + setCreateOrUpdateClusterPayloadGetMaintenanceAttributeType(&o.Maintenance, v) +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetNetwork() (res CreateOrUpdateClusterPayloadGetNetworkRetType) { + res, _ = o.GetNetworkOk() + return +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetNetworkOk() (ret CreateOrUpdateClusterPayloadGetNetworkRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetNetworkAttributeTypeOk(o.Network) +} + +// HasNetwork returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) HasNetwork() bool { + _, ok := o.GetNetworkOk() + return ok +} + +// SetNetwork gets a reference to the given Network and assigns it to the Network field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetNetwork(v CreateOrUpdateClusterPayloadGetNetworkRetType) { + setCreateOrUpdateClusterPayloadGetNetworkAttributeType(&o.Network, v) +} + +// GetNodepools returns the Nodepools field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetNodepools() (ret CreateOrUpdateClusterPayloadGetNodepoolsRetType) { + ret, _ = o.GetNodepoolsOk() + return ret +} + +// GetNodepoolsOk returns a tuple with the Nodepools field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetNodepoolsOk() (ret CreateOrUpdateClusterPayloadGetNodepoolsRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetNodepoolsAttributeTypeOk(o.Nodepools) +} + +// SetNodepools sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetNodepools(v CreateOrUpdateClusterPayloadGetNodepoolsRetType) { + setCreateOrUpdateClusterPayloadGetNodepoolsAttributeType(&o.Nodepools, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetStatus() (res CreateOrUpdateClusterPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) GetStatusOk() (ret CreateOrUpdateClusterPayloadGetStatusRetType, ok bool) { + return getCreateOrUpdateClusterPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given ClusterStatus and assigns it to the Status field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CreateOrUpdateClusterPayload) SetStatus(v CreateOrUpdateClusterPayloadGetStatusRetType) { + setCreateOrUpdateClusterPayloadGetStatusAttributeType(&o.Status, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o CreateOrUpdateClusterPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateOrUpdateClusterPayloadGetAccessAttributeTypeOk(o.Access); ok { + toSerialize["Access"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetExtensionsAttributeTypeOk(o.Extensions); ok { + toSerialize["Extensions"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetHibernationAttributeTypeOk(o.Hibernation); ok { + toSerialize["Hibernation"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetKubernetesAttributeTypeOk(o.Kubernetes); ok { + toSerialize["Kubernetes"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetMaintenanceAttributeTypeOk(o.Maintenance); ok { + toSerialize["Maintenance"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetNetworkAttributeTypeOk(o.Network); ok { + toSerialize["Network"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetNodepoolsAttributeTypeOk(o.Nodepools); ok { + toSerialize["Nodepools"] = val + } + if val, ok := getCreateOrUpdateClusterPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCreateOrUpdateClusterPayload struct { + value *CreateOrUpdateClusterPayload + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateOrUpdateClusterPayload) Get() *CreateOrUpdateClusterPayload { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateOrUpdateClusterPayload) Set(val *CreateOrUpdateClusterPayload) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateOrUpdateClusterPayload) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateOrUpdateClusterPayload) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCreateOrUpdateClusterPayload(val *CreateOrUpdateClusterPayload) *NullableCreateOrUpdateClusterPayload { + return &NullableCreateOrUpdateClusterPayload{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCreateOrUpdateClusterPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCreateOrUpdateClusterPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_credentials_rotation_state.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_credentials_rotation_state.go new file mode 100644 index 000000000..5abeeee83 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_credentials_rotation_state.go @@ -0,0 +1,401 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the CredentialsRotationState type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CredentialsRotationState{} + +/* + types and functions for lastCompletionTime +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetLastCompletionTimeAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetLastCompletionTimeArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetLastCompletionTimeRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCredentialsRotationStateGetLastCompletionTimeAttributeTypeOk(arg CredentialsRotationStateGetLastCompletionTimeAttributeType) (ret CredentialsRotationStateGetLastCompletionTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCredentialsRotationStateGetLastCompletionTimeAttributeType(arg *CredentialsRotationStateGetLastCompletionTimeAttributeType, val CredentialsRotationStateGetLastCompletionTimeRetType) { + *arg = &val +} + +/* + types and functions for lastInitiationTime +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetLastInitiationTimeAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetLastInitiationTimeArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetLastInitiationTimeRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCredentialsRotationStateGetLastInitiationTimeAttributeTypeOk(arg CredentialsRotationStateGetLastInitiationTimeAttributeType) (ret CredentialsRotationStateGetLastInitiationTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCredentialsRotationStateGetLastInitiationTimeAttributeType(arg *CredentialsRotationStateGetLastInitiationTimeAttributeType, val CredentialsRotationStateGetLastInitiationTimeRetType) { + *arg = &val +} + +/* + types and functions for phase +*/ + +// isEnum + +// CredentialsRotationStatePhase Phase of the credentials rotation. `NEVER` indicates that no credentials rotation has been performed using the new credentials rotation endpoints yet. +// value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStatePhase string + +// List of Phase +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CREDENTIALSROTATIONSTATEPHASE_NEVER CredentialsRotationStatePhase = "NEVER" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CREDENTIALSROTATIONSTATEPHASE_PREPARING CredentialsRotationStatePhase = "PREPARING" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CREDENTIALSROTATIONSTATEPHASE_PREPARED CredentialsRotationStatePhase = "PREPARED" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CREDENTIALSROTATIONSTATEPHASE_COMPLETING CredentialsRotationStatePhase = "COMPLETING" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CREDENTIALSROTATIONSTATEPHASE_COMPLETED CredentialsRotationStatePhase = "COMPLETED" +) + +// All allowed values of CredentialsRotationState enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedCredentialsRotationStatePhaseEnumValues = []CredentialsRotationStatePhase{ + "NEVER", + "PREPARING", + "PREPARED", + "COMPLETING", + "COMPLETED", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *CredentialsRotationStatePhase) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson CredentialsRotationStatePhase + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := CredentialsRotationStatePhase(value) + for _, existing := range AllowedCredentialsRotationStatePhaseEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CredentialsRotationState", value) +} + +// NewCredentialsRotationStatePhaseFromValue returns a pointer to a valid CredentialsRotationStatePhase +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCredentialsRotationStatePhaseFromValue(v CredentialsRotationStatePhase) (*CredentialsRotationStatePhase, error) { + ev := CredentialsRotationStatePhase(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CredentialsRotationStatePhase: valid values are %v", v, AllowedCredentialsRotationStatePhaseEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v CredentialsRotationStatePhase) IsValid() bool { + for _, existing := range AllowedCredentialsRotationStatePhaseEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PhasePhase value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v CredentialsRotationStatePhase) Ptr() *CredentialsRotationStatePhase { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCredentialsRotationStatePhase struct { + value *CredentialsRotationStatePhase + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCredentialsRotationStatePhase) Get() *CredentialsRotationStatePhase { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCredentialsRotationStatePhase) Set(val *CredentialsRotationStatePhase) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCredentialsRotationStatePhase) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCredentialsRotationStatePhase) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCredentialsRotationStatePhase(val *CredentialsRotationStatePhase) *NullableCredentialsRotationStatePhase { + return &NullableCredentialsRotationStatePhase{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCredentialsRotationStatePhase) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCredentialsRotationStatePhase) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetPhaseAttributeType = *CredentialsRotationStatePhase + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetPhaseArgType = CredentialsRotationStatePhase + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationStateGetPhaseRetType = CredentialsRotationStatePhase + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCredentialsRotationStateGetPhaseAttributeTypeOk(arg CredentialsRotationStateGetPhaseAttributeType) (ret CredentialsRotationStateGetPhaseRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCredentialsRotationStateGetPhaseAttributeType(arg *CredentialsRotationStateGetPhaseAttributeType, val CredentialsRotationStateGetPhaseRetType) { + *arg = &val +} + +// CredentialsRotationState struct for CredentialsRotationState +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CredentialsRotationState struct { + // Format: `2024-02-15T11:06:29Z` + LastCompletionTime CredentialsRotationStateGetLastCompletionTimeAttributeType `json:"lastCompletionTime,omitempty"` + // Format: `2024-02-15T11:06:29Z` + LastInitiationTime CredentialsRotationStateGetLastInitiationTimeAttributeType `json:"lastInitiationTime,omitempty"` + // Phase of the credentials rotation. `NEVER` indicates that no credentials rotation has been performed using the new credentials rotation endpoints yet. + Phase CredentialsRotationStateGetPhaseAttributeType `json:"phase,omitempty"` +} + +// NewCredentialsRotationState instantiates a new CredentialsRotationState object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCredentialsRotationState() *CredentialsRotationState { + this := CredentialsRotationState{} + return &this +} + +// NewCredentialsRotationStateWithDefaults instantiates a new CredentialsRotationState object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCredentialsRotationStateWithDefaults() *CredentialsRotationState { + this := CredentialsRotationState{} + return &this +} + +// GetLastCompletionTime returns the LastCompletionTime field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) GetLastCompletionTime() (res CredentialsRotationStateGetLastCompletionTimeRetType) { + res, _ = o.GetLastCompletionTimeOk() + return +} + +// GetLastCompletionTimeOk returns a tuple with the LastCompletionTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) GetLastCompletionTimeOk() (ret CredentialsRotationStateGetLastCompletionTimeRetType, ok bool) { + return getCredentialsRotationStateGetLastCompletionTimeAttributeTypeOk(o.LastCompletionTime) +} + +// HasLastCompletionTime returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) HasLastCompletionTime() bool { + _, ok := o.GetLastCompletionTimeOk() + return ok +} + +// SetLastCompletionTime gets a reference to the given time.Time and assigns it to the LastCompletionTime field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) SetLastCompletionTime(v CredentialsRotationStateGetLastCompletionTimeRetType) { + setCredentialsRotationStateGetLastCompletionTimeAttributeType(&o.LastCompletionTime, v) +} + +// GetLastInitiationTime returns the LastInitiationTime field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) GetLastInitiationTime() (res CredentialsRotationStateGetLastInitiationTimeRetType) { + res, _ = o.GetLastInitiationTimeOk() + return +} + +// GetLastInitiationTimeOk returns a tuple with the LastInitiationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) GetLastInitiationTimeOk() (ret CredentialsRotationStateGetLastInitiationTimeRetType, ok bool) { + return getCredentialsRotationStateGetLastInitiationTimeAttributeTypeOk(o.LastInitiationTime) +} + +// HasLastInitiationTime returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) HasLastInitiationTime() bool { + _, ok := o.GetLastInitiationTimeOk() + return ok +} + +// SetLastInitiationTime gets a reference to the given time.Time and assigns it to the LastInitiationTime field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) SetLastInitiationTime(v CredentialsRotationStateGetLastInitiationTimeRetType) { + setCredentialsRotationStateGetLastInitiationTimeAttributeType(&o.LastInitiationTime, v) +} + +// GetPhase returns the Phase field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) GetPhase() (res CredentialsRotationStateGetPhaseRetType) { + res, _ = o.GetPhaseOk() + return +} + +// GetPhaseOk returns a tuple with the Phase field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) GetPhaseOk() (ret CredentialsRotationStateGetPhaseRetType, ok bool) { + return getCredentialsRotationStateGetPhaseAttributeTypeOk(o.Phase) +} + +// HasPhase returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) HasPhase() bool { + _, ok := o.GetPhaseOk() + return ok +} + +// SetPhase gets a reference to the given string and assigns it to the Phase field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CredentialsRotationState) SetPhase(v CredentialsRotationStateGetPhaseRetType) { + setCredentialsRotationStateGetPhaseAttributeType(&o.Phase, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o CredentialsRotationState) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCredentialsRotationStateGetLastCompletionTimeAttributeTypeOk(o.LastCompletionTime); ok { + toSerialize["LastCompletionTime"] = val + } + if val, ok := getCredentialsRotationStateGetLastInitiationTimeAttributeTypeOk(o.LastInitiationTime); ok { + toSerialize["LastInitiationTime"] = val + } + if val, ok := getCredentialsRotationStateGetPhaseAttributeTypeOk(o.Phase); ok { + toSerialize["Phase"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCredentialsRotationState struct { + value *CredentialsRotationState + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCredentialsRotationState) Get() *CredentialsRotationState { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCredentialsRotationState) Set(val *CredentialsRotationState) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCredentialsRotationState) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCredentialsRotationState) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCredentialsRotationState(val *CredentialsRotationState) *NullableCredentialsRotationState { + return &NullableCredentialsRotationState{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCredentialsRotationState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCredentialsRotationState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cri.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cri.go new file mode 100644 index 000000000..8a1416cdf --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_cri.go @@ -0,0 +1,272 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" +) + +// checks if the CRI type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CRI{} + +/* + types and functions for name +*/ + +// isEnum + +// CRIName the model 'CRI' +// value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CRIName string + +// List of Name +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CRINAME_DOCKER CRIName = "docker" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + CRINAME_CONTAINERD CRIName = "containerd" +) + +// All allowed values of CRI enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedCRINameEnumValues = []CRIName{ + "docker", + "containerd", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *CRIName) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson CRIName + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := CRIName(value) + for _, existing := range AllowedCRINameEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CRI", value) +} + +// NewCRINameFromValue returns a pointer to a valid CRIName +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCRINameFromValue(v CRIName) (*CRIName, error) { + ev := CRIName(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CRIName: valid values are %v", v, AllowedCRINameEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v CRIName) IsValid() bool { + for _, existing := range AllowedCRINameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NameName value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v CRIName) Ptr() *CRIName { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCRIName struct { + value *CRIName + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCRIName) Get() *CRIName { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCRIName) Set(val *CRIName) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCRIName) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCRIName) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCRIName(val *CRIName) *NullableCRIName { + return &NullableCRIName{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCRIName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCRIName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CRIGetNameAttributeType = *CRIName + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CRIGetNameArgType = CRIName + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CRIGetNameRetType = CRIName + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getCRIGetNameAttributeTypeOk(arg CRIGetNameAttributeType) (ret CRIGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setCRIGetNameAttributeType(arg *CRIGetNameAttributeType, val CRIGetNameRetType) { + *arg = &val +} + +// CRI struct for CRI +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type CRI struct { + Name CRIGetNameAttributeType `json:"name,omitempty"` +} + +// NewCRI instantiates a new CRI object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCRI() *CRI { + this := CRI{} + return &this +} + +// NewCRIWithDefaults instantiates a new CRI object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewCRIWithDefaults() *CRI { + this := CRI{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CRI) GetName() (res CRIGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CRI) GetNameOk() (ret CRIGetNameRetType, ok bool) { + return getCRIGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CRI) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *CRI) SetName(v CRIGetNameRetType) { + setCRIGetNameAttributeType(&o.Name, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o CRI) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCRIGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableCRI struct { + value *CRI + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCRI) Get() *CRI { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCRI) Set(val *CRI) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCRI) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCRI) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableCRI(val *CRI) *NullableCRI { + return &NullableCRI{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableCRI) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableCRI) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_dns.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_dns.go new file mode 100644 index 000000000..dd2b7af45 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_dns.go @@ -0,0 +1,209 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the DNS type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DNS{} + +/* + types and functions for enabled +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNSgetEnabledAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNSgetEnabledArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNSgetEnabledRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getDNSgetEnabledAttributeTypeOk(arg DNSgetEnabledAttributeType) (ret DNSgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setDNSgetEnabledAttributeType(arg *DNSgetEnabledAttributeType, val DNSgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for zones +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNSGetZonesAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNSGetZonesArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNSGetZonesRetType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getDNSGetZonesAttributeTypeOk(arg DNSGetZonesAttributeType) (ret DNSGetZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setDNSGetZonesAttributeType(arg *DNSGetZonesAttributeType, val DNSGetZonesRetType) { + *arg = &val +} + +// DNS struct for DNS +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type DNS struct { + // Enables the dns extension. + // REQUIRED + Enabled DNSgetEnabledAttributeType `json:"enabled" required:"true"` + // Array of domain filters for externalDNS, e.g., *.runs.onstackit.cloud. + Zones DNSGetZonesAttributeType `json:"zones,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _DNS DNS + +// NewDNS instantiates a new DNS object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewDNS(enabled DNSgetEnabledArgType) *DNS { + this := DNS{} + setDNSgetEnabledAttributeType(&this.Enabled, enabled) + return &this +} + +// NewDNSWithDefaults instantiates a new DNS object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewDNSWithDefaults() *DNS { + this := DNS{} + return &this +} + +// GetEnabled returns the Enabled field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) GetEnabled() (ret DNSgetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) GetEnabledOk() (ret DNSgetEnabledRetType, ok bool) { + return getDNSgetEnabledAttributeTypeOk(o.Enabled) +} + +// SetEnabled sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) SetEnabled(v DNSgetEnabledRetType) { + setDNSgetEnabledAttributeType(&o.Enabled, v) +} + +// GetZones returns the Zones field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) GetZones() (res DNSGetZonesRetType) { + res, _ = o.GetZonesOk() + return +} + +// GetZonesOk returns a tuple with the Zones field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) GetZonesOk() (ret DNSGetZonesRetType, ok bool) { + return getDNSGetZonesAttributeTypeOk(o.Zones) +} + +// HasZones returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) HasZones() bool { + _, ok := o.GetZonesOk() + return ok +} + +// SetZones gets a reference to the given []string and assigns it to the Zones field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *DNS) SetZones(v DNSGetZonesRetType) { + setDNSGetZonesAttributeType(&o.Zones, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o DNS) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDNSgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getDNSGetZonesAttributeTypeOk(o.Zones); ok { + toSerialize["Zones"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableDNS struct { + value *DNS + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableDNS) Get() *DNS { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableDNS) Set(val *DNS) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableDNS) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableDNS) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableDNS(val *DNS) *NullableDNS { + return &NullableDNS{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableDNS) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableDNS) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_extension.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_extension.go new file mode 100644 index 000000000..55a97b3af --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_extension.go @@ -0,0 +1,267 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Extension type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Extension{} + +/* + types and functions for acl +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetAclAttributeType = *ACL + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetAclArgType = ACL + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetAclRetType = ACL + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getExtensionGetAclAttributeTypeOk(arg ExtensionGetAclAttributeType) (ret ExtensionGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setExtensionGetAclAttributeType(arg *ExtensionGetAclAttributeType, val ExtensionGetAclRetType) { + *arg = &val +} + +/* + types and functions for dns +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetDnsAttributeType = *DNS + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetDnsArgType = DNS + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetDnsRetType = DNS + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getExtensionGetDnsAttributeTypeOk(arg ExtensionGetDnsAttributeType) (ret ExtensionGetDnsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setExtensionGetDnsAttributeType(arg *ExtensionGetDnsAttributeType, val ExtensionGetDnsRetType) { + *arg = &val +} + +/* + types and functions for observability +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetObservabilityAttributeType = *Observability + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetObservabilityArgType = Observability + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ExtensionGetObservabilityRetType = Observability + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getExtensionGetObservabilityAttributeTypeOk(arg ExtensionGetObservabilityAttributeType) (ret ExtensionGetObservabilityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setExtensionGetObservabilityAttributeType(arg *ExtensionGetObservabilityAttributeType, val ExtensionGetObservabilityRetType) { + *arg = &val +} + +// Extension struct for Extension +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Extension struct { + Acl ExtensionGetAclAttributeType `json:"acl,omitempty"` + Dns ExtensionGetDnsAttributeType `json:"dns,omitempty"` + Observability ExtensionGetObservabilityAttributeType `json:"observability,omitempty"` +} + +// NewExtension instantiates a new Extension object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewExtension() *Extension { + this := Extension{} + return &this +} + +// NewExtensionWithDefaults instantiates a new Extension object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewExtensionWithDefaults() *Extension { + this := Extension{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) GetAcl() (res ExtensionGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) GetAclOk() (ret ExtensionGetAclRetType, ok bool) { + return getExtensionGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given ACL and assigns it to the Acl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) SetAcl(v ExtensionGetAclRetType) { + setExtensionGetAclAttributeType(&o.Acl, v) +} + +// GetDns returns the Dns field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) GetDns() (res ExtensionGetDnsRetType) { + res, _ = o.GetDnsOk() + return +} + +// GetDnsOk returns a tuple with the Dns field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) GetDnsOk() (ret ExtensionGetDnsRetType, ok bool) { + return getExtensionGetDnsAttributeTypeOk(o.Dns) +} + +// HasDns returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) HasDns() bool { + _, ok := o.GetDnsOk() + return ok +} + +// SetDns gets a reference to the given DNS and assigns it to the Dns field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) SetDns(v ExtensionGetDnsRetType) { + setExtensionGetDnsAttributeType(&o.Dns, v) +} + +// GetObservability returns the Observability field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) GetObservability() (res ExtensionGetObservabilityRetType) { + res, _ = o.GetObservabilityOk() + return +} + +// GetObservabilityOk returns a tuple with the Observability field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) GetObservabilityOk() (ret ExtensionGetObservabilityRetType, ok bool) { + return getExtensionGetObservabilityAttributeTypeOk(o.Observability) +} + +// HasObservability returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) HasObservability() bool { + _, ok := o.GetObservabilityOk() + return ok +} + +// SetObservability gets a reference to the given Observability and assigns it to the Observability field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Extension) SetObservability(v ExtensionGetObservabilityRetType) { + setExtensionGetObservabilityAttributeType(&o.Observability, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Extension) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getExtensionGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getExtensionGetDnsAttributeTypeOk(o.Dns); ok { + toSerialize["Dns"] = val + } + if val, ok := getExtensionGetObservabilityAttributeTypeOk(o.Observability); ok { + toSerialize["Observability"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableExtension struct { + value *Extension + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableExtension) Get() *Extension { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableExtension) Set(val *Extension) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableExtension) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableExtension) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableExtension(val *Extension) *NullableExtension { + return &NullableExtension{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableExtension) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableExtension) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_get_provider_options_request_version_state.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_get_provider_options_request_version_state.go new file mode 100644 index 000000000..68fe3395a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_get_provider_options_request_version_state.go @@ -0,0 +1,129 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" +) + +// GetProviderOptionsRequestVersionState the model 'GetProviderOptionsRequestVersionState' +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type GetProviderOptionsRequestVersionState string + +// List of GetProviderOptionsRequestVersionState +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + GETPROVIDEROPTIONSREQUESTVERSIONSTATE_SUPPORTED GetProviderOptionsRequestVersionState = "SUPPORTED" +) + +// All allowed values of GetProviderOptionsRequestVersionState enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedGetProviderOptionsRequestVersionStateEnumValues = []GetProviderOptionsRequestVersionState{ + "SUPPORTED", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *GetProviderOptionsRequestVersionState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GetProviderOptionsRequestVersionState(value) + for _, existing := range AllowedGetProviderOptionsRequestVersionStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetProviderOptionsRequestVersionState", value) +} + +// NewGetProviderOptionsRequestVersionStateFromValue returns a pointer to a valid GetProviderOptionsRequestVersionState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewGetProviderOptionsRequestVersionStateFromValue(v string) (*GetProviderOptionsRequestVersionState, error) { + ev := GetProviderOptionsRequestVersionState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetProviderOptionsRequestVersionState: valid values are %v", v, AllowedGetProviderOptionsRequestVersionStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v GetProviderOptionsRequestVersionState) IsValid() bool { + for _, existing := range AllowedGetProviderOptionsRequestVersionStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetProviderOptionsRequestVersionState value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v GetProviderOptionsRequestVersionState) Ptr() *GetProviderOptionsRequestVersionState { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableGetProviderOptionsRequestVersionState struct { + value *GetProviderOptionsRequestVersionState + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableGetProviderOptionsRequestVersionState) Get() *GetProviderOptionsRequestVersionState { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableGetProviderOptionsRequestVersionState) Set(val *GetProviderOptionsRequestVersionState) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableGetProviderOptionsRequestVersionState) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableGetProviderOptionsRequestVersionState) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableGetProviderOptionsRequestVersionState(val *GetProviderOptionsRequestVersionState) *NullableGetProviderOptionsRequestVersionState { + return &NullableGetProviderOptionsRequestVersionState{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableGetProviderOptionsRequestVersionState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableGetProviderOptionsRequestVersionState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_hibernation.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_hibernation.go new file mode 100644 index 000000000..644734594 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_hibernation.go @@ -0,0 +1,149 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Hibernation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Hibernation{} + +/* + types and functions for schedules +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationGetSchedulesAttributeType = *[]HibernationSchedule + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationGetSchedulesArgType = []HibernationSchedule + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationGetSchedulesRetType = []HibernationSchedule + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getHibernationGetSchedulesAttributeTypeOk(arg HibernationGetSchedulesAttributeType) (ret HibernationGetSchedulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setHibernationGetSchedulesAttributeType(arg *HibernationGetSchedulesAttributeType, val HibernationGetSchedulesRetType) { + *arg = &val +} + +// Hibernation struct for Hibernation +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Hibernation struct { + // REQUIRED + Schedules HibernationGetSchedulesAttributeType `json:"schedules" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Hibernation Hibernation + +// NewHibernation instantiates a new Hibernation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewHibernation(schedules HibernationGetSchedulesArgType) *Hibernation { + this := Hibernation{} + setHibernationGetSchedulesAttributeType(&this.Schedules, schedules) + return &this +} + +// NewHibernationWithDefaults instantiates a new Hibernation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewHibernationWithDefaults() *Hibernation { + this := Hibernation{} + return &this +} + +// GetSchedules returns the Schedules field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Hibernation) GetSchedules() (ret HibernationGetSchedulesRetType) { + ret, _ = o.GetSchedulesOk() + return ret +} + +// GetSchedulesOk returns a tuple with the Schedules field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Hibernation) GetSchedulesOk() (ret HibernationGetSchedulesRetType, ok bool) { + return getHibernationGetSchedulesAttributeTypeOk(o.Schedules) +} + +// SetSchedules sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Hibernation) SetSchedules(v HibernationGetSchedulesRetType) { + setHibernationGetSchedulesAttributeType(&o.Schedules, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Hibernation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHibernationGetSchedulesAttributeTypeOk(o.Schedules); ok { + toSerialize["Schedules"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableHibernation struct { + value *Hibernation + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableHibernation) Get() *Hibernation { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableHibernation) Set(val *Hibernation) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableHibernation) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableHibernation) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableHibernation(val *Hibernation) *NullableHibernation { + return &NullableHibernation{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableHibernation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableHibernation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_hibernation_schedule.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_hibernation_schedule.go new file mode 100644 index 000000000..777e7e5a7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_hibernation_schedule.go @@ -0,0 +1,260 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the HibernationSchedule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HibernationSchedule{} + +/* + types and functions for end +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetEndAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getHibernationScheduleGetEndAttributeTypeOk(arg HibernationScheduleGetEndAttributeType) (ret HibernationScheduleGetEndRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setHibernationScheduleGetEndAttributeType(arg *HibernationScheduleGetEndAttributeType, val HibernationScheduleGetEndRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetEndArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetEndRetType = string + +/* + types and functions for start +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetStartAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getHibernationScheduleGetStartAttributeTypeOk(arg HibernationScheduleGetStartAttributeType) (ret HibernationScheduleGetStartRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setHibernationScheduleGetStartAttributeType(arg *HibernationScheduleGetStartAttributeType, val HibernationScheduleGetStartRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetStartArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetStartRetType = string + +/* + types and functions for timezone +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetTimezoneAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getHibernationScheduleGetTimezoneAttributeTypeOk(arg HibernationScheduleGetTimezoneAttributeType) (ret HibernationScheduleGetTimezoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setHibernationScheduleGetTimezoneAttributeType(arg *HibernationScheduleGetTimezoneAttributeType, val HibernationScheduleGetTimezoneRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetTimezoneArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationScheduleGetTimezoneRetType = string + +// HibernationSchedule struct for HibernationSchedule +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type HibernationSchedule struct { + // REQUIRED + End HibernationScheduleGetEndAttributeType `json:"end" required:"true"` + // REQUIRED + Start HibernationScheduleGetStartAttributeType `json:"start" required:"true"` + Timezone HibernationScheduleGetTimezoneAttributeType `json:"timezone,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _HibernationSchedule HibernationSchedule + +// NewHibernationSchedule instantiates a new HibernationSchedule object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewHibernationSchedule(end HibernationScheduleGetEndArgType, start HibernationScheduleGetStartArgType) *HibernationSchedule { + this := HibernationSchedule{} + setHibernationScheduleGetEndAttributeType(&this.End, end) + setHibernationScheduleGetStartAttributeType(&this.Start, start) + return &this +} + +// NewHibernationScheduleWithDefaults instantiates a new HibernationSchedule object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewHibernationScheduleWithDefaults() *HibernationSchedule { + this := HibernationSchedule{} + return &this +} + +// GetEnd returns the End field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) GetEnd() (ret HibernationScheduleGetEndRetType) { + ret, _ = o.GetEndOk() + return ret +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) GetEndOk() (ret HibernationScheduleGetEndRetType, ok bool) { + return getHibernationScheduleGetEndAttributeTypeOk(o.End) +} + +// SetEnd sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) SetEnd(v HibernationScheduleGetEndRetType) { + setHibernationScheduleGetEndAttributeType(&o.End, v) +} + +// GetStart returns the Start field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) GetStart() (ret HibernationScheduleGetStartRetType) { + ret, _ = o.GetStartOk() + return ret +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) GetStartOk() (ret HibernationScheduleGetStartRetType, ok bool) { + return getHibernationScheduleGetStartAttributeTypeOk(o.Start) +} + +// SetStart sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) SetStart(v HibernationScheduleGetStartRetType) { + setHibernationScheduleGetStartAttributeType(&o.Start, v) +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) GetTimezone() (res HibernationScheduleGetTimezoneRetType) { + res, _ = o.GetTimezoneOk() + return +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) GetTimezoneOk() (ret HibernationScheduleGetTimezoneRetType, ok bool) { + return getHibernationScheduleGetTimezoneAttributeTypeOk(o.Timezone) +} + +// HasTimezone returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) HasTimezone() bool { + _, ok := o.GetTimezoneOk() + return ok +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *HibernationSchedule) SetTimezone(v HibernationScheduleGetTimezoneRetType) { + setHibernationScheduleGetTimezoneAttributeType(&o.Timezone, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o HibernationSchedule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHibernationScheduleGetEndAttributeTypeOk(o.End); ok { + toSerialize["End"] = val + } + if val, ok := getHibernationScheduleGetStartAttributeTypeOk(o.Start); ok { + toSerialize["Start"] = val + } + if val, ok := getHibernationScheduleGetTimezoneAttributeTypeOk(o.Timezone); ok { + toSerialize["Timezone"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableHibernationSchedule struct { + value *HibernationSchedule + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableHibernationSchedule) Get() *HibernationSchedule { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableHibernationSchedule) Set(val *HibernationSchedule) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableHibernationSchedule) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableHibernationSchedule) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableHibernationSchedule(val *HibernationSchedule) *NullableHibernationSchedule { + return &NullableHibernationSchedule{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableHibernationSchedule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableHibernationSchedule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_idp.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_idp.go new file mode 100644 index 000000000..9cdb6ba72 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_idp.go @@ -0,0 +1,204 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the IDP type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IDP{} + +/* + types and functions for enabled +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPgetEnabledAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPgetEnabledArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPgetEnabledRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIDPgetEnabledAttributeTypeOk(arg IDPgetEnabledAttributeType) (ret IDPgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIDPgetEnabledAttributeType(arg *IDPgetEnabledAttributeType, val IDPgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPGetTypeAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIDPGetTypeAttributeTypeOk(arg IDPGetTypeAttributeType) (ret IDPGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIDPGetTypeAttributeType(arg *IDPGetTypeAttributeType, val IDPGetTypeRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPGetTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPGetTypeRetType = string + +// IDP struct for IDP +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDP struct { + // Enable IDP integration for the cluster. + // REQUIRED + Enabled IDPgetEnabledAttributeType `json:"enabled" required:"true"` + // Possible values: `\"stackit\"` + // REQUIRED + Type IDPGetTypeAttributeType `json:"type" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _IDP IDP + +// NewIDP instantiates a new IDP object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIDP(enabled IDPgetEnabledArgType, types IDPGetTypeArgType) *IDP { + this := IDP{} + setIDPgetEnabledAttributeType(&this.Enabled, enabled) + setIDPGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewIDPWithDefaults instantiates a new IDP object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIDPWithDefaults() *IDP { + this := IDP{} + return &this +} + +// GetEnabled returns the Enabled field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDP) GetEnabled() (ret IDPgetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDP) GetEnabledOk() (ret IDPgetEnabledRetType, ok bool) { + return getIDPgetEnabledAttributeTypeOk(o.Enabled) +} + +// SetEnabled sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDP) SetEnabled(v IDPgetEnabledRetType) { + setIDPgetEnabledAttributeType(&o.Enabled, v) +} + +// GetType returns the Type field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDP) GetType() (ret IDPGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDP) GetTypeOk() (ret IDPGetTypeRetType, ok bool) { + return getIDPGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDP) SetType(v IDPGetTypeRetType) { + setIDPGetTypeAttributeType(&o.Type, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o IDP) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIDPgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getIDPGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableIDP struct { + value *IDP + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIDP) Get() *IDP { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIDP) Set(val *IDP) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIDP) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIDP) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableIDP(val *IDP) *NullableIDP { + return &NullableIDP{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIDP) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIDP) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_idp_kubeconfig.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_idp_kubeconfig.go new file mode 100644 index 000000000..da8cb2702 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_idp_kubeconfig.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the IDPKubeconfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IDPKubeconfig{} + +/* + types and functions for kubeconfig +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPKubeconfigGetKubeconfigAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIDPKubeconfigGetKubeconfigAttributeTypeOk(arg IDPKubeconfigGetKubeconfigAttributeType) (ret IDPKubeconfigGetKubeconfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIDPKubeconfigGetKubeconfigAttributeType(arg *IDPKubeconfigGetKubeconfigAttributeType, val IDPKubeconfigGetKubeconfigRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPKubeconfigGetKubeconfigArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPKubeconfigGetKubeconfigRetType = string + +// IDPKubeconfig struct for IDPKubeconfig +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IDPKubeconfig struct { + Kubeconfig IDPKubeconfigGetKubeconfigAttributeType `json:"kubeconfig,omitempty"` +} + +// NewIDPKubeconfig instantiates a new IDPKubeconfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIDPKubeconfig() *IDPKubeconfig { + this := IDPKubeconfig{} + return &this +} + +// NewIDPKubeconfigWithDefaults instantiates a new IDPKubeconfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIDPKubeconfigWithDefaults() *IDPKubeconfig { + this := IDPKubeconfig{} + return &this +} + +// GetKubeconfig returns the Kubeconfig field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDPKubeconfig) GetKubeconfig() (res IDPKubeconfigGetKubeconfigRetType) { + res, _ = o.GetKubeconfigOk() + return +} + +// GetKubeconfigOk returns a tuple with the Kubeconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDPKubeconfig) GetKubeconfigOk() (ret IDPKubeconfigGetKubeconfigRetType, ok bool) { + return getIDPKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig) +} + +// HasKubeconfig returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDPKubeconfig) HasKubeconfig() bool { + _, ok := o.GetKubeconfigOk() + return ok +} + +// SetKubeconfig gets a reference to the given string and assigns it to the Kubeconfig field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IDPKubeconfig) SetKubeconfig(v IDPKubeconfigGetKubeconfigRetType) { + setIDPKubeconfigGetKubeconfigAttributeType(&o.Kubeconfig, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o IDPKubeconfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIDPKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig); ok { + toSerialize["Kubeconfig"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableIDPKubeconfig struct { + value *IDPKubeconfig + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIDPKubeconfig) Get() *IDPKubeconfig { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIDPKubeconfig) Set(val *IDPKubeconfig) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIDPKubeconfig) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIDPKubeconfig) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableIDPKubeconfig(val *IDPKubeconfig) *NullableIDPKubeconfig { + return &NullableIDPKubeconfig{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIDPKubeconfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIDPKubeconfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_image.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_image.go new file mode 100644 index 000000000..ce10da7de --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_image.go @@ -0,0 +1,202 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Image type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Image{} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ImageGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getImageGetNameAttributeTypeOk(arg ImageGetNameAttributeType) (ret ImageGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setImageGetNameAttributeType(arg *ImageGetNameAttributeType, val ImageGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ImageGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ImageGetNameRetType = string + +/* + types and functions for version +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ImageGetVersionAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getImageGetVersionAttributeTypeOk(arg ImageGetVersionAttributeType) (ret ImageGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setImageGetVersionAttributeType(arg *ImageGetVersionAttributeType, val ImageGetVersionRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ImageGetVersionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ImageGetVersionRetType = string + +// Image For valid names and versions please take a look at [provider-options](#tag/ProviderOptions/operation/SkeService_GetProviderOptions) `machineImages`. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Image struct { + // REQUIRED + Name ImageGetNameAttributeType `json:"name" required:"true"` + // REQUIRED + Version ImageGetVersionAttributeType `json:"version" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Image Image + +// NewImage instantiates a new Image object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewImage(name ImageGetNameArgType, version ImageGetVersionArgType) *Image { + this := Image{} + setImageGetNameAttributeType(&this.Name, name) + setImageGetVersionAttributeType(&this.Version, version) + return &this +} + +// NewImageWithDefaults instantiates a new Image object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewImageWithDefaults() *Image { + this := Image{} + return &this +} + +// GetName returns the Name field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Image) GetName() (ret ImageGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Image) GetNameOk() (ret ImageGetNameRetType, ok bool) { + return getImageGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Image) SetName(v ImageGetNameRetType) { + setImageGetNameAttributeType(&o.Name, v) +} + +// GetVersion returns the Version field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Image) GetVersion() (ret ImageGetVersionRetType) { + ret, _ = o.GetVersionOk() + return ret +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Image) GetVersionOk() (ret ImageGetVersionRetType, ok bool) { + return getImageGetVersionAttributeTypeOk(o.Version) +} + +// SetVersion sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Image) SetVersion(v ImageGetVersionRetType) { + setImageGetVersionAttributeType(&o.Version, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Image) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getImageGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableImage struct { + value *Image + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableImage) Get() *Image { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableImage) Set(val *Image) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableImage) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableImage) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableImage(val *Image) *NullableImage { + return &NullableImage{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubeconfig.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubeconfig.go new file mode 100644 index 000000000..f62091853 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubeconfig.go @@ -0,0 +1,210 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "time" +) + +// checks if the Kubeconfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Kubeconfig{} + +/* + types and functions for expirationTimestamp +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubeconfigGetExpirationTimestampAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubeconfigGetExpirationTimestampArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubeconfigGetExpirationTimestampRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubeconfigGetExpirationTimestampAttributeTypeOk(arg KubeconfigGetExpirationTimestampAttributeType) (ret KubeconfigGetExpirationTimestampRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubeconfigGetExpirationTimestampAttributeType(arg *KubeconfigGetExpirationTimestampAttributeType, val KubeconfigGetExpirationTimestampRetType) { + *arg = &val +} + +/* + types and functions for kubeconfig +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubeconfigGetKubeconfigAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubeconfigGetKubeconfigAttributeTypeOk(arg KubeconfigGetKubeconfigAttributeType) (ret KubeconfigGetKubeconfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubeconfigGetKubeconfigAttributeType(arg *KubeconfigGetKubeconfigAttributeType, val KubeconfigGetKubeconfigRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubeconfigGetKubeconfigArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubeconfigGetKubeconfigRetType = string + +// Kubeconfig struct for Kubeconfig +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Kubeconfig struct { + ExpirationTimestamp KubeconfigGetExpirationTimestampAttributeType `json:"expirationTimestamp,omitempty"` + Kubeconfig KubeconfigGetKubeconfigAttributeType `json:"kubeconfig,omitempty"` +} + +// NewKubeconfig instantiates a new Kubeconfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewKubeconfig() *Kubeconfig { + this := Kubeconfig{} + return &this +} + +// NewKubeconfigWithDefaults instantiates a new Kubeconfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewKubeconfigWithDefaults() *Kubeconfig { + this := Kubeconfig{} + return &this +} + +// GetExpirationTimestamp returns the ExpirationTimestamp field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) GetExpirationTimestamp() (res KubeconfigGetExpirationTimestampRetType) { + res, _ = o.GetExpirationTimestampOk() + return +} + +// GetExpirationTimestampOk returns a tuple with the ExpirationTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) GetExpirationTimestampOk() (ret KubeconfigGetExpirationTimestampRetType, ok bool) { + return getKubeconfigGetExpirationTimestampAttributeTypeOk(o.ExpirationTimestamp) +} + +// HasExpirationTimestamp returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) HasExpirationTimestamp() bool { + _, ok := o.GetExpirationTimestampOk() + return ok +} + +// SetExpirationTimestamp gets a reference to the given time.Time and assigns it to the ExpirationTimestamp field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) SetExpirationTimestamp(v KubeconfigGetExpirationTimestampRetType) { + setKubeconfigGetExpirationTimestampAttributeType(&o.ExpirationTimestamp, v) +} + +// GetKubeconfig returns the Kubeconfig field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) GetKubeconfig() (res KubeconfigGetKubeconfigRetType) { + res, _ = o.GetKubeconfigOk() + return +} + +// GetKubeconfigOk returns a tuple with the Kubeconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) GetKubeconfigOk() (ret KubeconfigGetKubeconfigRetType, ok bool) { + return getKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig) +} + +// HasKubeconfig returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) HasKubeconfig() bool { + _, ok := o.GetKubeconfigOk() + return ok +} + +// SetKubeconfig gets a reference to the given string and assigns it to the Kubeconfig field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubeconfig) SetKubeconfig(v KubeconfigGetKubeconfigRetType) { + setKubeconfigGetKubeconfigAttributeType(&o.Kubeconfig, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Kubeconfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKubeconfigGetExpirationTimestampAttributeTypeOk(o.ExpirationTimestamp); ok { + toSerialize["ExpirationTimestamp"] = val + } + if val, ok := getKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig); ok { + toSerialize["Kubeconfig"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableKubeconfig struct { + value *Kubeconfig + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubeconfig) Get() *Kubeconfig { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubeconfig) Set(val *Kubeconfig) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubeconfig) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubeconfig) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableKubeconfig(val *Kubeconfig) *NullableKubeconfig { + return &NullableKubeconfig{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubeconfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubeconfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubernetes.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubernetes.go new file mode 100644 index 000000000..5a70c3a77 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubernetes.go @@ -0,0 +1,149 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Kubernetes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Kubernetes{} + +/* + types and functions for version +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesGetVersionAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubernetesGetVersionAttributeTypeOk(arg KubernetesGetVersionAttributeType) (ret KubernetesGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubernetesGetVersionAttributeType(arg *KubernetesGetVersionAttributeType, val KubernetesGetVersionRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesGetVersionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesGetVersionRetType = string + +// Kubernetes For valid versions please take a look at [provider-options](#tag/ProviderOptions/operation/SkeService_GetProviderOptions) `kubernetesVersions`. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Kubernetes struct { + // REQUIRED + Version KubernetesGetVersionAttributeType `json:"version" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Kubernetes Kubernetes + +// NewKubernetes instantiates a new Kubernetes object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewKubernetes(version KubernetesGetVersionArgType) *Kubernetes { + this := Kubernetes{} + setKubernetesGetVersionAttributeType(&this.Version, version) + return &this +} + +// NewKubernetesWithDefaults instantiates a new Kubernetes object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewKubernetesWithDefaults() *Kubernetes { + this := Kubernetes{} + return &this +} + +// GetVersion returns the Version field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubernetes) GetVersion() (ret KubernetesGetVersionRetType) { + ret, _ = o.GetVersionOk() + return ret +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubernetes) GetVersionOk() (ret KubernetesGetVersionRetType, ok bool) { + return getKubernetesGetVersionAttributeTypeOk(o.Version) +} + +// SetVersion sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Kubernetes) SetVersion(v KubernetesGetVersionRetType) { + setKubernetesGetVersionAttributeType(&o.Version, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Kubernetes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKubernetesGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableKubernetes struct { + value *Kubernetes + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubernetes) Get() *Kubernetes { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubernetes) Set(val *Kubernetes) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubernetes) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubernetes) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableKubernetes(val *Kubernetes) *NullableKubernetes { + return &NullableKubernetes{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubernetes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubernetes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubernetes_version.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubernetes_version.go new file mode 100644 index 000000000..94d3d4431 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_kubernetes_version.go @@ -0,0 +1,326 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "time" +) + +// checks if the KubernetesVersion type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesVersion{} + +/* + types and functions for expirationDate +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetExpirationDateAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetExpirationDateArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetExpirationDateRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubernetesVersionGetExpirationDateAttributeTypeOk(arg KubernetesVersionGetExpirationDateAttributeType) (ret KubernetesVersionGetExpirationDateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubernetesVersionGetExpirationDateAttributeType(arg *KubernetesVersionGetExpirationDateAttributeType, val KubernetesVersionGetExpirationDateRetType) { + *arg = &val +} + +/* + types and functions for featureGates +*/ + +// isContainer +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetFeatureGatesAttributeType = *map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetFeatureGatesArgType = map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetFeatureGatesRetType = map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubernetesVersionGetFeatureGatesAttributeTypeOk(arg KubernetesVersionGetFeatureGatesAttributeType) (ret KubernetesVersionGetFeatureGatesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubernetesVersionGetFeatureGatesAttributeType(arg *KubernetesVersionGetFeatureGatesAttributeType, val KubernetesVersionGetFeatureGatesRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetStateAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubernetesVersionGetStateAttributeTypeOk(arg KubernetesVersionGetStateAttributeType) (ret KubernetesVersionGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubernetesVersionGetStateAttributeType(arg *KubernetesVersionGetStateAttributeType, val KubernetesVersionGetStateRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetStateArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetStateRetType = string + +/* + types and functions for version +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetVersionAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getKubernetesVersionGetVersionAttributeTypeOk(arg KubernetesVersionGetVersionAttributeType) (ret KubernetesVersionGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setKubernetesVersionGetVersionAttributeType(arg *KubernetesVersionGetVersionAttributeType, val KubernetesVersionGetVersionRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetVersionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersionGetVersionRetType = string + +// KubernetesVersion struct for KubernetesVersion +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type KubernetesVersion struct { + ExpirationDate KubernetesVersionGetExpirationDateAttributeType `json:"expirationDate,omitempty"` + FeatureGates KubernetesVersionGetFeatureGatesAttributeType `json:"featureGates,omitempty"` + State KubernetesVersionGetStateAttributeType `json:"state,omitempty"` + Version KubernetesVersionGetVersionAttributeType `json:"version,omitempty"` +} + +// NewKubernetesVersion instantiates a new KubernetesVersion object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewKubernetesVersion() *KubernetesVersion { + this := KubernetesVersion{} + return &this +} + +// NewKubernetesVersionWithDefaults instantiates a new KubernetesVersion object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewKubernetesVersionWithDefaults() *KubernetesVersion { + this := KubernetesVersion{} + return &this +} + +// GetExpirationDate returns the ExpirationDate field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetExpirationDate() (res KubernetesVersionGetExpirationDateRetType) { + res, _ = o.GetExpirationDateOk() + return +} + +// GetExpirationDateOk returns a tuple with the ExpirationDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetExpirationDateOk() (ret KubernetesVersionGetExpirationDateRetType, ok bool) { + return getKubernetesVersionGetExpirationDateAttributeTypeOk(o.ExpirationDate) +} + +// HasExpirationDate returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) HasExpirationDate() bool { + _, ok := o.GetExpirationDateOk() + return ok +} + +// SetExpirationDate gets a reference to the given time.Time and assigns it to the ExpirationDate field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) SetExpirationDate(v KubernetesVersionGetExpirationDateRetType) { + setKubernetesVersionGetExpirationDateAttributeType(&o.ExpirationDate, v) +} + +// GetFeatureGates returns the FeatureGates field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetFeatureGates() (res KubernetesVersionGetFeatureGatesRetType) { + res, _ = o.GetFeatureGatesOk() + return +} + +// GetFeatureGatesOk returns a tuple with the FeatureGates field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetFeatureGatesOk() (ret KubernetesVersionGetFeatureGatesRetType, ok bool) { + return getKubernetesVersionGetFeatureGatesAttributeTypeOk(o.FeatureGates) +} + +// HasFeatureGates returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) HasFeatureGates() bool { + _, ok := o.GetFeatureGatesOk() + return ok +} + +// SetFeatureGates gets a reference to the given map[string]string and assigns it to the FeatureGates field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) SetFeatureGates(v KubernetesVersionGetFeatureGatesRetType) { + setKubernetesVersionGetFeatureGatesAttributeType(&o.FeatureGates, v) +} + +// GetState returns the State field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetState() (res KubernetesVersionGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetStateOk() (ret KubernetesVersionGetStateRetType, ok bool) { + return getKubernetesVersionGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) SetState(v KubernetesVersionGetStateRetType) { + setKubernetesVersionGetStateAttributeType(&o.State, v) +} + +// GetVersion returns the Version field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetVersion() (res KubernetesVersionGetVersionRetType) { + res, _ = o.GetVersionOk() + return +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) GetVersionOk() (ret KubernetesVersionGetVersionRetType, ok bool) { + return getKubernetesVersionGetVersionAttributeTypeOk(o.Version) +} + +// HasVersion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) HasVersion() bool { + _, ok := o.GetVersionOk() + return ok +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *KubernetesVersion) SetVersion(v KubernetesVersionGetVersionRetType) { + setKubernetesVersionGetVersionAttributeType(&o.Version, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o KubernetesVersion) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKubernetesVersionGetExpirationDateAttributeTypeOk(o.ExpirationDate); ok { + toSerialize["ExpirationDate"] = val + } + if val, ok := getKubernetesVersionGetFeatureGatesAttributeTypeOk(o.FeatureGates); ok { + toSerialize["FeatureGates"] = val + } + if val, ok := getKubernetesVersionGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getKubernetesVersionGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableKubernetesVersion struct { + value *KubernetesVersion + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubernetesVersion) Get() *KubernetesVersion { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubernetesVersion) Set(val *KubernetesVersion) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubernetesVersion) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubernetesVersion) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableKubernetesVersion(val *KubernetesVersion) *NullableKubernetesVersion { + return &NullableKubernetesVersion{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableKubernetesVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableKubernetesVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_list_clusters_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_list_clusters_response.go new file mode 100644 index 000000000..d69c9756a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_list_clusters_response.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the ListClustersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListClustersResponse{} + +/* + types and functions for items +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListClustersResponseGetItemsAttributeType = *[]Cluster + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListClustersResponseGetItemsArgType = []Cluster + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListClustersResponseGetItemsRetType = []Cluster + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getListClustersResponseGetItemsAttributeTypeOk(arg ListClustersResponseGetItemsAttributeType) (ret ListClustersResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setListClustersResponseGetItemsAttributeType(arg *ListClustersResponseGetItemsAttributeType, val ListClustersResponseGetItemsRetType) { + *arg = &val +} + +// ListClustersResponse struct for ListClustersResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ListClustersResponse struct { + Items ListClustersResponseGetItemsAttributeType `json:"items,omitempty"` +} + +// NewListClustersResponse instantiates a new ListClustersResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewListClustersResponse() *ListClustersResponse { + this := ListClustersResponse{} + return &this +} + +// NewListClustersResponseWithDefaults instantiates a new ListClustersResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewListClustersResponseWithDefaults() *ListClustersResponse { + this := ListClustersResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListClustersResponse) GetItems() (res ListClustersResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListClustersResponse) GetItemsOk() (ret ListClustersResponseGetItemsRetType, ok bool) { + return getListClustersResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListClustersResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []Cluster and assigns it to the Items field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ListClustersResponse) SetItems(v ListClustersResponseGetItemsRetType) { + setListClustersResponseGetItemsAttributeType(&o.Items, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o ListClustersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListClustersResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableListClustersResponse struct { + value *ListClustersResponse + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableListClustersResponse) Get() *ListClustersResponse { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableListClustersResponse) Set(val *ListClustersResponse) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableListClustersResponse) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableListClustersResponse) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableListClustersResponse(val *ListClustersResponse) *NullableListClustersResponse { + return &NullableListClustersResponse{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableListClustersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableListClustersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_login_kubeconfig.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_login_kubeconfig.go new file mode 100644 index 000000000..ec0cc37ed --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_login_kubeconfig.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the LoginKubeconfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoginKubeconfig{} + +/* + types and functions for kubeconfig +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type LoginKubeconfigGetKubeconfigAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getLoginKubeconfigGetKubeconfigAttributeTypeOk(arg LoginKubeconfigGetKubeconfigAttributeType) (ret LoginKubeconfigGetKubeconfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setLoginKubeconfigGetKubeconfigAttributeType(arg *LoginKubeconfigGetKubeconfigAttributeType, val LoginKubeconfigGetKubeconfigRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type LoginKubeconfigGetKubeconfigArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type LoginKubeconfigGetKubeconfigRetType = string + +// LoginKubeconfig struct for LoginKubeconfig +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type LoginKubeconfig struct { + Kubeconfig LoginKubeconfigGetKubeconfigAttributeType `json:"kubeconfig,omitempty"` +} + +// NewLoginKubeconfig instantiates a new LoginKubeconfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewLoginKubeconfig() *LoginKubeconfig { + this := LoginKubeconfig{} + return &this +} + +// NewLoginKubeconfigWithDefaults instantiates a new LoginKubeconfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewLoginKubeconfigWithDefaults() *LoginKubeconfig { + this := LoginKubeconfig{} + return &this +} + +// GetKubeconfig returns the Kubeconfig field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *LoginKubeconfig) GetKubeconfig() (res LoginKubeconfigGetKubeconfigRetType) { + res, _ = o.GetKubeconfigOk() + return +} + +// GetKubeconfigOk returns a tuple with the Kubeconfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *LoginKubeconfig) GetKubeconfigOk() (ret LoginKubeconfigGetKubeconfigRetType, ok bool) { + return getLoginKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig) +} + +// HasKubeconfig returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *LoginKubeconfig) HasKubeconfig() bool { + _, ok := o.GetKubeconfigOk() + return ok +} + +// SetKubeconfig gets a reference to the given string and assigns it to the Kubeconfig field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *LoginKubeconfig) SetKubeconfig(v LoginKubeconfigGetKubeconfigRetType) { + setLoginKubeconfigGetKubeconfigAttributeType(&o.Kubeconfig, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o LoginKubeconfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoginKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig); ok { + toSerialize["Kubeconfig"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableLoginKubeconfig struct { + value *LoginKubeconfig + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableLoginKubeconfig) Get() *LoginKubeconfig { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableLoginKubeconfig) Set(val *LoginKubeconfig) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableLoginKubeconfig) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableLoginKubeconfig) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableLoginKubeconfig(val *LoginKubeconfig) *NullableLoginKubeconfig { + return &NullableLoginKubeconfig{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableLoginKubeconfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableLoginKubeconfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine.go new file mode 100644 index 000000000..20645e837 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine.go @@ -0,0 +1,203 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Machine type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Machine{} + +/* + types and functions for image +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineGetImageAttributeType = *Image + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineGetImageArgType = Image + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineGetImageRetType = Image + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineGetImageAttributeTypeOk(arg MachineGetImageAttributeType) (ret MachineGetImageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineGetImageAttributeType(arg *MachineGetImageAttributeType, val MachineGetImageRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineGetTypeAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineGetTypeAttributeTypeOk(arg MachineGetTypeAttributeType) (ret MachineGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineGetTypeAttributeType(arg *MachineGetTypeAttributeType, val MachineGetTypeRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineGetTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineGetTypeRetType = string + +// Machine struct for Machine +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Machine struct { + // REQUIRED + Image MachineGetImageAttributeType `json:"image" required:"true"` + // For valid types please take a look at [provider-options](#tag/ProviderOptions/operation/SkeService_GetProviderOptions) `machineTypes`. + // REQUIRED + Type MachineGetTypeAttributeType `json:"type" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Machine Machine + +// NewMachine instantiates a new Machine object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachine(image MachineGetImageArgType, types MachineGetTypeArgType) *Machine { + this := Machine{} + setMachineGetImageAttributeType(&this.Image, image) + setMachineGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewMachineWithDefaults instantiates a new Machine object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineWithDefaults() *Machine { + this := Machine{} + return &this +} + +// GetImage returns the Image field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Machine) GetImage() (ret MachineGetImageRetType) { + ret, _ = o.GetImageOk() + return ret +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Machine) GetImageOk() (ret MachineGetImageRetType, ok bool) { + return getMachineGetImageAttributeTypeOk(o.Image) +} + +// SetImage sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Machine) SetImage(v MachineGetImageRetType) { + setMachineGetImageAttributeType(&o.Image, v) +} + +// GetType returns the Type field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Machine) GetType() (ret MachineGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Machine) GetTypeOk() (ret MachineGetTypeRetType, ok bool) { + return getMachineGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Machine) SetType(v MachineGetTypeRetType) { + setMachineGetTypeAttributeType(&o.Type, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Machine) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineGetImageAttributeTypeOk(o.Image); ok { + toSerialize["Image"] = val + } + if val, ok := getMachineGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableMachine struct { + value *Machine + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachine) Get() *Machine { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachine) Set(val *Machine) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachine) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachine) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableMachine(val *Machine) *NullableMachine { + return &NullableMachine{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachine) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachine) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_image.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_image.go new file mode 100644 index 000000000..f3199c31f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_image.go @@ -0,0 +1,209 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the MachineImage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineImage{} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineImageGetNameAttributeTypeOk(arg MachineImageGetNameAttributeType) (ret MachineImageGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineImageGetNameAttributeType(arg *MachineImageGetNameAttributeType, val MachineImageGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageGetNameRetType = string + +/* + types and functions for versions +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageGetVersionsAttributeType = *[]MachineImageVersion + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageGetVersionsArgType = []MachineImageVersion + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageGetVersionsRetType = []MachineImageVersion + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineImageGetVersionsAttributeTypeOk(arg MachineImageGetVersionsAttributeType) (ret MachineImageGetVersionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineImageGetVersionsAttributeType(arg *MachineImageGetVersionsAttributeType, val MachineImageGetVersionsRetType) { + *arg = &val +} + +// MachineImage struct for MachineImage +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImage struct { + Name MachineImageGetNameAttributeType `json:"name,omitempty"` + Versions MachineImageGetVersionsAttributeType `json:"versions,omitempty"` +} + +// NewMachineImage instantiates a new MachineImage object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineImage() *MachineImage { + this := MachineImage{} + return &this +} + +// NewMachineImageWithDefaults instantiates a new MachineImage object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineImageWithDefaults() *MachineImage { + this := MachineImage{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) GetName() (res MachineImageGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) GetNameOk() (ret MachineImageGetNameRetType, ok bool) { + return getMachineImageGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) SetName(v MachineImageGetNameRetType) { + setMachineImageGetNameAttributeType(&o.Name, v) +} + +// GetVersions returns the Versions field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) GetVersions() (res MachineImageGetVersionsRetType) { + res, _ = o.GetVersionsOk() + return +} + +// GetVersionsOk returns a tuple with the Versions field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) GetVersionsOk() (ret MachineImageGetVersionsRetType, ok bool) { + return getMachineImageGetVersionsAttributeTypeOk(o.Versions) +} + +// HasVersions returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) HasVersions() bool { + _, ok := o.GetVersionsOk() + return ok +} + +// SetVersions gets a reference to the given []MachineImageVersion and assigns it to the Versions field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImage) SetVersions(v MachineImageGetVersionsRetType) { + setMachineImageGetVersionsAttributeType(&o.Versions, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o MachineImage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineImageGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getMachineImageGetVersionsAttributeTypeOk(o.Versions); ok { + toSerialize["Versions"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableMachineImage struct { + value *MachineImage + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineImage) Get() *MachineImage { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineImage) Set(val *MachineImage) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineImage) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineImage) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableMachineImage(val *MachineImage) *NullableMachineImage { + return &NullableMachineImage{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_image_version.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_image_version.go new file mode 100644 index 000000000..fd2d4d3b6 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_image_version.go @@ -0,0 +1,326 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "time" +) + +// checks if the MachineImageVersion type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineImageVersion{} + +/* + types and functions for cri +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetCriAttributeType = *[]CRI + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetCriArgType = []CRI + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetCriRetType = []CRI + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineImageVersionGetCriAttributeTypeOk(arg MachineImageVersionGetCriAttributeType) (ret MachineImageVersionGetCriRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineImageVersionGetCriAttributeType(arg *MachineImageVersionGetCriAttributeType, val MachineImageVersionGetCriRetType) { + *arg = &val +} + +/* + types and functions for expirationDate +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetExpirationDateAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetExpirationDateArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetExpirationDateRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineImageVersionGetExpirationDateAttributeTypeOk(arg MachineImageVersionGetExpirationDateAttributeType) (ret MachineImageVersionGetExpirationDateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineImageVersionGetExpirationDateAttributeType(arg *MachineImageVersionGetExpirationDateAttributeType, val MachineImageVersionGetExpirationDateRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetStateAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineImageVersionGetStateAttributeTypeOk(arg MachineImageVersionGetStateAttributeType) (ret MachineImageVersionGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineImageVersionGetStateAttributeType(arg *MachineImageVersionGetStateAttributeType, val MachineImageVersionGetStateRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetStateArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetStateRetType = string + +/* + types and functions for version +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetVersionAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineImageVersionGetVersionAttributeTypeOk(arg MachineImageVersionGetVersionAttributeType) (ret MachineImageVersionGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineImageVersionGetVersionAttributeType(arg *MachineImageVersionGetVersionAttributeType, val MachineImageVersionGetVersionRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetVersionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersionGetVersionRetType = string + +// MachineImageVersion struct for MachineImageVersion +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineImageVersion struct { + Cri MachineImageVersionGetCriAttributeType `json:"cri,omitempty"` + ExpirationDate MachineImageVersionGetExpirationDateAttributeType `json:"expirationDate,omitempty"` + State MachineImageVersionGetStateAttributeType `json:"state,omitempty"` + Version MachineImageVersionGetVersionAttributeType `json:"version,omitempty"` +} + +// NewMachineImageVersion instantiates a new MachineImageVersion object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineImageVersion() *MachineImageVersion { + this := MachineImageVersion{} + return &this +} + +// NewMachineImageVersionWithDefaults instantiates a new MachineImageVersion object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineImageVersionWithDefaults() *MachineImageVersion { + this := MachineImageVersion{} + return &this +} + +// GetCri returns the Cri field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetCri() (res MachineImageVersionGetCriRetType) { + res, _ = o.GetCriOk() + return +} + +// GetCriOk returns a tuple with the Cri field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetCriOk() (ret MachineImageVersionGetCriRetType, ok bool) { + return getMachineImageVersionGetCriAttributeTypeOk(o.Cri) +} + +// HasCri returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) HasCri() bool { + _, ok := o.GetCriOk() + return ok +} + +// SetCri gets a reference to the given []CRI and assigns it to the Cri field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) SetCri(v MachineImageVersionGetCriRetType) { + setMachineImageVersionGetCriAttributeType(&o.Cri, v) +} + +// GetExpirationDate returns the ExpirationDate field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetExpirationDate() (res MachineImageVersionGetExpirationDateRetType) { + res, _ = o.GetExpirationDateOk() + return +} + +// GetExpirationDateOk returns a tuple with the ExpirationDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetExpirationDateOk() (ret MachineImageVersionGetExpirationDateRetType, ok bool) { + return getMachineImageVersionGetExpirationDateAttributeTypeOk(o.ExpirationDate) +} + +// HasExpirationDate returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) HasExpirationDate() bool { + _, ok := o.GetExpirationDateOk() + return ok +} + +// SetExpirationDate gets a reference to the given time.Time and assigns it to the ExpirationDate field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) SetExpirationDate(v MachineImageVersionGetExpirationDateRetType) { + setMachineImageVersionGetExpirationDateAttributeType(&o.ExpirationDate, v) +} + +// GetState returns the State field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetState() (res MachineImageVersionGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetStateOk() (ret MachineImageVersionGetStateRetType, ok bool) { + return getMachineImageVersionGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) SetState(v MachineImageVersionGetStateRetType) { + setMachineImageVersionGetStateAttributeType(&o.State, v) +} + +// GetVersion returns the Version field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetVersion() (res MachineImageVersionGetVersionRetType) { + res, _ = o.GetVersionOk() + return +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) GetVersionOk() (ret MachineImageVersionGetVersionRetType, ok bool) { + return getMachineImageVersionGetVersionAttributeTypeOk(o.Version) +} + +// HasVersion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) HasVersion() bool { + _, ok := o.GetVersionOk() + return ok +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineImageVersion) SetVersion(v MachineImageVersionGetVersionRetType) { + setMachineImageVersionGetVersionAttributeType(&o.Version, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o MachineImageVersion) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineImageVersionGetCriAttributeTypeOk(o.Cri); ok { + toSerialize["Cri"] = val + } + if val, ok := getMachineImageVersionGetExpirationDateAttributeTypeOk(o.ExpirationDate); ok { + toSerialize["ExpirationDate"] = val + } + if val, ok := getMachineImageVersionGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getMachineImageVersionGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableMachineImageVersion struct { + value *MachineImageVersion + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineImageVersion) Get() *MachineImageVersion { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineImageVersion) Set(val *MachineImageVersion) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineImageVersion) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineImageVersion) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableMachineImageVersion(val *MachineImageVersion) *NullableMachineImageVersion { + return &NullableMachineImageVersion{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineImageVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineImageVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_type.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_type.go new file mode 100644 index 000000000..2e2e126a4 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_machine_type.go @@ -0,0 +1,386 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the MachineType type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineType{} + +/* + types and functions for architecture +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetArchitectureAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineTypeGetArchitectureAttributeTypeOk(arg MachineTypeGetArchitectureAttributeType) (ret MachineTypeGetArchitectureRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineTypeGetArchitectureAttributeType(arg *MachineTypeGetArchitectureAttributeType, val MachineTypeGetArchitectureRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetArchitectureArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetArchitectureRetType = string + +/* + types and functions for cpu +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetCpuAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetCpuArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetCpuRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineTypeGetCpuAttributeTypeOk(arg MachineTypeGetCpuAttributeType) (ret MachineTypeGetCpuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineTypeGetCpuAttributeType(arg *MachineTypeGetCpuAttributeType, val MachineTypeGetCpuRetType) { + *arg = &val +} + +/* + types and functions for gpu +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetGpuAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetGpuArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetGpuRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineTypeGetGpuAttributeTypeOk(arg MachineTypeGetGpuAttributeType) (ret MachineTypeGetGpuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineTypeGetGpuAttributeType(arg *MachineTypeGetGpuAttributeType, val MachineTypeGetGpuRetType) { + *arg = &val +} + +/* + types and functions for memory +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetMemoryAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetMemoryArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetMemoryRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineTypeGetMemoryAttributeTypeOk(arg MachineTypeGetMemoryAttributeType) (ret MachineTypeGetMemoryRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineTypeGetMemoryAttributeType(arg *MachineTypeGetMemoryAttributeType, val MachineTypeGetMemoryRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMachineTypeGetNameAttributeTypeOk(arg MachineTypeGetNameAttributeType) (ret MachineTypeGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMachineTypeGetNameAttributeType(arg *MachineTypeGetNameAttributeType, val MachineTypeGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineTypeGetNameRetType = string + +// MachineType struct for MachineType +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MachineType struct { + Architecture MachineTypeGetArchitectureAttributeType `json:"architecture,omitempty"` + // Can be cast to int32 without loss of precision. + Cpu MachineTypeGetCpuAttributeType `json:"cpu,omitempty"` + // Can be cast to int32 without loss of precision. + Gpu MachineTypeGetGpuAttributeType `json:"gpu,omitempty"` + // Can be cast to int32 without loss of precision. + Memory MachineTypeGetMemoryAttributeType `json:"memory,omitempty"` + Name MachineTypeGetNameAttributeType `json:"name,omitempty"` +} + +// NewMachineType instantiates a new MachineType object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineType() *MachineType { + this := MachineType{} + return &this +} + +// NewMachineTypeWithDefaults instantiates a new MachineType object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMachineTypeWithDefaults() *MachineType { + this := MachineType{} + return &this +} + +// GetArchitecture returns the Architecture field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetArchitecture() (res MachineTypeGetArchitectureRetType) { + res, _ = o.GetArchitectureOk() + return +} + +// GetArchitectureOk returns a tuple with the Architecture field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetArchitectureOk() (ret MachineTypeGetArchitectureRetType, ok bool) { + return getMachineTypeGetArchitectureAttributeTypeOk(o.Architecture) +} + +// HasArchitecture returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) HasArchitecture() bool { + _, ok := o.GetArchitectureOk() + return ok +} + +// SetArchitecture gets a reference to the given string and assigns it to the Architecture field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) SetArchitecture(v MachineTypeGetArchitectureRetType) { + setMachineTypeGetArchitectureAttributeType(&o.Architecture, v) +} + +// GetCpu returns the Cpu field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetCpu() (res MachineTypeGetCpuRetType) { + res, _ = o.GetCpuOk() + return +} + +// GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetCpuOk() (ret MachineTypeGetCpuRetType, ok bool) { + return getMachineTypeGetCpuAttributeTypeOk(o.Cpu) +} + +// HasCpu returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) HasCpu() bool { + _, ok := o.GetCpuOk() + return ok +} + +// SetCpu gets a reference to the given int64 and assigns it to the Cpu field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) SetCpu(v MachineTypeGetCpuRetType) { + setMachineTypeGetCpuAttributeType(&o.Cpu, v) +} + +// GetGpu returns the Gpu field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetGpu() (res MachineTypeGetGpuRetType) { + res, _ = o.GetGpuOk() + return +} + +// GetGpuOk returns a tuple with the Gpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetGpuOk() (ret MachineTypeGetGpuRetType, ok bool) { + return getMachineTypeGetGpuAttributeTypeOk(o.Gpu) +} + +// HasGpu returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) HasGpu() bool { + _, ok := o.GetGpuOk() + return ok +} + +// SetGpu gets a reference to the given int64 and assigns it to the Gpu field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) SetGpu(v MachineTypeGetGpuRetType) { + setMachineTypeGetGpuAttributeType(&o.Gpu, v) +} + +// GetMemory returns the Memory field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetMemory() (res MachineTypeGetMemoryRetType) { + res, _ = o.GetMemoryOk() + return +} + +// GetMemoryOk returns a tuple with the Memory field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetMemoryOk() (ret MachineTypeGetMemoryRetType, ok bool) { + return getMachineTypeGetMemoryAttributeTypeOk(o.Memory) +} + +// HasMemory returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) HasMemory() bool { + _, ok := o.GetMemoryOk() + return ok +} + +// SetMemory gets a reference to the given int64 and assigns it to the Memory field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) SetMemory(v MachineTypeGetMemoryRetType) { + setMachineTypeGetMemoryAttributeType(&o.Memory, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetName() (res MachineTypeGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) GetNameOk() (ret MachineTypeGetNameRetType, ok bool) { + return getMachineTypeGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MachineType) SetName(v MachineTypeGetNameRetType) { + setMachineTypeGetNameAttributeType(&o.Name, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o MachineType) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineTypeGetArchitectureAttributeTypeOk(o.Architecture); ok { + toSerialize["Architecture"] = val + } + if val, ok := getMachineTypeGetCpuAttributeTypeOk(o.Cpu); ok { + toSerialize["Cpu"] = val + } + if val, ok := getMachineTypeGetGpuAttributeTypeOk(o.Gpu); ok { + toSerialize["Gpu"] = val + } + if val, ok := getMachineTypeGetMemoryAttributeTypeOk(o.Memory); ok { + toSerialize["Memory"] = val + } + if val, ok := getMachineTypeGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableMachineType struct { + value *MachineType + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineType) Get() *MachineType { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineType) Set(val *MachineType) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineType) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineType) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableMachineType(val *MachineType) *NullableMachineType { + return &NullableMachineType{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMachineType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMachineType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_maintenance.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_maintenance.go new file mode 100644 index 000000000..ecaa519d4 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_maintenance.go @@ -0,0 +1,202 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Maintenance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Maintenance{} + +/* + types and functions for autoUpdate +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceGetAutoUpdateAttributeType = *MaintenanceAutoUpdate + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceGetAutoUpdateArgType = MaintenanceAutoUpdate + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceGetAutoUpdateRetType = MaintenanceAutoUpdate + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMaintenanceGetAutoUpdateAttributeTypeOk(arg MaintenanceGetAutoUpdateAttributeType) (ret MaintenanceGetAutoUpdateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMaintenanceGetAutoUpdateAttributeType(arg *MaintenanceGetAutoUpdateAttributeType, val MaintenanceGetAutoUpdateRetType) { + *arg = &val +} + +/* + types and functions for timeWindow +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceGetTimeWindowAttributeType = *TimeWindow + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceGetTimeWindowArgType = TimeWindow + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceGetTimeWindowRetType = TimeWindow + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMaintenanceGetTimeWindowAttributeTypeOk(arg MaintenanceGetTimeWindowAttributeType) (ret MaintenanceGetTimeWindowRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMaintenanceGetTimeWindowAttributeType(arg *MaintenanceGetTimeWindowAttributeType, val MaintenanceGetTimeWindowRetType) { + *arg = &val +} + +// Maintenance struct for Maintenance +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Maintenance struct { + // REQUIRED + AutoUpdate MaintenanceGetAutoUpdateAttributeType `json:"autoUpdate" required:"true"` + // REQUIRED + TimeWindow MaintenanceGetTimeWindowAttributeType `json:"timeWindow" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Maintenance Maintenance + +// NewMaintenance instantiates a new Maintenance object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMaintenance(autoUpdate MaintenanceGetAutoUpdateArgType, timeWindow MaintenanceGetTimeWindowArgType) *Maintenance { + this := Maintenance{} + setMaintenanceGetAutoUpdateAttributeType(&this.AutoUpdate, autoUpdate) + setMaintenanceGetTimeWindowAttributeType(&this.TimeWindow, timeWindow) + return &this +} + +// NewMaintenanceWithDefaults instantiates a new Maintenance object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMaintenanceWithDefaults() *Maintenance { + this := Maintenance{} + return &this +} + +// GetAutoUpdate returns the AutoUpdate field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Maintenance) GetAutoUpdate() (ret MaintenanceGetAutoUpdateRetType) { + ret, _ = o.GetAutoUpdateOk() + return ret +} + +// GetAutoUpdateOk returns a tuple with the AutoUpdate field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Maintenance) GetAutoUpdateOk() (ret MaintenanceGetAutoUpdateRetType, ok bool) { + return getMaintenanceGetAutoUpdateAttributeTypeOk(o.AutoUpdate) +} + +// SetAutoUpdate sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Maintenance) SetAutoUpdate(v MaintenanceGetAutoUpdateRetType) { + setMaintenanceGetAutoUpdateAttributeType(&o.AutoUpdate, v) +} + +// GetTimeWindow returns the TimeWindow field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Maintenance) GetTimeWindow() (ret MaintenanceGetTimeWindowRetType) { + ret, _ = o.GetTimeWindowOk() + return ret +} + +// GetTimeWindowOk returns a tuple with the TimeWindow field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Maintenance) GetTimeWindowOk() (ret MaintenanceGetTimeWindowRetType, ok bool) { + return getMaintenanceGetTimeWindowAttributeTypeOk(o.TimeWindow) +} + +// SetTimeWindow sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Maintenance) SetTimeWindow(v MaintenanceGetTimeWindowRetType) { + setMaintenanceGetTimeWindowAttributeType(&o.TimeWindow, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Maintenance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMaintenanceGetAutoUpdateAttributeTypeOk(o.AutoUpdate); ok { + toSerialize["AutoUpdate"] = val + } + if val, ok := getMaintenanceGetTimeWindowAttributeTypeOk(o.TimeWindow); ok { + toSerialize["TimeWindow"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableMaintenance struct { + value *Maintenance + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMaintenance) Get() *Maintenance { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMaintenance) Set(val *Maintenance) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMaintenance) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMaintenance) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableMaintenance(val *Maintenance) *NullableMaintenance { + return &NullableMaintenance{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMaintenance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMaintenance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_maintenance_auto_update.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_maintenance_auto_update.go new file mode 100644 index 000000000..741f5be33 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_maintenance_auto_update.go @@ -0,0 +1,209 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the MaintenanceAutoUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MaintenanceAutoUpdate{} + +/* + types and functions for kubernetesVersion +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdategetKubernetesVersionAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdategetKubernetesVersionArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdategetKubernetesVersionRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMaintenanceAutoUpdategetKubernetesVersionAttributeTypeOk(arg MaintenanceAutoUpdategetKubernetesVersionAttributeType) (ret MaintenanceAutoUpdategetKubernetesVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMaintenanceAutoUpdategetKubernetesVersionAttributeType(arg *MaintenanceAutoUpdategetKubernetesVersionAttributeType, val MaintenanceAutoUpdategetKubernetesVersionRetType) { + *arg = &val +} + +/* + types and functions for machineImageVersion +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdategetMachineImageVersionAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdategetMachineImageVersionArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdategetMachineImageVersionRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getMaintenanceAutoUpdategetMachineImageVersionAttributeTypeOk(arg MaintenanceAutoUpdategetMachineImageVersionAttributeType) (ret MaintenanceAutoUpdategetMachineImageVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setMaintenanceAutoUpdategetMachineImageVersionAttributeType(arg *MaintenanceAutoUpdategetMachineImageVersionAttributeType, val MaintenanceAutoUpdategetMachineImageVersionRetType) { + *arg = &val +} + +// MaintenanceAutoUpdate struct for MaintenanceAutoUpdate +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MaintenanceAutoUpdate struct { + KubernetesVersion MaintenanceAutoUpdategetKubernetesVersionAttributeType `json:"kubernetesVersion,omitempty"` + MachineImageVersion MaintenanceAutoUpdategetMachineImageVersionAttributeType `json:"machineImageVersion,omitempty"` +} + +// NewMaintenanceAutoUpdate instantiates a new MaintenanceAutoUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMaintenanceAutoUpdate() *MaintenanceAutoUpdate { + this := MaintenanceAutoUpdate{} + return &this +} + +// NewMaintenanceAutoUpdateWithDefaults instantiates a new MaintenanceAutoUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewMaintenanceAutoUpdateWithDefaults() *MaintenanceAutoUpdate { + this := MaintenanceAutoUpdate{} + return &this +} + +// GetKubernetesVersion returns the KubernetesVersion field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) GetKubernetesVersion() (res MaintenanceAutoUpdategetKubernetesVersionRetType) { + res, _ = o.GetKubernetesVersionOk() + return +} + +// GetKubernetesVersionOk returns a tuple with the KubernetesVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) GetKubernetesVersionOk() (ret MaintenanceAutoUpdategetKubernetesVersionRetType, ok bool) { + return getMaintenanceAutoUpdategetKubernetesVersionAttributeTypeOk(o.KubernetesVersion) +} + +// HasKubernetesVersion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) HasKubernetesVersion() bool { + _, ok := o.GetKubernetesVersionOk() + return ok +} + +// SetKubernetesVersion gets a reference to the given bool and assigns it to the KubernetesVersion field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) SetKubernetesVersion(v MaintenanceAutoUpdategetKubernetesVersionRetType) { + setMaintenanceAutoUpdategetKubernetesVersionAttributeType(&o.KubernetesVersion, v) +} + +// GetMachineImageVersion returns the MachineImageVersion field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) GetMachineImageVersion() (res MaintenanceAutoUpdategetMachineImageVersionRetType) { + res, _ = o.GetMachineImageVersionOk() + return +} + +// GetMachineImageVersionOk returns a tuple with the MachineImageVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) GetMachineImageVersionOk() (ret MaintenanceAutoUpdategetMachineImageVersionRetType, ok bool) { + return getMaintenanceAutoUpdategetMachineImageVersionAttributeTypeOk(o.MachineImageVersion) +} + +// HasMachineImageVersion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) HasMachineImageVersion() bool { + _, ok := o.GetMachineImageVersionOk() + return ok +} + +// SetMachineImageVersion gets a reference to the given bool and assigns it to the MachineImageVersion field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *MaintenanceAutoUpdate) SetMachineImageVersion(v MaintenanceAutoUpdategetMachineImageVersionRetType) { + setMaintenanceAutoUpdategetMachineImageVersionAttributeType(&o.MachineImageVersion, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o MaintenanceAutoUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMaintenanceAutoUpdategetKubernetesVersionAttributeTypeOk(o.KubernetesVersion); ok { + toSerialize["KubernetesVersion"] = val + } + if val, ok := getMaintenanceAutoUpdategetMachineImageVersionAttributeTypeOk(o.MachineImageVersion); ok { + toSerialize["MachineImageVersion"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableMaintenanceAutoUpdate struct { + value *MaintenanceAutoUpdate + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMaintenanceAutoUpdate) Get() *MaintenanceAutoUpdate { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMaintenanceAutoUpdate) Set(val *MaintenanceAutoUpdate) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMaintenanceAutoUpdate) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMaintenanceAutoUpdate) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableMaintenanceAutoUpdate(val *MaintenanceAutoUpdate) *NullableMaintenanceAutoUpdate { + return &NullableMaintenanceAutoUpdate{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableMaintenanceAutoUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableMaintenanceAutoUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_network.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_network.go new file mode 100644 index 000000000..91b96b360 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_network.go @@ -0,0 +1,209 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +/* + types and functions for controlPlane +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NetworkGetControlPlaneAttributeType = *V2ControlPlaneNetwork + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NetworkGetControlPlaneArgType = V2ControlPlaneNetwork + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NetworkGetControlPlaneRetType = V2ControlPlaneNetwork + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNetworkGetControlPlaneAttributeTypeOk(arg NetworkGetControlPlaneAttributeType) (ret NetworkGetControlPlaneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNetworkGetControlPlaneAttributeType(arg *NetworkGetControlPlaneAttributeType, val NetworkGetControlPlaneRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NetworkGetIdAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNetworkGetIdAttributeTypeOk(arg NetworkGetIdAttributeType) (ret NetworkGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNetworkGetIdAttributeType(arg *NetworkGetIdAttributeType, val NetworkGetIdRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NetworkGetIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NetworkGetIdRetType = string + +// Network struct for Network +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Network struct { + ControlPlane NetworkGetControlPlaneAttributeType `json:"controlPlane,omitempty"` + Id NetworkGetIdAttributeType `json:"id,omitempty"` +} + +// NewNetwork instantiates a new Network object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNetwork() *Network { + this := Network{} + return &this +} + +// NewNetworkWithDefaults instantiates a new Network object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNetworkWithDefaults() *Network { + this := Network{} + return &this +} + +// GetControlPlane returns the ControlPlane field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) GetControlPlane() (res NetworkGetControlPlaneRetType) { + res, _ = o.GetControlPlaneOk() + return +} + +// GetControlPlaneOk returns a tuple with the ControlPlane field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) GetControlPlaneOk() (ret NetworkGetControlPlaneRetType, ok bool) { + return getNetworkGetControlPlaneAttributeTypeOk(o.ControlPlane) +} + +// HasControlPlane returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) HasControlPlane() bool { + _, ok := o.GetControlPlaneOk() + return ok +} + +// SetControlPlane gets a reference to the given V2ControlPlaneNetwork and assigns it to the ControlPlane field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) SetControlPlane(v NetworkGetControlPlaneRetType) { + setNetworkGetControlPlaneAttributeType(&o.ControlPlane, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) GetId() (res NetworkGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) GetIdOk() (ret NetworkGetIdRetType, ok bool) { + return getNetworkGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Network) SetId(v NetworkGetIdRetType) { + setNetworkGetIdAttributeType(&o.Id, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Network) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkGetControlPlaneAttributeTypeOk(o.ControlPlane); ok { + toSerialize["ControlPlane"] = val + } + if val, ok := getNetworkGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableNetwork struct { + value *Network + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNetwork) Get() *Network { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNetwork) Set(val *Network) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNetwork) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNetwork) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableNetwork(val *Network) *NullableNetwork { + return &NullableNetwork{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_nodepool.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_nodepool.go new file mode 100644 index 000000000..5457565c8 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_nodepool.go @@ -0,0 +1,828 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Nodepool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Nodepool{} + +/* + types and functions for allowSystemComponents +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolgetAllowSystemComponentsAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolgetAllowSystemComponentsArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolgetAllowSystemComponentsRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolgetAllowSystemComponentsAttributeTypeOk(arg NodepoolgetAllowSystemComponentsAttributeType) (ret NodepoolgetAllowSystemComponentsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolgetAllowSystemComponentsAttributeType(arg *NodepoolgetAllowSystemComponentsAttributeType, val NodepoolgetAllowSystemComponentsRetType) { + *arg = &val +} + +/* + types and functions for availabilityZones +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetAvailabilityZonesAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetAvailabilityZonesArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetAvailabilityZonesRetType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetAvailabilityZonesAttributeTypeOk(arg NodepoolGetAvailabilityZonesAttributeType) (ret NodepoolGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetAvailabilityZonesAttributeType(arg *NodepoolGetAvailabilityZonesAttributeType, val NodepoolGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for cri +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetCriAttributeType = *CRI + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetCriArgType = CRI + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetCriRetType = CRI + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetCriAttributeTypeOk(arg NodepoolGetCriAttributeType) (ret NodepoolGetCriRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetCriAttributeType(arg *NodepoolGetCriAttributeType, val NodepoolGetCriRetType) { + *arg = &val +} + +/* + types and functions for kubernetes +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetKubernetesAttributeType = *NodepoolKubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetKubernetesArgType = NodepoolKubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetKubernetesRetType = NodepoolKubernetes + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetKubernetesAttributeTypeOk(arg NodepoolGetKubernetesAttributeType) (ret NodepoolGetKubernetesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetKubernetesAttributeType(arg *NodepoolGetKubernetesAttributeType, val NodepoolGetKubernetesRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetLabelsAttributeType = *map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetLabelsArgType = map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetLabelsRetType = map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetLabelsAttributeTypeOk(arg NodepoolGetLabelsAttributeType) (ret NodepoolGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetLabelsAttributeType(arg *NodepoolGetLabelsAttributeType, val NodepoolGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for machine +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMachineAttributeType = *Machine + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMachineArgType = Machine + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMachineRetType = Machine + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetMachineAttributeTypeOk(arg NodepoolGetMachineAttributeType) (ret NodepoolGetMachineRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetMachineAttributeType(arg *NodepoolGetMachineAttributeType, val NodepoolGetMachineRetType) { + *arg = &val +} + +/* + types and functions for maxSurge +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaxSurgeAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaxSurgeArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaxSurgeRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetMaxSurgeAttributeTypeOk(arg NodepoolGetMaxSurgeAttributeType) (ret NodepoolGetMaxSurgeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetMaxSurgeAttributeType(arg *NodepoolGetMaxSurgeAttributeType, val NodepoolGetMaxSurgeRetType) { + *arg = &val +} + +/* + types and functions for maxUnavailable +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaxUnavailableAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaxUnavailableArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaxUnavailableRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetMaxUnavailableAttributeTypeOk(arg NodepoolGetMaxUnavailableAttributeType) (ret NodepoolGetMaxUnavailableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetMaxUnavailableAttributeType(arg *NodepoolGetMaxUnavailableAttributeType, val NodepoolGetMaxUnavailableRetType) { + *arg = &val +} + +/* + types and functions for maximum +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaximumAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaximumArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMaximumRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetMaximumAttributeTypeOk(arg NodepoolGetMaximumAttributeType) (ret NodepoolGetMaximumRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetMaximumAttributeType(arg *NodepoolGetMaximumAttributeType, val NodepoolGetMaximumRetType) { + *arg = &val +} + +/* + types and functions for minimum +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMinimumAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMinimumArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetMinimumRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetMinimumAttributeTypeOk(arg NodepoolGetMinimumAttributeType) (ret NodepoolGetMinimumRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetMinimumAttributeType(arg *NodepoolGetMinimumAttributeType, val NodepoolGetMinimumRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetNameAttributeTypeOk(arg NodepoolGetNameAttributeType) (ret NodepoolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetNameAttributeType(arg *NodepoolGetNameAttributeType, val NodepoolGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetNameRetType = string + +/* + types and functions for taints +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetTaintsAttributeType = *[]Taint + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetTaintsArgType = []Taint + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetTaintsRetType = []Taint + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetTaintsAttributeTypeOk(arg NodepoolGetTaintsAttributeType) (ret NodepoolGetTaintsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetTaintsAttributeType(arg *NodepoolGetTaintsAttributeType, val NodepoolGetTaintsRetType) { + *arg = &val +} + +/* + types and functions for volume +*/ + +// isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetVolumeAttributeType = *Volume + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetVolumeArgType = Volume + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolGetVolumeRetType = Volume + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolGetVolumeAttributeTypeOk(arg NodepoolGetVolumeAttributeType) (ret NodepoolGetVolumeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolGetVolumeAttributeType(arg *NodepoolGetVolumeAttributeType, val NodepoolGetVolumeRetType) { + *arg = &val +} + +// Nodepool struct for Nodepool +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Nodepool struct { + // This needs to be true for at least one node pool. + AllowSystemComponents NodepoolgetAllowSystemComponentsAttributeType `json:"allowSystemComponents,omitempty"` + // REQUIRED + AvailabilityZones NodepoolGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + Cri NodepoolGetCriAttributeType `json:"cri,omitempty"` + Kubernetes NodepoolGetKubernetesAttributeType `json:"kubernetes,omitempty"` + Labels NodepoolGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Machine NodepoolGetMachineAttributeType `json:"machine" required:"true"` + // Can be cast to int32 without loss of precision. + MaxSurge NodepoolGetMaxSurgeAttributeType `json:"maxSurge,omitempty"` + // Can be cast to int32 without loss of precision. + MaxUnavailable NodepoolGetMaxUnavailableAttributeType `json:"maxUnavailable,omitempty"` + // Maximum number of nodes in the pool. During runtime, the cluster will never scale beyond 1000 nodes, even if the total maximum would allow for a larger cluster. + // Can be cast to int32 without loss of precision. + // REQUIRED + Maximum NodepoolGetMaximumAttributeType `json:"maximum" required:"true"` + // Minimum number of nodes in the pool. The sum of all minima must not exceed 1000. + // Can be cast to int32 without loss of precision. + // REQUIRED + Minimum NodepoolGetMinimumAttributeType `json:"minimum" required:"true"` + // Maximum 15 chars + // REQUIRED + Name NodepoolGetNameAttributeType `json:"name" required:"true"` + Taints NodepoolGetTaintsAttributeType `json:"taints,omitempty"` + // REQUIRED + Volume NodepoolGetVolumeAttributeType `json:"volume" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Nodepool Nodepool + +// NewNodepool instantiates a new Nodepool object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNodepool(availabilityZones NodepoolGetAvailabilityZonesArgType, machine NodepoolGetMachineArgType, maximum NodepoolGetMaximumArgType, minimum NodepoolGetMinimumArgType, name NodepoolGetNameArgType, volume NodepoolGetVolumeArgType) *Nodepool { + this := Nodepool{} + setNodepoolGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setNodepoolGetMachineAttributeType(&this.Machine, machine) + setNodepoolGetMaximumAttributeType(&this.Maximum, maximum) + setNodepoolGetMinimumAttributeType(&this.Minimum, minimum) + setNodepoolGetNameAttributeType(&this.Name, name) + setNodepoolGetVolumeAttributeType(&this.Volume, volume) + return &this +} + +// NewNodepoolWithDefaults instantiates a new Nodepool object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNodepoolWithDefaults() *Nodepool { + this := Nodepool{} + return &this +} + +// GetAllowSystemComponents returns the AllowSystemComponents field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetAllowSystemComponents() (res NodepoolgetAllowSystemComponentsRetType) { + res, _ = o.GetAllowSystemComponentsOk() + return +} + +// GetAllowSystemComponentsOk returns a tuple with the AllowSystemComponents field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetAllowSystemComponentsOk() (ret NodepoolgetAllowSystemComponentsRetType, ok bool) { + return getNodepoolgetAllowSystemComponentsAttributeTypeOk(o.AllowSystemComponents) +} + +// HasAllowSystemComponents returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasAllowSystemComponents() bool { + _, ok := o.GetAllowSystemComponentsOk() + return ok +} + +// SetAllowSystemComponents gets a reference to the given bool and assigns it to the AllowSystemComponents field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetAllowSystemComponents(v NodepoolgetAllowSystemComponentsRetType) { + setNodepoolgetAllowSystemComponentsAttributeType(&o.AllowSystemComponents, v) +} + +// GetAvailabilityZones returns the AvailabilityZones field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetAvailabilityZones() (ret NodepoolGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetAvailabilityZonesOk() (ret NodepoolGetAvailabilityZonesRetType, ok bool) { + return getNodepoolGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetAvailabilityZones(v NodepoolGetAvailabilityZonesRetType) { + setNodepoolGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetCri returns the Cri field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetCri() (res NodepoolGetCriRetType) { + res, _ = o.GetCriOk() + return +} + +// GetCriOk returns a tuple with the Cri field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetCriOk() (ret NodepoolGetCriRetType, ok bool) { + return getNodepoolGetCriAttributeTypeOk(o.Cri) +} + +// HasCri returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasCri() bool { + _, ok := o.GetCriOk() + return ok +} + +// SetCri gets a reference to the given CRI and assigns it to the Cri field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetCri(v NodepoolGetCriRetType) { + setNodepoolGetCriAttributeType(&o.Cri, v) +} + +// GetKubernetes returns the Kubernetes field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetKubernetes() (res NodepoolGetKubernetesRetType) { + res, _ = o.GetKubernetesOk() + return +} + +// GetKubernetesOk returns a tuple with the Kubernetes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetKubernetesOk() (ret NodepoolGetKubernetesRetType, ok bool) { + return getNodepoolGetKubernetesAttributeTypeOk(o.Kubernetes) +} + +// HasKubernetes returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasKubernetes() bool { + _, ok := o.GetKubernetesOk() + return ok +} + +// SetKubernetes gets a reference to the given NodepoolKubernetes and assigns it to the Kubernetes field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetKubernetes(v NodepoolGetKubernetesRetType) { + setNodepoolGetKubernetesAttributeType(&o.Kubernetes, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetLabels() (res NodepoolGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetLabelsOk() (ret NodepoolGetLabelsRetType, ok bool) { + return getNodepoolGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetLabels(v NodepoolGetLabelsRetType) { + setNodepoolGetLabelsAttributeType(&o.Labels, v) +} + +// GetMachine returns the Machine field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMachine() (ret NodepoolGetMachineRetType) { + ret, _ = o.GetMachineOk() + return ret +} + +// GetMachineOk returns a tuple with the Machine field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMachineOk() (ret NodepoolGetMachineRetType, ok bool) { + return getNodepoolGetMachineAttributeTypeOk(o.Machine) +} + +// SetMachine sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetMachine(v NodepoolGetMachineRetType) { + setNodepoolGetMachineAttributeType(&o.Machine, v) +} + +// GetMaxSurge returns the MaxSurge field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMaxSurge() (res NodepoolGetMaxSurgeRetType) { + res, _ = o.GetMaxSurgeOk() + return +} + +// GetMaxSurgeOk returns a tuple with the MaxSurge field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMaxSurgeOk() (ret NodepoolGetMaxSurgeRetType, ok bool) { + return getNodepoolGetMaxSurgeAttributeTypeOk(o.MaxSurge) +} + +// HasMaxSurge returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasMaxSurge() bool { + _, ok := o.GetMaxSurgeOk() + return ok +} + +// SetMaxSurge gets a reference to the given int64 and assigns it to the MaxSurge field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetMaxSurge(v NodepoolGetMaxSurgeRetType) { + setNodepoolGetMaxSurgeAttributeType(&o.MaxSurge, v) +} + +// GetMaxUnavailable returns the MaxUnavailable field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMaxUnavailable() (res NodepoolGetMaxUnavailableRetType) { + res, _ = o.GetMaxUnavailableOk() + return +} + +// GetMaxUnavailableOk returns a tuple with the MaxUnavailable field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMaxUnavailableOk() (ret NodepoolGetMaxUnavailableRetType, ok bool) { + return getNodepoolGetMaxUnavailableAttributeTypeOk(o.MaxUnavailable) +} + +// HasMaxUnavailable returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasMaxUnavailable() bool { + _, ok := o.GetMaxUnavailableOk() + return ok +} + +// SetMaxUnavailable gets a reference to the given int64 and assigns it to the MaxUnavailable field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetMaxUnavailable(v NodepoolGetMaxUnavailableRetType) { + setNodepoolGetMaxUnavailableAttributeType(&o.MaxUnavailable, v) +} + +// GetMaximum returns the Maximum field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMaximum() (ret NodepoolGetMaximumRetType) { + ret, _ = o.GetMaximumOk() + return ret +} + +// GetMaximumOk returns a tuple with the Maximum field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMaximumOk() (ret NodepoolGetMaximumRetType, ok bool) { + return getNodepoolGetMaximumAttributeTypeOk(o.Maximum) +} + +// SetMaximum sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetMaximum(v NodepoolGetMaximumRetType) { + setNodepoolGetMaximumAttributeType(&o.Maximum, v) +} + +// GetMinimum returns the Minimum field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMinimum() (ret NodepoolGetMinimumRetType) { + ret, _ = o.GetMinimumOk() + return ret +} + +// GetMinimumOk returns a tuple with the Minimum field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetMinimumOk() (ret NodepoolGetMinimumRetType, ok bool) { + return getNodepoolGetMinimumAttributeTypeOk(o.Minimum) +} + +// SetMinimum sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetMinimum(v NodepoolGetMinimumRetType) { + setNodepoolGetMinimumAttributeType(&o.Minimum, v) +} + +// GetName returns the Name field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetName() (ret NodepoolGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetNameOk() (ret NodepoolGetNameRetType, ok bool) { + return getNodepoolGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetName(v NodepoolGetNameRetType) { + setNodepoolGetNameAttributeType(&o.Name, v) +} + +// GetTaints returns the Taints field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetTaints() (res NodepoolGetTaintsRetType) { + res, _ = o.GetTaintsOk() + return +} + +// GetTaintsOk returns a tuple with the Taints field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetTaintsOk() (ret NodepoolGetTaintsRetType, ok bool) { + return getNodepoolGetTaintsAttributeTypeOk(o.Taints) +} + +// HasTaints returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) HasTaints() bool { + _, ok := o.GetTaintsOk() + return ok +} + +// SetTaints gets a reference to the given []Taint and assigns it to the Taints field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetTaints(v NodepoolGetTaintsRetType) { + setNodepoolGetTaintsAttributeType(&o.Taints, v) +} + +// GetVolume returns the Volume field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetVolume() (ret NodepoolGetVolumeRetType) { + ret, _ = o.GetVolumeOk() + return ret +} + +// GetVolumeOk returns a tuple with the Volume field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) GetVolumeOk() (ret NodepoolGetVolumeRetType, ok bool) { + return getNodepoolGetVolumeAttributeTypeOk(o.Volume) +} + +// SetVolume sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Nodepool) SetVolume(v NodepoolGetVolumeRetType) { + setNodepoolGetVolumeAttributeType(&o.Volume, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Nodepool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNodepoolgetAllowSystemComponentsAttributeTypeOk(o.AllowSystemComponents); ok { + toSerialize["AllowSystemComponents"] = val + } + if val, ok := getNodepoolGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getNodepoolGetCriAttributeTypeOk(o.Cri); ok { + toSerialize["Cri"] = val + } + if val, ok := getNodepoolGetKubernetesAttributeTypeOk(o.Kubernetes); ok { + toSerialize["Kubernetes"] = val + } + if val, ok := getNodepoolGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNodepoolGetMachineAttributeTypeOk(o.Machine); ok { + toSerialize["Machine"] = val + } + if val, ok := getNodepoolGetMaxSurgeAttributeTypeOk(o.MaxSurge); ok { + toSerialize["MaxSurge"] = val + } + if val, ok := getNodepoolGetMaxUnavailableAttributeTypeOk(o.MaxUnavailable); ok { + toSerialize["MaxUnavailable"] = val + } + if val, ok := getNodepoolGetMaximumAttributeTypeOk(o.Maximum); ok { + toSerialize["Maximum"] = val + } + if val, ok := getNodepoolGetMinimumAttributeTypeOk(o.Minimum); ok { + toSerialize["Minimum"] = val + } + if val, ok := getNodepoolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNodepoolGetTaintsAttributeTypeOk(o.Taints); ok { + toSerialize["Taints"] = val + } + if val, ok := getNodepoolGetVolumeAttributeTypeOk(o.Volume); ok { + toSerialize["Volume"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableNodepool struct { + value *Nodepool + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNodepool) Get() *Nodepool { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNodepool) Set(val *Nodepool) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNodepool) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNodepool) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableNodepool(val *Nodepool) *NullableNodepool { + return &NullableNodepool{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNodepool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNodepool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_nodepool_kubernetes.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_nodepool_kubernetes.go new file mode 100644 index 000000000..023017937 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_nodepool_kubernetes.go @@ -0,0 +1,152 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the NodepoolKubernetes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodepoolKubernetes{} + +/* + types and functions for version +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolKubernetesGetVersionAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getNodepoolKubernetesGetVersionAttributeTypeOk(arg NodepoolKubernetesGetVersionAttributeType) (ret NodepoolKubernetesGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setNodepoolKubernetesGetVersionAttributeType(arg *NodepoolKubernetesGetVersionAttributeType, val NodepoolKubernetesGetVersionRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolKubernetesGetVersionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolKubernetesGetVersionRetType = string + +// NodepoolKubernetes struct for NodepoolKubernetes +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NodepoolKubernetes struct { + // Override the Kubernetes version for the Kubelet of this Nodepool. Version must be equal or lower than the version of the cluster. Only one minor version difference to the version of the cluster is allowed. Downgrade of existing Nodepools is prohibited. + Version NodepoolKubernetesGetVersionAttributeType `json:"version,omitempty"` +} + +// NewNodepoolKubernetes instantiates a new NodepoolKubernetes object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNodepoolKubernetes() *NodepoolKubernetes { + this := NodepoolKubernetes{} + return &this +} + +// NewNodepoolKubernetesWithDefaults instantiates a new NodepoolKubernetes object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNodepoolKubernetesWithDefaults() *NodepoolKubernetes { + this := NodepoolKubernetes{} + return &this +} + +// GetVersion returns the Version field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *NodepoolKubernetes) GetVersion() (res NodepoolKubernetesGetVersionRetType) { + res, _ = o.GetVersionOk() + return +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *NodepoolKubernetes) GetVersionOk() (ret NodepoolKubernetesGetVersionRetType, ok bool) { + return getNodepoolKubernetesGetVersionAttributeTypeOk(o.Version) +} + +// HasVersion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *NodepoolKubernetes) HasVersion() bool { + _, ok := o.GetVersionOk() + return ok +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *NodepoolKubernetes) SetVersion(v NodepoolKubernetesGetVersionRetType) { + setNodepoolKubernetesGetVersionAttributeType(&o.Version, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o NodepoolKubernetes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNodepoolKubernetesGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableNodepoolKubernetes struct { + value *NodepoolKubernetes + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNodepoolKubernetes) Get() *NodepoolKubernetes { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNodepoolKubernetes) Set(val *NodepoolKubernetes) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNodepoolKubernetes) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNodepoolKubernetes) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableNodepoolKubernetes(val *NodepoolKubernetes) *NullableNodepoolKubernetes { + return &NullableNodepoolKubernetes{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableNodepoolKubernetes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableNodepoolKubernetes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_observability.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_observability.go new file mode 100644 index 000000000..31632d02b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_observability.go @@ -0,0 +1,204 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Observability type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Observability{} + +/* + types and functions for enabled +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ObservabilitygetEnabledAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ObservabilitygetEnabledArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ObservabilitygetEnabledRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getObservabilitygetEnabledAttributeTypeOk(arg ObservabilitygetEnabledAttributeType) (ret ObservabilitygetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setObservabilitygetEnabledAttributeType(arg *ObservabilitygetEnabledAttributeType, val ObservabilitygetEnabledRetType) { + *arg = &val +} + +/* + types and functions for instanceId +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ObservabilityGetInstanceIdAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getObservabilityGetInstanceIdAttributeTypeOk(arg ObservabilityGetInstanceIdAttributeType) (ret ObservabilityGetInstanceIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setObservabilityGetInstanceIdAttributeType(arg *ObservabilityGetInstanceIdAttributeType, val ObservabilityGetInstanceIdRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ObservabilityGetInstanceIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ObservabilityGetInstanceIdRetType = string + +// Observability struct for Observability +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Observability struct { + // Enables the Observability extension. + // REQUIRED + Enabled ObservabilitygetEnabledAttributeType `json:"enabled" required:"true"` + // Instance ID to choose which Observability instance is used. + // REQUIRED + InstanceId ObservabilityGetInstanceIdAttributeType `json:"instanceId" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Observability Observability + +// NewObservability instantiates a new Observability object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewObservability(enabled ObservabilitygetEnabledArgType, instanceId ObservabilityGetInstanceIdArgType) *Observability { + this := Observability{} + setObservabilitygetEnabledAttributeType(&this.Enabled, enabled) + setObservabilityGetInstanceIdAttributeType(&this.InstanceId, instanceId) + return &this +} + +// NewObservabilityWithDefaults instantiates a new Observability object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewObservabilityWithDefaults() *Observability { + this := Observability{} + return &this +} + +// GetEnabled returns the Enabled field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Observability) GetEnabled() (ret ObservabilitygetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Observability) GetEnabledOk() (ret ObservabilitygetEnabledRetType, ok bool) { + return getObservabilitygetEnabledAttributeTypeOk(o.Enabled) +} + +// SetEnabled sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Observability) SetEnabled(v ObservabilitygetEnabledRetType) { + setObservabilitygetEnabledAttributeType(&o.Enabled, v) +} + +// GetInstanceId returns the InstanceId field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Observability) GetInstanceId() (ret ObservabilityGetInstanceIdRetType) { + ret, _ = o.GetInstanceIdOk() + return ret +} + +// GetInstanceIdOk returns a tuple with the InstanceId field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Observability) GetInstanceIdOk() (ret ObservabilityGetInstanceIdRetType, ok bool) { + return getObservabilityGetInstanceIdAttributeTypeOk(o.InstanceId) +} + +// SetInstanceId sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Observability) SetInstanceId(v ObservabilityGetInstanceIdRetType) { + setObservabilityGetInstanceIdAttributeType(&o.InstanceId, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Observability) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getObservabilitygetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getObservabilityGetInstanceIdAttributeTypeOk(o.InstanceId); ok { + toSerialize["InstanceId"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableObservability struct { + value *Observability + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableObservability) Get() *Observability { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableObservability) Set(val *Observability) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableObservability) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableObservability) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableObservability(val *Observability) *NullableObservability { + return &NullableObservability{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableObservability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableObservability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_provider_options.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_provider_options.go new file mode 100644 index 000000000..186e66d96 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_provider_options.go @@ -0,0 +1,383 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the ProviderOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProviderOptions{} + +/* + types and functions for availabilityZones +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetAvailabilityZonesAttributeType = *[]AvailabilityZone + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetAvailabilityZonesArgType = []AvailabilityZone + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetAvailabilityZonesRetType = []AvailabilityZone + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getProviderOptionsGetAvailabilityZonesAttributeTypeOk(arg ProviderOptionsGetAvailabilityZonesAttributeType) (ret ProviderOptionsGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setProviderOptionsGetAvailabilityZonesAttributeType(arg *ProviderOptionsGetAvailabilityZonesAttributeType, val ProviderOptionsGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for kubernetesVersions +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetKubernetesVersionsAttributeType = *[]KubernetesVersion + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetKubernetesVersionsArgType = []KubernetesVersion + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetKubernetesVersionsRetType = []KubernetesVersion + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getProviderOptionsGetKubernetesVersionsAttributeTypeOk(arg ProviderOptionsGetKubernetesVersionsAttributeType) (ret ProviderOptionsGetKubernetesVersionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setProviderOptionsGetKubernetesVersionsAttributeType(arg *ProviderOptionsGetKubernetesVersionsAttributeType, val ProviderOptionsGetKubernetesVersionsRetType) { + *arg = &val +} + +/* + types and functions for machineImages +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetMachineImagesAttributeType = *[]MachineImage + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetMachineImagesArgType = []MachineImage + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetMachineImagesRetType = []MachineImage + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getProviderOptionsGetMachineImagesAttributeTypeOk(arg ProviderOptionsGetMachineImagesAttributeType) (ret ProviderOptionsGetMachineImagesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setProviderOptionsGetMachineImagesAttributeType(arg *ProviderOptionsGetMachineImagesAttributeType, val ProviderOptionsGetMachineImagesRetType) { + *arg = &val +} + +/* + types and functions for machineTypes +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetMachineTypesAttributeType = *[]MachineType + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetMachineTypesArgType = []MachineType + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetMachineTypesRetType = []MachineType + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getProviderOptionsGetMachineTypesAttributeTypeOk(arg ProviderOptionsGetMachineTypesAttributeType) (ret ProviderOptionsGetMachineTypesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setProviderOptionsGetMachineTypesAttributeType(arg *ProviderOptionsGetMachineTypesAttributeType, val ProviderOptionsGetMachineTypesRetType) { + *arg = &val +} + +/* + types and functions for volumeTypes +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetVolumeTypesAttributeType = *[]VolumeType + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetVolumeTypesArgType = []VolumeType + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptionsGetVolumeTypesRetType = []VolumeType + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getProviderOptionsGetVolumeTypesAttributeTypeOk(arg ProviderOptionsGetVolumeTypesAttributeType) (ret ProviderOptionsGetVolumeTypesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setProviderOptionsGetVolumeTypesAttributeType(arg *ProviderOptionsGetVolumeTypesAttributeType, val ProviderOptionsGetVolumeTypesRetType) { + *arg = &val +} + +// ProviderOptions struct for ProviderOptions +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type ProviderOptions struct { + AvailabilityZones ProviderOptionsGetAvailabilityZonesAttributeType `json:"availabilityZones,omitempty"` + KubernetesVersions ProviderOptionsGetKubernetesVersionsAttributeType `json:"kubernetesVersions,omitempty"` + MachineImages ProviderOptionsGetMachineImagesAttributeType `json:"machineImages,omitempty"` + MachineTypes ProviderOptionsGetMachineTypesAttributeType `json:"machineTypes,omitempty"` + VolumeTypes ProviderOptionsGetVolumeTypesAttributeType `json:"volumeTypes,omitempty"` +} + +// NewProviderOptions instantiates a new ProviderOptions object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewProviderOptions() *ProviderOptions { + this := ProviderOptions{} + return &this +} + +// NewProviderOptionsWithDefaults instantiates a new ProviderOptions object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewProviderOptionsWithDefaults() *ProviderOptions { + this := ProviderOptions{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetAvailabilityZones() (res ProviderOptionsGetAvailabilityZonesRetType) { + res, _ = o.GetAvailabilityZonesOk() + return +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetAvailabilityZonesOk() (ret ProviderOptionsGetAvailabilityZonesRetType, ok bool) { + return getProviderOptionsGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// HasAvailabilityZones returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) HasAvailabilityZones() bool { + _, ok := o.GetAvailabilityZonesOk() + return ok +} + +// SetAvailabilityZones gets a reference to the given []AvailabilityZone and assigns it to the AvailabilityZones field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) SetAvailabilityZones(v ProviderOptionsGetAvailabilityZonesRetType) { + setProviderOptionsGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetKubernetesVersions returns the KubernetesVersions field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetKubernetesVersions() (res ProviderOptionsGetKubernetesVersionsRetType) { + res, _ = o.GetKubernetesVersionsOk() + return +} + +// GetKubernetesVersionsOk returns a tuple with the KubernetesVersions field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetKubernetesVersionsOk() (ret ProviderOptionsGetKubernetesVersionsRetType, ok bool) { + return getProviderOptionsGetKubernetesVersionsAttributeTypeOk(o.KubernetesVersions) +} + +// HasKubernetesVersions returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) HasKubernetesVersions() bool { + _, ok := o.GetKubernetesVersionsOk() + return ok +} + +// SetKubernetesVersions gets a reference to the given []KubernetesVersion and assigns it to the KubernetesVersions field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) SetKubernetesVersions(v ProviderOptionsGetKubernetesVersionsRetType) { + setProviderOptionsGetKubernetesVersionsAttributeType(&o.KubernetesVersions, v) +} + +// GetMachineImages returns the MachineImages field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetMachineImages() (res ProviderOptionsGetMachineImagesRetType) { + res, _ = o.GetMachineImagesOk() + return +} + +// GetMachineImagesOk returns a tuple with the MachineImages field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetMachineImagesOk() (ret ProviderOptionsGetMachineImagesRetType, ok bool) { + return getProviderOptionsGetMachineImagesAttributeTypeOk(o.MachineImages) +} + +// HasMachineImages returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) HasMachineImages() bool { + _, ok := o.GetMachineImagesOk() + return ok +} + +// SetMachineImages gets a reference to the given []MachineImage and assigns it to the MachineImages field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) SetMachineImages(v ProviderOptionsGetMachineImagesRetType) { + setProviderOptionsGetMachineImagesAttributeType(&o.MachineImages, v) +} + +// GetMachineTypes returns the MachineTypes field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetMachineTypes() (res ProviderOptionsGetMachineTypesRetType) { + res, _ = o.GetMachineTypesOk() + return +} + +// GetMachineTypesOk returns a tuple with the MachineTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetMachineTypesOk() (ret ProviderOptionsGetMachineTypesRetType, ok bool) { + return getProviderOptionsGetMachineTypesAttributeTypeOk(o.MachineTypes) +} + +// HasMachineTypes returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) HasMachineTypes() bool { + _, ok := o.GetMachineTypesOk() + return ok +} + +// SetMachineTypes gets a reference to the given []MachineType and assigns it to the MachineTypes field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) SetMachineTypes(v ProviderOptionsGetMachineTypesRetType) { + setProviderOptionsGetMachineTypesAttributeType(&o.MachineTypes, v) +} + +// GetVolumeTypes returns the VolumeTypes field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetVolumeTypes() (res ProviderOptionsGetVolumeTypesRetType) { + res, _ = o.GetVolumeTypesOk() + return +} + +// GetVolumeTypesOk returns a tuple with the VolumeTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) GetVolumeTypesOk() (ret ProviderOptionsGetVolumeTypesRetType, ok bool) { + return getProviderOptionsGetVolumeTypesAttributeTypeOk(o.VolumeTypes) +} + +// HasVolumeTypes returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) HasVolumeTypes() bool { + _, ok := o.GetVolumeTypesOk() + return ok +} + +// SetVolumeTypes gets a reference to the given []VolumeType and assigns it to the VolumeTypes field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *ProviderOptions) SetVolumeTypes(v ProviderOptionsGetVolumeTypesRetType) { + setProviderOptionsGetVolumeTypesAttributeType(&o.VolumeTypes, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o ProviderOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProviderOptionsGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getProviderOptionsGetKubernetesVersionsAttributeTypeOk(o.KubernetesVersions); ok { + toSerialize["KubernetesVersions"] = val + } + if val, ok := getProviderOptionsGetMachineImagesAttributeTypeOk(o.MachineImages); ok { + toSerialize["MachineImages"] = val + } + if val, ok := getProviderOptionsGetMachineTypesAttributeTypeOk(o.MachineTypes); ok { + toSerialize["MachineTypes"] = val + } + if val, ok := getProviderOptionsGetVolumeTypesAttributeTypeOk(o.VolumeTypes); ok { + toSerialize["VolumeTypes"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableProviderOptions struct { + value *ProviderOptions + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableProviderOptions) Get() *ProviderOptions { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableProviderOptions) Set(val *ProviderOptions) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableProviderOptions) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableProviderOptions) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableProviderOptions(val *ProviderOptions) *NullableProviderOptions { + return &NullableProviderOptions{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableProviderOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableProviderOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_runtime_error.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_runtime_error.go new file mode 100644 index 000000000..f06d7f08c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_runtime_error.go @@ -0,0 +1,416 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" +) + +// checks if the RuntimeError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RuntimeError{} + +/* + types and functions for code +*/ + +// isEnum + +// RuntimeErrorCode - Code: `SKE_UNSPECIFIED` Message: \"An error occurred. Please open a support ticket if this error persists.\" - Code: `SKE_TMP_AUTH_ERROR` Message: \"Authentication failed. This is a temporary error. Please wait while the system recovers.\" - Code: `SKE_QUOTA_EXCEEDED` Message: \"Your project's resource quotas are exhausted. Please make sure your quota is sufficient for the ordered cluster.\" - Code: `SKE_OBSERVABILITY_INSTANCE_NOT_FOUND` Message: \"The provided Observability instance could not be found.\" - Code: `SKE_RATE_LIMITS` Message: \"While provisioning your cluster, request rate limits where incurred. Please wait while the system recovers.\" - Code: `SKE_INFRA_ERROR` Message: \"An error occurred with the underlying infrastructure. Please open a support ticket if this error persists.\" - Code: `SKE_REMAINING_RESOURCES` Message: \"There are remaining Kubernetes resources in your cluster that prevent deletion. Please make sure to remove them.\" - Code: `SKE_CONFIGURATION_PROBLEM` Message: \"A configuration error occurred. Please open a support ticket if this error persists.\" - Code: `SKE_UNREADY_NODES` Message: \"Not all worker nodes are ready. Please open a support ticket if this error persists.\" - Code: `SKE_API_SERVER_ERROR` Message: \"The Kubernetes API server is not reporting readiness. Please open a support ticket if this error persists.\" - Code: `SKE_DNS_ZONE_NOT_FOUND` Message: \"The provided DNS zone for the STACKIT DNS extension could not be found. Please ensure you defined a valid domain that belongs to a STACKIT DNS zone.\" +// value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorCode string + +// List of Code +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_UNSPECIFIED RuntimeErrorCode = "SKE_UNSPECIFIED" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_TMP_AUTH_ERROR RuntimeErrorCode = "SKE_TMP_AUTH_ERROR" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_QUOTA_EXCEEDED RuntimeErrorCode = "SKE_QUOTA_EXCEEDED" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_OBSERVABILITY_INSTANCE_NOT_FOUND RuntimeErrorCode = "SKE_OBSERVABILITY_INSTANCE_NOT_FOUND" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_RATE_LIMITS RuntimeErrorCode = "SKE_RATE_LIMITS" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_INFRA_ERROR RuntimeErrorCode = "SKE_INFRA_ERROR" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_REMAINING_RESOURCES RuntimeErrorCode = "SKE_REMAINING_RESOURCES" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_CONFIGURATION_PROBLEM RuntimeErrorCode = "SKE_CONFIGURATION_PROBLEM" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_UNREADY_NODES RuntimeErrorCode = "SKE_UNREADY_NODES" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_API_SERVER_ERROR RuntimeErrorCode = "SKE_API_SERVER_ERROR" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + RUNTIMEERRORCODE_DNS_ZONE_NOT_FOUND RuntimeErrorCode = "SKE_DNS_ZONE_NOT_FOUND" +) + +// All allowed values of RuntimeError enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedRuntimeErrorCodeEnumValues = []RuntimeErrorCode{ + "SKE_UNSPECIFIED", + "SKE_TMP_AUTH_ERROR", + "SKE_QUOTA_EXCEEDED", + "SKE_OBSERVABILITY_INSTANCE_NOT_FOUND", + "SKE_RATE_LIMITS", + "SKE_INFRA_ERROR", + "SKE_REMAINING_RESOURCES", + "SKE_CONFIGURATION_PROBLEM", + "SKE_UNREADY_NODES", + "SKE_API_SERVER_ERROR", + "SKE_DNS_ZONE_NOT_FOUND", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *RuntimeErrorCode) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson RuntimeErrorCode + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := RuntimeErrorCode(value) + for _, existing := range AllowedRuntimeErrorCodeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RuntimeError", value) +} + +// NewRuntimeErrorCodeFromValue returns a pointer to a valid RuntimeErrorCode +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewRuntimeErrorCodeFromValue(v RuntimeErrorCode) (*RuntimeErrorCode, error) { + ev := RuntimeErrorCode(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RuntimeErrorCode: valid values are %v", v, AllowedRuntimeErrorCodeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v RuntimeErrorCode) IsValid() bool { + for _, existing := range AllowedRuntimeErrorCodeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CodeCode value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v RuntimeErrorCode) Ptr() *RuntimeErrorCode { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableRuntimeErrorCode struct { + value *RuntimeErrorCode + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableRuntimeErrorCode) Get() *RuntimeErrorCode { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableRuntimeErrorCode) Set(val *RuntimeErrorCode) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableRuntimeErrorCode) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableRuntimeErrorCode) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableRuntimeErrorCode(val *RuntimeErrorCode) *NullableRuntimeErrorCode { + return &NullableRuntimeErrorCode{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableRuntimeErrorCode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableRuntimeErrorCode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetCodeAttributeType = *RuntimeErrorCode + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetCodeArgType = RuntimeErrorCode + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetCodeRetType = RuntimeErrorCode + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getRuntimeErrorGetCodeAttributeTypeOk(arg RuntimeErrorGetCodeAttributeType) (ret RuntimeErrorGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setRuntimeErrorGetCodeAttributeType(arg *RuntimeErrorGetCodeAttributeType, val RuntimeErrorGetCodeRetType) { + *arg = &val +} + +/* + types and functions for details +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetDetailsAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getRuntimeErrorGetDetailsAttributeTypeOk(arg RuntimeErrorGetDetailsAttributeType) (ret RuntimeErrorGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setRuntimeErrorGetDetailsAttributeType(arg *RuntimeErrorGetDetailsAttributeType, val RuntimeErrorGetDetailsRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetDetailsArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetDetailsRetType = string + +/* + types and functions for message +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetMessageAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getRuntimeErrorGetMessageAttributeTypeOk(arg RuntimeErrorGetMessageAttributeType) (ret RuntimeErrorGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setRuntimeErrorGetMessageAttributeType(arg *RuntimeErrorGetMessageAttributeType, val RuntimeErrorGetMessageRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetMessageArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeErrorGetMessageRetType = string + +// RuntimeError struct for RuntimeError +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type RuntimeError struct { + // - Code: `SKE_UNSPECIFIED` Message: \"An error occurred. Please open a support ticket if this error persists.\" - Code: `SKE_TMP_AUTH_ERROR` Message: \"Authentication failed. This is a temporary error. Please wait while the system recovers.\" - Code: `SKE_QUOTA_EXCEEDED` Message: \"Your project's resource quotas are exhausted. Please make sure your quota is sufficient for the ordered cluster.\" - Code: `SKE_OBSERVABILITY_INSTANCE_NOT_FOUND` Message: \"The provided Observability instance could not be found.\" - Code: `SKE_RATE_LIMITS` Message: \"While provisioning your cluster, request rate limits where incurred. Please wait while the system recovers.\" - Code: `SKE_INFRA_ERROR` Message: \"An error occurred with the underlying infrastructure. Please open a support ticket if this error persists.\" - Code: `SKE_REMAINING_RESOURCES` Message: \"There are remaining Kubernetes resources in your cluster that prevent deletion. Please make sure to remove them.\" - Code: `SKE_CONFIGURATION_PROBLEM` Message: \"A configuration error occurred. Please open a support ticket if this error persists.\" - Code: `SKE_UNREADY_NODES` Message: \"Not all worker nodes are ready. Please open a support ticket if this error persists.\" - Code: `SKE_API_SERVER_ERROR` Message: \"The Kubernetes API server is not reporting readiness. Please open a support ticket if this error persists.\" - Code: `SKE_DNS_ZONE_NOT_FOUND` Message: \"The provided DNS zone for the STACKIT DNS extension could not be found. Please ensure you defined a valid domain that belongs to a STACKIT DNS zone.\" + Code RuntimeErrorGetCodeAttributeType `json:"code,omitempty"` + Details RuntimeErrorGetDetailsAttributeType `json:"details,omitempty"` + Message RuntimeErrorGetMessageAttributeType `json:"message,omitempty"` +} + +// NewRuntimeError instantiates a new RuntimeError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewRuntimeError() *RuntimeError { + this := RuntimeError{} + return &this +} + +// NewRuntimeErrorWithDefaults instantiates a new RuntimeError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewRuntimeErrorWithDefaults() *RuntimeError { + this := RuntimeError{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) GetCode() (res RuntimeErrorGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) GetCodeOk() (ret RuntimeErrorGetCodeRetType, ok bool) { + return getRuntimeErrorGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) SetCode(v RuntimeErrorGetCodeRetType) { + setRuntimeErrorGetCodeAttributeType(&o.Code, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) GetDetails() (res RuntimeErrorGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) GetDetailsOk() (ret RuntimeErrorGetDetailsRetType, ok bool) { + return getRuntimeErrorGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) SetDetails(v RuntimeErrorGetDetailsRetType) { + setRuntimeErrorGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) GetMessage() (res RuntimeErrorGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) GetMessageOk() (ret RuntimeErrorGetMessageRetType, ok bool) { + return getRuntimeErrorGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *RuntimeError) SetMessage(v RuntimeErrorGetMessageRetType) { + setRuntimeErrorGetMessageAttributeType(&o.Message, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o RuntimeError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRuntimeErrorGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getRuntimeErrorGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getRuntimeErrorGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableRuntimeError struct { + value *RuntimeError + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableRuntimeError) Get() *RuntimeError { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableRuntimeError) Set(val *RuntimeError) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableRuntimeError) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableRuntimeError) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableRuntimeError(val *RuntimeError) *NullableRuntimeError { + return &NullableRuntimeError{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableRuntimeError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableRuntimeError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_taint.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_taint.go new file mode 100644 index 000000000..08d69879f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_taint.go @@ -0,0 +1,384 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "fmt" +) + +// checks if the Taint type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Taint{} + +/* + types and functions for effect +*/ + +// isEnum + +// TaintEffect the model 'Taint' +// value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintEffect string + +// List of Effect +const ( + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + TAINTEFFECT_NO_SCHEDULE TaintEffect = "NoSchedule" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + TAINTEFFECT_PREFER_NO_SCHEDULE TaintEffect = "PreferNoSchedule" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + TAINTEFFECT_NO_EXECUTE TaintEffect = "NoExecute" +) + +// All allowed values of Taint enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +var AllowedTaintEffectEnumValues = []TaintEffect{ + "NoSchedule", + "PreferNoSchedule", + "NoExecute", +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *TaintEffect) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson TaintEffect + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := TaintEffect(value) + for _, existing := range AllowedTaintEffectEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Taint", value) +} + +// NewTaintEffectFromValue returns a pointer to a valid TaintEffect +// for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewTaintEffectFromValue(v TaintEffect) (*TaintEffect, error) { + ev := TaintEffect(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TaintEffect: valid values are %v", v, AllowedTaintEffectEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v TaintEffect) IsValid() bool { + for _, existing := range AllowedTaintEffectEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EffectEffect value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v TaintEffect) Ptr() *TaintEffect { + return &v +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableTaintEffect struct { + value *TaintEffect + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTaintEffect) Get() *TaintEffect { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTaintEffect) Set(val *TaintEffect) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTaintEffect) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTaintEffect) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableTaintEffect(val *TaintEffect) *NullableTaintEffect { + return &NullableTaintEffect{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTaintEffect) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTaintEffect) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetEffectAttributeType = *TaintEffect + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetEffectArgType = TaintEffect + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetEffectRetType = TaintEffect + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getTaintGetEffectAttributeTypeOk(arg TaintGetEffectAttributeType) (ret TaintGetEffectRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setTaintGetEffectAttributeType(arg *TaintGetEffectAttributeType, val TaintGetEffectRetType) { + *arg = &val +} + +/* + types and functions for key +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetKeyAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getTaintGetKeyAttributeTypeOk(arg TaintGetKeyAttributeType) (ret TaintGetKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setTaintGetKeyAttributeType(arg *TaintGetKeyAttributeType, val TaintGetKeyRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetKeyArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetKeyRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetValueAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getTaintGetValueAttributeTypeOk(arg TaintGetValueAttributeType) (ret TaintGetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setTaintGetValueAttributeType(arg *TaintGetValueAttributeType, val TaintGetValueRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetValueArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TaintGetValueRetType = string + +// Taint struct for Taint +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Taint struct { + // REQUIRED + Effect TaintGetEffectAttributeType `json:"effect" required:"true"` + // REQUIRED + Key TaintGetKeyAttributeType `json:"key" required:"true"` + Value TaintGetValueAttributeType `json:"value,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Taint Taint + +// NewTaint instantiates a new Taint object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewTaint(effect TaintGetEffectArgType, key TaintGetKeyArgType) *Taint { + this := Taint{} + setTaintGetEffectAttributeType(&this.Effect, effect) + setTaintGetKeyAttributeType(&this.Key, key) + return &this +} + +// NewTaintWithDefaults instantiates a new Taint object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewTaintWithDefaults() *Taint { + this := Taint{} + return &this +} + +// GetEffect returns the Effect field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) GetEffect() (ret TaintGetEffectRetType) { + ret, _ = o.GetEffectOk() + return ret +} + +// GetEffectOk returns a tuple with the Effect field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) GetEffectOk() (ret TaintGetEffectRetType, ok bool) { + return getTaintGetEffectAttributeTypeOk(o.Effect) +} + +// SetEffect sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) SetEffect(v TaintGetEffectRetType) { + setTaintGetEffectAttributeType(&o.Effect, v) +} + +// GetKey returns the Key field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) GetKey() (ret TaintGetKeyRetType) { + ret, _ = o.GetKeyOk() + return ret +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) GetKeyOk() (ret TaintGetKeyRetType, ok bool) { + return getTaintGetKeyAttributeTypeOk(o.Key) +} + +// SetKey sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) SetKey(v TaintGetKeyRetType) { + setTaintGetKeyAttributeType(&o.Key, v) +} + +// GetValue returns the Value field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) GetValue() (res TaintGetValueRetType) { + res, _ = o.GetValueOk() + return +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) GetValueOk() (ret TaintGetValueRetType, ok bool) { + return getTaintGetValueAttributeTypeOk(o.Value) +} + +// HasValue returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) HasValue() bool { + _, ok := o.GetValueOk() + return ok +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Taint) SetValue(v TaintGetValueRetType) { + setTaintGetValueAttributeType(&o.Value, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Taint) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTaintGetEffectAttributeTypeOk(o.Effect); ok { + toSerialize["Effect"] = val + } + if val, ok := getTaintGetKeyAttributeTypeOk(o.Key); ok { + toSerialize["Key"] = val + } + if val, ok := getTaintGetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableTaint struct { + value *Taint + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTaint) Get() *Taint { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTaint) Set(val *Taint) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTaint) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTaint) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableTaint(val *Taint) *NullableTaint { + return &NullableTaint{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTaint) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTaint) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_time_window.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_time_window.go new file mode 100644 index 000000000..a75f581e5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_time_window.go @@ -0,0 +1,203 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" + "time" +) + +// checks if the TimeWindow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TimeWindow{} + +/* + types and functions for end +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindowGetEndAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindowGetEndArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindowGetEndRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getTimeWindowGetEndAttributeTypeOk(arg TimeWindowGetEndAttributeType) (ret TimeWindowGetEndRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setTimeWindowGetEndAttributeType(arg *TimeWindowGetEndAttributeType, val TimeWindowGetEndRetType) { + *arg = &val +} + +/* + types and functions for start +*/ + +// isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindowGetStartAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindowGetStartArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindowGetStartRetType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getTimeWindowGetStartAttributeTypeOk(arg TimeWindowGetStartAttributeType) (ret TimeWindowGetStartRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setTimeWindowGetStartAttributeType(arg *TimeWindowGetStartAttributeType, val TimeWindowGetStartRetType) { + *arg = &val +} + +// TimeWindow struct for TimeWindow +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type TimeWindow struct { + // REQUIRED + End TimeWindowGetEndAttributeType `json:"end" required:"true"` + // REQUIRED + Start TimeWindowGetStartAttributeType `json:"start" required:"true"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _TimeWindow TimeWindow + +// NewTimeWindow instantiates a new TimeWindow object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewTimeWindow(end TimeWindowGetEndArgType, start TimeWindowGetStartArgType) *TimeWindow { + this := TimeWindow{} + setTimeWindowGetEndAttributeType(&this.End, end) + setTimeWindowGetStartAttributeType(&this.Start, start) + return &this +} + +// NewTimeWindowWithDefaults instantiates a new TimeWindow object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewTimeWindowWithDefaults() *TimeWindow { + this := TimeWindow{} + return &this +} + +// GetEnd returns the End field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *TimeWindow) GetEnd() (ret TimeWindowGetEndRetType) { + ret, _ = o.GetEndOk() + return ret +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *TimeWindow) GetEndOk() (ret TimeWindowGetEndRetType, ok bool) { + return getTimeWindowGetEndAttributeTypeOk(o.End) +} + +// SetEnd sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *TimeWindow) SetEnd(v TimeWindowGetEndRetType) { + setTimeWindowGetEndAttributeType(&o.End, v) +} + +// GetStart returns the Start field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *TimeWindow) GetStart() (ret TimeWindowGetStartRetType) { + ret, _ = o.GetStartOk() + return ret +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *TimeWindow) GetStartOk() (ret TimeWindowGetStartRetType, ok bool) { + return getTimeWindowGetStartAttributeTypeOk(o.Start) +} + +// SetStart sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *TimeWindow) SetStart(v TimeWindowGetStartRetType) { + setTimeWindowGetStartAttributeType(&o.Start, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o TimeWindow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTimeWindowGetEndAttributeTypeOk(o.End); ok { + toSerialize["End"] = val + } + if val, ok := getTimeWindowGetStartAttributeTypeOk(o.Start); ok { + toSerialize["Start"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableTimeWindow struct { + value *TimeWindow + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTimeWindow) Get() *TimeWindow { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTimeWindow) Set(val *TimeWindow) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTimeWindow) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTimeWindow) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableTimeWindow(val *TimeWindow) *NullableTimeWindow { + return &NullableTimeWindow{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTimeWindow) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTimeWindow) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_v2_control_plane_network.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_v2_control_plane_network.go new file mode 100644 index 000000000..ef5d4cc5d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_v2_control_plane_network.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the V2ControlPlaneNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2ControlPlaneNetwork{} + +/* + types and functions for accessScope +*/ + +// isEnumRef +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type V2ControlPlaneNetworkGetAccessScopeAttributeType = *AccessScope + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type V2ControlPlaneNetworkGetAccessScopeArgType = AccessScope + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type V2ControlPlaneNetworkGetAccessScopeRetType = AccessScope + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getV2ControlPlaneNetworkGetAccessScopeAttributeTypeOk(arg V2ControlPlaneNetworkGetAccessScopeAttributeType) (ret V2ControlPlaneNetworkGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setV2ControlPlaneNetworkGetAccessScopeAttributeType(arg *V2ControlPlaneNetworkGetAccessScopeAttributeType, val V2ControlPlaneNetworkGetAccessScopeRetType) { + *arg = &val +} + +// V2ControlPlaneNetwork struct for V2ControlPlaneNetwork +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type V2ControlPlaneNetwork struct { + AccessScope V2ControlPlaneNetworkGetAccessScopeAttributeType `json:"accessScope,omitempty"` +} + +// NewV2ControlPlaneNetwork instantiates a new V2ControlPlaneNetwork object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewV2ControlPlaneNetwork() *V2ControlPlaneNetwork { + this := V2ControlPlaneNetwork{} + return &this +} + +// NewV2ControlPlaneNetworkWithDefaults instantiates a new V2ControlPlaneNetwork object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewV2ControlPlaneNetworkWithDefaults() *V2ControlPlaneNetwork { + this := V2ControlPlaneNetwork{} + return &this +} + +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *V2ControlPlaneNetwork) GetAccessScope() (res V2ControlPlaneNetworkGetAccessScopeRetType) { + res, _ = o.GetAccessScopeOk() + return +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *V2ControlPlaneNetwork) GetAccessScopeOk() (ret V2ControlPlaneNetworkGetAccessScopeRetType, ok bool) { + return getV2ControlPlaneNetworkGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// HasAccessScope returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *V2ControlPlaneNetwork) HasAccessScope() bool { + _, ok := o.GetAccessScopeOk() + return ok +} + +// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *V2ControlPlaneNetwork) SetAccessScope(v V2ControlPlaneNetworkGetAccessScopeRetType) { + setV2ControlPlaneNetworkGetAccessScopeAttributeType(&o.AccessScope, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o V2ControlPlaneNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2ControlPlaneNetworkGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableV2ControlPlaneNetwork struct { + value *V2ControlPlaneNetwork + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableV2ControlPlaneNetwork) Get() *V2ControlPlaneNetwork { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableV2ControlPlaneNetwork) Set(val *V2ControlPlaneNetwork) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableV2ControlPlaneNetwork) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableV2ControlPlaneNetwork) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableV2ControlPlaneNetwork(val *V2ControlPlaneNetwork) *NullableV2ControlPlaneNetwork { + return &NullableV2ControlPlaneNetwork{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableV2ControlPlaneNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableV2ControlPlaneNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_volume.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_volume.go new file mode 100644 index 000000000..0feb40196 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_volume.go @@ -0,0 +1,209 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + +/* + types and functions for size +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeGetSizeAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeGetSizeArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeGetSizeRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getVolumeGetSizeAttributeTypeOk(arg VolumeGetSizeAttributeType) (ret VolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setVolumeGetSizeAttributeType(arg *VolumeGetSizeAttributeType, val VolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeGetTypeAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getVolumeGetTypeAttributeTypeOk(arg VolumeGetTypeAttributeType) (ret VolumeGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setVolumeGetTypeAttributeType(arg *VolumeGetTypeAttributeType, val VolumeGetTypeRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeGetTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeGetTypeRetType = string + +// Volume struct for Volume +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type Volume struct { + // Can be cast to int32 without loss of precision. + // REQUIRED + Size VolumeGetSizeAttributeType `json:"size" required:"true"` + // For valid values please take a look at [provider-options](#tag/ProviderOptions/operation/SkeService_GetProviderOptions) `volumeTypes`. + Type VolumeGetTypeAttributeType `json:"type,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _Volume Volume + +// NewVolume instantiates a new Volume object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewVolume(size VolumeGetSizeArgType) *Volume { + this := Volume{} + setVolumeGetSizeAttributeType(&this.Size, size) + return &this +} + +// NewVolumeWithDefaults instantiates a new Volume object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewVolumeWithDefaults() *Volume { + this := Volume{} + return &this +} + +// GetSize returns the Size field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) GetSize() (ret VolumeGetSizeRetType) { + ret, _ = o.GetSizeOk() + return ret +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) GetSizeOk() (ret VolumeGetSizeRetType, ok bool) { + return getVolumeGetSizeAttributeTypeOk(o.Size) +} + +// SetSize sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) SetSize(v VolumeGetSizeRetType) { + setVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) GetType() (res VolumeGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) GetTypeOk() (ret VolumeGetTypeRetType, ok bool) { + return getVolumeGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *Volume) SetType(v VolumeGetTypeRetType) { + setVolumeGetTypeAttributeType(&o.Type, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o Volume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getVolumeGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableVolume struct { + value *Volume + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableVolume) Get() *Volume { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_volume_type.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_volume_type.go new file mode 100644 index 000000000..cbcbde939 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/model_volume_type.go @@ -0,0 +1,151 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package ske + +import ( + "encoding/json" +) + +// checks if the VolumeType type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeType{} + +/* + types and functions for name +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeTypeGetNameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getVolumeTypeGetNameAttributeTypeOk(arg VolumeTypeGetNameAttributeType) (ret VolumeTypeGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setVolumeTypeGetNameAttributeType(arg *VolumeTypeGetNameAttributeType, val VolumeTypeGetNameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeTypeGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeTypeGetNameRetType = string + +// VolumeType struct for VolumeType +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type VolumeType struct { + Name VolumeTypeGetNameAttributeType `json:"name,omitempty"` +} + +// NewVolumeType instantiates a new VolumeType object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewVolumeType() *VolumeType { + this := VolumeType{} + return &this +} + +// NewVolumeTypeWithDefaults instantiates a new VolumeType object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewVolumeTypeWithDefaults() *VolumeType { + this := VolumeType{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *VolumeType) GetName() (res VolumeTypeGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *VolumeType) GetNameOk() (ret VolumeTypeGetNameRetType, ok bool) { + return getVolumeTypeGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *VolumeType) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *VolumeType) SetName(v VolumeTypeGetNameRetType) { + setVolumeTypeGetNameAttributeType(&o.Name, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o VolumeType) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeTypeGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableVolumeType struct { + value *VolumeType + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableVolumeType) Get() *VolumeType { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableVolumeType) Set(val *VolumeType) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableVolumeType) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableVolumeType) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableVolumeType(val *VolumeType) *NullableVolumeType { + return &NullableVolumeType{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableVolumeType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableVolumeType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/oas_commit b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/oas_commit new file mode 100644 index 000000000..6c8d03f40 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/oas_commit @@ -0,0 +1 @@ +d94385ca86971d220feac3bfdad5397be3406de1 diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/utils.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/utils.go new file mode 100644 index 000000000..85041ff9c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/ske/utils.go @@ -0,0 +1,466 @@ +/* +STACKIT Kubernetes Engine API + +The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ske + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func PtrTime(v time.Time) *time.Time { return &v } + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableValue[T any] struct { + value *T + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableValue[T]) Get() *T { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableBool struct { + value *bool + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableBool) Get() *bool { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableBool) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableInt struct { + value *int + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt) Get() *int { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableInt32 struct { + value *int32 + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt32) Get() *int32 { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableInt64 struct { + value *int64 + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt64) Get() *int64 { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableFloat32 struct { + value *float32 + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableFloat32) Get() *float32 { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableFloat64 struct { + value *float64 + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableFloat64) Get() *float64 { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableString struct { + value *string + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableString) Get() *string { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableString) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableTime struct { + value *time.Time + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTime) Get() *time.Time { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTime) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 84f87eb44..19333e9bc 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -412,6 +412,9 @@ github.com/gobuffalo/flect ## explicit; go 1.15 github.com/gogo/protobuf/proto github.com/gogo/protobuf/sortkeys +# github.com/golang-jwt/jwt/v5 v5.3.1 +## explicit; go 1.21 +github.com/golang-jwt/jwt/v5 # github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da ## explicit github.com/golang/groupcache/lru @@ -433,8 +436,8 @@ github.com/google/gnostic-models/extensions github.com/google/gnostic-models/jsonschema github.com/google/gnostic-models/openapiv2 github.com/google/gnostic-models/openapiv3 -# github.com/google/go-cmp v0.6.0 -## explicit; go 1.13 +# github.com/google/go-cmp v0.7.0 +## explicit; go 1.21 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags @@ -854,6 +857,17 @@ github.com/spf13/viper/internal/encoding/json github.com/spf13/viper/internal/encoding/toml github.com/spf13/viper/internal/encoding/yaml github.com/spf13/viper/internal/features +# github.com/stackitcloud/stackit-sdk-go/core v0.22.0 +## explicit; go 1.21 +github.com/stackitcloud/stackit-sdk-go/core/auth +github.com/stackitcloud/stackit-sdk-go/core/clients +github.com/stackitcloud/stackit-sdk-go/core/config +github.com/stackitcloud/stackit-sdk-go/core/oapierror +github.com/stackitcloud/stackit-sdk-go/core/oidcadapters +github.com/stackitcloud/stackit-sdk-go/core/utils +# github.com/stackitcloud/stackit-sdk-go/services/ske v1.9.0 +## explicit; go 1.21 +github.com/stackitcloud/stackit-sdk-go/services/ske # github.com/subosito/gotenv v1.6.0 ## explicit; go 1.18 github.com/subosito/gotenv