From 0242a5284d207022a86ed5f9d7ac934ed9eeaa00 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 12 Feb 2026 09:01:33 +0000 Subject: [PATCH] Generate ske --- services/ske/api_default_test.go | 773 ------------------ services/ske/model_access_scope.go | 115 +++ services/ske/model_access_scope_test.go | 11 + services/ske/model_cluster_status.go | 2 - services/ske/model_cluster_status_state.go | 2 - ..._provider_options_request_version_state.go | 4 +- services/ske/model_network.go | 49 +- .../ske/model_v2_control_plane_network.go | 127 +++ .../model_v2_control_plane_network_test.go | 11 + services/ske/oas_commit | 2 +- 10 files changed, 314 insertions(+), 782 deletions(-) delete mode 100644 services/ske/api_default_test.go create mode 100644 services/ske/model_access_scope.go create mode 100644 services/ske/model_access_scope_test.go create mode 100644 services/ske/model_v2_control_plane_network.go create mode 100644 services/ske/model_v2_control_plane_network_test.go diff --git a/services/ske/api_default_test.go b/services/ske/api_default_test.go deleted file mode 100644 index 8c07b5cf7..000000000 --- a/services/ske/api_default_test.go +++ /dev/null @@ -1,773 +0,0 @@ -/* -STACKIT Kubernetes Engine API - -Testing DefaultApiService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - -package ske - -import ( - "context" - "encoding/json" - "net/http" - "net/http/httptest" - "net/url" - "strings" - "testing" - - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -func Test_ske_DefaultApiService(t *testing.T) { - - t.Run("Test DefaultApiService CompleteCredentialsRotation", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/complete-credentials-rotation" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.CompleteCredentialsRotation(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService CreateKubeconfig", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/kubeconfig" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := Kubeconfig{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - createKubeconfigPayload := CreateKubeconfigPayload{} - - resp, reqErr := apiClient.CreateKubeconfig(context.Background(), projectId, region, clusterName).CreateKubeconfigPayload(createKubeconfigPayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService CreateOrUpdateCluster", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := Cluster{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - createOrUpdateClusterPayload := CreateOrUpdateClusterPayload{} - - resp, reqErr := apiClient.CreateOrUpdateCluster(context.Background(), projectId, region, clusterName).CreateOrUpdateClusterPayload(createOrUpdateClusterPayload).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService DeleteCluster", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.DeleteCluster(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService GetCluster", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := Cluster{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.GetCluster(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService GetLoginKubeconfig", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/kubeconfig/login" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := LoginKubeconfig{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.GetLoginKubeconfig(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListClusters", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListClustersResponse{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - - resp, reqErr := apiClient.ListClusters(context.Background(), projectId, region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService ListProviderOptions", func(t *testing.T) { - _apiUrlPath := "/v2/regions/{region}/provider-options" - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ProviderOptions{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - region := regionValue - - resp, reqErr := apiClient.ListProviderOptions(context.Background(), region).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService StartCredentialsRotation", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/start-credentials-rotation" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.StartCredentialsRotation(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService TriggerHibernate", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/hibernate" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.TriggerHibernate(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService TriggerMaintenance", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/maintenance" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.TriggerMaintenance(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService TriggerReconcile", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/reconcile" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.TriggerReconcile(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService TriggerWakeup", func(t *testing.T) { - _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/clusters/{clusterName}/wakeup" - projectIdValue := "projectId-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - clusterNameValue := "clusterName-value" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := map[string]interface{}{} - w.Header().Add("Content-Type", "application/json") - json.NewEncoder(w).Encode(data) - }) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() - - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for ske_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) - if err != nil { - t.Fatalf("creating API client: %v", err) - } - - projectId := projectIdValue - region := regionValue - clusterName := clusterNameValue - - resp, reqErr := apiClient.TriggerWakeup(context.Background(), projectId, region, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }) - -} diff --git a/services/ske/model_access_scope.go b/services/ske/model_access_scope.go new file mode 100644 index 000000000..fd273e60a --- /dev/null +++ b/services/ske/model_access_scope.go @@ -0,0 +1,115 @@ +/* +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" + "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. +type AccessScope string + +// List of AccessScope +const ( + ACCESSSCOPE_PUBLIC AccessScope = "PUBLIC" + ACCESSSCOPE_SNA AccessScope = "SNA" +) + +// All allowed values of AccessScope enum +var AllowedAccessScopeEnumValues = []AccessScope{ + "PUBLIC", + "SNA", +} + +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 +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 +func (v AccessScope) IsValid() bool { + for _, existing := range AllowedAccessScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AccessScope value +func (v AccessScope) Ptr() *AccessScope { + return &v +} + +type NullableAccessScope struct { + value *AccessScope + isSet bool +} + +func (v NullableAccessScope) Get() *AccessScope { + return v.value +} + +func (v *NullableAccessScope) Set(val *AccessScope) { + v.value = val + v.isSet = true +} + +func (v NullableAccessScope) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessScope(val *AccessScope) *NullableAccessScope { + return &NullableAccessScope{value: val, isSet: true} +} + +func (v NullableAccessScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/ske/model_access_scope_test.go b/services/ske/model_access_scope_test.go new file mode 100644 index 000000000..be50da75a --- /dev/null +++ b/services/ske/model_access_scope_test.go @@ -0,0 +1,11 @@ +/* +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 diff --git a/services/ske/model_cluster_status.go b/services/ske/model_cluster_status.go index a580cf790..4311902e8 100644 --- a/services/ske/model_cluster_status.go +++ b/services/ske/model_cluster_status.go @@ -229,8 +229,6 @@ func NewClusterStatus() *ClusterStatus { // but it doesn't guarantee that properties required by API are set func NewClusterStatusWithDefaults() *ClusterStatus { this := ClusterStatus{} - var aggregated ClusterStatusState = CLUSTERSTATUSSTATE_UNSPECIFIED - this.Aggregated = &aggregated return &this } diff --git a/services/ske/model_cluster_status_state.go b/services/ske/model_cluster_status_state.go index ea9dea0bb..3cfd13125 100644 --- a/services/ske/model_cluster_status_state.go +++ b/services/ske/model_cluster_status_state.go @@ -20,7 +20,6 @@ type ClusterStatusState string // List of ClusterStatusState const ( - CLUSTERSTATUSSTATE_UNSPECIFIED ClusterStatusState = "STATE_UNSPECIFIED" CLUSTERSTATUSSTATE_HEALTHY ClusterStatusState = "STATE_HEALTHY" CLUSTERSTATUSSTATE_CREATING ClusterStatusState = "STATE_CREATING" CLUSTERSTATUSSTATE_DELETING ClusterStatusState = "STATE_DELETING" @@ -33,7 +32,6 @@ const ( // All allowed values of ClusterStatusState enum var AllowedClusterStatusStateEnumValues = []ClusterStatusState{ - "STATE_UNSPECIFIED", "STATE_HEALTHY", "STATE_CREATING", "STATE_DELETING", diff --git a/services/ske/model_get_provider_options_request_version_state.go b/services/ske/model_get_provider_options_request_version_state.go index 0f654bf77..e83c82cb3 100644 --- a/services/ske/model_get_provider_options_request_version_state.go +++ b/services/ske/model_get_provider_options_request_version_state.go @@ -20,13 +20,11 @@ type GetProviderOptionsRequestVersionState string // List of GetProviderOptionsRequestVersionState const ( - GETPROVIDEROPTIONSREQUESTVERSIONSTATE_UNSPECIFIED GetProviderOptionsRequestVersionState = "UNSPECIFIED" - GETPROVIDEROPTIONSREQUESTVERSIONSTATE_SUPPORTED GetProviderOptionsRequestVersionState = "SUPPORTED" + GETPROVIDEROPTIONSREQUESTVERSIONSTATE_SUPPORTED GetProviderOptionsRequestVersionState = "SUPPORTED" ) // All allowed values of GetProviderOptionsRequestVersionState enum var AllowedGetProviderOptionsRequestVersionStateEnumValues = []GetProviderOptionsRequestVersionState{ - "UNSPECIFIED", "SUPPORTED", } diff --git a/services/ske/model_network.go b/services/ske/model_network.go index 9b7d0981e..a3ed5c090 100644 --- a/services/ske/model_network.go +++ b/services/ske/model_network.go @@ -17,6 +17,26 @@ import ( // checks if the Network type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Network{} +/* + types and functions for controlPlane +*/ + +// isModel +type NetworkGetControlPlaneAttributeType = *V2ControlPlaneNetwork +type NetworkGetControlPlaneArgType = V2ControlPlaneNetwork +type NetworkGetControlPlaneRetType = V2ControlPlaneNetwork + +func getNetworkGetControlPlaneAttributeTypeOk(arg NetworkGetControlPlaneAttributeType) (ret NetworkGetControlPlaneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetControlPlaneAttributeType(arg *NetworkGetControlPlaneAttributeType, val NetworkGetControlPlaneRetType) { + *arg = &val +} + /* types and functions for id */ @@ -40,7 +60,8 @@ type NetworkGetIdRetType = string // Network struct for Network type Network struct { - Id NetworkGetIdAttributeType `json:"id,omitempty"` + ControlPlane NetworkGetControlPlaneAttributeType `json:"controlPlane,omitempty"` + Id NetworkGetIdAttributeType `json:"id,omitempty"` } // NewNetwork instantiates a new Network object @@ -60,6 +81,29 @@ func NewNetworkWithDefaults() *Network { return &this } +// GetControlPlane returns the ControlPlane field value if set, zero value otherwise. +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. +func (o *Network) GetControlPlaneOk() (ret NetworkGetControlPlaneRetType, ok bool) { + return getNetworkGetControlPlaneAttributeTypeOk(o.ControlPlane) +} + +// HasControlPlane returns a boolean if a field has been set. +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. +func (o *Network) SetControlPlane(v NetworkGetControlPlaneRetType) { + setNetworkGetControlPlaneAttributeType(&o.ControlPlane, v) +} + // GetId returns the Id field value if set, zero value otherwise. func (o *Network) GetId() (res NetworkGetIdRetType) { res, _ = o.GetIdOk() @@ -85,6 +129,9 @@ func (o *Network) SetId(v NetworkGetIdRetType) { 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 } diff --git a/services/ske/model_v2_control_plane_network.go b/services/ske/model_v2_control_plane_network.go new file mode 100644 index 000000000..c838baef2 --- /dev/null +++ b/services/ske/model_v2_control_plane_network.go @@ -0,0 +1,127 @@ +/* +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" +) + +// checks if the V2ControlPlaneNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2ControlPlaneNetwork{} + +/* + types and functions for accessScope +*/ + +// isEnumRef +type V2ControlPlaneNetworkGetAccessScopeAttributeType = *AccessScope +type V2ControlPlaneNetworkGetAccessScopeArgType = AccessScope +type V2ControlPlaneNetworkGetAccessScopeRetType = AccessScope + +func getV2ControlPlaneNetworkGetAccessScopeAttributeTypeOk(arg V2ControlPlaneNetworkGetAccessScopeAttributeType) (ret V2ControlPlaneNetworkGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2ControlPlaneNetworkGetAccessScopeAttributeType(arg *V2ControlPlaneNetworkGetAccessScopeAttributeType, val V2ControlPlaneNetworkGetAccessScopeRetType) { + *arg = &val +} + +// V2ControlPlaneNetwork struct for V2ControlPlaneNetwork +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 +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 +func NewV2ControlPlaneNetworkWithDefaults() *V2ControlPlaneNetwork { + this := V2ControlPlaneNetwork{} + return &this +} + +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +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. +func (o *V2ControlPlaneNetwork) GetAccessScopeOk() (ret V2ControlPlaneNetworkGetAccessScopeRetType, ok bool) { + return getV2ControlPlaneNetworkGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// HasAccessScope returns a boolean if a field has been set. +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. +func (o *V2ControlPlaneNetwork) SetAccessScope(v V2ControlPlaneNetworkGetAccessScopeRetType) { + setV2ControlPlaneNetworkGetAccessScopeAttributeType(&o.AccessScope, v) +} + +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 +} + +type NullableV2ControlPlaneNetwork struct { + value *V2ControlPlaneNetwork + isSet bool +} + +func (v NullableV2ControlPlaneNetwork) Get() *V2ControlPlaneNetwork { + return v.value +} + +func (v *NullableV2ControlPlaneNetwork) Set(val *V2ControlPlaneNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableV2ControlPlaneNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableV2ControlPlaneNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2ControlPlaneNetwork(val *V2ControlPlaneNetwork) *NullableV2ControlPlaneNetwork { + return &NullableV2ControlPlaneNetwork{value: val, isSet: true} +} + +func (v NullableV2ControlPlaneNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2ControlPlaneNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/ske/model_v2_control_plane_network_test.go b/services/ske/model_v2_control_plane_network_test.go new file mode 100644 index 000000000..be50da75a --- /dev/null +++ b/services/ske/model_v2_control_plane_network_test.go @@ -0,0 +1,11 @@ +/* +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 diff --git a/services/ske/oas_commit b/services/ske/oas_commit index 1c4304d8a..47b49289a 100644 --- a/services/ske/oas_commit +++ b/services/ske/oas_commit @@ -1 +1 @@ -4ba9d6ffcf1ec61aff0807a261f8c0ca25d266f8 +d7a7113a1117f58b72d89fb9f7ecc3cc9e94c8ad