From 81052237db6aa516b58fd5479226276eb9c0dff4 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 17 Jan 2025 08:24:27 +0000 Subject: [PATCH] Generate sqlserverflex --- services/ske/api_default.go | 812 +----------------- services/ske/api_default_test.go | 266 ------ services/ske/model_cluster_status.go | 13 +- services/ske/model_credentials.go | 225 ----- .../ske/model_credentials_rotation_state.go | 27 +- services/ske/model_kubeconfig.go | 15 +- services/ske/model_kubernetes_version.go | 13 +- services/ske/model_machine_image_version.go | 19 +- services/ske/model_machine_type.go | 11 +- services/ske/model_nodepool.go | 10 +- services/ske/model_project_response.go | 156 ---- services/ske/model_project_state.go | 121 --- services/ske/model_time_window.go | 23 +- services/ske/model_volume.go | 1 + services/sqlserverflex/api_default.go | 116 --- services/sqlserverflex/api_default_test.go | 46 - 16 files changed, 111 insertions(+), 1763 deletions(-) delete mode 100644 services/ske/model_credentials.go delete mode 100644 services/ske/model_project_response.go delete mode 100644 services/ske/model_project_state.go diff --git a/services/ske/api_default.go b/services/ske/api_default.go index c774162b8..8aa74ccff 100644 --- a/services/ske/api_default.go +++ b/services/ske/api_default.go @@ -612,602 +612,27 @@ func (a *APIClient) DeleteClusterExecute(ctx context.Context, projectId string, return r.Execute() } -type ApiDisableServiceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string -} - -func (r ApiDisableServiceRequest) Execute() (map[string]interface{}, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue map[string]interface{} - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DisableService") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 := a.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 := a.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 = a.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 = a.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 = a.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 -} - -/* -DisableService: Delete a project - -Deprecated: This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. - -Deletes the SKE project specified by `projectId`. Deleting a project deletes all corresponding shoots. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @return ApiDisableServiceRequest -*/ -func (a *APIClient) DisableService(ctx context.Context, projectId string) ApiDisableServiceRequest { - return ApiDisableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } -} - -/* -Deprecated: This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. - -Deletes the SKE project specified by `projectId`. Deleting a project deletes all corresponding shoots. -*/ -func (a *APIClient) DisableServiceExecute(ctx context.Context, projectId string) (map[string]interface{}, error) { - r := ApiDisableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } - return r.Execute() -} - -type ApiEnableServiceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string -} - -func (r ApiEnableServiceRequest) Execute() (*ProjectResponse, error) { - var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ProjectResponse - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.EnableService") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 := a.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 := a.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 = a.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 = a.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 = a.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 -} - -/* -EnableService: Create a Project - -Deprecated: This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. - -Returns creation state of Project specified by `projectId`. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @return ApiEnableServiceRequest -*/ -func (a *APIClient) EnableService(ctx context.Context, projectId string) ApiEnableServiceRequest { - return ApiEnableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } -} - -/* -Deprecated: This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. - -Returns creation state of Project specified by `projectId`. -*/ -func (a *APIClient) EnableServiceExecute(ctx context.Context, projectId string) (*ProjectResponse, error) { - r := ApiEnableServiceRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } - return r.Execute() -} - -type ApiGetClusterRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - clusterName string -} - -func (r ApiGetClusterRequest) Execute() (*Cluster, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Cluster - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCluster") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}/clusters/{clusterName}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 := a.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 := a.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, - } - var v RuntimeError - err = a.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 = a.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 - -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 clusterName - @return ApiGetClusterRequest -*/ -func (a *APIClient) GetCluster(ctx context.Context, projectId string, clusterName string) ApiGetClusterRequest { - return ApiGetClusterRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - clusterName: clusterName, - } -} - -func (a *APIClient) GetClusterExecute(ctx context.Context, projectId string, clusterName string) (*Cluster, error) { - r := ApiGetClusterRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - clusterName: clusterName, - } - return r.Execute() -} - -type ApiGetCredentialsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - clusterName string -} - -func (r ApiGetCredentialsRequest) Execute() (*Credentials, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Credentials - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCredentials") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}/clusters/{clusterName}/credentials" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 := a.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 := a.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 = a.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 = a.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 = a.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 = a.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 -} - -/* -GetCredentials: Get credentials for a cluster - -Deprecated: This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [kubeconfig](#tag/Credentials/operation/SkeService_CreateKubeconfig) instead to obtain a kubeconfig. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). - -Get credentials for the cluster specified by `clusterName`, 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 clusterName - @return ApiGetCredentialsRequest -*/ -func (a *APIClient) GetCredentials(ctx context.Context, projectId string, clusterName string) ApiGetCredentialsRequest { - return ApiGetCredentialsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - clusterName: clusterName, - } -} - -/* -Deprecated: This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [kubeconfig](#tag/Credentials/operation/SkeService_CreateKubeconfig) instead to obtain a kubeconfig. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). - -Get credentials for the cluster specified by `clusterName`, belonging to the project specified by `projectId`. -*/ -func (a *APIClient) GetCredentialsExecute(ctx context.Context, projectId string, clusterName string) (*Credentials, error) { - r := ApiGetCredentialsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - clusterName: clusterName, - } - return r.Execute() -} - -type ApiGetLoginKubeconfigRequest struct { +type ApiGetClusterRequest struct { ctx context.Context apiService *DefaultApiService projectId string clusterName string } -func (r ApiGetLoginKubeconfigRequest) Execute() (*LoginKubeconfig, error) { +func (r ApiGetClusterRequest) Execute() (*Cluster, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *LoginKubeconfig + localVarReturnValue *Cluster ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLoginKubeconfig") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCluster") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig/login" + localVarPath := localBasePath + "/v1/projects/{projectId}/clusters/{clusterName}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) @@ -1289,17 +714,17 @@ func (r ApiGetLoginKubeconfigRequest) Execute() (*LoginKubeconfig, error) { } /* -GetLoginKubeconfig: Get a kubeconfig for use with the STACKIT CLI +GetCluster: Get a cluster -A kubeconfig retrieved using this endpoint does not contain any credentials and instead obtains valid credentials via the STACKIT CLI. +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 clusterName - @return ApiGetLoginKubeconfigRequest + @return ApiGetClusterRequest */ -func (a *APIClient) GetLoginKubeconfig(ctx context.Context, projectId string, clusterName string) ApiGetLoginKubeconfigRequest { - return ApiGetLoginKubeconfigRequest{ +func (a *APIClient) GetCluster(ctx context.Context, projectId string, clusterName string) ApiGetClusterRequest { + return ApiGetClusterRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -1307,8 +732,8 @@ func (a *APIClient) GetLoginKubeconfig(ctx context.Context, projectId string, cl } } -func (a *APIClient) GetLoginKubeconfigExecute(ctx context.Context, projectId string, clusterName string) (*LoginKubeconfig, error) { - r := ApiGetLoginKubeconfigRequest{ +func (a *APIClient) GetClusterExecute(ctx context.Context, projectId string, clusterName string) (*Cluster, error) { + r := ApiGetClusterRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, @@ -1317,27 +742,29 @@ func (a *APIClient) GetLoginKubeconfigExecute(ctx context.Context, projectId str return r.Execute() } -type ApiGetServiceStatusRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string +type ApiGetLoginKubeconfigRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + clusterName string } -func (r ApiGetServiceStatusRequest) Execute() (*ProjectResponse, error) { +func (r ApiGetLoginKubeconfigRequest) Execute() (*LoginKubeconfig, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ProjectResponse + localVarReturnValue *LoginKubeconfig ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServiceStatus") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLoginKubeconfig") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig/login" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(r.clusterName, "clusterName")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1392,17 +819,6 @@ func (r ApiGetServiceStatusRequest) Execute() (*ProjectResponse, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 404 { - var v map[string]interface{} - err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1428,34 +844,30 @@ func (r ApiGetServiceStatusRequest) Execute() (*ProjectResponse, error) { } /* -GetServiceStatus: Get a Project - -Deprecated: This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. +GetLoginKubeconfig: Get a kubeconfig for use with the STACKIT CLI -Get a Project specified by `projectId`. +A 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 - @return ApiGetServiceStatusRequest + @param clusterName + @return ApiGetLoginKubeconfigRequest */ -func (a *APIClient) GetServiceStatus(ctx context.Context, projectId string) ApiGetServiceStatusRequest { - return ApiGetServiceStatusRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) GetLoginKubeconfig(ctx context.Context, projectId string, clusterName string) ApiGetLoginKubeconfigRequest { + return ApiGetLoginKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + clusterName: clusterName, } } -/* -Deprecated: This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. - -Get a Project specified by `projectId`. -*/ -func (a *APIClient) GetServiceStatusExecute(ctx context.Context, projectId string) (*ProjectResponse, error) { - r := ApiGetServiceStatusRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, +func (a *APIClient) GetLoginKubeconfigExecute(ctx context.Context, projectId string, clusterName string) (*LoginKubeconfig, error) { + r := ApiGetLoginKubeconfigRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + clusterName: clusterName, } return r.Execute() } @@ -2301,151 +1713,3 @@ func (a *APIClient) TriggerReconcileExecute(ctx context.Context, projectId strin } return r.Execute() } - -type ApiTriggerRotateCredentialsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - clusterName string -} - -func (r ApiTriggerRotateCredentialsRequest) Execute() (map[string]interface{}, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue map[string]interface{} - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.TriggerRotateCredentials") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}/clusters/{clusterName}/rotate-credentials" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 := a.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 := a.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 == 404 { - var v map[string]interface{} - err = a.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 = a.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 = a.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 -} - -/* -TriggerRotateCredentials: Rotate cluster credentials - -Deprecated: This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [start-credentials-rotation](#tag/Credentials/operation/SkeService_StartClusterCredentialsRotation) instead to rotate all cluster credentials. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). - -Trigger credential rotation. The old credentials (kubeconfig) will be invalid after the operation. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param clusterName - @return ApiTriggerRotateCredentialsRequest -*/ -func (a *APIClient) TriggerRotateCredentials(ctx context.Context, projectId string, clusterName string) ApiTriggerRotateCredentialsRequest { - return ApiTriggerRotateCredentialsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - clusterName: clusterName, - } -} - -/* -Deprecated: This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [start-credentials-rotation](#tag/Credentials/operation/SkeService_StartClusterCredentialsRotation) instead to rotate all cluster credentials. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). - -Trigger credential rotation. The old credentials (kubeconfig) will be invalid after the operation. -*/ -func (a *APIClient) TriggerRotateCredentialsExecute(ctx context.Context, projectId string, clusterName string) (map[string]interface{}, error) { - r := ApiTriggerRotateCredentialsRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - clusterName: clusterName, - } - return r.Execute() -} diff --git a/services/ske/api_default_test.go b/services/ske/api_default_test.go index 3f6161efb..df4f74c4f 100644 --- a/services/ske/api_default_test.go +++ b/services/ske/api_default_test.go @@ -245,110 +245,6 @@ func Test_ske_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DisableService", func(t *testing.T) { - path := "/v1/projects/{projectId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, 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 := "projectId" - - resp, reqErr := apiClient.DisableService(context.Background(), projectId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if resp == nil { - t.Fatalf("response not present") - } - }) - - t.Run("Test DefaultApiService EnableService", func(t *testing.T) { - path := "/v1/projects/{projectId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ProjectResponse{} - 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 := "projectId" - - resp, reqErr := apiClient.EnableService(context.Background(), projectId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if resp == nil { - t.Fatalf("response not present") - } - }) - t.Run("Test DefaultApiService GetCluster", func(t *testing.T) { path := "/v1/projects/{projectId}/clusters/{clusterName}" projectIdValue := "projectId" @@ -404,61 +300,6 @@ func Test_ske_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { - path := "/v1/projects/{projectId}/clusters/{clusterName}/credentials" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" - path = strings.Replace(path, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := Credentials{} - 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 := "projectId" - clusterName := "clusterName" - - resp, reqErr := apiClient.GetCredentials(context.Background(), projectId, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if resp == nil { - t.Fatalf("response not present") - } - }) - t.Run("Test DefaultApiService GetLoginKubeconfig", func(t *testing.T) { path := "/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig/login" projectIdValue := "projectId" @@ -514,58 +355,6 @@ func Test_ske_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetServiceStatus", func(t *testing.T) { - path := "/v1/projects/{projectId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - data := ProjectResponse{} - 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 := "projectId" - - resp, reqErr := apiClient.GetServiceStatus(context.Background(), projectId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if resp == nil { - t.Fatalf("response not present") - } - }) - t.Run("Test DefaultApiService ListClusters", func(t *testing.T) { path := "/v1/projects/{projectId}/clusters" projectIdValue := "projectId" @@ -886,59 +675,4 @@ func Test_ske_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService TriggerRotateCredentials", func(t *testing.T) { - path := "/v1/projects/{projectId}/clusters/{clusterName}/rotate-credentials" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" - path = strings.Replace(path, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, 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 := "projectId" - clusterName := "clusterName" - - resp, reqErr := apiClient.TriggerRotateCredentials(context.Background(), projectId, clusterName).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if resp == nil { - t.Fatalf("response not present") - } - }) - } diff --git a/services/ske/model_cluster_status.go b/services/ske/model_cluster_status.go index 87f3bafdd..66d9f21ff 100644 --- a/services/ske/model_cluster_status.go +++ b/services/ske/model_cluster_status.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "time" ) // checks if the ClusterStatus type satisfies the MappedNullable interface at compile time @@ -21,7 +22,7 @@ var _ MappedNullable = &ClusterStatus{} type ClusterStatus struct { Aggregated *ClusterStatusState `json:"aggregated,omitempty"` // Format: `2024-02-15T11:06:29Z` - CreationTime *string `json:"creationTime,omitempty"` + CreationTime *time.Time `json:"creationTime,omitempty"` CredentialsRotation *CredentialsRotationState `json:"credentialsRotation,omitempty"` Error *RuntimeError `json:"error,omitempty"` Hibernated *bool `json:"hibernated,omitempty"` @@ -81,9 +82,9 @@ func (o *ClusterStatus) SetAggregated(v *ClusterStatusState) { } // GetCreationTime returns the CreationTime field value if set, zero value otherwise. -func (o *ClusterStatus) GetCreationTime() *string { +func (o *ClusterStatus) GetCreationTime() *time.Time { if o == nil || IsNil(o.CreationTime) { - var ret *string + var ret *time.Time return ret } return o.CreationTime @@ -91,7 +92,7 @@ func (o *ClusterStatus) GetCreationTime() *string { // GetCreationTimeOk returns a tuple with the CreationTime field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *ClusterStatus) GetCreationTimeOk() (*string, bool) { +func (o *ClusterStatus) GetCreationTimeOk() (*time.Time, bool) { if o == nil || IsNil(o.CreationTime) { return nil, false } @@ -107,8 +108,8 @@ func (o *ClusterStatus) HasCreationTime() bool { return false } -// SetCreationTime gets a reference to the given string and assigns it to the CreationTime field. -func (o *ClusterStatus) SetCreationTime(v *string) { +// SetCreationTime gets a reference to the given time.Time and assigns it to the CreationTime field. +func (o *ClusterStatus) SetCreationTime(v *time.Time) { o.CreationTime = v } diff --git a/services/ske/model_credentials.go b/services/ske/model_credentials.go deleted file mode 100644 index d574f2d88..000000000 --- a/services/ske/model_credentials.go +++ /dev/null @@ -1,225 +0,0 @@ -/* -SKE-API - -The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. - -API version: 1.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ske - -import ( - "encoding/json" -) - -// checks if the Credentials type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Credentials{} - -// Credentials struct for Credentials -type Credentials struct { - CertificateAuthorityData *string `json:"certificateAuthorityData,omitempty"` - // This string contains the kubeconfig as yaml. - Kubeconfig *string `json:"kubeconfig,omitempty"` - Server *string `json:"server,omitempty"` - Token *string `json:"token,omitempty"` -} - -// NewCredentials instantiates a new Credentials 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 NewCredentials() *Credentials { - this := Credentials{} - return &this -} - -// NewCredentialsWithDefaults instantiates a new Credentials 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 NewCredentialsWithDefaults() *Credentials { - this := Credentials{} - return &this -} - -// GetCertificateAuthorityData returns the CertificateAuthorityData field value if set, zero value otherwise. -func (o *Credentials) GetCertificateAuthorityData() *string { - if o == nil || IsNil(o.CertificateAuthorityData) { - var ret *string - return ret - } - return o.CertificateAuthorityData -} - -// GetCertificateAuthorityDataOk returns a tuple with the CertificateAuthorityData field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Credentials) GetCertificateAuthorityDataOk() (*string, bool) { - if o == nil || IsNil(o.CertificateAuthorityData) { - return nil, false - } - return o.CertificateAuthorityData, true -} - -// HasCertificateAuthorityData returns a boolean if a field has been set. -func (o *Credentials) HasCertificateAuthorityData() bool { - if o != nil && !IsNil(o.CertificateAuthorityData) { - return true - } - - return false -} - -// SetCertificateAuthorityData gets a reference to the given string and assigns it to the CertificateAuthorityData field. -func (o *Credentials) SetCertificateAuthorityData(v *string) { - o.CertificateAuthorityData = v -} - -// GetKubeconfig returns the Kubeconfig field value if set, zero value otherwise. -func (o *Credentials) GetKubeconfig() *string { - if o == nil || IsNil(o.Kubeconfig) { - var ret *string - return ret - } - return o.Kubeconfig -} - -// GetKubeconfigOk returns a tuple with the Kubeconfig field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Credentials) GetKubeconfigOk() (*string, bool) { - if o == nil || IsNil(o.Kubeconfig) { - return nil, false - } - return o.Kubeconfig, true -} - -// HasKubeconfig returns a boolean if a field has been set. -func (o *Credentials) HasKubeconfig() bool { - if o != nil && !IsNil(o.Kubeconfig) { - return true - } - - return false -} - -// SetKubeconfig gets a reference to the given string and assigns it to the Kubeconfig field. -func (o *Credentials) SetKubeconfig(v *string) { - o.Kubeconfig = v -} - -// GetServer returns the Server field value if set, zero value otherwise. -func (o *Credentials) GetServer() *string { - if o == nil || IsNil(o.Server) { - var ret *string - return ret - } - return o.Server -} - -// GetServerOk returns a tuple with the Server field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Credentials) GetServerOk() (*string, bool) { - if o == nil || IsNil(o.Server) { - return nil, false - } - return o.Server, true -} - -// HasServer returns a boolean if a field has been set. -func (o *Credentials) HasServer() bool { - if o != nil && !IsNil(o.Server) { - return true - } - - return false -} - -// SetServer gets a reference to the given string and assigns it to the Server field. -func (o *Credentials) SetServer(v *string) { - o.Server = v -} - -// GetToken returns the Token field value if set, zero value otherwise. -func (o *Credentials) GetToken() *string { - if o == nil || IsNil(o.Token) { - var ret *string - return ret - } - return o.Token -} - -// GetTokenOk returns a tuple with the Token field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Credentials) GetTokenOk() (*string, bool) { - if o == nil || IsNil(o.Token) { - return nil, false - } - return o.Token, true -} - -// HasToken returns a boolean if a field has been set. -func (o *Credentials) HasToken() bool { - if o != nil && !IsNil(o.Token) { - return true - } - - return false -} - -// SetToken gets a reference to the given string and assigns it to the Token field. -func (o *Credentials) SetToken(v *string) { - o.Token = v -} - -func (o Credentials) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.CertificateAuthorityData) { - toSerialize["certificateAuthorityData"] = o.CertificateAuthorityData - } - if !IsNil(o.Kubeconfig) { - toSerialize["kubeconfig"] = o.Kubeconfig - } - if !IsNil(o.Server) { - toSerialize["server"] = o.Server - } - if !IsNil(o.Token) { - toSerialize["token"] = o.Token - } - return toSerialize, nil -} - -type NullableCredentials struct { - value *Credentials - isSet bool -} - -func (v NullableCredentials) Get() *Credentials { - return v.value -} - -func (v *NullableCredentials) Set(val *Credentials) { - v.value = val - v.isSet = true -} - -func (v NullableCredentials) IsSet() bool { - return v.isSet -} - -func (v *NullableCredentials) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableCredentials(val *Credentials) *NullableCredentials { - return &NullableCredentials{value: val, isSet: true} -} - -func (v NullableCredentials) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableCredentials) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/ske/model_credentials_rotation_state.go b/services/ske/model_credentials_rotation_state.go index e77ca6c93..d71f40d3e 100644 --- a/services/ske/model_credentials_rotation_state.go +++ b/services/ske/model_credentials_rotation_state.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "time" ) // checks if the CredentialsRotationState type satisfies the MappedNullable interface at compile time @@ -20,10 +21,10 @@ var _ MappedNullable = &CredentialsRotationState{} // CredentialsRotationState struct for CredentialsRotationState type CredentialsRotationState struct { // Format: `2024-02-15T11:06:29Z` - LastCompletionTime *string `json:"lastCompletionTime,omitempty"` + LastCompletionTime *time.Time `json:"lastCompletionTime,omitempty"` // Format: `2024-02-15T11:06:29Z` - LastInitiationTime *string `json:"lastInitiationTime,omitempty"` - // Phase of the credentials rotation. `NEVER` indicates that no credentials rotation has been performed using the new credentials rotation endpoints yet. Using the deprecated [rotate-credentials](#tag/Credentials/operation/SkeService_GetClusterCredentials) endpoint will not update this status field. + LastInitiationTime *time.Time `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 *string `json:"phase,omitempty"` } @@ -45,9 +46,9 @@ func NewCredentialsRotationStateWithDefaults() *CredentialsRotationState { } // GetLastCompletionTime returns the LastCompletionTime field value if set, zero value otherwise. -func (o *CredentialsRotationState) GetLastCompletionTime() *string { +func (o *CredentialsRotationState) GetLastCompletionTime() *time.Time { if o == nil || IsNil(o.LastCompletionTime) { - var ret *string + var ret *time.Time return ret } return o.LastCompletionTime @@ -55,7 +56,7 @@ func (o *CredentialsRotationState) GetLastCompletionTime() *string { // GetLastCompletionTimeOk returns a tuple with the LastCompletionTime field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CredentialsRotationState) GetLastCompletionTimeOk() (*string, bool) { +func (o *CredentialsRotationState) GetLastCompletionTimeOk() (*time.Time, bool) { if o == nil || IsNil(o.LastCompletionTime) { return nil, false } @@ -71,15 +72,15 @@ func (o *CredentialsRotationState) HasLastCompletionTime() bool { return false } -// SetLastCompletionTime gets a reference to the given string and assigns it to the LastCompletionTime field. -func (o *CredentialsRotationState) SetLastCompletionTime(v *string) { +// SetLastCompletionTime gets a reference to the given time.Time and assigns it to the LastCompletionTime field. +func (o *CredentialsRotationState) SetLastCompletionTime(v *time.Time) { o.LastCompletionTime = v } // GetLastInitiationTime returns the LastInitiationTime field value if set, zero value otherwise. -func (o *CredentialsRotationState) GetLastInitiationTime() *string { +func (o *CredentialsRotationState) GetLastInitiationTime() *time.Time { if o == nil || IsNil(o.LastInitiationTime) { - var ret *string + var ret *time.Time return ret } return o.LastInitiationTime @@ -87,7 +88,7 @@ func (o *CredentialsRotationState) GetLastInitiationTime() *string { // GetLastInitiationTimeOk returns a tuple with the LastInitiationTime field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CredentialsRotationState) GetLastInitiationTimeOk() (*string, bool) { +func (o *CredentialsRotationState) GetLastInitiationTimeOk() (*time.Time, bool) { if o == nil || IsNil(o.LastInitiationTime) { return nil, false } @@ -103,8 +104,8 @@ func (o *CredentialsRotationState) HasLastInitiationTime() bool { return false } -// SetLastInitiationTime gets a reference to the given string and assigns it to the LastInitiationTime field. -func (o *CredentialsRotationState) SetLastInitiationTime(v *string) { +// SetLastInitiationTime gets a reference to the given time.Time and assigns it to the LastInitiationTime field. +func (o *CredentialsRotationState) SetLastInitiationTime(v *time.Time) { o.LastInitiationTime = v } diff --git a/services/ske/model_kubeconfig.go b/services/ske/model_kubeconfig.go index a347eb05d..696a43da8 100644 --- a/services/ske/model_kubeconfig.go +++ b/services/ske/model_kubeconfig.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "time" ) // checks if the Kubeconfig type satisfies the MappedNullable interface at compile time @@ -19,8 +20,8 @@ var _ MappedNullable = &Kubeconfig{} // Kubeconfig struct for Kubeconfig type Kubeconfig struct { - ExpirationTimestamp *string `json:"expirationTimestamp,omitempty"` - Kubeconfig *string `json:"kubeconfig,omitempty"` + ExpirationTimestamp *time.Time `json:"expirationTimestamp,omitempty"` + Kubeconfig *string `json:"kubeconfig,omitempty"` } // NewKubeconfig instantiates a new Kubeconfig object @@ -41,9 +42,9 @@ func NewKubeconfigWithDefaults() *Kubeconfig { } // GetExpirationTimestamp returns the ExpirationTimestamp field value if set, zero value otherwise. -func (o *Kubeconfig) GetExpirationTimestamp() *string { +func (o *Kubeconfig) GetExpirationTimestamp() *time.Time { if o == nil || IsNil(o.ExpirationTimestamp) { - var ret *string + var ret *time.Time return ret } return o.ExpirationTimestamp @@ -51,7 +52,7 @@ func (o *Kubeconfig) GetExpirationTimestamp() *string { // GetExpirationTimestampOk returns a tuple with the ExpirationTimestamp field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Kubeconfig) GetExpirationTimestampOk() (*string, bool) { +func (o *Kubeconfig) GetExpirationTimestampOk() (*time.Time, bool) { if o == nil || IsNil(o.ExpirationTimestamp) { return nil, false } @@ -67,8 +68,8 @@ func (o *Kubeconfig) HasExpirationTimestamp() bool { return false } -// SetExpirationTimestamp gets a reference to the given string and assigns it to the ExpirationTimestamp field. -func (o *Kubeconfig) SetExpirationTimestamp(v *string) { +// SetExpirationTimestamp gets a reference to the given time.Time and assigns it to the ExpirationTimestamp field. +func (o *Kubeconfig) SetExpirationTimestamp(v *time.Time) { o.ExpirationTimestamp = v } diff --git a/services/ske/model_kubernetes_version.go b/services/ske/model_kubernetes_version.go index 281781e2f..0a0f106f8 100644 --- a/services/ske/model_kubernetes_version.go +++ b/services/ske/model_kubernetes_version.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "time" ) // checks if the KubernetesVersion type satisfies the MappedNullable interface at compile time @@ -19,7 +20,7 @@ var _ MappedNullable = &KubernetesVersion{} // KubernetesVersion struct for KubernetesVersion type KubernetesVersion struct { - ExpirationDate *string `json:"expirationDate,omitempty"` + ExpirationDate *time.Time `json:"expirationDate,omitempty"` FeatureGates *map[string]string `json:"featureGates,omitempty"` State *string `json:"state,omitempty"` Version *string `json:"version,omitempty"` @@ -43,9 +44,9 @@ func NewKubernetesVersionWithDefaults() *KubernetesVersion { } // GetExpirationDate returns the ExpirationDate field value if set, zero value otherwise. -func (o *KubernetesVersion) GetExpirationDate() *string { +func (o *KubernetesVersion) GetExpirationDate() *time.Time { if o == nil || IsNil(o.ExpirationDate) { - var ret *string + var ret *time.Time return ret } return o.ExpirationDate @@ -53,7 +54,7 @@ func (o *KubernetesVersion) GetExpirationDate() *string { // GetExpirationDateOk returns a tuple with the ExpirationDate field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *KubernetesVersion) GetExpirationDateOk() (*string, bool) { +func (o *KubernetesVersion) GetExpirationDateOk() (*time.Time, bool) { if o == nil || IsNil(o.ExpirationDate) { return nil, false } @@ -69,8 +70,8 @@ func (o *KubernetesVersion) HasExpirationDate() bool { return false } -// SetExpirationDate gets a reference to the given string and assigns it to the ExpirationDate field. -func (o *KubernetesVersion) SetExpirationDate(v *string) { +// SetExpirationDate gets a reference to the given time.Time and assigns it to the ExpirationDate field. +func (o *KubernetesVersion) SetExpirationDate(v *time.Time) { o.ExpirationDate = v } diff --git a/services/ske/model_machine_image_version.go b/services/ske/model_machine_image_version.go index 3286333a7..ea606be9c 100644 --- a/services/ske/model_machine_image_version.go +++ b/services/ske/model_machine_image_version.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "time" ) // checks if the MachineImageVersion type satisfies the MappedNullable interface at compile time @@ -19,10 +20,10 @@ var _ MappedNullable = &MachineImageVersion{} // MachineImageVersion struct for MachineImageVersion type MachineImageVersion struct { - Cri *[]CRI `json:"cri,omitempty"` - ExpirationDate *string `json:"expirationDate,omitempty"` - State *string `json:"state,omitempty"` - Version *string `json:"version,omitempty"` + Cri *[]CRI `json:"cri,omitempty"` + ExpirationDate *time.Time `json:"expirationDate,omitempty"` + State *string `json:"state,omitempty"` + Version *string `json:"version,omitempty"` } // NewMachineImageVersion instantiates a new MachineImageVersion object @@ -75,9 +76,9 @@ func (o *MachineImageVersion) SetCri(v *[]CRI) { } // GetExpirationDate returns the ExpirationDate field value if set, zero value otherwise. -func (o *MachineImageVersion) GetExpirationDate() *string { +func (o *MachineImageVersion) GetExpirationDate() *time.Time { if o == nil || IsNil(o.ExpirationDate) { - var ret *string + var ret *time.Time return ret } return o.ExpirationDate @@ -85,7 +86,7 @@ func (o *MachineImageVersion) GetExpirationDate() *string { // GetExpirationDateOk returns a tuple with the ExpirationDate field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *MachineImageVersion) GetExpirationDateOk() (*string, bool) { +func (o *MachineImageVersion) GetExpirationDateOk() (*time.Time, bool) { if o == nil || IsNil(o.ExpirationDate) { return nil, false } @@ -101,8 +102,8 @@ func (o *MachineImageVersion) HasExpirationDate() bool { return false } -// SetExpirationDate gets a reference to the given string and assigns it to the ExpirationDate field. -func (o *MachineImageVersion) SetExpirationDate(v *string) { +// SetExpirationDate gets a reference to the given time.Time and assigns it to the ExpirationDate field. +func (o *MachineImageVersion) SetExpirationDate(v *time.Time) { o.ExpirationDate = v } diff --git a/services/ske/model_machine_type.go b/services/ske/model_machine_type.go index d96892935..191cfa24a 100644 --- a/services/ske/model_machine_type.go +++ b/services/ske/model_machine_type.go @@ -20,10 +20,13 @@ var _ MappedNullable = &MachineType{} // MachineType struct for MachineType type MachineType struct { Architecture *string `json:"architecture,omitempty"` - Cpu *int64 `json:"cpu,omitempty"` - Gpu *int64 `json:"gpu,omitempty"` - Memory *int64 `json:"memory,omitempty"` - Name *string `json:"name,omitempty"` + // Can be cast to int32 without loss of precision. + Cpu *int64 `json:"cpu,omitempty"` + // Can be cast to int32 without loss of precision. + Gpu *int64 `json:"gpu,omitempty"` + // Can be cast to int32 without loss of precision. + Memory *int64 `json:"memory,omitempty"` + Name *string `json:"name,omitempty"` } // NewMachineType instantiates a new MachineType object diff --git a/services/ske/model_nodepool.go b/services/ske/model_nodepool.go index fe7811f5d..cde0c4aec 100644 --- a/services/ske/model_nodepool.go +++ b/services/ske/model_nodepool.go @@ -26,11 +26,15 @@ type Nodepool struct { Cri *CRI `json:"cri,omitempty"` Labels *map[string]string `json:"labels,omitempty"` // REQUIRED - Machine *Machine `json:"machine"` - MaxSurge *int64 `json:"maxSurge,omitempty"` - MaxUnavailable *int64 `json:"maxUnavailable,omitempty"` + Machine *Machine `json:"machine"` + // Can be cast to int32 without loss of precision. + MaxSurge *int64 `json:"maxSurge,omitempty"` + // Can be cast to int32 without loss of precision. + MaxUnavailable *int64 `json:"maxUnavailable,omitempty"` + // Can be cast to int32 without loss of precision. // REQUIRED Maximum *int64 `json:"maximum"` + // Can be cast to int32 without loss of precision. // REQUIRED Minimum *int64 `json:"minimum"` // Maximum 15 chars diff --git a/services/ske/model_project_response.go b/services/ske/model_project_response.go deleted file mode 100644 index fd7276b79..000000000 --- a/services/ske/model_project_response.go +++ /dev/null @@ -1,156 +0,0 @@ -/* -SKE-API - -The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. - -API version: 1.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ske - -import ( - "encoding/json" -) - -// checks if the ProjectResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ProjectResponse{} - -// ProjectResponse struct for ProjectResponse -type ProjectResponse struct { - ProjectId *string `json:"projectId,omitempty"` - State *ProjectState `json:"state,omitempty"` -} - -// NewProjectResponse instantiates a new ProjectResponse 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 NewProjectResponse() *ProjectResponse { - this := ProjectResponse{} - var state ProjectState = PROJECTSTATE_UNSPECIFIED - this.State = &state - return &this -} - -// NewProjectResponseWithDefaults instantiates a new ProjectResponse 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 NewProjectResponseWithDefaults() *ProjectResponse { - this := ProjectResponse{} - var state ProjectState = PROJECTSTATE_UNSPECIFIED - this.State = &state - return &this -} - -// GetProjectId returns the ProjectId field value if set, zero value otherwise. -func (o *ProjectResponse) GetProjectId() *string { - if o == nil || IsNil(o.ProjectId) { - var ret *string - return ret - } - return o.ProjectId -} - -// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProjectResponse) GetProjectIdOk() (*string, bool) { - if o == nil || IsNil(o.ProjectId) { - return nil, false - } - return o.ProjectId, true -} - -// HasProjectId returns a boolean if a field has been set. -func (o *ProjectResponse) HasProjectId() bool { - if o != nil && !IsNil(o.ProjectId) { - return true - } - - return false -} - -// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. -func (o *ProjectResponse) SetProjectId(v *string) { - o.ProjectId = v -} - -// GetState returns the State field value if set, zero value otherwise. -func (o *ProjectResponse) GetState() *ProjectState { - if o == nil || IsNil(o.State) { - var ret *ProjectState - return ret - } - return o.State -} - -// GetStateOk returns a tuple with the State field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ProjectResponse) GetStateOk() (*ProjectState, bool) { - if o == nil || IsNil(o.State) { - return nil, false - } - return o.State, true -} - -// HasState returns a boolean if a field has been set. -func (o *ProjectResponse) HasState() bool { - if o != nil && !IsNil(o.State) { - return true - } - - return false -} - -// SetState gets a reference to the given ProjectState and assigns it to the State field. -func (o *ProjectResponse) SetState(v *ProjectState) { - o.State = v -} - -func (o ProjectResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.ProjectId) { - toSerialize["projectId"] = o.ProjectId - } - if !IsNil(o.State) { - toSerialize["state"] = o.State - } - return toSerialize, nil -} - -type NullableProjectResponse struct { - value *ProjectResponse - isSet bool -} - -func (v NullableProjectResponse) Get() *ProjectResponse { - return v.value -} - -func (v *NullableProjectResponse) Set(val *ProjectResponse) { - v.value = val - v.isSet = true -} - -func (v NullableProjectResponse) IsSet() bool { - return v.isSet -} - -func (v *NullableProjectResponse) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableProjectResponse(val *ProjectResponse) *NullableProjectResponse { - return &NullableProjectResponse{value: val, isSet: true} -} - -func (v NullableProjectResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableProjectResponse) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/ske/model_project_state.go b/services/ske/model_project_state.go deleted file mode 100644 index 3d26eb7ec..000000000 --- a/services/ske/model_project_state.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -SKE-API - -The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. - -API version: 1.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ske - -import ( - "encoding/json" - "fmt" -) - -// ProjectState the model 'ProjectState' -type ProjectState string - -// List of ProjectState -const ( - PROJECTSTATE_UNSPECIFIED ProjectState = "STATE_UNSPECIFIED" - PROJECTSTATE_CREATING ProjectState = "STATE_CREATING" - PROJECTSTATE_CREATED ProjectState = "STATE_CREATED" - PROJECTSTATE_DELETING ProjectState = "STATE_DELETING" - PROJECTSTATE_FAILED ProjectState = "STATE_FAILED" -) - -// All allowed values of ProjectState enum -var AllowedProjectStateEnumValues = []ProjectState{ - "STATE_UNSPECIFIED", - "STATE_CREATING", - "STATE_CREATED", - "STATE_DELETING", - "STATE_FAILED", -} - -func (v *ProjectState) 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 := ProjectState(value) - for _, existing := range AllowedProjectStateEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid ProjectState", value) -} - -// NewProjectStateFromValue returns a pointer to a valid ProjectState -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewProjectStateFromValue(v string) (*ProjectState, error) { - ev := ProjectState(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for ProjectState: valid values are %v", v, AllowedProjectStateEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v ProjectState) IsValid() bool { - for _, existing := range AllowedProjectStateEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ProjectState value -func (v ProjectState) Ptr() *ProjectState { - return &v -} - -type NullableProjectState struct { - value *ProjectState - isSet bool -} - -func (v NullableProjectState) Get() *ProjectState { - return v.value -} - -func (v *NullableProjectState) Set(val *ProjectState) { - v.value = val - v.isSet = true -} - -func (v NullableProjectState) IsSet() bool { - return v.isSet -} - -func (v *NullableProjectState) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableProjectState(val *ProjectState) *NullableProjectState { - return &NullableProjectState{value: val, isSet: true} -} - -func (v NullableProjectState) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableProjectState) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/ske/model_time_window.go b/services/ske/model_time_window.go index 934158297..cd9369023 100644 --- a/services/ske/model_time_window.go +++ b/services/ske/model_time_window.go @@ -12,6 +12,7 @@ package ske import ( "encoding/json" + "time" ) // checks if the TimeWindow type satisfies the MappedNullable interface at compile time @@ -20,9 +21,9 @@ var _ MappedNullable = &TimeWindow{} // TimeWindow struct for TimeWindow type TimeWindow struct { // REQUIRED - End *string `json:"end"` + End *time.Time `json:"end"` // REQUIRED - Start *string `json:"start"` + Start *time.Time `json:"start"` } type _TimeWindow TimeWindow @@ -31,7 +32,7 @@ type _TimeWindow TimeWindow // 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 NewTimeWindow(end *string, start *string) *TimeWindow { +func NewTimeWindow(end *time.Time, start *time.Time) *TimeWindow { this := TimeWindow{} this.End = end this.Start = start @@ -47,9 +48,9 @@ func NewTimeWindowWithDefaults() *TimeWindow { } // GetEnd returns the End field value -func (o *TimeWindow) GetEnd() *string { +func (o *TimeWindow) GetEnd() *time.Time { if o == nil || IsNil(o.End) { - var ret *string + var ret *time.Time return ret } @@ -58,7 +59,7 @@ func (o *TimeWindow) GetEnd() *string { // GetEndOk returns a tuple with the End field value // and a boolean to check if the value has been set. -func (o *TimeWindow) GetEndOk() (*string, bool) { +func (o *TimeWindow) GetEndOk() (*time.Time, bool) { if o == nil { return nil, false } @@ -66,14 +67,14 @@ func (o *TimeWindow) GetEndOk() (*string, bool) { } // SetEnd sets field value -func (o *TimeWindow) SetEnd(v *string) { +func (o *TimeWindow) SetEnd(v *time.Time) { o.End = v } // GetStart returns the Start field value -func (o *TimeWindow) GetStart() *string { +func (o *TimeWindow) GetStart() *time.Time { if o == nil || IsNil(o.Start) { - var ret *string + var ret *time.Time return ret } @@ -82,7 +83,7 @@ func (o *TimeWindow) GetStart() *string { // GetStartOk returns a tuple with the Start field value // and a boolean to check if the value has been set. -func (o *TimeWindow) GetStartOk() (*string, bool) { +func (o *TimeWindow) GetStartOk() (*time.Time, bool) { if o == nil { return nil, false } @@ -90,7 +91,7 @@ func (o *TimeWindow) GetStartOk() (*string, bool) { } // SetStart sets field value -func (o *TimeWindow) SetStart(v *string) { +func (o *TimeWindow) SetStart(v *time.Time) { o.Start = v } diff --git a/services/ske/model_volume.go b/services/ske/model_volume.go index 9964c8781..1d610d266 100644 --- a/services/ske/model_volume.go +++ b/services/ske/model_volume.go @@ -19,6 +19,7 @@ var _ MappedNullable = &Volume{} // Volume struct for Volume type Volume struct { + // Can be cast to int32 without loss of precision. // REQUIRED Size *int64 `json:"size"` // For valid values please take a look at [provider-options](#tag/ProviderOptions/operation/SkeService_GetProviderOptions) `volumeTypes`. diff --git a/services/sqlserverflex/api_default.go b/services/sqlserverflex/api_default.go index 7a2cdb381..a7c6cd604 100644 --- a/services/sqlserverflex/api_default.go +++ b/services/sqlserverflex/api_default.go @@ -3209,122 +3209,6 @@ func (a *APIClient) ResetUserExecute(ctx context.Context, projectId string, inst return r.Execute() } -type ApiTerminateProjectRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string -} - -func (r ApiTerminateProjectRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.TerminateProject") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1/projects/{projectId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 500 { - var v InstanceError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return newErr - } - - return nil -} - -/* -TerminateProject: Terminate the Project - -Termination is the deletion of a whole project which causes the deletion of all instances for this project. Only System with permission system.databases-project.remove is able to call this resource - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId Project ID - @return ApiTerminateProjectRequest -*/ -func (a *APIClient) TerminateProject(ctx context.Context, projectId string) ApiTerminateProjectRequest { - return ApiTerminateProjectRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } -} - -func (a *APIClient) TerminateProjectExecute(ctx context.Context, projectId string) error { - r := ApiTerminateProjectRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - } - return r.Execute() -} - type ApiTriggerDatabaseBackupRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/sqlserverflex/api_default_test.go b/services/sqlserverflex/api_default_test.go index 13dbec41e..61cdb096d 100644 --- a/services/sqlserverflex/api_default_test.go +++ b/services/sqlserverflex/api_default_test.go @@ -1280,52 +1280,6 @@ func Test_sqlserverflex_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService TerminateProject", func(t *testing.T) { - path := "/v1/projects/{projectId}" - projectIdValue := "projectId" - path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { - }) - 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 sqlserverflex_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 := "projectId" - - reqErr := apiClient.TerminateProject(context.Background(), projectId).Execute() - - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }) - t.Run("Test DefaultApiService TriggerDatabaseBackup", func(t *testing.T) { path := "/v1/projects/{projectId}/instances/{instanceId}/backups/databases/{databaseName}" projectIdValue := "projectId"