diff --git a/services/certificates/model_usage.go b/services/certificates/model_usage.go index 23318a5d8..6c1e30313 100644 --- a/services/certificates/model_usage.go +++ b/services/certificates/model_usage.go @@ -75,7 +75,7 @@ func setUsageGetItemsAttributeType(arg *UsageGetItemsAttributeType, val UsageGet // Usage struct for Usage // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type Usage struct { - // Number of Load Balancers using this certificate. + // Number of listeners using this certificate. // Can be cast to int32 without loss of precision. Count UsageGetCountAttributeType `json:"count,omitempty"` // List of Load Balancers with their associated listeners that use this certificate. diff --git a/services/certificates/model_usage_item.go b/services/certificates/model_usage_item.go index 38c0ac59e..a8b8e31c8 100644 --- a/services/certificates/model_usage_item.go +++ b/services/certificates/model_usage_item.go @@ -75,7 +75,7 @@ type UsageItemGetLoadBalancerNameRetType = string // UsageItem struct for UsageItem // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UsageItem struct { - // A list of listener names on this Load Balancer that are using the certificate. + // The list of listener names in this Load Balancer, that are using the certificate. ListenerNames UsageItemGetListenerNamesAttributeType `json:"listenerNames,omitempty"` // The display name of the Load Balancer. LoadBalancerName UsageItemGetLoadBalancerNameAttributeType `json:"loadBalancerName,omitempty"` diff --git a/services/certificates/oas_commit b/services/certificates/oas_commit index 308f94ffe..fd8126223 100644 --- a/services/certificates/oas_commit +++ b/services/certificates/oas_commit @@ -1 +1 @@ -00b020b2998425397c9a0e51364fe8846fa66880 +1dc09971ed72317b026ae7187333277e2b258115 diff --git a/services/certificates/v2api/model_usage.go b/services/certificates/v2api/model_usage.go index 74bd59776..7441d4a67 100644 --- a/services/certificates/v2api/model_usage.go +++ b/services/certificates/v2api/model_usage.go @@ -19,7 +19,7 @@ var _ MappedNullable = &Usage{} // Usage struct for Usage type Usage struct { - // Number of Load Balancers using this certificate. + // Number of listeners using this certificate. Count *int32 `json:"count,omitempty"` // List of Load Balancers with their associated listeners that use this certificate. Items []UsageItem `json:"items,omitempty"` diff --git a/services/certificates/v2api/model_usage_item.go b/services/certificates/v2api/model_usage_item.go index e37b23421..dfefb4a05 100644 --- a/services/certificates/v2api/model_usage_item.go +++ b/services/certificates/v2api/model_usage_item.go @@ -19,7 +19,7 @@ var _ MappedNullable = &UsageItem{} // UsageItem struct for UsageItem type UsageItem struct { - // A list of listener names on this Load Balancer that are using the certificate. + // The list of listener names in this Load Balancer, that are using the certificate. ListenerNames []string `json:"listenerNames,omitempty"` // The display name of the Load Balancer. LoadBalancerName *string `json:"loadBalancerName,omitempty"` diff --git a/services/certificates/v2betaapi/api_default.go b/services/certificates/v2betaapi/api_default.go deleted file mode 100644 index ea5a80545..000000000 --- a/services/certificates/v2betaapi/api_default.go +++ /dev/null @@ -1,713 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package v2betaapi - -import ( - "bytes" - "context" - "io" - "net/http" - "net/url" - "strings" - - "github.com/stackitcloud/stackit-sdk-go/core/config" - "github.com/stackitcloud/stackit-sdk-go/core/oapierror" -) - -type DefaultAPI interface { - - /* - CreateCertificate Store a TLS certificate in a project. - - CreateCertificate will store a TLS certificate in a project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @return ApiCreateCertificateRequest - - Deprecated - */ - CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest - - // CreateCertificateExecute executes the request - // @return CreateCertificateResponse - // Deprecated - CreateCertificateExecute(r ApiCreateCertificateRequest) (*CreateCertificateResponse, error) - - /* - DeleteCertificate Delete a stored TLS certificate in a project. - - DeleteCertificate will delete the stored TLS certificate. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @param id - @return ApiDeleteCertificateRequest - - Deprecated - */ - DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest - - // DeleteCertificateExecute executes the request - // @return map[string]interface{} - // Deprecated - DeleteCertificateExecute(r ApiDeleteCertificateRequest) (map[string]interface{}, error) - - /* - GetCertificate Retrieve the public parts of a stored TLS certificate. - - GetCertificate will return the public parts of a stored TLS certificate. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @param id - @return ApiGetCertificateRequest - - Deprecated - */ - GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest - - // GetCertificateExecute executes the request - // @return GetCertificateResponse - // Deprecated - GetCertificateExecute(r ApiGetCertificateRequest) (*GetCertificateResponse, error) - - /* - ListCertificates Retrieve the list of TLS certificate stored in a project. - - ListCertificates will return the list of TLS certificates in a project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @return ApiListCertificatesRequest - - Deprecated - */ - ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest - - // ListCertificatesExecute executes the request - // @return ListCertificatesResponse - // Deprecated - ListCertificatesExecute(r ApiListCertificatesRequest) (*ListCertificatesResponse, error) -} - -// DefaultAPIService DefaultAPI service -type DefaultAPIService service - -type ApiCreateCertificateRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - createCertificatePayload *CreateCertificatePayload -} - -func (r ApiCreateCertificateRequest) CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest { - r.createCertificatePayload = &createCertificatePayload - return r -} - -func (r ApiCreateCertificateRequest) Execute() (*CreateCertificateResponse, error) { - return r.ApiService.CreateCertificateExecute(r) -} - -/* -CreateCertificate Store a TLS certificate in a project. - -CreateCertificate will store a TLS certificate in a project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @return ApiCreateCertificateRequest - -Deprecated -*/ -func (a *DefaultAPIService) CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest { - return ApiCreateCertificateRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - } -} - -// Execute executes the request -// -// @return CreateCertificateResponse -// -// Deprecated -func (a *DefaultAPIService) CreateCertificateExecute(r ApiCreateCertificateRequest) (*CreateCertificateResponse, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *CreateCertificateResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateCertificate") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.createCertificatePayload == nil { - return localVarReturnValue, reportError("createCertificatePayload is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.createCertificatePayload - 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{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 401 { - var v Status - 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 Status - 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 -} - -type ApiDeleteCertificateRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - id string -} - -func (r ApiDeleteCertificateRequest) Execute() (map[string]interface{}, error) { - return r.ApiService.DeleteCertificateExecute(r) -} - -/* -DeleteCertificate Delete a stored TLS certificate in a project. - -DeleteCertificate will delete the stored TLS certificate. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @param id - @return ApiDeleteCertificateRequest - -Deprecated -*/ -func (a *DefaultAPIService) DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest { - return ApiDeleteCertificateRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - id: id, - } -} - -// Execute executes the request -// -// @return map[string]interface{} -// -// Deprecated -func (a *DefaultAPIService) DeleteCertificateExecute(r ApiDeleteCertificateRequest) (map[string]interface{}, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue map[string]interface{} - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteCertificate") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -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{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 401 { - var v Status - 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 Status - 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 -} - -type ApiGetCertificateRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - id string -} - -func (r ApiGetCertificateRequest) Execute() (*GetCertificateResponse, error) { - return r.ApiService.GetCertificateExecute(r) -} - -/* -GetCertificate Retrieve the public parts of a stored TLS certificate. - -GetCertificate will return the public parts of a stored TLS certificate. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @param id - @return ApiGetCertificateRequest - -Deprecated -*/ -func (a *DefaultAPIService) GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest { - return ApiGetCertificateRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - id: id, - } -} - -// Execute executes the request -// -// @return GetCertificateResponse -// -// Deprecated -func (a *DefaultAPIService) GetCertificateExecute(r ApiGetCertificateRequest) (*GetCertificateResponse, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *GetCertificateResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCertificate") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -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{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 401 { - var v Status - 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 Status - 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 -} - -type ApiListCertificatesRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - region string - pageSize *string - pageId *string -} - -// page_size specifies how many certificates should be returned on this page. Must be a positive number <= 1000 -func (r ApiListCertificatesRequest) PageSize(pageSize string) ApiListCertificatesRequest { - r.pageSize = &pageSize - return r -} - -// page_id is a page identifier returned by the previous response and is used to request the next page -func (r ApiListCertificatesRequest) PageId(pageId string) ApiListCertificatesRequest { - r.pageId = &pageId - return r -} - -func (r ApiListCertificatesRequest) Execute() (*ListCertificatesResponse, error) { - return r.ApiService.ListCertificatesExecute(r) -} - -/* -ListCertificates Retrieve the list of TLS certificate stored in a project. - -ListCertificates will return the list of TLS certificates in a project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId - @param region - @return ApiListCertificatesRequest - -Deprecated -*/ -func (a *DefaultAPIService) ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest { - return ApiListCertificatesRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - } -} - -// Execute executes the request -// -// @return ListCertificatesResponse -// -// Deprecated -func (a *DefaultAPIService) ListCertificatesExecute(r ApiListCertificatesRequest) (*ListCertificatesResponse, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListCertificatesResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCertificates") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if r.pageSize != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") - } - if r.pageId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "form", "") - } - // 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{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 401 { - var v Status - 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 Status - 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 -} diff --git a/services/certificates/v2betaapi/api_default_mock.go b/services/certificates/v2betaapi/api_default_mock.go deleted file mode 100644 index d18226cda..000000000 --- a/services/certificates/v2betaapi/api_default_mock.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "context" -) - -// assert the implementation matches the interface -var _ DefaultAPI = &DefaultAPIServiceMock{} - -// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. -// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. -type DefaultAPIServiceMock struct { - // Deprecated: CreateCertificateExecuteMock can be populated to implement the behavior of the CreateCertificateExecute function of this mock - CreateCertificateExecuteMock *func(r ApiCreateCertificateRequest) (*CreateCertificateResponse, error) - // Deprecated: DeleteCertificateExecuteMock can be populated to implement the behavior of the DeleteCertificateExecute function of this mock - DeleteCertificateExecuteMock *func(r ApiDeleteCertificateRequest) (map[string]interface{}, error) - // Deprecated: GetCertificateExecuteMock can be populated to implement the behavior of the GetCertificateExecute function of this mock - GetCertificateExecuteMock *func(r ApiGetCertificateRequest) (*GetCertificateResponse, error) - // Deprecated: ListCertificatesExecuteMock can be populated to implement the behavior of the ListCertificatesExecute function of this mock - ListCertificatesExecuteMock *func(r ApiListCertificatesRequest) (*ListCertificatesResponse, error) -} - -// Deprecated -func (a DefaultAPIServiceMock) CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest { - return ApiCreateCertificateRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - } -} - -// Deprecated: CreateCertificateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateCertificateExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) CreateCertificateExecute(r ApiCreateCertificateRequest) (*CreateCertificateResponse, error) { - if a.CreateCertificateExecuteMock == nil { - var localVarReturnValue *CreateCertificateResponse - return localVarReturnValue, nil - } - - return (*a.CreateCertificateExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest { - return ApiDeleteCertificateRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - id: id, - } -} - -// Deprecated: DeleteCertificateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteCertificateExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DeleteCertificateExecute(r ApiDeleteCertificateRequest) (map[string]interface{}, error) { - if a.DeleteCertificateExecuteMock == nil { - var localVarReturnValue map[string]interface{} - return localVarReturnValue, nil - } - - return (*a.DeleteCertificateExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest { - return ApiGetCertificateRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - id: id, - } -} - -// Deprecated: GetCertificateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCertificateExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) GetCertificateExecute(r ApiGetCertificateRequest) (*GetCertificateResponse, error) { - if a.GetCertificateExecuteMock == nil { - var localVarReturnValue *GetCertificateResponse - return localVarReturnValue, nil - } - - return (*a.GetCertificateExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest { - return ApiListCertificatesRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - region: region, - } -} - -// Deprecated: ListCertificatesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCertificatesExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ListCertificatesExecute(r ApiListCertificatesRequest) (*ListCertificatesResponse, error) { - if a.ListCertificatesExecuteMock == nil { - var localVarReturnValue *ListCertificatesResponse - return localVarReturnValue, nil - } - - return (*a.ListCertificatesExecuteMock)(r) -} diff --git a/services/certificates/v2betaapi/client.go b/services/certificates/v2betaapi/client.go deleted file mode 100644 index 2137c83a6..000000000 --- a/services/certificates/v2betaapi/client.go +++ /dev/null @@ -1,658 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package v2betaapi - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" - - "github.com/stackitcloud/stackit-sdk-go/core/auth" - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -var ( - JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) - XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) - queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") -) - -// APIClient manages communication with the STACKIT Application Load Balancer Certificates API API v2beta.0.0 -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *config.Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services - - DefaultAPI DefaultAPI -} - -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { - cfg := NewConfiguration() - - for _, option := range opts { - err := option(cfg) - if err != nil { - return nil, fmt.Errorf("configuring the client: %w", err) - } - } - - err := config.ConfigureRegion(cfg) - if err != nil { - return nil, fmt.Errorf("configuring region: %w", err) - } - - if cfg.HTTPClient == nil { - cfg.HTTPClient = &http.Client{} - } - - authRoundTripper, err := auth.SetupAuth(cfg) - if err != nil { - return nil, fmt.Errorf("setting up authentication: %w", err) - } - - roundTripper := authRoundTripper - if cfg.Middleware != nil { - roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) - } - - cfg.HTTPClient.Transport = roundTripper - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - - // API Services - c.DefaultAPI = (*DefaultAPIService)(&c.common) - - return c, nil -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insensitive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.EqualFold(a, needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -func parameterValueToString(obj interface{}, key string) string { - if reflect.TypeOf(obj).Kind() != reflect.Ptr { - if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { - return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) - } - - return fmt.Sprintf("%v", obj) - } - var param, ok = obj.(MappedNullable) - if !ok { - return "" - } - dataMap, err := param.ToMap() - if err != nil { - return "" - } - return fmt.Sprintf("%v", dataMap[key]) -} - -// parameterAddToHeaderOrQuery adds the provided object to the request header or url query -// supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { - var v = reflect.ValueOf(obj) - var value = "" - if v == reflect.ValueOf(nil) { - value = "null" - } else { - switch v.Kind() { - case reflect.Invalid: - value = "invalid" - - case reflect.Struct: - if t, ok := obj.(MappedNullable); ok { - dataMap, err := t.ToMap() - if err != nil { - return - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - var lenIndValue = indValue.Len() - for i := 0; i < lenIndValue; i++ { - var arrayValue = indValue.Index(i) - var keyPrefixForCollectionType = keyPrefix - if style == "deepObject" { - keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) - } - return - - case reflect.Map: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - iter := indValue.MapRange() - for iter.Next() { - k, v := iter.Key(), iter.Value() - parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) - } - return - - case reflect.Interface: - fallthrough - case reflect.Ptr: - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) - return - - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - value = strconv.FormatInt(v.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, - reflect.Uint32, reflect.Uint64, reflect.Uintptr: - value = strconv.FormatUint(v.Uint(), 10) - case reflect.Float32, reflect.Float64: - value = strconv.FormatFloat(v.Float(), 'g', -1, 32) - case reflect.Bool: - value = strconv.FormatBool(v.Bool()) - case reflect.String: - value = v.String() - default: - value = v.Type().String() + " value" - } - } - - switch valuesMap := headerOrQueryParams.(type) { - case url.Values: - if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { - valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) - } else { - valuesMap.Add(keyPrefix, value) - } - break - case map[string]string: - valuesMap[keyPrefix] = value - break - } -} - -// helper for converting interface{} parameters to json strings -func parameterToJson(obj interface{}) (string, error) { - jsonBuf, err := json.Marshal(obj) - if err != nil { - return "", err - } - return string(jsonBuf), err -} - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) - if err != nil { - return nil, err - } - log.Printf("\n%s\n", string(dump)) - } - - resp, err := c.cfg.HTTPClient.Do(request) - if err != nil { - return resp, err - } - - if c.cfg.Debug { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return resp, err - } - log.Printf("\n%s\n", string(dump)) - } - return resp, err -} - -// Allow modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior -func (c *APIClient) GetConfig() *config.Configuration { - return c.cfg -} - -type formFile struct { - fileBytes []byte - fileName string - formFileName string -} - -// prepareRequest build the request -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - formFiles []formFile) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - for _, formFile := range formFiles { - if len(formFile.fileBytes) > 0 && formFile.fileName != "" { - w.Boundary() - part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(formFile.fileBytes) - if err != nil { - return nil, err - } - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.cfg.Host != "" { - url.Host = c.cfg.Host - } - - // Override request scheme, if applicable - if c.cfg.Scheme != "" { - url.Scheme = c.cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { - pieces := strings.Split(s, "=") - pieces[0] = queryDescape.Replace(pieces[0]) - return strings.Join(pieces, "=") - }) - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers[h] = []string{v} - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if f, ok := v.(*os.File); ok { - f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = f.Write(b) - if err != nil { - return - } - _, err = f.Seek(0, io.SeekStart) - return - } - if f, ok := v.(**os.File); ok { - *f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - if err != nil { - return - } - _, err = (*f).Seek(0, io.SeekStart) - return - } - if XmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if JsonCheck.MatchString(contentType) { - if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err != nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(filepath.Clean(path)) - if err != nil { - return err - } - defer file.Close() - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(*os.File); ok { - _, err = bodyBuf.ReadFrom(fp) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if JsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if XmlCheck.MatchString(contentType) { - var bs []byte - bs, err = xml.Marshal(body) - if err == nil { - bodyBuf.Write(bs) - } - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } else { - expires = now.Add(lifetime) - } - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// format error message using title and detail when model implements rfc7807 -func formatErrorMessage(status string, v interface{}) string { - str := "" - metaValue := reflect.ValueOf(v).Elem() - - if metaValue.Kind() == reflect.Struct { - field := metaValue.FieldByName("Title") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s", field.Interface()) - } - - field = metaValue.FieldByName("Detail") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s (%s)", str, field.Interface()) - } - } - - return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) -} diff --git a/services/certificates/v2betaapi/configuration.go b/services/certificates/v2betaapi/configuration.go deleted file mode 100644 index 0fb8405da..000000000 --- a/services/certificates/v2betaapi/configuration.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package v2betaapi - -import ( - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -// NewConfiguration returns a new Configuration object -func NewConfiguration() *config.Configuration { - cfg := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "stackit-sdk-go/certificates", - Debug: false, - Servers: config.ServerConfigurations{ - { - URL: "https://certificates.api.stackit.cloud", - Description: "No description provided", - Variables: map[string]config.ServerVariable{ - "region": { - Description: "No description provided", - DefaultValue: "global", - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - return cfg -} diff --git a/services/certificates/v2betaapi/model_create_certificate_payload.go b/services/certificates/v2betaapi/model_create_certificate_payload.go deleted file mode 100644 index 67bc032c7..000000000 --- a/services/certificates/v2betaapi/model_create_certificate_payload.go +++ /dev/null @@ -1,306 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "encoding/json" -) - -// checks if the CreateCertificatePayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CreateCertificatePayload{} - -// CreateCertificatePayload Uploads a PEM encoded X509 public/private key pair -type CreateCertificatePayload struct { - // TLS certificate name - Name *string `json:"name,omitempty" validate:"regexp=^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$"` - // The PEM encoded private key part - PrivateKey *string `json:"privateKey,omitempty"` - // Project identifier - ProjectId *string `json:"projectId,omitempty" validate:"regexp=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"` - // The PEM encoded public key part - PublicKey *string `json:"publicKey,omitempty"` - // Region - Region *string `json:"region,omitempty" validate:"regexp=^[a-z]{2,4}[0-9]{2}$"` - AdditionalProperties map[string]interface{} -} - -type _CreateCertificatePayload CreateCertificatePayload - -// NewCreateCertificatePayload instantiates a new CreateCertificatePayload 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 NewCreateCertificatePayload() *CreateCertificatePayload { - this := CreateCertificatePayload{} - return &this -} - -// NewCreateCertificatePayloadWithDefaults instantiates a new CreateCertificatePayload 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 NewCreateCertificatePayloadWithDefaults() *CreateCertificatePayload { - this := CreateCertificatePayload{} - return &this -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *CreateCertificatePayload) GetName() string { - if o == nil || IsNil(o.Name) { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateCertificatePayload) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *CreateCertificatePayload) HasName() bool { - if o != nil && !IsNil(o.Name) { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *CreateCertificatePayload) SetName(v string) { - o.Name = &v -} - -// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise. -func (o *CreateCertificatePayload) GetPrivateKey() string { - if o == nil || IsNil(o.PrivateKey) { - var ret string - return ret - } - return *o.PrivateKey -} - -// GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateCertificatePayload) GetPrivateKeyOk() (*string, bool) { - if o == nil || IsNil(o.PrivateKey) { - return nil, false - } - return o.PrivateKey, true -} - -// HasPrivateKey returns a boolean if a field has been set. -func (o *CreateCertificatePayload) HasPrivateKey() bool { - if o != nil && !IsNil(o.PrivateKey) { - return true - } - - return false -} - -// SetPrivateKey gets a reference to the given string and assigns it to the PrivateKey field. -func (o *CreateCertificatePayload) SetPrivateKey(v string) { - o.PrivateKey = &v -} - -// GetProjectId returns the ProjectId field value if set, zero value otherwise. -func (o *CreateCertificatePayload) 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 *CreateCertificatePayload) 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 *CreateCertificatePayload) 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 *CreateCertificatePayload) SetProjectId(v string) { - o.ProjectId = &v -} - -// GetPublicKey returns the PublicKey field value if set, zero value otherwise. -func (o *CreateCertificatePayload) GetPublicKey() string { - if o == nil || IsNil(o.PublicKey) { - var ret string - return ret - } - return *o.PublicKey -} - -// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateCertificatePayload) GetPublicKeyOk() (*string, bool) { - if o == nil || IsNil(o.PublicKey) { - return nil, false - } - return o.PublicKey, true -} - -// HasPublicKey returns a boolean if a field has been set. -func (o *CreateCertificatePayload) HasPublicKey() bool { - if o != nil && !IsNil(o.PublicKey) { - return true - } - - return false -} - -// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. -func (o *CreateCertificatePayload) SetPublicKey(v string) { - o.PublicKey = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *CreateCertificatePayload) GetRegion() string { - if o == nil || IsNil(o.Region) { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateCertificatePayload) GetRegionOk() (*string, bool) { - if o == nil || IsNil(o.Region) { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *CreateCertificatePayload) HasRegion() bool { - if o != nil && !IsNil(o.Region) { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *CreateCertificatePayload) SetRegion(v string) { - o.Region = &v -} - -func (o CreateCertificatePayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o CreateCertificatePayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Name) { - toSerialize["name"] = o.Name - } - if !IsNil(o.PrivateKey) { - toSerialize["privateKey"] = o.PrivateKey - } - if !IsNil(o.ProjectId) { - toSerialize["projectId"] = o.ProjectId - } - if !IsNil(o.PublicKey) { - toSerialize["publicKey"] = o.PublicKey - } - if !IsNil(o.Region) { - toSerialize["region"] = o.Region - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *CreateCertificatePayload) UnmarshalJSON(data []byte) (err error) { - varCreateCertificatePayload := _CreateCertificatePayload{} - - err = json.Unmarshal(data, &varCreateCertificatePayload) - - if err != nil { - return err - } - - *o = CreateCertificatePayload(varCreateCertificatePayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "name") - delete(additionalProperties, "privateKey") - delete(additionalProperties, "projectId") - delete(additionalProperties, "publicKey") - delete(additionalProperties, "region") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableCreateCertificatePayload struct { - value *CreateCertificatePayload - isSet bool -} - -func (v NullableCreateCertificatePayload) Get() *CreateCertificatePayload { - return v.value -} - -func (v *NullableCreateCertificatePayload) Set(val *CreateCertificatePayload) { - v.value = val - v.isSet = true -} - -func (v NullableCreateCertificatePayload) IsSet() bool { - return v.isSet -} - -func (v *NullableCreateCertificatePayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableCreateCertificatePayload(val *CreateCertificatePayload) *NullableCreateCertificatePayload { - return &NullableCreateCertificatePayload{value: val, isSet: true} -} - -func (v NullableCreateCertificatePayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableCreateCertificatePayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/certificates/v2betaapi/model_create_certificate_response.go b/services/certificates/v2betaapi/model_create_certificate_response.go deleted file mode 100644 index ab5402533..000000000 --- a/services/certificates/v2betaapi/model_create_certificate_response.go +++ /dev/null @@ -1,192 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "encoding/json" -) - -// checks if the CreateCertificateResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CreateCertificateResponse{} - -// CreateCertificateResponse CreateCertificateResponse returns unique resource id -type CreateCertificateResponse struct { - // The certificates resource id - Id *string `json:"id,omitempty" validate:"regexp=^[0-9a-z](?:(?:[0-9a-z]|-){0,251}[0-9a-z])?$"` - // Region - Region *string `json:"region,omitempty" validate:"regexp=^[a-z]{2,4}[0-9]{2}$"` - AdditionalProperties map[string]interface{} -} - -type _CreateCertificateResponse CreateCertificateResponse - -// NewCreateCertificateResponse instantiates a new CreateCertificateResponse 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 NewCreateCertificateResponse() *CreateCertificateResponse { - this := CreateCertificateResponse{} - return &this -} - -// NewCreateCertificateResponseWithDefaults instantiates a new CreateCertificateResponse 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 NewCreateCertificateResponseWithDefaults() *CreateCertificateResponse { - this := CreateCertificateResponse{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *CreateCertificateResponse) GetId() string { - if o == nil || IsNil(o.Id) { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateCertificateResponse) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *CreateCertificateResponse) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *CreateCertificateResponse) SetId(v string) { - o.Id = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *CreateCertificateResponse) GetRegion() string { - if o == nil || IsNil(o.Region) { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateCertificateResponse) GetRegionOk() (*string, bool) { - if o == nil || IsNil(o.Region) { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *CreateCertificateResponse) HasRegion() bool { - if o != nil && !IsNil(o.Region) { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *CreateCertificateResponse) SetRegion(v string) { - o.Region = &v -} - -func (o CreateCertificateResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o CreateCertificateResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id - } - if !IsNil(o.Region) { - toSerialize["region"] = o.Region - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *CreateCertificateResponse) UnmarshalJSON(data []byte) (err error) { - varCreateCertificateResponse := _CreateCertificateResponse{} - - err = json.Unmarshal(data, &varCreateCertificateResponse) - - if err != nil { - return err - } - - *o = CreateCertificateResponse(varCreateCertificateResponse) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "id") - delete(additionalProperties, "region") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableCreateCertificateResponse struct { - value *CreateCertificateResponse - isSet bool -} - -func (v NullableCreateCertificateResponse) Get() *CreateCertificateResponse { - return v.value -} - -func (v *NullableCreateCertificateResponse) Set(val *CreateCertificateResponse) { - v.value = val - v.isSet = true -} - -func (v NullableCreateCertificateResponse) IsSet() bool { - return v.isSet -} - -func (v *NullableCreateCertificateResponse) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableCreateCertificateResponse(val *CreateCertificateResponse) *NullableCreateCertificateResponse { - return &NullableCreateCertificateResponse{value: val, isSet: true} -} - -func (v NullableCreateCertificateResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableCreateCertificateResponse) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/certificates/v2betaapi/model_get_certificate_response.go b/services/certificates/v2betaapi/model_get_certificate_response.go deleted file mode 100644 index 75796a4da..000000000 --- a/services/certificates/v2betaapi/model_get_certificate_response.go +++ /dev/null @@ -1,268 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "encoding/json" -) - -// checks if the GetCertificateResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &GetCertificateResponse{} - -// GetCertificateResponse GetCertificateResponse returns name, id and public key -type GetCertificateResponse struct { - // The certificates resource id - Id *string `json:"id,omitempty" validate:"regexp=^[0-9a-z](?:(?:[0-9a-z]|-){0,251}[0-9a-z])?$"` - // TLS certificate name - Name *string `json:"name,omitempty" validate:"regexp=^[0-9a-z](?:(?:[0-9a-z]|-){0,251}[0-9a-z])?$"` - // The PEM encoded public key part - PublicKey *string `json:"publicKey,omitempty"` - // Region of the LoadBalancer - Region *string `json:"region,omitempty"` - AdditionalProperties map[string]interface{} -} - -type _GetCertificateResponse GetCertificateResponse - -// NewGetCertificateResponse instantiates a new GetCertificateResponse 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 NewGetCertificateResponse() *GetCertificateResponse { - this := GetCertificateResponse{} - return &this -} - -// NewGetCertificateResponseWithDefaults instantiates a new GetCertificateResponse 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 NewGetCertificateResponseWithDefaults() *GetCertificateResponse { - this := GetCertificateResponse{} - return &this -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *GetCertificateResponse) GetId() string { - if o == nil || IsNil(o.Id) { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GetCertificateResponse) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *GetCertificateResponse) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *GetCertificateResponse) SetId(v string) { - o.Id = &v -} - -// GetName returns the Name field value if set, zero value otherwise. -func (o *GetCertificateResponse) GetName() string { - if o == nil || IsNil(o.Name) { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GetCertificateResponse) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *GetCertificateResponse) HasName() bool { - if o != nil && !IsNil(o.Name) { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *GetCertificateResponse) SetName(v string) { - o.Name = &v -} - -// GetPublicKey returns the PublicKey field value if set, zero value otherwise. -func (o *GetCertificateResponse) GetPublicKey() string { - if o == nil || IsNil(o.PublicKey) { - var ret string - return ret - } - return *o.PublicKey -} - -// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GetCertificateResponse) GetPublicKeyOk() (*string, bool) { - if o == nil || IsNil(o.PublicKey) { - return nil, false - } - return o.PublicKey, true -} - -// HasPublicKey returns a boolean if a field has been set. -func (o *GetCertificateResponse) HasPublicKey() bool { - if o != nil && !IsNil(o.PublicKey) { - return true - } - - return false -} - -// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. -func (o *GetCertificateResponse) SetPublicKey(v string) { - o.PublicKey = &v -} - -// GetRegion returns the Region field value if set, zero value otherwise. -func (o *GetCertificateResponse) GetRegion() string { - if o == nil || IsNil(o.Region) { - var ret string - return ret - } - return *o.Region -} - -// GetRegionOk returns a tuple with the Region field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GetCertificateResponse) GetRegionOk() (*string, bool) { - if o == nil || IsNil(o.Region) { - return nil, false - } - return o.Region, true -} - -// HasRegion returns a boolean if a field has been set. -func (o *GetCertificateResponse) HasRegion() bool { - if o != nil && !IsNil(o.Region) { - return true - } - - return false -} - -// SetRegion gets a reference to the given string and assigns it to the Region field. -func (o *GetCertificateResponse) SetRegion(v string) { - o.Region = &v -} - -func (o GetCertificateResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o GetCertificateResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id - } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name - } - if !IsNil(o.PublicKey) { - toSerialize["publicKey"] = o.PublicKey - } - if !IsNil(o.Region) { - toSerialize["region"] = o.Region - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *GetCertificateResponse) UnmarshalJSON(data []byte) (err error) { - varGetCertificateResponse := _GetCertificateResponse{} - - err = json.Unmarshal(data, &varGetCertificateResponse) - - if err != nil { - return err - } - - *o = GetCertificateResponse(varGetCertificateResponse) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "id") - delete(additionalProperties, "name") - delete(additionalProperties, "publicKey") - delete(additionalProperties, "region") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableGetCertificateResponse struct { - value *GetCertificateResponse - isSet bool -} - -func (v NullableGetCertificateResponse) Get() *GetCertificateResponse { - return v.value -} - -func (v *NullableGetCertificateResponse) Set(val *GetCertificateResponse) { - v.value = val - v.isSet = true -} - -func (v NullableGetCertificateResponse) IsSet() bool { - return v.isSet -} - -func (v *NullableGetCertificateResponse) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableGetCertificateResponse(val *GetCertificateResponse) *NullableGetCertificateResponse { - return &NullableGetCertificateResponse{value: val, isSet: true} -} - -func (v NullableGetCertificateResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableGetCertificateResponse) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/certificates/v2betaapi/model_google_protobuf_any.go b/services/certificates/v2betaapi/model_google_protobuf_any.go deleted file mode 100644 index 5c746b4f5..000000000 --- a/services/certificates/v2betaapi/model_google_protobuf_any.go +++ /dev/null @@ -1,154 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "encoding/json" -) - -// checks if the GoogleProtobufAny type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &GoogleProtobufAny{} - -// GoogleProtobufAny Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. -type GoogleProtobufAny struct { - // The type of the serialized message. - Type *string `json:"@type,omitempty"` - AdditionalProperties map[string]interface{} -} - -type _GoogleProtobufAny GoogleProtobufAny - -// NewGoogleProtobufAny instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAny() *GoogleProtobufAny { - this := GoogleProtobufAny{} - return &this -} - -// NewGoogleProtobufAnyWithDefaults instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAnyWithDefaults() *GoogleProtobufAny { - this := GoogleProtobufAny{} - return &this -} - -// GetType returns the Type field value if set, zero value otherwise. -func (o *GoogleProtobufAny) GetType() string { - if o == nil || IsNil(o.Type) { - var ret string - return ret - } - return *o.Type -} - -// GetTypeOk returns a tuple with the Type field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *GoogleProtobufAny) GetTypeOk() (*string, bool) { - if o == nil || IsNil(o.Type) { - return nil, false - } - return o.Type, true -} - -// HasType returns a boolean if a field has been set. -func (o *GoogleProtobufAny) HasType() bool { - if o != nil && !IsNil(o.Type) { - return true - } - - return false -} - -// SetType gets a reference to the given string and assigns it to the Type field. -func (o *GoogleProtobufAny) SetType(v string) { - o.Type = &v -} - -func (o GoogleProtobufAny) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Type) { - toSerialize["@type"] = o.Type - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *GoogleProtobufAny) UnmarshalJSON(data []byte) (err error) { - varGoogleProtobufAny := _GoogleProtobufAny{} - - err = json.Unmarshal(data, &varGoogleProtobufAny) - - if err != nil { - return err - } - - *o = GoogleProtobufAny(varGoogleProtobufAny) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "@type") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableGoogleProtobufAny struct { - value *GoogleProtobufAny - isSet bool -} - -func (v NullableGoogleProtobufAny) Get() *GoogleProtobufAny { - return v.value -} - -func (v *NullableGoogleProtobufAny) Set(val *GoogleProtobufAny) { - v.value = val - v.isSet = true -} - -func (v NullableGoogleProtobufAny) IsSet() bool { - return v.isSet -} - -func (v *NullableGoogleProtobufAny) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableGoogleProtobufAny(val *GoogleProtobufAny) *NullableGoogleProtobufAny { - return &NullableGoogleProtobufAny{value: val, isSet: true} -} - -func (v NullableGoogleProtobufAny) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableGoogleProtobufAny) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/certificates/v2betaapi/model_list_certificates_response.go b/services/certificates/v2betaapi/model_list_certificates_response.go deleted file mode 100644 index 09c0212a6..000000000 --- a/services/certificates/v2betaapi/model_list_certificates_response.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "encoding/json" -) - -// checks if the ListCertificatesResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListCertificatesResponse{} - -// ListCertificatesResponse ListCertificateResponse returns a list of certificate responses -type ListCertificatesResponse struct { - Items []GetCertificateResponse `json:"items,omitempty"` - // Continue token from the ListCertificatesResponse with Limit option - NextPageId *string `json:"nextPageId,omitempty" validate:"regexp=^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$"` - AdditionalProperties map[string]interface{} -} - -type _ListCertificatesResponse ListCertificatesResponse - -// NewListCertificatesResponse instantiates a new ListCertificatesResponse 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 NewListCertificatesResponse() *ListCertificatesResponse { - this := ListCertificatesResponse{} - return &this -} - -// NewListCertificatesResponseWithDefaults instantiates a new ListCertificatesResponse 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 NewListCertificatesResponseWithDefaults() *ListCertificatesResponse { - this := ListCertificatesResponse{} - return &this -} - -// GetItems returns the Items field value if set, zero value otherwise. -func (o *ListCertificatesResponse) GetItems() []GetCertificateResponse { - if o == nil || IsNil(o.Items) { - var ret []GetCertificateResponse - return ret - } - return o.Items -} - -// GetItemsOk returns a tuple with the Items field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListCertificatesResponse) GetItemsOk() ([]GetCertificateResponse, bool) { - if o == nil || IsNil(o.Items) { - return nil, false - } - return o.Items, true -} - -// HasItems returns a boolean if a field has been set. -func (o *ListCertificatesResponse) HasItems() bool { - if o != nil && !IsNil(o.Items) { - return true - } - - return false -} - -// SetItems gets a reference to the given []GetCertificateResponse and assigns it to the Items field. -func (o *ListCertificatesResponse) SetItems(v []GetCertificateResponse) { - o.Items = v -} - -// GetNextPageId returns the NextPageId field value if set, zero value otherwise. -func (o *ListCertificatesResponse) GetNextPageId() string { - if o == nil || IsNil(o.NextPageId) { - var ret string - return ret - } - return *o.NextPageId -} - -// GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ListCertificatesResponse) GetNextPageIdOk() (*string, bool) { - if o == nil || IsNil(o.NextPageId) { - return nil, false - } - return o.NextPageId, true -} - -// HasNextPageId returns a boolean if a field has been set. -func (o *ListCertificatesResponse) HasNextPageId() bool { - if o != nil && !IsNil(o.NextPageId) { - return true - } - - return false -} - -// SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. -func (o *ListCertificatesResponse) SetNextPageId(v string) { - o.NextPageId = &v -} - -func (o ListCertificatesResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ListCertificatesResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Items) { - toSerialize["items"] = o.Items - } - if !IsNil(o.NextPageId) { - toSerialize["nextPageId"] = o.NextPageId - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *ListCertificatesResponse) UnmarshalJSON(data []byte) (err error) { - varListCertificatesResponse := _ListCertificatesResponse{} - - err = json.Unmarshal(data, &varListCertificatesResponse) - - if err != nil { - return err - } - - *o = ListCertificatesResponse(varListCertificatesResponse) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "items") - delete(additionalProperties, "nextPageId") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableListCertificatesResponse struct { - value *ListCertificatesResponse - isSet bool -} - -func (v NullableListCertificatesResponse) Get() *ListCertificatesResponse { - return v.value -} - -func (v *NullableListCertificatesResponse) Set(val *ListCertificatesResponse) { - v.value = val - v.isSet = true -} - -func (v NullableListCertificatesResponse) IsSet() bool { - return v.isSet -} - -func (v *NullableListCertificatesResponse) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableListCertificatesResponse(val *ListCertificatesResponse) *NullableListCertificatesResponse { - return &NullableListCertificatesResponse{value: val, isSet: true} -} - -func (v NullableListCertificatesResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableListCertificatesResponse) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/certificates/v2betaapi/model_status.go b/services/certificates/v2betaapi/model_status.go deleted file mode 100644 index e76089e95..000000000 --- a/services/certificates/v2betaapi/model_status.go +++ /dev/null @@ -1,230 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "encoding/json" -) - -// checks if the Status type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Status{} - -// Status The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). -type Status struct { - // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. - Code *int32 `json:"code,omitempty"` - // A list of messages that carry the error details. There is a common set of message types for APIs to use. - Details []GoogleProtobufAny `json:"details,omitempty"` - // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. - Message *string `json:"message,omitempty"` - AdditionalProperties map[string]interface{} -} - -type _Status Status - -// NewStatus instantiates a new Status 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 NewStatus() *Status { - this := Status{} - return &this -} - -// NewStatusWithDefaults instantiates a new Status 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 NewStatusWithDefaults() *Status { - this := Status{} - return &this -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *Status) GetCode() int32 { - if o == nil || IsNil(o.Code) { - var ret int32 - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Status) GetCodeOk() (*int32, bool) { - if o == nil || IsNil(o.Code) { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *Status) HasCode() bool { - if o != nil && !IsNil(o.Code) { - return true - } - - return false -} - -// SetCode gets a reference to the given int32 and assigns it to the Code field. -func (o *Status) SetCode(v int32) { - o.Code = &v -} - -// GetDetails returns the Details field value if set, zero value otherwise. -func (o *Status) GetDetails() []GoogleProtobufAny { - if o == nil || IsNil(o.Details) { - var ret []GoogleProtobufAny - return ret - } - return o.Details -} - -// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Status) GetDetailsOk() ([]GoogleProtobufAny, bool) { - if o == nil || IsNil(o.Details) { - return nil, false - } - return o.Details, true -} - -// HasDetails returns a boolean if a field has been set. -func (o *Status) HasDetails() bool { - if o != nil && !IsNil(o.Details) { - return true - } - - return false -} - -// SetDetails gets a reference to the given []GoogleProtobufAny and assigns it to the Details field. -func (o *Status) SetDetails(v []GoogleProtobufAny) { - o.Details = v -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *Status) GetMessage() string { - if o == nil || IsNil(o.Message) { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Status) GetMessageOk() (*string, bool) { - if o == nil || IsNil(o.Message) { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *Status) HasMessage() bool { - if o != nil && !IsNil(o.Message) { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *Status) SetMessage(v string) { - o.Message = &v -} - -func (o Status) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Status) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Code) { - toSerialize["code"] = o.Code - } - if !IsNil(o.Details) { - toSerialize["details"] = o.Details - } - if !IsNil(o.Message) { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *Status) UnmarshalJSON(data []byte) (err error) { - varStatus := _Status{} - - err = json.Unmarshal(data, &varStatus) - - if err != nil { - return err - } - - *o = Status(varStatus) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "code") - delete(additionalProperties, "details") - delete(additionalProperties, "message") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableStatus struct { - value *Status - isSet bool -} - -func (v NullableStatus) Get() *Status { - return v.value -} - -func (v *NullableStatus) Set(val *Status) { - v.value = val - v.isSet = true -} - -func (v NullableStatus) IsSet() bool { - return v.isSet -} - -func (v *NullableStatus) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableStatus(val *Status) *NullableStatus { - return &NullableStatus{value: val, isSet: true} -} - -func (v NullableStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableStatus) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/certificates/v2betaapi/response.go b/services/certificates/v2betaapi/response.go deleted file mode 100644 index 6dfc93a83..000000000 --- a/services/certificates/v2betaapi/response.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "net/http" -) - -// APIResponse stores the API response returned by the server. -type APIResponse struct { - *http.Response `json:"-"` - Message string `json:"message,omitempty"` - // Operation is the name of the OpenAPI operation. - Operation string `json:"operation,omitempty"` - // RequestURL is the request URL. This value is always available, even if the - // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` - // Method is the HTTP method used for the request. This value is always - // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` - // Payload holds the contents of the response body (which may be nil or empty). - // This is provided here as the raw response.Body() reader will have already - // been drained. - Payload []byte `json:"-"` -} - -// NewAPIResponse returns a new APIResponse object. -func NewAPIResponse(r *http.Response) *APIResponse { - - response := &APIResponse{Response: r} - return response -} - -// NewAPIResponseWithError returns a new APIResponse object with the provided error message. -func NewAPIResponseWithError(errorMessage string) *APIResponse { - - response := &APIResponse{Message: errorMessage} - return response -} diff --git a/services/certificates/v2betaapi/utils.go b/services/certificates/v2betaapi/utils.go deleted file mode 100644 index faf798371..000000000 --- a/services/certificates/v2betaapi/utils.go +++ /dev/null @@ -1,361 +0,0 @@ -/* -STACKIT Application Load Balancer Certificates API - -### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. - -API version: 2beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v2betaapi - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "time" -) - -// PtrBool is a helper routine that returns a pointer to given boolean value. -func PtrBool(v bool) *bool { return &v } - -// PtrInt is a helper routine that returns a pointer to given integer value. -func PtrInt(v int) *int { return &v } - -// PtrInt32 is a helper routine that returns a pointer to given integer value. -func PtrInt32(v int32) *int32 { return &v } - -// PtrInt64 is a helper routine that returns a pointer to given integer value. -func PtrInt64(v int64) *int64 { return &v } - -// PtrFloat32 is a helper routine that returns a pointer to given float value. -func PtrFloat32(v float32) *float32 { return &v } - -// PtrFloat64 is a helper routine that returns a pointer to given float value. -func PtrFloat64(v float64) *float64 { return &v } - -// PtrString is a helper routine that returns a pointer to given string value. -func PtrString(v string) *string { return &v } - -// PtrTime is helper routine that returns a pointer to given Time value. -func PtrTime(v time.Time) *time.Time { return &v } - -type NullableBool struct { - value *bool - isSet bool -} - -func (v NullableBool) Get() *bool { - return v.value -} - -func (v *NullableBool) Set(val *bool) { - v.value = val - v.isSet = true -} - -func (v NullableBool) IsSet() bool { - return v.isSet -} - -func (v *NullableBool) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBool(val *bool) *NullableBool { - return &NullableBool{value: val, isSet: true} -} - -func (v NullableBool) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBool) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt struct { - value *int - isSet bool -} - -func (v NullableInt) Get() *int { - return v.value -} - -func (v *NullableInt) Set(val *int) { - v.value = val - v.isSet = true -} - -func (v NullableInt) IsSet() bool { - return v.isSet -} - -func (v *NullableInt) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt(val *int) *NullableInt { - return &NullableInt{value: val, isSet: true} -} - -func (v NullableInt) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt32 struct { - value *int32 - isSet bool -} - -func (v NullableInt32) Get() *int32 { - return v.value -} - -func (v *NullableInt32) Set(val *int32) { - v.value = val - v.isSet = true -} - -func (v NullableInt32) IsSet() bool { - return v.isSet -} - -func (v *NullableInt32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt32(val *int32) *NullableInt32 { - return &NullableInt32{value: val, isSet: true} -} - -func (v NullableInt32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt64 struct { - value *int64 - isSet bool -} - -func (v NullableInt64) Get() *int64 { - return v.value -} - -func (v *NullableInt64) Set(val *int64) { - v.value = val - v.isSet = true -} - -func (v NullableInt64) IsSet() bool { - return v.isSet -} - -func (v *NullableInt64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt64(val *int64) *NullableInt64 { - return &NullableInt64{value: val, isSet: true} -} - -func (v NullableInt64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableFloat32 struct { - value *float32 - isSet bool -} - -func (v NullableFloat32) Get() *float32 { - return v.value -} - -func (v *NullableFloat32) Set(val *float32) { - v.value = val - v.isSet = true -} - -func (v NullableFloat32) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat32(val *float32) *NullableFloat32 { - return &NullableFloat32{value: val, isSet: true} -} - -func (v NullableFloat32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableFloat64 struct { - value *float64 - isSet bool -} - -func (v NullableFloat64) Get() *float64 { - return v.value -} - -func (v *NullableFloat64) Set(val *float64) { - v.value = val - v.isSet = true -} - -func (v NullableFloat64) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat64(val *float64) *NullableFloat64 { - return &NullableFloat64{value: val, isSet: true} -} - -func (v NullableFloat64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableString struct { - value *string - isSet bool -} - -func (v NullableString) Get() *string { - return v.value -} - -func (v *NullableString) Set(val *string) { - v.value = val - v.isSet = true -} - -func (v NullableString) IsSet() bool { - return v.isSet -} - -func (v *NullableString) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableString(val *string) *NullableString { - return &NullableString{value: val, isSet: true} -} - -func (v NullableString) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableString) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableTime struct { - value *time.Time - isSet bool -} - -func (v NullableTime) Get() *time.Time { - return v.value -} - -func (v *NullableTime) Set(val *time.Time) { - v.value = val - v.isSet = true -} - -func (v NullableTime) IsSet() bool { - return v.isSet -} - -func (v *NullableTime) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTime(val *time.Time) *NullableTime { - return &NullableTime{value: val, isSet: true} -} - -func (v NullableTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTime) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// IsNil checks if an input is nil -func IsNil(i interface{}) bool { - if i == nil { - return true - } - switch reflect.TypeOf(i).Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: - return reflect.ValueOf(i).IsNil() - case reflect.Array: - return reflect.ValueOf(i).IsZero() - } - return false -} - -type MappedNullable interface { - ToMap() (map[string]interface{}, error) -} - -// A wrapper for strict JSON decoding -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -}