From cb18611b1c24b9388d669acbde4e127ecce979b3 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 5 Mar 2026 10:52:29 +0000 Subject: [PATCH] Generate certificates --- services/certificates/api_default.go | 51 +- services/certificates/client.go | 7 + services/certificates/configuration.go | 2 + services/certificates/go.mod | 2 +- services/certificates/go.sum | 4 +- .../model_create_certificate_payload.go | 63 ++ .../model_get_certificate_response.go | 53 ++ .../certificates/model_google_protobuf_any.go | 24 + .../model_list_certificates_response.go | 34 + services/certificates/model_status.go | 45 ++ services/certificates/oas_commit | 2 +- services/certificates/utils.go | 81 ++ services/certificates/v2api/api_default.go | 693 ++++++++++++++++++ .../certificates/v2api/api_default_mock.go | 109 +++ services/certificates/v2api/client.go | 658 +++++++++++++++++ services/certificates/v2api/configuration.go | 37 + .../v2api/model_create_certificate_payload.go | 273 +++++++ .../v2api/model_get_certificate_response.go | 236 ++++++ .../v2api/model_google_protobuf_any.go | 154 ++++ .../v2api/model_list_certificates_response.go | 161 ++++ services/certificates/v2api/model_status.go | 199 +++++ services/certificates/v2api/response.go | 47 ++ services/certificates/v2api/utils.go | 361 +++++++++ .../certificates/v2betaapi/api_default.go | 693 ++++++++++++++++++ .../v2betaapi/api_default_mock.go | 109 +++ services/certificates/v2betaapi/client.go | 658 +++++++++++++++++ .../certificates/v2betaapi/configuration.go | 37 + .../model_create_certificate_payload.go | 273 +++++++ .../model_create_certificate_response.go | 162 ++++ .../model_get_certificate_response.go | 236 ++++++ .../v2betaapi/model_google_protobuf_any.go | 154 ++++ .../model_list_certificates_response.go | 161 ++++ .../certificates/v2betaapi/model_status.go | 199 +++++ services/certificates/v2betaapi/response.go | 47 ++ services/certificates/v2betaapi/utils.go | 361 +++++++++ 35 files changed, 6376 insertions(+), 10 deletions(-) create mode 100644 services/certificates/v2api/api_default.go create mode 100644 services/certificates/v2api/api_default_mock.go create mode 100644 services/certificates/v2api/client.go create mode 100644 services/certificates/v2api/configuration.go create mode 100644 services/certificates/v2api/model_create_certificate_payload.go create mode 100644 services/certificates/v2api/model_get_certificate_response.go create mode 100644 services/certificates/v2api/model_google_protobuf_any.go create mode 100644 services/certificates/v2api/model_list_certificates_response.go create mode 100644 services/certificates/v2api/model_status.go create mode 100644 services/certificates/v2api/response.go create mode 100644 services/certificates/v2api/utils.go create mode 100644 services/certificates/v2betaapi/api_default.go create mode 100644 services/certificates/v2betaapi/api_default_mock.go create mode 100644 services/certificates/v2betaapi/client.go create mode 100644 services/certificates/v2betaapi/configuration.go create mode 100644 services/certificates/v2betaapi/model_create_certificate_payload.go create mode 100644 services/certificates/v2betaapi/model_create_certificate_response.go create mode 100644 services/certificates/v2betaapi/model_get_certificate_response.go create mode 100644 services/certificates/v2betaapi/model_google_protobuf_any.go create mode 100644 services/certificates/v2betaapi/model_list_certificates_response.go create mode 100644 services/certificates/v2betaapi/model_status.go create mode 100644 services/certificates/v2betaapi/response.go create mode 100644 services/certificates/v2betaapi/utils.go diff --git a/services/certificates/api_default.go b/services/certificates/api_default.go index 49a2a26e8..862bcdf97 100644 --- a/services/certificates/api_default.go +++ b/services/certificates/api_default.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -23,6 +24,7 @@ import ( "github.com/stackitcloud/stackit-sdk-go/core/oapierror" ) +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApi interface { /* CreateCertificate Store a TLS certificate in a project. @@ -32,6 +34,8 @@ type DefaultApi interface { @param projectId @param region @return ApiCreateCertificateRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest /* @@ -42,6 +46,7 @@ type DefaultApi interface { @param region @return GetCertificateResponse + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateCertificateExecute(ctx context.Context, projectId string, region string) (*GetCertificateResponse, error) /* @@ -53,6 +58,8 @@ type DefaultApi interface { @param region @param id @return ApiDeleteCertificateRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest /* @@ -64,6 +71,7 @@ type DefaultApi interface { @param id @return map[string]interface{} + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteCertificateExecute(ctx context.Context, projectId string, region string, id string) (map[string]interface{}, error) /* @@ -75,6 +83,8 @@ type DefaultApi interface { @param region @param id @return ApiGetCertificateRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest /* @@ -86,6 +96,7 @@ type DefaultApi interface { @param id @return GetCertificateResponse + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetCertificateExecute(ctx context.Context, projectId string, region string, id string) (*GetCertificateResponse, error) /* @@ -96,6 +107,8 @@ type DefaultApi interface { @param projectId @param region @return ApiListCertificatesRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest /* @@ -106,34 +119,48 @@ type DefaultApi interface { @param region @return ListCertificatesResponse + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListCertificatesExecute(ctx context.Context, projectId string, region string) (*ListCertificatesResponse, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiCreateCertificateRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*GetCertificateResponse, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteCertificateRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (map[string]interface{}, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiGetCertificateRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*GetCertificateResponse, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListCertificatesRequest interface { // page_size specifies how many certificates should be returned on this page. Must be a positive number <= 1000 + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead PageSize(pageSize string) ApiListCertificatesRequest // page_id is a page identifier returned by the previous response and is used to request the next page + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead PageId(pageId string) ApiListCertificatesRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*ListCertificatesResponse, error) } // DefaultApiService DefaultApi service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApiService service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificateRequest struct { ctx context.Context apiService *DefaultApiService @@ -142,11 +169,13 @@ type CreateCertificateRequest struct { createCertificatePayload *CreateCertificatePayload } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateCertificateRequest) CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest { r.createCertificatePayload = &createCertificatePayload return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateCertificateRequest) Execute() (*GetCertificateResponse, error) { var ( localVarHTTPMethod = http.MethodPost @@ -264,7 +293,7 @@ func (r CreateCertificateRequest) Execute() (*GetCertificateResponse, error) { /* CreateCertificate: Store a TLS certificate in a project. -CreateCertificate will store a TLS certificate in a project. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -280,6 +309,7 @@ func (a *APIClient) CreateCertificate(ctx context.Context, projectId string, reg } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) CreateCertificateExecute(ctx context.Context, projectId string, region string) (*GetCertificateResponse, error) { r := CreateCertificateRequest{ apiService: a.defaultApi, @@ -290,6 +320,7 @@ func (a *APIClient) CreateCertificateExecute(ctx context.Context, projectId stri return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DeleteCertificateRequest struct { ctx context.Context apiService *DefaultApiService @@ -298,6 +329,7 @@ type DeleteCertificateRequest struct { id string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r DeleteCertificateRequest) Execute() (map[string]interface{}, error) { var ( localVarHTTPMethod = http.MethodDelete @@ -411,7 +443,7 @@ func (r DeleteCertificateRequest) Execute() (map[string]interface{}, error) { /* DeleteCertificate: Delete a stored TLS certificate in a project. -DeleteCertificate will delete the stored TLS certificate. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -429,6 +461,7 @@ func (a *APIClient) DeleteCertificate(ctx context.Context, projectId string, reg } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) DeleteCertificateExecute(ctx context.Context, projectId string, region string, id string) (map[string]interface{}, error) { r := DeleteCertificateRequest{ apiService: a.defaultApi, @@ -440,6 +473,7 @@ func (a *APIClient) DeleteCertificateExecute(ctx context.Context, projectId stri return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateRequest struct { ctx context.Context apiService *DefaultApiService @@ -448,6 +482,7 @@ type GetCertificateRequest struct { id string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r GetCertificateRequest) Execute() (*GetCertificateResponse, error) { var ( localVarHTTPMethod = http.MethodGet @@ -561,7 +596,7 @@ func (r GetCertificateRequest) Execute() (*GetCertificateResponse, error) { /* GetCertificate: Retrieve the public parts of a stored TLS certificate. -GetCertificate will return the public parts of a stored TLS certificate. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -579,6 +614,7 @@ func (a *APIClient) GetCertificate(ctx context.Context, projectId string, region } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) GetCertificateExecute(ctx context.Context, projectId string, region string, id string) (*GetCertificateResponse, error) { r := GetCertificateRequest{ apiService: a.defaultApi, @@ -590,6 +626,7 @@ func (a *APIClient) GetCertificateExecute(ctx context.Context, projectId string, return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesRequest struct { ctx context.Context apiService *DefaultApiService @@ -600,19 +637,20 @@ type ListCertificatesRequest struct { } // page_size specifies how many certificates should be returned on this page. Must be a positive number <= 1000 - +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListCertificatesRequest) 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 - +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListCertificatesRequest) PageId(pageId string) ApiListCertificatesRequest { r.pageId = &pageId return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListCertificatesRequest) Execute() (*ListCertificatesResponse, error) { var ( localVarHTTPMethod = http.MethodGet @@ -731,7 +769,7 @@ func (r ListCertificatesRequest) Execute() (*ListCertificatesResponse, error) { /* ListCertificates: Retrieve the list of TLS certificate stored in a project. -ListCertificates will return the list of TLS certificates in a project. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId @@ -747,6 +785,7 @@ func (a *APIClient) ListCertificates(ctx context.Context, projectId string, regi } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) ListCertificatesExecute(ctx context.Context, projectId string, region string) (*ListCertificatesResponse, error) { r := ListCertificatesRequest{ apiService: a.defaultApi, diff --git a/services/certificates/client.go b/services/certificates/client.go index 3041c495a..db996c727 100644 --- a/services/certificates/client.go +++ b/services/certificates/client.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -44,18 +45,21 @@ var ( // APIClient manages communication with the STACKIT Application Load Balancer Certificates API API v2.0.0 // In most cases there should be only one, shared, APIClient. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type APIClient struct { cfg *config.Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. defaultApi *DefaultApiService } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type service struct { client DefaultApi } // NewAPIClient creates a new API client. // Optionally receives configuration options +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { cfg := NewConfiguration() @@ -144,6 +148,7 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func ParameterValueToString(obj interface{}, key string) string { if reflect.TypeOf(obj).Kind() != reflect.Ptr { return fmt.Sprintf("%v", obj) @@ -282,6 +287,7 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { // Allow modification of underlying config for alternate implementations and testing // Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (c *APIClient) GetConfig() *config.Configuration { return c.cfg } @@ -592,6 +598,7 @@ func parseCacheControl(headers http.Header) cacheControl { } // CacheExpires helper function to determine remaining time before repeating a request. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time diff --git a/services/certificates/configuration.go b/services/certificates/configuration.go index 2e2e7fa6b..bd1f2fcee 100644 --- a/services/certificates/configuration.go +++ b/services/certificates/configuration.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -15,6 +16,7 @@ import ( ) // NewConfiguration returns a new Configuration object +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewConfiguration() *config.Configuration { cfg := &config.Configuration{ DefaultHeader: make(map[string]string), diff --git a/services/certificates/go.mod b/services/certificates/go.mod index 651d8713c..acd57feb9 100644 --- a/services/certificates/go.mod +++ b/services/certificates/go.mod @@ -2,7 +2,7 @@ module github.com/stackitcloud/stackit-sdk-go/services/certificates go 1.21 -require github.com/stackitcloud/stackit-sdk-go/core v0.21.1 +require github.com/stackitcloud/stackit-sdk-go/core v0.22.0 require ( github.com/golang-jwt/jwt/v5 v5.3.1 // indirect diff --git a/services/certificates/go.sum b/services/certificates/go.sum index ca103c909..195011dd5 100644 --- a/services/certificates/go.sum +++ b/services/certificates/go.sum @@ -4,5 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts= -github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= diff --git a/services/certificates/model_create_certificate_payload.go b/services/certificates/model_create_certificate_payload.go index 79ee6681f..42ecd1249 100644 --- a/services/certificates/model_create_certificate_payload.go +++ b/services/certificates/model_create_certificate_payload.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &CreateCertificatePayload{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCertificatePayloadGetNameAttributeTypeOk(arg CreateCertificatePayloadGetNameAttributeType) (ret CreateCertificatePayloadGetNameRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getCreateCertificatePayloadGetNameAttributeTypeOk(arg CreateCertificatePayl return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCertificatePayloadGetNameAttributeType(arg *CreateCertificatePayloadGetNameAttributeType, val CreateCertificatePayloadGetNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetNameRetType = string /* @@ -43,8 +50,10 @@ type CreateCertificatePayloadGetNameRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetPrivateKeyAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(arg CreateCertificatePayloadGetPrivateKeyAttributeType) (ret CreateCertificatePayloadGetPrivateKeyRetType, ok bool) { if arg == nil { return ret, false @@ -52,11 +61,15 @@ func getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(arg CreateCertifica return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCertificatePayloadGetPrivateKeyAttributeType(arg *CreateCertificatePayloadGetPrivateKeyAttributeType, val CreateCertificatePayloadGetPrivateKeyRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetPrivateKeyArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetPrivateKeyRetType = string /* @@ -64,8 +77,10 @@ type CreateCertificatePayloadGetPrivateKeyRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetProjectIdAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCertificatePayloadGetProjectIdAttributeTypeOk(arg CreateCertificatePayloadGetProjectIdAttributeType) (ret CreateCertificatePayloadGetProjectIdRetType, ok bool) { if arg == nil { return ret, false @@ -73,11 +88,15 @@ func getCreateCertificatePayloadGetProjectIdAttributeTypeOk(arg CreateCertificat return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCertificatePayloadGetProjectIdAttributeType(arg *CreateCertificatePayloadGetProjectIdAttributeType, val CreateCertificatePayloadGetProjectIdRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetProjectIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetProjectIdRetType = string /* @@ -85,8 +104,10 @@ type CreateCertificatePayloadGetProjectIdRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetPublicKeyAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(arg CreateCertificatePayloadGetPublicKeyAttributeType) (ret CreateCertificatePayloadGetPublicKeyRetType, ok bool) { if arg == nil { return ret, false @@ -94,11 +115,15 @@ func getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(arg CreateCertificat return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCertificatePayloadGetPublicKeyAttributeType(arg *CreateCertificatePayloadGetPublicKeyAttributeType, val CreateCertificatePayloadGetPublicKeyRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetPublicKeyArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetPublicKeyRetType = string /* @@ -106,8 +131,10 @@ type CreateCertificatePayloadGetPublicKeyRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetRegionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCertificatePayloadGetRegionAttributeTypeOk(arg CreateCertificatePayloadGetRegionAttributeType) (ret CreateCertificatePayloadGetRegionRetType, ok bool) { if arg == nil { return ret, false @@ -115,14 +142,19 @@ func getCreateCertificatePayloadGetRegionAttributeTypeOk(arg CreateCertificatePa return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCertificatePayloadGetRegionAttributeType(arg *CreateCertificatePayloadGetRegionAttributeType, val CreateCertificatePayloadGetRegionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetRegionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayloadGetRegionRetType = string // CreateCertificatePayload Uploads a PEM encoded X509 public/private key pair +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCertificatePayload struct { // TLS certificate name Name CreateCertificatePayloadGetNameAttributeType `json:"name,omitempty"` @@ -140,6 +172,7 @@ type CreateCertificatePayload struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateCertificatePayload() *CreateCertificatePayload { this := CreateCertificatePayload{} return &this @@ -148,12 +181,14 @@ func NewCreateCertificatePayload() *CreateCertificatePayload { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateCertificatePayloadWithDefaults() *CreateCertificatePayload { this := CreateCertificatePayload{} return &this } // GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetName() (res CreateCertificatePayloadGetNameRetType) { res, _ = o.GetNameOk() return @@ -161,22 +196,26 @@ func (o *CreateCertificatePayload) GetName() (res CreateCertificatePayloadGetNam // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetNameOk() (ret CreateCertificatePayloadGetNameRetType, ok bool) { return getCreateCertificatePayloadGetNameAttributeTypeOk(o.Name) } // HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) HasName() bool { _, ok := o.GetNameOk() return ok } // SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) SetName(v CreateCertificatePayloadGetNameRetType) { setCreateCertificatePayloadGetNameAttributeType(&o.Name, v) } // GetPrivateKey returns the PrivateKey field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetPrivateKey() (res CreateCertificatePayloadGetPrivateKeyRetType) { res, _ = o.GetPrivateKeyOk() return @@ -184,22 +223,26 @@ func (o *CreateCertificatePayload) GetPrivateKey() (res CreateCertificatePayload // GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetPrivateKeyOk() (ret CreateCertificatePayloadGetPrivateKeyRetType, ok bool) { return getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(o.PrivateKey) } // HasPrivateKey returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) HasPrivateKey() bool { _, ok := o.GetPrivateKeyOk() return ok } // SetPrivateKey gets a reference to the given string and assigns it to the PrivateKey field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) SetPrivateKey(v CreateCertificatePayloadGetPrivateKeyRetType) { setCreateCertificatePayloadGetPrivateKeyAttributeType(&o.PrivateKey, v) } // GetProjectId returns the ProjectId field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetProjectId() (res CreateCertificatePayloadGetProjectIdRetType) { res, _ = o.GetProjectIdOk() return @@ -207,22 +250,26 @@ func (o *CreateCertificatePayload) GetProjectId() (res CreateCertificatePayloadG // GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetProjectIdOk() (ret CreateCertificatePayloadGetProjectIdRetType, ok bool) { return getCreateCertificatePayloadGetProjectIdAttributeTypeOk(o.ProjectId) } // HasProjectId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) HasProjectId() bool { _, ok := o.GetProjectIdOk() return ok } // SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) SetProjectId(v CreateCertificatePayloadGetProjectIdRetType) { setCreateCertificatePayloadGetProjectIdAttributeType(&o.ProjectId, v) } // GetPublicKey returns the PublicKey field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetPublicKey() (res CreateCertificatePayloadGetPublicKeyRetType) { res, _ = o.GetPublicKeyOk() return @@ -230,22 +277,26 @@ func (o *CreateCertificatePayload) GetPublicKey() (res CreateCertificatePayloadG // GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetPublicKeyOk() (ret CreateCertificatePayloadGetPublicKeyRetType, ok bool) { return getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(o.PublicKey) } // HasPublicKey returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) HasPublicKey() bool { _, ok := o.GetPublicKeyOk() return ok } // SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) SetPublicKey(v CreateCertificatePayloadGetPublicKeyRetType) { setCreateCertificatePayloadGetPublicKeyAttributeType(&o.PublicKey, v) } // GetRegion returns the Region field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetRegion() (res CreateCertificatePayloadGetRegionRetType) { res, _ = o.GetRegionOk() return @@ -253,21 +304,25 @@ func (o *CreateCertificatePayload) GetRegion() (res CreateCertificatePayloadGetR // GetRegionOk returns a tuple with the Region field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) GetRegionOk() (ret CreateCertificatePayloadGetRegionRetType, ok bool) { return getCreateCertificatePayloadGetRegionAttributeTypeOk(o.Region) } // HasRegion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) HasRegion() bool { _, ok := o.GetRegionOk() return ok } // SetRegion gets a reference to the given string and assigns it to the Region field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCertificatePayload) SetRegion(v CreateCertificatePayloadGetRegionRetType) { setCreateCertificatePayloadGetRegionAttributeType(&o.Region, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CreateCertificatePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCreateCertificatePayloadGetNameAttributeTypeOk(o.Name); ok { @@ -288,37 +343,45 @@ func (o CreateCertificatePayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCreateCertificatePayload struct { value *CreateCertificatePayload isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateCertificatePayload) Get() *CreateCertificatePayload { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateCertificatePayload) Set(val *CreateCertificatePayload) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateCertificatePayload) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateCertificatePayload) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCreateCertificatePayload(val *CreateCertificatePayload) *NullableCreateCertificatePayload { return &NullableCreateCertificatePayload{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateCertificatePayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateCertificatePayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/certificates/model_get_certificate_response.go b/services/certificates/model_get_certificate_response.go index ea597fbe7..0738de66d 100644 --- a/services/certificates/model_get_certificate_response.go +++ b/services/certificates/model_get_certificate_response.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &GetCertificateResponse{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetIdAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getGetCertificateResponseGetIdAttributeTypeOk(arg GetCertificateResponseGetIdAttributeType) (ret GetCertificateResponseGetIdRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getGetCertificateResponseGetIdAttributeTypeOk(arg GetCertificateResponseGet return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setGetCertificateResponseGetIdAttributeType(arg *GetCertificateResponseGetIdAttributeType, val GetCertificateResponseGetIdRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetIdRetType = string /* @@ -43,8 +50,10 @@ type GetCertificateResponseGetIdRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getGetCertificateResponseGetNameAttributeTypeOk(arg GetCertificateResponseGetNameAttributeType) (ret GetCertificateResponseGetNameRetType, ok bool) { if arg == nil { return ret, false @@ -52,11 +61,15 @@ func getGetCertificateResponseGetNameAttributeTypeOk(arg GetCertificateResponseG return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setGetCertificateResponseGetNameAttributeType(arg *GetCertificateResponseGetNameAttributeType, val GetCertificateResponseGetNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetNameRetType = string /* @@ -64,8 +77,10 @@ type GetCertificateResponseGetNameRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetPublicKeyAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getGetCertificateResponseGetPublicKeyAttributeTypeOk(arg GetCertificateResponseGetPublicKeyAttributeType) (ret GetCertificateResponseGetPublicKeyRetType, ok bool) { if arg == nil { return ret, false @@ -73,11 +88,15 @@ func getGetCertificateResponseGetPublicKeyAttributeTypeOk(arg GetCertificateResp return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setGetCertificateResponseGetPublicKeyAttributeType(arg *GetCertificateResponseGetPublicKeyAttributeType, val GetCertificateResponseGetPublicKeyRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetPublicKeyArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetPublicKeyRetType = string /* @@ -85,8 +104,10 @@ type GetCertificateResponseGetPublicKeyRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetRegionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getGetCertificateResponseGetRegionAttributeTypeOk(arg GetCertificateResponseGetRegionAttributeType) (ret GetCertificateResponseGetRegionRetType, ok bool) { if arg == nil { return ret, false @@ -94,14 +115,19 @@ func getGetCertificateResponseGetRegionAttributeTypeOk(arg GetCertificateRespons return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setGetCertificateResponseGetRegionAttributeType(arg *GetCertificateResponseGetRegionAttributeType, val GetCertificateResponseGetRegionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetRegionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponseGetRegionRetType = string // GetCertificateResponse GetCertificateResponse returns name, id and public key +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCertificateResponse struct { // The certificates resource id Id GetCertificateResponseGetIdAttributeType `json:"id,omitempty"` @@ -117,6 +143,7 @@ type GetCertificateResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewGetCertificateResponse() *GetCertificateResponse { this := GetCertificateResponse{} return &this @@ -125,12 +152,14 @@ func NewGetCertificateResponse() *GetCertificateResponse { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewGetCertificateResponseWithDefaults() *GetCertificateResponse { this := GetCertificateResponse{} return &this } // GetId returns the Id field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetId() (res GetCertificateResponseGetIdRetType) { res, _ = o.GetIdOk() return @@ -138,22 +167,26 @@ func (o *GetCertificateResponse) GetId() (res GetCertificateResponseGetIdRetType // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetIdOk() (ret GetCertificateResponseGetIdRetType, ok bool) { return getGetCertificateResponseGetIdAttributeTypeOk(o.Id) } // HasId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) HasId() bool { _, ok := o.GetIdOk() return ok } // SetId gets a reference to the given string and assigns it to the Id field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) SetId(v GetCertificateResponseGetIdRetType) { setGetCertificateResponseGetIdAttributeType(&o.Id, v) } // GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetName() (res GetCertificateResponseGetNameRetType) { res, _ = o.GetNameOk() return @@ -161,22 +194,26 @@ func (o *GetCertificateResponse) GetName() (res GetCertificateResponseGetNameRet // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetNameOk() (ret GetCertificateResponseGetNameRetType, ok bool) { return getGetCertificateResponseGetNameAttributeTypeOk(o.Name) } // HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) HasName() bool { _, ok := o.GetNameOk() return ok } // SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) SetName(v GetCertificateResponseGetNameRetType) { setGetCertificateResponseGetNameAttributeType(&o.Name, v) } // GetPublicKey returns the PublicKey field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetPublicKey() (res GetCertificateResponseGetPublicKeyRetType) { res, _ = o.GetPublicKeyOk() return @@ -184,22 +221,26 @@ func (o *GetCertificateResponse) GetPublicKey() (res GetCertificateResponseGetPu // GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetPublicKeyOk() (ret GetCertificateResponseGetPublicKeyRetType, ok bool) { return getGetCertificateResponseGetPublicKeyAttributeTypeOk(o.PublicKey) } // HasPublicKey returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) HasPublicKey() bool { _, ok := o.GetPublicKeyOk() return ok } // SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) SetPublicKey(v GetCertificateResponseGetPublicKeyRetType) { setGetCertificateResponseGetPublicKeyAttributeType(&o.PublicKey, v) } // GetRegion returns the Region field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetRegion() (res GetCertificateResponseGetRegionRetType) { res, _ = o.GetRegionOk() return @@ -207,21 +248,25 @@ func (o *GetCertificateResponse) GetRegion() (res GetCertificateResponseGetRegio // GetRegionOk returns a tuple with the Region field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) GetRegionOk() (ret GetCertificateResponseGetRegionRetType, ok bool) { return getGetCertificateResponseGetRegionAttributeTypeOk(o.Region) } // HasRegion returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) HasRegion() bool { _, ok := o.GetRegionOk() return ok } // SetRegion gets a reference to the given string and assigns it to the Region field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCertificateResponse) SetRegion(v GetCertificateResponseGetRegionRetType) { setGetCertificateResponseGetRegionAttributeType(&o.Region, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o GetCertificateResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getGetCertificateResponseGetIdAttributeTypeOk(o.Id); ok { @@ -239,37 +284,45 @@ func (o GetCertificateResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableGetCertificateResponse struct { value *GetCertificateResponse isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGetCertificateResponse) Get() *GetCertificateResponse { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGetCertificateResponse) Set(val *GetCertificateResponse) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGetCertificateResponse) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGetCertificateResponse) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableGetCertificateResponse(val *GetCertificateResponse) *NullableGetCertificateResponse { return &NullableGetCertificateResponse{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGetCertificateResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGetCertificateResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/certificates/model_google_protobuf_any.go b/services/certificates/model_google_protobuf_any.go index a116c36ca..bd2a2e879 100644 --- a/services/certificates/model_google_protobuf_any.go +++ b/services/certificates/model_google_protobuf_any.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &GoogleProtobufAny{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GoogleProtobufAnyGetTypeAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttributeType) (ret GoogleProtobufAnyGetTypeRetType, ok bool) { if arg == nil { return ret, false @@ -31,26 +34,33 @@ func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttr return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setGoogleProtobufAnyGetTypeAttributeType(arg *GoogleProtobufAnyGetTypeAttributeType, val GoogleProtobufAnyGetTypeRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GoogleProtobufAnyGetTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GoogleProtobufAnyGetTypeRetType = string // GoogleProtobufAny Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GoogleProtobufAny struct { // The type of the serialized message. Type GoogleProtobufAnyGetTypeAttributeType `json:"@type,omitempty"` AdditionalProperties map[string]interface{} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewGoogleProtobufAny() *GoogleProtobufAny { this := GoogleProtobufAny{} return &this @@ -59,12 +69,14 @@ func NewGoogleProtobufAny() *GoogleProtobufAny { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewGoogleProtobufAnyWithDefaults() *GoogleProtobufAny { this := GoogleProtobufAny{} return &this } // GetType returns the Type field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GoogleProtobufAny) GetType() (res GoogleProtobufAnyGetTypeRetType) { res, _ = o.GetTypeOk() return @@ -72,21 +84,25 @@ func (o *GoogleProtobufAny) GetType() (res GoogleProtobufAnyGetTypeRetType) { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GoogleProtobufAny) GetTypeOk() (ret GoogleProtobufAnyGetTypeRetType, ok bool) { return getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type) } // HasType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GoogleProtobufAny) HasType() bool { _, ok := o.GetTypeOk() return ok } // SetType gets a reference to the given string and assigns it to the Type field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GoogleProtobufAny) SetType(v GoogleProtobufAnyGetTypeRetType) { setGoogleProtobufAnyGetTypeAttributeType(&o.Type, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type); ok { @@ -100,37 +116,45 @@ func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableGoogleProtobufAny struct { value *GoogleProtobufAny isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGoogleProtobufAny) Get() *GoogleProtobufAny { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGoogleProtobufAny) Set(val *GoogleProtobufAny) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGoogleProtobufAny) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGoogleProtobufAny) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableGoogleProtobufAny(val *GoogleProtobufAny) *NullableGoogleProtobufAny { return &NullableGoogleProtobufAny{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGoogleProtobufAny) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGoogleProtobufAny) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/certificates/model_list_certificates_response.go b/services/certificates/model_list_certificates_response.go index 5e8b0eae5..c4a2f8d01 100644 --- a/services/certificates/model_list_certificates_response.go +++ b/services/certificates/model_list_certificates_response.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &ListCertificatesResponse{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponseGetItemsAttributeType = *[]GetCertificateResponse + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponseGetItemsArgType = []GetCertificateResponse + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponseGetItemsRetType = []GetCertificateResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getListCertificatesResponseGetItemsAttributeTypeOk(arg ListCertificatesResponseGetItemsAttributeType) (ret ListCertificatesResponseGetItemsRetType, ok bool) { if arg == nil { return ret, false @@ -33,6 +40,7 @@ func getListCertificatesResponseGetItemsAttributeTypeOk(arg ListCertificatesResp return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setListCertificatesResponseGetItemsAttributeType(arg *ListCertificatesResponseGetItemsAttributeType, val ListCertificatesResponseGetItemsRetType) { *arg = &val } @@ -42,8 +50,10 @@ func setListCertificatesResponseGetItemsAttributeType(arg *ListCertificatesRespo */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponseGetNextPageIdAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getListCertificatesResponseGetNextPageIdAttributeTypeOk(arg ListCertificatesResponseGetNextPageIdAttributeType) (ret ListCertificatesResponseGetNextPageIdRetType, ok bool) { if arg == nil { return ret, false @@ -51,14 +61,19 @@ func getListCertificatesResponseGetNextPageIdAttributeTypeOk(arg ListCertificate return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setListCertificatesResponseGetNextPageIdAttributeType(arg *ListCertificatesResponseGetNextPageIdAttributeType, val ListCertificatesResponseGetNextPageIdRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponseGetNextPageIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponseGetNextPageIdRetType = string // ListCertificatesResponse ListCertificateResponse returns a list of certificate responses +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCertificatesResponse struct { Items ListCertificatesResponseGetItemsAttributeType `json:"items,omitempty"` // Continue token from the ListCertificatesResponse with Limit option @@ -69,6 +84,7 @@ type ListCertificatesResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewListCertificatesResponse() *ListCertificatesResponse { this := ListCertificatesResponse{} return &this @@ -77,12 +93,14 @@ func NewListCertificatesResponse() *ListCertificatesResponse { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewListCertificatesResponseWithDefaults() *ListCertificatesResponse { this := ListCertificatesResponse{} return &this } // GetItems returns the Items field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) GetItems() (res ListCertificatesResponseGetItemsRetType) { res, _ = o.GetItemsOk() return @@ -90,22 +108,26 @@ func (o *ListCertificatesResponse) GetItems() (res ListCertificatesResponseGetIt // GetItemsOk returns a tuple with the Items field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) GetItemsOk() (ret ListCertificatesResponseGetItemsRetType, ok bool) { return getListCertificatesResponseGetItemsAttributeTypeOk(o.Items) } // HasItems returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) HasItems() bool { _, ok := o.GetItemsOk() return ok } // SetItems gets a reference to the given []GetCertificateResponse and assigns it to the Items field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) SetItems(v ListCertificatesResponseGetItemsRetType) { setListCertificatesResponseGetItemsAttributeType(&o.Items, v) } // GetNextPageId returns the NextPageId field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) GetNextPageId() (res ListCertificatesResponseGetNextPageIdRetType) { res, _ = o.GetNextPageIdOk() return @@ -113,21 +135,25 @@ func (o *ListCertificatesResponse) GetNextPageId() (res ListCertificatesResponse // GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) GetNextPageIdOk() (ret ListCertificatesResponseGetNextPageIdRetType, ok bool) { return getListCertificatesResponseGetNextPageIdAttributeTypeOk(o.NextPageId) } // HasNextPageId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) HasNextPageId() bool { _, ok := o.GetNextPageIdOk() return ok } // SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ListCertificatesResponse) SetNextPageId(v ListCertificatesResponseGetNextPageIdRetType) { setListCertificatesResponseGetNextPageIdAttributeType(&o.NextPageId, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o ListCertificatesResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getListCertificatesResponseGetItemsAttributeTypeOk(o.Items); ok { @@ -139,37 +165,45 @@ func (o ListCertificatesResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableListCertificatesResponse struct { value *ListCertificatesResponse isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableListCertificatesResponse) Get() *ListCertificatesResponse { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableListCertificatesResponse) Set(val *ListCertificatesResponse) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableListCertificatesResponse) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableListCertificatesResponse) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableListCertificatesResponse(val *ListCertificatesResponse) *NullableListCertificatesResponse { return &NullableListCertificatesResponse{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableListCertificatesResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableListCertificatesResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/certificates/model_status.go b/services/certificates/model_status.go index 5c3aaa60f..6934348c0 100644 --- a/services/certificates/model_status.go +++ b/services/certificates/model_status.go @@ -8,6 +8,7 @@ API version: 2.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package certificates import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &Status{} */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetCodeAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetCodeArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetCodeRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret StatusGetCodeRetType, ok bool) { if arg == nil { return ret, false @@ -33,6 +40,7 @@ func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret Status return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGetCodeRetType) { *arg = &val } @@ -42,10 +50,16 @@ func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGe */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetDetailsAttributeType = *[]GoogleProtobufAny + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetDetailsArgType = []GoogleProtobufAny + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetDetailsRetType = []GoogleProtobufAny +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret StatusGetDetailsRetType, ok bool) { if arg == nil { return ret, false @@ -53,6 +67,7 @@ func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val StatusGetDetailsRetType) { *arg = &val } @@ -62,8 +77,10 @@ func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val St */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetMessageAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret StatusGetMessageRetType, ok bool) { if arg == nil { return ret, false @@ -71,14 +88,19 @@ func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setStatusGetMessageAttributeType(arg *StatusGetMessageAttributeType, val StatusGetMessageRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetMessageArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type StatusGetMessageRetType = string // 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). +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type Status struct { // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. // Can be cast to int32 without loss of precision. @@ -93,6 +115,7 @@ type Status struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewStatus() *Status { this := Status{} return &this @@ -101,12 +124,14 @@ func NewStatus() *Status { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewStatusWithDefaults() *Status { this := Status{} return &this } // GetCode returns the Code field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) GetCode() (res StatusGetCodeRetType) { res, _ = o.GetCodeOk() return @@ -114,22 +139,26 @@ func (o *Status) GetCode() (res StatusGetCodeRetType) { // GetCodeOk returns a tuple with the Code field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) GetCodeOk() (ret StatusGetCodeRetType, ok bool) { return getStatusGetCodeAttributeTypeOk(o.Code) } // HasCode returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) HasCode() bool { _, ok := o.GetCodeOk() return ok } // SetCode gets a reference to the given int64 and assigns it to the Code field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) SetCode(v StatusGetCodeRetType) { setStatusGetCodeAttributeType(&o.Code, v) } // GetDetails returns the Details field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) GetDetails() (res StatusGetDetailsRetType) { res, _ = o.GetDetailsOk() return @@ -137,22 +166,26 @@ func (o *Status) GetDetails() (res StatusGetDetailsRetType) { // GetDetailsOk returns a tuple with the Details field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) GetDetailsOk() (ret StatusGetDetailsRetType, ok bool) { return getStatusGetDetailsAttributeTypeOk(o.Details) } // HasDetails returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) HasDetails() bool { _, ok := o.GetDetailsOk() return ok } // SetDetails gets a reference to the given []GoogleProtobufAny and assigns it to the Details field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) SetDetails(v StatusGetDetailsRetType) { setStatusGetDetailsAttributeType(&o.Details, v) } // GetMessage returns the Message field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) GetMessage() (res StatusGetMessageRetType) { res, _ = o.GetMessageOk() return @@ -160,21 +193,25 @@ func (o *Status) GetMessage() (res StatusGetMessageRetType) { // GetMessageOk returns a tuple with the Message field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) GetMessageOk() (ret StatusGetMessageRetType, ok bool) { return getStatusGetMessageAttributeTypeOk(o.Message) } // HasMessage returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) HasMessage() bool { _, ok := o.GetMessageOk() return ok } // SetMessage gets a reference to the given string and assigns it to the Message field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Status) SetMessage(v StatusGetMessageRetType) { setStatusGetMessageAttributeType(&o.Message, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o Status) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getStatusGetCodeAttributeTypeOk(o.Code); ok { @@ -189,37 +226,45 @@ func (o Status) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableStatus struct { value *Status isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableStatus) Get() *Status { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableStatus) Set(val *Status) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableStatus) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableStatus) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableStatus(val *Status) *NullableStatus { return &NullableStatus{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableStatus) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableStatus) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/certificates/oas_commit b/services/certificates/oas_commit index 588ee296b..bf3189995 100644 --- a/services/certificates/oas_commit +++ b/services/certificates/oas_commit @@ -1 +1 @@ -964ac4ce34f0b6417f2496a1d48585c4926dee3a +3e9c109388be83b40c16d8cb5ab146aa314eb6e8 diff --git a/services/certificates/utils.go b/services/certificates/utils.go index 1a3544ae3..58806d329 100644 --- a/services/certificates/utils.go +++ b/services/certificates/utils.go @@ -18,341 +18,419 @@ import ( ) // PtrBool is a helper routine that returns a pointer to given boolean value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrBool(v bool) *bool { return &v } // PtrInt is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt(v int) *int { return &v } // PtrInt32 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt32(v int32) *int32 { return &v } // PtrInt64 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt64(v int64) *int64 { return &v } // PtrFloat32 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrFloat32(v float32) *float32 { return &v } // PtrFloat64 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrFloat64(v float64) *float64 { return &v } // PtrString is a helper routine that returns a pointer to given string value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrString(v string) *string { return &v } // PtrTime is helper routine that returns a pointer to given Time value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrTime(v time.Time) *time.Time { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableValue[T any] struct { value *T isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableValue[T]) Get() *T { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableValue[T]) Set(val *T) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableValue[T]) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableValue[T]) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableBool struct { value *bool isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) Get() *bool { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) Set(val *bool) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableBool(val *bool) *NullableBool { return &NullableBool{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt struct { value *int isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) Get() *int { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) Set(val *int) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt(val *int) *NullableInt { return &NullableInt{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt32 struct { value *int32 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) Get() *int32 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) Set(val *int32) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt32(val *int32) *NullableInt32 { return &NullableInt32{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt64 struct { value *int64 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) Get() *int64 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) Set(val *int64) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt64(val *int64) *NullableInt64 { return &NullableInt64{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableFloat32 struct { value *float32 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) Get() *float32 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) Set(val *float32) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableFloat32(val *float32) *NullableFloat32 { return &NullableFloat32{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableFloat64 struct { value *float64 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) Get() *float64 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) Set(val *float64) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableFloat64(val *float64) *NullableFloat64 { return &NullableFloat64{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableString struct { value *string isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) Get() *string { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) Set(val *string) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableString(val *string) *NullableString { return &NullableString{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableTime struct { value *time.Time isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) Get() *time.Time { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) Set(val *time.Time) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableTime(val *time.Time) *NullableTime { return &NullableTime{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) MarshalJSON() ([]byte, error) { return v.value.MarshalJSON() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } // IsNil checks if an input is nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func IsNil(i interface{}) bool { if i == nil { return true @@ -369,13 +447,16 @@ func IsNil(i interface{}) bool { return false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type MappedNullable interface { ToMap() (map[string]interface{}, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // randString returns a random string with a specified length. It panics if n <= 0. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func randString(n int) string { b := make([]byte, n) for i := range b { diff --git a/services/certificates/v2api/api_default.go b/services/certificates/v2api/api_default.go new file mode 100644 index 000000000..be8d09f40 --- /dev/null +++ b/services/certificates/v2api/api_default.go @@ -0,0 +1,693 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2api + +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 + */ + CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest + + // CreateCertificateExecute executes the request + // @return GetCertificateResponse + CreateCertificateExecute(r ApiCreateCertificateRequest) (*GetCertificateResponse, 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 + */ + DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest + + // DeleteCertificateExecute executes the request + // @return map[string]interface{} + 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 + */ + GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest + + // GetCertificateExecute executes the request + // @return GetCertificateResponse + 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 + */ + ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest + + // ListCertificatesExecute executes the request + // @return ListCertificatesResponse + 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() (*GetCertificateResponse, 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 +*/ +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 GetCertificateResponse +func (a *DefaultAPIService) CreateCertificateExecute(r ApiCreateCertificateRequest) (*GetCertificateResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCertificateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateCertificate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/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 + 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 + 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 +*/ +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{} +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 + "/v2/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 + 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 + 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 +*/ +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 +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 + "/v2/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 + 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 + 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 +*/ +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 +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 + "/v2/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 + 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 + 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/v2api/api_default_mock.go b/services/certificates/v2api/api_default_mock.go new file mode 100644 index 000000000..0e54adbea --- /dev/null +++ b/services/certificates/v2api/api_default_mock.go @@ -0,0 +1,109 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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 { + // CreateCertificateExecuteMock can be populated to implement the behavior of the CreateCertificateExecute function of this mock + CreateCertificateExecuteMock *func(r ApiCreateCertificateRequest) (*GetCertificateResponse, error) + // DeleteCertificateExecuteMock can be populated to implement the behavior of the DeleteCertificateExecute function of this mock + DeleteCertificateExecuteMock *func(r ApiDeleteCertificateRequest) (map[string]interface{}, error) + // GetCertificateExecuteMock can be populated to implement the behavior of the GetCertificateExecute function of this mock + GetCertificateExecuteMock *func(r ApiGetCertificateRequest) (*GetCertificateResponse, error) + // ListCertificatesExecuteMock can be populated to implement the behavior of the ListCertificatesExecute function of this mock + ListCertificatesExecuteMock *func(r ApiListCertificatesRequest) (*ListCertificatesResponse, error) +} + +func (a DefaultAPIServiceMock) CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest { + return ApiCreateCertificateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// 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) (*GetCertificateResponse, error) { + if a.CreateCertificateExecuteMock == nil { + var localVarReturnValue *GetCertificateResponse + return localVarReturnValue, nil + } + + return (*a.CreateCertificateExecuteMock)(r) +} + +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, + } +} + +// 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) +} + +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, + } +} + +// 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) +} + +func (a DefaultAPIServiceMock) ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest { + return ApiListCertificatesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// 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/v2api/client.go b/services/certificates/v2api/client.go new file mode 100644 index 000000000..75d0e312d --- /dev/null +++ b/services/certificates/v2api/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2api + +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 v2.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/v2api/configuration.go b/services/certificates/v2api/configuration.go new file mode 100644 index 000000000..dab1f47a5 --- /dev/null +++ b/services/certificates/v2api/configuration.go @@ -0,0 +1,37 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2api + +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/v2api/model_create_certificate_payload.go b/services/certificates/v2api/model_create_certificate_payload.go new file mode 100644 index 000000000..912bcce2f --- /dev/null +++ b/services/certificates/v2api/model_create_certificate_payload.go @@ -0,0 +1,273 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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}$"` +} + +// 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 + } + return toSerialize, nil +} + +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/v2api/model_get_certificate_response.go b/services/certificates/v2api/model_get_certificate_response.go new file mode 100644 index 000000000..26f1858b9 --- /dev/null +++ b/services/certificates/v2api/model_get_certificate_response.go @@ -0,0 +1,236 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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"` +} + +// 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 + } + return toSerialize, nil +} + +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/v2api/model_google_protobuf_any.go b/services/certificates/v2api/model_google_protobuf_any.go new file mode 100644 index 000000000..885344e3c --- /dev/null +++ b/services/certificates/v2api/model_google_protobuf_any.go @@ -0,0 +1,154 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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/v2api/model_list_certificates_response.go b/services/certificates/v2api/model_list_certificates_response.go new file mode 100644 index 000000000..0f3da7e72 --- /dev/null +++ b/services/certificates/v2api/model_list_certificates_response.go @@ -0,0 +1,161 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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])?$"` +} + +// 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 + } + return toSerialize, nil +} + +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/v2api/model_status.go b/services/certificates/v2api/model_status.go new file mode 100644 index 000000000..372576df5 --- /dev/null +++ b/services/certificates/v2api/model_status.go @@ -0,0 +1,199 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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"` +} + +// 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 + } + return toSerialize, nil +} + +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/v2api/response.go b/services/certificates/v2api/response.go new file mode 100644 index 000000000..1cef44059 --- /dev/null +++ b/services/certificates/v2api/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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/v2api/utils.go b/services/certificates/v2api/utils.go new file mode 100644 index 000000000..6279fabd5 --- /dev/null +++ b/services/certificates/v2api/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Application Load Balancer Certificates API + +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: 2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +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...) +} diff --git a/services/certificates/v2betaapi/api_default.go b/services/certificates/v2betaapi/api_default.go new file mode 100644 index 000000000..2fd20f4f4 --- /dev/null +++ b/services/certificates/v2betaapi/api_default.go @@ -0,0 +1,693 @@ +/* +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 + */ + CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest + + // CreateCertificateExecute executes the request + // @return CreateCertificateResponse + 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 + */ + DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest + + // DeleteCertificateExecute executes the request + // @return map[string]interface{} + 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 + */ + GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest + + // GetCertificateExecute executes the request + // @return GetCertificateResponse + 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 + */ + ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest + + // ListCertificatesExecute executes the request + // @return ListCertificatesResponse + 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 +*/ +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 +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 + 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 + 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 +*/ +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{} +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 + 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 + 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 +*/ +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 +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 + 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 + 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 +*/ +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 +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 + 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 + 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 new file mode 100644 index 000000000..17ef95abc --- /dev/null +++ b/services/certificates/v2betaapi/api_default_mock.go @@ -0,0 +1,109 @@ +/* +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 { + // CreateCertificateExecuteMock can be populated to implement the behavior of the CreateCertificateExecute function of this mock + CreateCertificateExecuteMock *func(r ApiCreateCertificateRequest) (*CreateCertificateResponse, error) + // DeleteCertificateExecuteMock can be populated to implement the behavior of the DeleteCertificateExecute function of this mock + DeleteCertificateExecuteMock *func(r ApiDeleteCertificateRequest) (map[string]interface{}, error) + // GetCertificateExecuteMock can be populated to implement the behavior of the GetCertificateExecute function of this mock + GetCertificateExecuteMock *func(r ApiGetCertificateRequest) (*GetCertificateResponse, error) + // ListCertificatesExecuteMock can be populated to implement the behavior of the ListCertificatesExecute function of this mock + ListCertificatesExecuteMock *func(r ApiListCertificatesRequest) (*ListCertificatesResponse, error) +} + +func (a DefaultAPIServiceMock) CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest { + return ApiCreateCertificateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// 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) +} + +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, + } +} + +// 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) +} + +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, + } +} + +// 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) +} + +func (a DefaultAPIServiceMock) ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest { + return ApiListCertificatesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// 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 new file mode 100644 index 000000000..2137c83a6 --- /dev/null +++ b/services/certificates/v2betaapi/client.go @@ -0,0 +1,658 @@ +/* +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 new file mode 100644 index 000000000..0fb8405da --- /dev/null +++ b/services/certificates/v2betaapi/configuration.go @@ -0,0 +1,37 @@ +/* +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 new file mode 100644 index 000000000..e90be8e1d --- /dev/null +++ b/services/certificates/v2betaapi/model_create_certificate_payload.go @@ -0,0 +1,273 @@ +/* +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}$"` +} + +// 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 + } + return toSerialize, nil +} + +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 new file mode 100644 index 000000000..fca98f41e --- /dev/null +++ b/services/certificates/v2betaapi/model_create_certificate_response.go @@ -0,0 +1,162 @@ +/* +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}$"` +} + +// 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 + } + return toSerialize, nil +} + +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 new file mode 100644 index 000000000..af1374809 --- /dev/null +++ b/services/certificates/v2betaapi/model_get_certificate_response.go @@ -0,0 +1,236 @@ +/* +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"` +} + +// 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 + } + return toSerialize, nil +} + +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 new file mode 100644 index 000000000..5c746b4f5 --- /dev/null +++ b/services/certificates/v2betaapi/model_google_protobuf_any.go @@ -0,0 +1,154 @@ +/* +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 new file mode 100644 index 000000000..55c9446ce --- /dev/null +++ b/services/certificates/v2betaapi/model_list_certificates_response.go @@ -0,0 +1,161 @@ +/* +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])?$"` +} + +// 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 + } + return toSerialize, nil +} + +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 new file mode 100644 index 000000000..188a5b9d8 --- /dev/null +++ b/services/certificates/v2betaapi/model_status.go @@ -0,0 +1,199 @@ +/* +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"` +} + +// 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 + } + return toSerialize, nil +} + +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 new file mode 100644 index 000000000..6dfc93a83 --- /dev/null +++ b/services/certificates/v2betaapi/response.go @@ -0,0 +1,47 @@ +/* +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 new file mode 100644 index 000000000..faf798371 --- /dev/null +++ b/services/certificates/v2betaapi/utils.go @@ -0,0 +1,361 @@ +/* +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...) +}