feat: generating code
This commit is contained in:
parent
c329d58970
commit
51663cd8d0
1221 changed files with 271709 additions and 2444 deletions
1
pkg/certificatesbeta/.openapi-generator/VERSION
Normal file
1
pkg/certificatesbeta/.openapi-generator/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
6.6.0
|
||||
758
pkg/certificatesbeta/api_default.go
Normal file
758
pkg/certificatesbeta/api_default.go
Normal file
|
|
@ -0,0 +1,758 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId
|
||||
@param region
|
||||
@return CreateCertificateResponse
|
||||
|
||||
*/
|
||||
CreateCertificateExecute(ctx context.Context, projectId string, region string) (*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
|
||||
|
||||
@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 map[string]interface{}
|
||||
|
||||
*/
|
||||
DeleteCertificateExecute(ctx context.Context, projectId string, region string, id string) (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
|
||||
|
||||
@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 GetCertificateResponse
|
||||
|
||||
*/
|
||||
GetCertificateExecute(ctx context.Context, projectId string, region string, id string) (*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
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId
|
||||
@param region
|
||||
@return ListCertificatesResponse
|
||||
|
||||
*/
|
||||
ListCertificatesExecute(ctx context.Context, projectId string, region string) (*ListCertificatesResponse, error)
|
||||
}
|
||||
|
||||
type ApiCreateCertificateRequest interface {
|
||||
CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest
|
||||
Execute() (*CreateCertificateResponse, error)
|
||||
}
|
||||
|
||||
type ApiDeleteCertificateRequest interface {
|
||||
Execute() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
type ApiGetCertificateRequest interface {
|
||||
Execute() (*GetCertificateResponse, error)
|
||||
}
|
||||
|
||||
type ApiListCertificatesRequest interface {
|
||||
// page_size specifies how many certificates should be returned on this page. Must be a positive number <= 1000
|
||||
PageSize(pageSize string) ApiListCertificatesRequest
|
||||
// page_id is a page identifier returned by the previous response and is used to request the next page
|
||||
PageId(pageId string) ApiListCertificatesRequest
|
||||
Execute() (*ListCertificatesResponse, error)
|
||||
}
|
||||
|
||||
// DefaultApiService DefaultApi service
|
||||
type DefaultApiService service
|
||||
|
||||
type CreateCertificateRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
region string
|
||||
createCertificatePayload *CreateCertificatePayload
|
||||
}
|
||||
|
||||
func (r CreateCertificateRequest) CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest {
|
||||
r.createCertificatePayload = &createCertificatePayload
|
||||
return r
|
||||
}
|
||||
|
||||
func (r CreateCertificateRequest) Execute() (*CreateCertificateResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *CreateCertificateResponse
|
||||
)
|
||||
a := r.apiService
|
||||
client, ok := a.client.(*APIClient)
|
||||
if !ok {
|
||||
return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient")
|
||||
}
|
||||
localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.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, fmt.Errorf("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 := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request)
|
||||
if ok {
|
||||
*contextHTTPRequest = req
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := client.callAPI(req)
|
||||
contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response)
|
||||
if ok {
|
||||
*contextHTTPResponse = localVarHTTPResponse
|
||||
}
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: localVarHTTPResponse.Status,
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, nil
|
||||
}
|
||||
|
||||
/*
|
||||
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 *APIClient) CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest {
|
||||
return CreateCertificateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) CreateCertificateExecute(ctx context.Context, projectId string, region string) (*CreateCertificateResponse, error) {
|
||||
r := CreateCertificateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type DeleteCertificateRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
region string
|
||||
id string
|
||||
}
|
||||
|
||||
func (r DeleteCertificateRequest) Execute() (map[string]interface{}, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodDelete
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue map[string]interface{}
|
||||
)
|
||||
a := r.apiService
|
||||
client, ok := a.client.(*APIClient)
|
||||
if !ok {
|
||||
return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient")
|
||||
}
|
||||
localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.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 := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request)
|
||||
if ok {
|
||||
*contextHTTPRequest = req
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := client.callAPI(req)
|
||||
contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response)
|
||||
if ok {
|
||||
*contextHTTPResponse = localVarHTTPResponse
|
||||
}
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: localVarHTTPResponse.Status,
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, nil
|
||||
}
|
||||
|
||||
/*
|
||||
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 *APIClient) DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest {
|
||||
return DeleteCertificateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
id: id,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) DeleteCertificateExecute(ctx context.Context, projectId string, region string, id string) (map[string]interface{}, error) {
|
||||
r := DeleteCertificateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
id: id,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type GetCertificateRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
region string
|
||||
id string
|
||||
}
|
||||
|
||||
func (r GetCertificateRequest) Execute() (*GetCertificateResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *GetCertificateResponse
|
||||
)
|
||||
a := r.apiService
|
||||
client, ok := a.client.(*APIClient)
|
||||
if !ok {
|
||||
return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient")
|
||||
}
|
||||
localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.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 := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request)
|
||||
if ok {
|
||||
*contextHTTPRequest = req
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := client.callAPI(req)
|
||||
contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response)
|
||||
if ok {
|
||||
*contextHTTPResponse = localVarHTTPResponse
|
||||
}
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: localVarHTTPResponse.Status,
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, nil
|
||||
}
|
||||
|
||||
/*
|
||||
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 *APIClient) GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest {
|
||||
return GetCertificateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
id: id,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) GetCertificateExecute(ctx context.Context, projectId string, region string, id string) (*GetCertificateResponse, error) {
|
||||
r := GetCertificateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
id: id,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type ListCertificatesRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
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 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
|
||||
|
||||
func (r ListCertificatesRequest) PageId(pageId string) ApiListCertificatesRequest {
|
||||
r.pageId = &pageId
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ListCertificatesRequest) Execute() (*ListCertificatesResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *ListCertificatesResponse
|
||||
)
|
||||
a := r.apiService
|
||||
client, ok := a.client.(*APIClient)
|
||||
if !ok {
|
||||
return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient")
|
||||
}
|
||||
localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.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, "")
|
||||
}
|
||||
if r.pageId != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "")
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json", "*/*"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request)
|
||||
if ok {
|
||||
*contextHTTPRequest = req
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := client.callAPI(req)
|
||||
contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response)
|
||||
if ok {
|
||||
*contextHTTPResponse = localVarHTTPResponse
|
||||
}
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: localVarHTTPResponse.Status,
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
var v Status
|
||||
err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.ErrorMessage = err.Error()
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v)
|
||||
newErr.Model = v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := &oapierror.GenericOpenAPIError{
|
||||
StatusCode: localVarHTTPResponse.StatusCode,
|
||||
Body: localVarBody,
|
||||
ErrorMessage: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, nil
|
||||
}
|
||||
|
||||
/*
|
||||
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 *APIClient) ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest {
|
||||
return ListCertificatesRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) ListCertificatesExecute(ctx context.Context, projectId string, region string) (*ListCertificatesResponse, error) {
|
||||
r := ListCertificatesRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
253
pkg/certificatesbeta/api_default_test.go
Normal file
253
pkg/certificatesbeta/api_default_test.go
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
STACKIT Application Load Balancer Certificates API
|
||||
|
||||
Testing DefaultApiService
|
||||
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
|
||||
|
||||
package certificatesbeta
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
)
|
||||
|
||||
func Test_certificatesbeta_DefaultApiService(t *testing.T) {
|
||||
|
||||
t.Run("Test DefaultApiService CreateCertificate", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
regionValue := "region-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := CreateCertificateResponse{}
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(data)
|
||||
})
|
||||
testServer := httptest.NewServer(testDefaultApiServeMux)
|
||||
defer testServer.Close()
|
||||
|
||||
configuration := &config.Configuration{
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||
Debug: false,
|
||||
Region: "test_region",
|
||||
Servers: config.ServerConfigurations{
|
||||
{
|
||||
URL: testServer.URL,
|
||||
Description: "Localhost for certificatesbeta_DefaultApi",
|
||||
Variables: map[string]config.ServerVariable{
|
||||
"region": {
|
||||
DefaultValue: "test_region.",
|
||||
EnumValues: []string{
|
||||
"test_region.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
OperationServers: map[string]config.ServerConfigurations{},
|
||||
}
|
||||
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
|
||||
if err != nil {
|
||||
t.Fatalf("creating API client: %v", err)
|
||||
}
|
||||
|
||||
projectId := projectIdValue
|
||||
region := regionValue
|
||||
createCertificatePayload := CreateCertificatePayload{}
|
||||
|
||||
resp, reqErr := apiClient.CreateCertificate(context.Background(), projectId, region).CreateCertificatePayload(createCertificatePayload).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService DeleteCertificate", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
regionValue := "region-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
||||
idValue := "id-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(idValue, "id")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := map[string]interface{}{}
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(data)
|
||||
})
|
||||
testServer := httptest.NewServer(testDefaultApiServeMux)
|
||||
defer testServer.Close()
|
||||
|
||||
configuration := &config.Configuration{
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||
Debug: false,
|
||||
Region: "test_region",
|
||||
Servers: config.ServerConfigurations{
|
||||
{
|
||||
URL: testServer.URL,
|
||||
Description: "Localhost for certificatesbeta_DefaultApi",
|
||||
Variables: map[string]config.ServerVariable{
|
||||
"region": {
|
||||
DefaultValue: "test_region.",
|
||||
EnumValues: []string{
|
||||
"test_region.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
OperationServers: map[string]config.ServerConfigurations{},
|
||||
}
|
||||
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
|
||||
if err != nil {
|
||||
t.Fatalf("creating API client: %v", err)
|
||||
}
|
||||
|
||||
projectId := projectIdValue
|
||||
region := regionValue
|
||||
id := idValue
|
||||
|
||||
resp, reqErr := apiClient.DeleteCertificate(context.Background(), projectId, region, id).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService GetCertificate", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
regionValue := "region-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
||||
idValue := "id-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(idValue, "id")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := GetCertificateResponse{}
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(data)
|
||||
})
|
||||
testServer := httptest.NewServer(testDefaultApiServeMux)
|
||||
defer testServer.Close()
|
||||
|
||||
configuration := &config.Configuration{
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||
Debug: false,
|
||||
Region: "test_region",
|
||||
Servers: config.ServerConfigurations{
|
||||
{
|
||||
URL: testServer.URL,
|
||||
Description: "Localhost for certificatesbeta_DefaultApi",
|
||||
Variables: map[string]config.ServerVariable{
|
||||
"region": {
|
||||
DefaultValue: "test_region.",
|
||||
EnumValues: []string{
|
||||
"test_region.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
OperationServers: map[string]config.ServerConfigurations{},
|
||||
}
|
||||
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
|
||||
if err != nil {
|
||||
t.Fatalf("creating API client: %v", err)
|
||||
}
|
||||
|
||||
projectId := projectIdValue
|
||||
region := regionValue
|
||||
id := idValue
|
||||
|
||||
resp, reqErr := apiClient.GetCertificate(context.Background(), projectId, region, id).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService ListCertificates", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
regionValue := "region-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := ListCertificatesResponse{}
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(data)
|
||||
})
|
||||
testServer := httptest.NewServer(testDefaultApiServeMux)
|
||||
defer testServer.Close()
|
||||
|
||||
configuration := &config.Configuration{
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||
Debug: false,
|
||||
Region: "test_region",
|
||||
Servers: config.ServerConfigurations{
|
||||
{
|
||||
URL: testServer.URL,
|
||||
Description: "Localhost for certificatesbeta_DefaultApi",
|
||||
Variables: map[string]config.ServerVariable{
|
||||
"region": {
|
||||
DefaultValue: "test_region.",
|
||||
EnumValues: []string{
|
||||
"test_region.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
OperationServers: map[string]config.ServerConfigurations{},
|
||||
}
|
||||
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
|
||||
if err != nil {
|
||||
t.Fatalf("creating API client: %v", err)
|
||||
}
|
||||
|
||||
projectId := projectIdValue
|
||||
region := regionValue
|
||||
|
||||
resp, reqErr := apiClient.ListCertificates(context.Background(), projectId, region).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
631
pkg/certificatesbeta/client.go
Normal file
631
pkg/certificatesbeta/client.go
Normal file
|
|
@ -0,0 +1,631 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/auth"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
|
||||
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
|
||||
queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`)
|
||||
queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]")
|
||||
)
|
||||
|
||||
// APIClient manages communication with the STACKIT 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.
|
||||
defaultApi *DefaultApiService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client DefaultApi
|
||||
}
|
||||
|
||||
// NewAPIClient creates a new API client.
|
||||
// Optionally receives configuration options
|
||||
func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) {
|
||||
cfg := NewConfiguration()
|
||||
|
||||
for _, option := range opts {
|
||||
err := option(cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("configuring the client: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
err := config.ConfigureRegion(cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("configuring region: %w", err)
|
||||
}
|
||||
|
||||
if cfg.HTTPClient == nil {
|
||||
cfg.HTTPClient = &http.Client{}
|
||||
}
|
||||
|
||||
authRoundTripper, err := auth.SetupAuth(cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("setting up authentication: %w", err)
|
||||
}
|
||||
|
||||
roundTripper := authRoundTripper
|
||||
if cfg.Middleware != nil {
|
||||
roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...)
|
||||
}
|
||||
|
||||
cfg.HTTPClient.Transport = roundTripper
|
||||
|
||||
c := &APIClient{}
|
||||
c.cfg = cfg
|
||||
c.common.client = c
|
||||
c.defaultApi = (*DefaultApiService)(&c.common)
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
return ""
|
||||
}
|
||||
if contains(contentTypes, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
// selectHeaderAccept join all accept types and return
|
||||
func selectHeaderAccept(accepts []string) string {
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
// contains is a case insensitive match, finding needle in a haystack
|
||||
func contains(haystack []string, needle string) bool {
|
||||
for _, a := range haystack {
|
||||
if strings.EqualFold(a, needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Verify optional parameters are of the correct type.
|
||||
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||
// Make sure there is an object.
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the type is as expected.
|
||||
if reflect.TypeOf(obj).String() != expected {
|
||||
return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ParameterValueToString(obj interface{}, key string) string {
|
||||
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
|
||||
return fmt.Sprintf("%v", obj)
|
||||
}
|
||||
var param, ok = obj.(MappedNullable)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
dataMap, err := param.ToMap()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%v", dataMap[key])
|
||||
}
|
||||
|
||||
// parameterAddToHeaderOrQuery adds the provided object to the request header or url query
|
||||
// supporting deep object syntax
|
||||
func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
|
||||
var v = reflect.ValueOf(obj)
|
||||
var value = ""
|
||||
if v == reflect.ValueOf(nil) {
|
||||
value = "null"
|
||||
} else {
|
||||
switch v.Kind() {
|
||||
case reflect.Invalid:
|
||||
value = "invalid"
|
||||
|
||||
case reflect.Struct:
|
||||
if t, ok := obj.(MappedNullable); ok {
|
||||
dataMap, err := t.ToMap()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType)
|
||||
return
|
||||
}
|
||||
if t, ok := obj.(time.Time); ok {
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType)
|
||||
return
|
||||
}
|
||||
value = v.Type().String() + " value"
|
||||
case reflect.Slice:
|
||||
var indValue = reflect.ValueOf(obj)
|
||||
if indValue == reflect.ValueOf(nil) {
|
||||
return
|
||||
}
|
||||
var lenIndValue = indValue.Len()
|
||||
for i := 0; i < lenIndValue; i++ {
|
||||
var arrayValue = indValue.Index(i)
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType)
|
||||
}
|
||||
return
|
||||
|
||||
case reflect.Map:
|
||||
var indValue = reflect.ValueOf(obj)
|
||||
if indValue == reflect.ValueOf(nil) {
|
||||
return
|
||||
}
|
||||
iter := indValue.MapRange()
|
||||
for iter.Next() {
|
||||
k, v := iter.Key(), iter.Value()
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType)
|
||||
}
|
||||
return
|
||||
|
||||
case reflect.Interface:
|
||||
fallthrough
|
||||
case reflect.Ptr:
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType)
|
||||
return
|
||||
|
||||
case reflect.Int, reflect.Int8, reflect.Int16,
|
||||
reflect.Int32, reflect.Int64:
|
||||
value = strconv.FormatInt(v.Int(), 10)
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16,
|
||||
reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
value = strconv.FormatUint(v.Uint(), 10)
|
||||
case reflect.Float32, reflect.Float64:
|
||||
value = strconv.FormatFloat(v.Float(), 'g', -1, 32)
|
||||
case reflect.Bool:
|
||||
value = strconv.FormatBool(v.Bool())
|
||||
case reflect.String:
|
||||
value = v.String()
|
||||
default:
|
||||
value = v.Type().String() + " value"
|
||||
}
|
||||
}
|
||||
|
||||
switch valuesMap := headerOrQueryParams.(type) {
|
||||
case url.Values:
|
||||
if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" {
|
||||
valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value)
|
||||
} else {
|
||||
valuesMap.Add(keyPrefix, value)
|
||||
}
|
||||
break
|
||||
case map[string]string:
|
||||
valuesMap[keyPrefix] = value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// helper for converting interface{} parameters to json strings
|
||||
func parameterToJson(obj interface{}) (string, error) {
|
||||
jsonBuf, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(jsonBuf), err
|
||||
}
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
if c.cfg.Debug {
|
||||
dump, err := httputil.DumpRequestOut(request, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Printf("\n%s\n", string(dump))
|
||||
}
|
||||
|
||||
resp, err := c.cfg.HTTPClient.Do(request)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
if c.cfg.Debug {
|
||||
dump, err := httputil.DumpResponse(resp, true)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
log.Printf("\n%s\n", string(dump))
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Allow modification of underlying config for alternate implementations and testing
|
||||
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
|
||||
func (c *APIClient) GetConfig() *config.Configuration {
|
||||
return c.cfg
|
||||
}
|
||||
|
||||
type formFile struct {
|
||||
fileBytes []byte
|
||||
fileName string
|
||||
formFileName string
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
queryParams url.Values,
|
||||
formParams url.Values,
|
||||
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||
|
||||
var body *bytes.Buffer
|
||||
|
||||
// Detect postBody type and post.
|
||||
if !IsNil(postBody) {
|
||||
contentType := headerParams["Content-Type"]
|
||||
if contentType == "" {
|
||||
contentType = detectContentType(postBody)
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
body, err = setBody(postBody, contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// add form parameters and file if available.
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||
if body != nil {
|
||||
return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
w := multipart.NewWriter(body)
|
||||
|
||||
for k, v := range formParams {
|
||||
for _, iv := range v {
|
||||
if strings.HasPrefix(k, "@") { // file
|
||||
err = addFile(w, k[1:], iv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else { // form value
|
||||
w.WriteField(k, iv)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, formFile := range formFiles {
|
||||
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||
w.Boundary()
|
||||
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = part.Write(formFile.fileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Boundary in the Content-Type
|
||||
headerParams["Content-Type"] = w.FormDataContentType()
|
||||
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
w.Close()
|
||||
}
|
||||
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
||||
if body != nil {
|
||||
return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
body.WriteString(formParams.Encode())
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
}
|
||||
|
||||
// Setup path and query parameters
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Override request host, if applicable
|
||||
if c.cfg.Host != "" {
|
||||
url.Host = c.cfg.Host
|
||||
}
|
||||
|
||||
// Override request scheme, if applicable
|
||||
if c.cfg.Scheme != "" {
|
||||
url.Scheme = c.cfg.Scheme
|
||||
}
|
||||
|
||||
// Adding Query Param
|
||||
query := url.Query()
|
||||
for k, v := range queryParams {
|
||||
for _, iv := range v {
|
||||
query.Add(k, iv)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode the parameters.
|
||||
url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string {
|
||||
pieces := strings.Split(s, "=")
|
||||
pieces[0] = queryDescape.Replace(pieces[0])
|
||||
return strings.Join(pieces, "=")
|
||||
})
|
||||
|
||||
// Generate a new request
|
||||
if body != nil {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||
} else {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add header parameters, if any
|
||||
if len(headerParams) > 0 {
|
||||
headers := http.Header{}
|
||||
for h, v := range headerParams {
|
||||
headers[h] = []string{v}
|
||||
}
|
||||
localVarRequest.Header = headers
|
||||
}
|
||||
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
|
||||
// Walk through any authentication.
|
||||
|
||||
}
|
||||
|
||||
for header, value := range c.cfg.DefaultHeader {
|
||||
localVarRequest.Header.Add(header, value)
|
||||
}
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
if s, ok := v.(*string); ok {
|
||||
*s = string(b)
|
||||
return nil
|
||||
}
|
||||
if f, ok := v.(*os.File); ok {
|
||||
f, err = os.CreateTemp("", "HttpClientFile")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = f.Write(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = f.Seek(0, io.SeekStart)
|
||||
return
|
||||
}
|
||||
if f, ok := v.(**os.File); ok {
|
||||
*f, err = os.CreateTemp("", "HttpClientFile")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = (*f).Write(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = (*f).Seek(0, io.SeekStart)
|
||||
return
|
||||
}
|
||||
if xmlCheck.MatchString(contentType) {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
|
||||
}
|
||||
} else if err = json.Unmarshal(b, v); err != nil { // simple model
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(filepath.Clean(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = file.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(part, file)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// A wrapper for strict JSON decoding
|
||||
func newStrictDecoder(data []byte) *json.Decoder {
|
||||
dec := json.NewDecoder(bytes.NewBuffer(data))
|
||||
dec.DisallowUnknownFields()
|
||||
return dec
|
||||
}
|
||||
|
||||
// Set request body from an interface{}
|
||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||
if bodyBuf == nil {
|
||||
bodyBuf = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
if reader, ok := body.(io.Reader); ok {
|
||||
_, err = bodyBuf.ReadFrom(reader)
|
||||
} else if fp, ok := body.(*os.File); ok {
|
||||
_, err = bodyBuf.ReadFrom(fp)
|
||||
} else if b, ok := body.([]byte); ok {
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
err = xml.NewEncoder(bodyBuf).Encode(body)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if bodyBuf.Len() == 0 {
|
||||
err = fmt.Errorf("invalid body type %s", contentType)
|
||||
return nil, err
|
||||
}
|
||||
return bodyBuf, nil
|
||||
}
|
||||
|
||||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||
func detectContentType(body interface{}) string {
|
||||
contentType := "text/plain; charset=utf-8"
|
||||
kind := reflect.TypeOf(body).Kind()
|
||||
|
||||
switch kind {
|
||||
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||
contentType = "application/json; charset=utf-8"
|
||||
case reflect.String:
|
||||
contentType = "text/plain; charset=utf-8"
|
||||
default:
|
||||
if b, ok := body.([]byte); ok {
|
||||
contentType = http.DetectContentType(b)
|
||||
} else if kind == reflect.Slice {
|
||||
contentType = "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
||||
|
||||
return contentType
|
||||
}
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
func parseCacheControl(headers http.Header) cacheControl {
|
||||
cc := cacheControl{}
|
||||
ccHeader := headers.Get("Cache-Control")
|
||||
for _, part := range strings.Split(ccHeader, ",") {
|
||||
part = strings.Trim(part, " ")
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
if strings.ContainsRune(part, '=') {
|
||||
keyval := strings.Split(part, "=")
|
||||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||
} else {
|
||||
cc[part] = ""
|
||||
}
|
||||
}
|
||||
return cc
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
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)
|
||||
}
|
||||
38
pkg/certificatesbeta/configuration.go
Normal file
38
pkg/certificatesbeta/configuration.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
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/certificatesbeta",
|
||||
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
|
||||
}
|
||||
325
pkg/certificatesbeta/model_create_certificate_payload.go
Normal file
325
pkg/certificatesbeta/model_create_certificate_payload.go
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CreateCertificatePayload type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CreateCertificatePayload{}
|
||||
|
||||
/*
|
||||
types and functions for name
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificatePayloadGetNameAttributeType = *string
|
||||
|
||||
func getCreateCertificatePayloadGetNameAttributeTypeOk(arg CreateCertificatePayloadGetNameAttributeType) (ret CreateCertificatePayloadGetNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificatePayloadGetNameAttributeType(arg *CreateCertificatePayloadGetNameAttributeType, val CreateCertificatePayloadGetNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificatePayloadGetNameArgType = string
|
||||
type CreateCertificatePayloadGetNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for privateKey
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificatePayloadGetPrivateKeyAttributeType = *string
|
||||
|
||||
func getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(arg CreateCertificatePayloadGetPrivateKeyAttributeType) (ret CreateCertificatePayloadGetPrivateKeyRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificatePayloadGetPrivateKeyAttributeType(arg *CreateCertificatePayloadGetPrivateKeyAttributeType, val CreateCertificatePayloadGetPrivateKeyRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificatePayloadGetPrivateKeyArgType = string
|
||||
type CreateCertificatePayloadGetPrivateKeyRetType = string
|
||||
|
||||
/*
|
||||
types and functions for projectId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificatePayloadGetProjectIdAttributeType = *string
|
||||
|
||||
func getCreateCertificatePayloadGetProjectIdAttributeTypeOk(arg CreateCertificatePayloadGetProjectIdAttributeType) (ret CreateCertificatePayloadGetProjectIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificatePayloadGetProjectIdAttributeType(arg *CreateCertificatePayloadGetProjectIdAttributeType, val CreateCertificatePayloadGetProjectIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificatePayloadGetProjectIdArgType = string
|
||||
type CreateCertificatePayloadGetProjectIdRetType = string
|
||||
|
||||
/*
|
||||
types and functions for publicKey
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificatePayloadGetPublicKeyAttributeType = *string
|
||||
|
||||
func getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(arg CreateCertificatePayloadGetPublicKeyAttributeType) (ret CreateCertificatePayloadGetPublicKeyRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificatePayloadGetPublicKeyAttributeType(arg *CreateCertificatePayloadGetPublicKeyAttributeType, val CreateCertificatePayloadGetPublicKeyRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificatePayloadGetPublicKeyArgType = string
|
||||
type CreateCertificatePayloadGetPublicKeyRetType = string
|
||||
|
||||
/*
|
||||
types and functions for region
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificatePayloadGetRegionAttributeType = *string
|
||||
|
||||
func getCreateCertificatePayloadGetRegionAttributeTypeOk(arg CreateCertificatePayloadGetRegionAttributeType) (ret CreateCertificatePayloadGetRegionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificatePayloadGetRegionAttributeType(arg *CreateCertificatePayloadGetRegionAttributeType, val CreateCertificatePayloadGetRegionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificatePayloadGetRegionArgType = string
|
||||
type CreateCertificatePayloadGetRegionRetType = string
|
||||
|
||||
// CreateCertificatePayload Uploads a PEM encoded X509 public/private key pair
|
||||
type CreateCertificatePayload struct {
|
||||
// TLS certificate name
|
||||
Name CreateCertificatePayloadGetNameAttributeType `json:"name,omitempty"`
|
||||
// The PEM encoded private key part
|
||||
PrivateKey CreateCertificatePayloadGetPrivateKeyAttributeType `json:"privateKey,omitempty"`
|
||||
// Project identifier
|
||||
ProjectId CreateCertificatePayloadGetProjectIdAttributeType `json:"projectId,omitempty"`
|
||||
// The PEM encoded public key part
|
||||
PublicKey CreateCertificatePayloadGetPublicKeyAttributeType `json:"publicKey,omitempty"`
|
||||
// Region
|
||||
Region CreateCertificatePayloadGetRegionAttributeType `json:"region,omitempty"`
|
||||
}
|
||||
|
||||
// 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() (res CreateCertificatePayloadGetNameRetType) {
|
||||
res, _ = o.GetNameOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CreateCertificatePayload) GetNameOk() (ret CreateCertificatePayloadGetNameRetType, ok bool) {
|
||||
return getCreateCertificatePayloadGetNameAttributeTypeOk(o.Name)
|
||||
}
|
||||
|
||||
// HasName returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *CreateCertificatePayload) SetName(v CreateCertificatePayloadGetNameRetType) {
|
||||
setCreateCertificatePayloadGetNameAttributeType(&o.Name, v)
|
||||
}
|
||||
|
||||
// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise.
|
||||
func (o *CreateCertificatePayload) GetPrivateKey() (res CreateCertificatePayloadGetPrivateKeyRetType) {
|
||||
res, _ = o.GetPrivateKeyOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret CreateCertificatePayloadGetPrivateKeyRetType, ok bool) {
|
||||
return getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(o.PrivateKey)
|
||||
}
|
||||
|
||||
// HasPrivateKey returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *CreateCertificatePayload) SetPrivateKey(v CreateCertificatePayloadGetPrivateKeyRetType) {
|
||||
setCreateCertificatePayloadGetPrivateKeyAttributeType(&o.PrivateKey, v)
|
||||
}
|
||||
|
||||
// GetProjectId returns the ProjectId field value if set, zero value otherwise.
|
||||
func (o *CreateCertificatePayload) GetProjectId() (res CreateCertificatePayloadGetProjectIdRetType) {
|
||||
res, _ = o.GetProjectIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret CreateCertificatePayloadGetProjectIdRetType, ok bool) {
|
||||
return getCreateCertificatePayloadGetProjectIdAttributeTypeOk(o.ProjectId)
|
||||
}
|
||||
|
||||
// HasProjectId returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *CreateCertificatePayload) SetProjectId(v CreateCertificatePayloadGetProjectIdRetType) {
|
||||
setCreateCertificatePayloadGetProjectIdAttributeType(&o.ProjectId, v)
|
||||
}
|
||||
|
||||
// GetPublicKey returns the PublicKey field value if set, zero value otherwise.
|
||||
func (o *CreateCertificatePayload) GetPublicKey() (res CreateCertificatePayloadGetPublicKeyRetType) {
|
||||
res, _ = o.GetPublicKeyOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret CreateCertificatePayloadGetPublicKeyRetType, ok bool) {
|
||||
return getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(o.PublicKey)
|
||||
}
|
||||
|
||||
// HasPublicKey returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *CreateCertificatePayload) SetPublicKey(v CreateCertificatePayloadGetPublicKeyRetType) {
|
||||
setCreateCertificatePayloadGetPublicKeyAttributeType(&o.PublicKey, v)
|
||||
}
|
||||
|
||||
// GetRegion returns the Region field value if set, zero value otherwise.
|
||||
func (o *CreateCertificatePayload) GetRegion() (res CreateCertificatePayloadGetRegionRetType) {
|
||||
res, _ = o.GetRegionOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret CreateCertificatePayloadGetRegionRetType, ok bool) {
|
||||
return getCreateCertificatePayloadGetRegionAttributeTypeOk(o.Region)
|
||||
}
|
||||
|
||||
// HasRegion returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *CreateCertificatePayload) SetRegion(v CreateCertificatePayloadGetRegionRetType) {
|
||||
setCreateCertificatePayloadGetRegionAttributeType(&o.Region, v)
|
||||
}
|
||||
|
||||
func (o CreateCertificatePayload) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCreateCertificatePayloadGetNameAttributeTypeOk(o.Name); ok {
|
||||
toSerialize["Name"] = val
|
||||
}
|
||||
if val, ok := getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(o.PrivateKey); ok {
|
||||
toSerialize["PrivateKey"] = val
|
||||
}
|
||||
if val, ok := getCreateCertificatePayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok {
|
||||
toSerialize["ProjectId"] = val
|
||||
}
|
||||
if val, ok := getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(o.PublicKey); ok {
|
||||
toSerialize["PublicKey"] = val
|
||||
}
|
||||
if val, ok := getCreateCertificatePayloadGetRegionAttributeTypeOk(o.Region); ok {
|
||||
toSerialize["Region"] = val
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
178
pkg/certificatesbeta/model_create_certificate_response.go
Normal file
178
pkg/certificatesbeta/model_create_certificate_response.go
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CreateCertificateResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CreateCertificateResponse{}
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificateResponseGetIdAttributeType = *string
|
||||
|
||||
func getCreateCertificateResponseGetIdAttributeTypeOk(arg CreateCertificateResponseGetIdAttributeType) (ret CreateCertificateResponseGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificateResponseGetIdAttributeType(arg *CreateCertificateResponseGetIdAttributeType, val CreateCertificateResponseGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificateResponseGetIdArgType = string
|
||||
type CreateCertificateResponseGetIdRetType = string
|
||||
|
||||
/*
|
||||
types and functions for region
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCertificateResponseGetRegionAttributeType = *string
|
||||
|
||||
func getCreateCertificateResponseGetRegionAttributeTypeOk(arg CreateCertificateResponseGetRegionAttributeType) (ret CreateCertificateResponseGetRegionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCertificateResponseGetRegionAttributeType(arg *CreateCertificateResponseGetRegionAttributeType, val CreateCertificateResponseGetRegionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCertificateResponseGetRegionArgType = string
|
||||
type CreateCertificateResponseGetRegionRetType = string
|
||||
|
||||
// CreateCertificateResponse CreateCertificateResponse returns unique resource id
|
||||
type CreateCertificateResponse struct {
|
||||
// The certificates resource id
|
||||
Id CreateCertificateResponseGetIdAttributeType `json:"id,omitempty"`
|
||||
// Region
|
||||
Region CreateCertificateResponseGetRegionAttributeType `json:"region,omitempty"`
|
||||
}
|
||||
|
||||
// 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() (res CreateCertificateResponseGetIdRetType) {
|
||||
res, _ = o.GetIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CreateCertificateResponse) GetIdOk() (ret CreateCertificateResponseGetIdRetType, ok bool) {
|
||||
return getCreateCertificateResponseGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *CreateCertificateResponse) HasId() bool {
|
||||
_, ok := o.GetIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given string and assigns it to the Id field.
|
||||
func (o *CreateCertificateResponse) SetId(v CreateCertificateResponseGetIdRetType) {
|
||||
setCreateCertificateResponseGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
// GetRegion returns the Region field value if set, zero value otherwise.
|
||||
func (o *CreateCertificateResponse) GetRegion() (res CreateCertificateResponseGetRegionRetType) {
|
||||
res, _ = o.GetRegionOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret CreateCertificateResponseGetRegionRetType, ok bool) {
|
||||
return getCreateCertificateResponseGetRegionAttributeTypeOk(o.Region)
|
||||
}
|
||||
|
||||
// HasRegion returns a boolean if a field has been set.
|
||||
func (o *CreateCertificateResponse) HasRegion() bool {
|
||||
_, ok := o.GetRegionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetRegion gets a reference to the given string and assigns it to the Region field.
|
||||
func (o *CreateCertificateResponse) SetRegion(v CreateCertificateResponseGetRegionRetType) {
|
||||
setCreateCertificateResponseGetRegionAttributeType(&o.Region, v)
|
||||
}
|
||||
|
||||
func (o CreateCertificateResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCreateCertificateResponseGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
if val, ok := getCreateCertificateResponseGetRegionAttributeTypeOk(o.Region); ok {
|
||||
toSerialize["Region"] = val
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
276
pkg/certificatesbeta/model_get_certificate_response.go
Normal file
276
pkg/certificatesbeta/model_get_certificate_response.go
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the GetCertificateResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &GetCertificateResponse{}
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type GetCertificateResponseGetIdAttributeType = *string
|
||||
|
||||
func getGetCertificateResponseGetIdAttributeTypeOk(arg GetCertificateResponseGetIdAttributeType) (ret GetCertificateResponseGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setGetCertificateResponseGetIdAttributeType(arg *GetCertificateResponseGetIdAttributeType, val GetCertificateResponseGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type GetCertificateResponseGetIdArgType = string
|
||||
type GetCertificateResponseGetIdRetType = string
|
||||
|
||||
/*
|
||||
types and functions for name
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type GetCertificateResponseGetNameAttributeType = *string
|
||||
|
||||
func getGetCertificateResponseGetNameAttributeTypeOk(arg GetCertificateResponseGetNameAttributeType) (ret GetCertificateResponseGetNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setGetCertificateResponseGetNameAttributeType(arg *GetCertificateResponseGetNameAttributeType, val GetCertificateResponseGetNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type GetCertificateResponseGetNameArgType = string
|
||||
type GetCertificateResponseGetNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for publicKey
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type GetCertificateResponseGetPublicKeyAttributeType = *string
|
||||
|
||||
func getGetCertificateResponseGetPublicKeyAttributeTypeOk(arg GetCertificateResponseGetPublicKeyAttributeType) (ret GetCertificateResponseGetPublicKeyRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setGetCertificateResponseGetPublicKeyAttributeType(arg *GetCertificateResponseGetPublicKeyAttributeType, val GetCertificateResponseGetPublicKeyRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type GetCertificateResponseGetPublicKeyArgType = string
|
||||
type GetCertificateResponseGetPublicKeyRetType = string
|
||||
|
||||
/*
|
||||
types and functions for region
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type GetCertificateResponseGetRegionAttributeType = *string
|
||||
|
||||
func getGetCertificateResponseGetRegionAttributeTypeOk(arg GetCertificateResponseGetRegionAttributeType) (ret GetCertificateResponseGetRegionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setGetCertificateResponseGetRegionAttributeType(arg *GetCertificateResponseGetRegionAttributeType, val GetCertificateResponseGetRegionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type GetCertificateResponseGetRegionArgType = string
|
||||
type GetCertificateResponseGetRegionRetType = string
|
||||
|
||||
// GetCertificateResponse GetCertificateResponse returns name, id and public key
|
||||
type GetCertificateResponse struct {
|
||||
// The certificates resource id
|
||||
Id GetCertificateResponseGetIdAttributeType `json:"id,omitempty"`
|
||||
// TLS certificate name
|
||||
Name GetCertificateResponseGetNameAttributeType `json:"name,omitempty"`
|
||||
// The PEM encoded public key part
|
||||
PublicKey GetCertificateResponseGetPublicKeyAttributeType `json:"publicKey,omitempty"`
|
||||
// Region of the LoadBalancer
|
||||
Region GetCertificateResponseGetRegionAttributeType `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() (res GetCertificateResponseGetIdRetType) {
|
||||
res, _ = o.GetIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *GetCertificateResponse) GetIdOk() (ret GetCertificateResponseGetIdRetType, ok bool) {
|
||||
return getGetCertificateResponseGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *GetCertificateResponse) SetId(v GetCertificateResponseGetIdRetType) {
|
||||
setGetCertificateResponseGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
// GetName returns the Name field value if set, zero value otherwise.
|
||||
func (o *GetCertificateResponse) GetName() (res GetCertificateResponseGetNameRetType) {
|
||||
res, _ = o.GetNameOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *GetCertificateResponse) GetNameOk() (ret GetCertificateResponseGetNameRetType, ok bool) {
|
||||
return getGetCertificateResponseGetNameAttributeTypeOk(o.Name)
|
||||
}
|
||||
|
||||
// HasName returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *GetCertificateResponse) SetName(v GetCertificateResponseGetNameRetType) {
|
||||
setGetCertificateResponseGetNameAttributeType(&o.Name, v)
|
||||
}
|
||||
|
||||
// GetPublicKey returns the PublicKey field value if set, zero value otherwise.
|
||||
func (o *GetCertificateResponse) GetPublicKey() (res GetCertificateResponseGetPublicKeyRetType) {
|
||||
res, _ = o.GetPublicKeyOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret GetCertificateResponseGetPublicKeyRetType, ok bool) {
|
||||
return getGetCertificateResponseGetPublicKeyAttributeTypeOk(o.PublicKey)
|
||||
}
|
||||
|
||||
// HasPublicKey returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *GetCertificateResponse) SetPublicKey(v GetCertificateResponseGetPublicKeyRetType) {
|
||||
setGetCertificateResponseGetPublicKeyAttributeType(&o.PublicKey, v)
|
||||
}
|
||||
|
||||
// GetRegion returns the Region field value if set, zero value otherwise.
|
||||
func (o *GetCertificateResponse) GetRegion() (res GetCertificateResponseGetRegionRetType) {
|
||||
res, _ = o.GetRegionOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret GetCertificateResponseGetRegionRetType, ok bool) {
|
||||
return getGetCertificateResponseGetRegionAttributeTypeOk(o.Region)
|
||||
}
|
||||
|
||||
// HasRegion returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *GetCertificateResponse) SetRegion(v GetCertificateResponseGetRegionRetType) {
|
||||
setGetCertificateResponseGetRegionAttributeType(&o.Region, v)
|
||||
}
|
||||
|
||||
func (o GetCertificateResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getGetCertificateResponseGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
if val, ok := getGetCertificateResponseGetNameAttributeTypeOk(o.Name); ok {
|
||||
toSerialize["Name"] = val
|
||||
}
|
||||
if val, ok := getGetCertificateResponseGetPublicKeyAttributeTypeOk(o.PublicKey); ok {
|
||||
toSerialize["PublicKey"] = val
|
||||
}
|
||||
if val, ok := getGetCertificateResponseGetRegionAttributeTypeOk(o.Region); ok {
|
||||
toSerialize["Region"] = val
|
||||
}
|
||||
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)
|
||||
}
|
||||
11
pkg/certificatesbeta/model_get_certificate_response_test.go
Normal file
11
pkg/certificatesbeta/model_get_certificate_response_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
137
pkg/certificatesbeta/model_google_protobuf_any.go
Normal file
137
pkg/certificatesbeta/model_google_protobuf_any.go
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the GoogleProtobufAny type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &GoogleProtobufAny{}
|
||||
|
||||
/*
|
||||
types and functions for @type
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type GoogleProtobufAnyGetTypeAttributeType = *string
|
||||
|
||||
func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttributeType) (ret GoogleProtobufAnyGetTypeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setGoogleProtobufAnyGetTypeAttributeType(arg *GoogleProtobufAnyGetTypeAttributeType, val GoogleProtobufAnyGetTypeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type GoogleProtobufAnyGetTypeArgType = string
|
||||
type GoogleProtobufAnyGetTypeRetType = string
|
||||
|
||||
// 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 GoogleProtobufAnyGetTypeAttributeType `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() (res GoogleProtobufAnyGetTypeRetType) {
|
||||
res, _ = o.GetTypeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *GoogleProtobufAny) GetTypeOk() (ret GoogleProtobufAnyGetTypeRetType, ok bool) {
|
||||
return getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type)
|
||||
}
|
||||
|
||||
// HasType returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *GoogleProtobufAny) SetType(v GoogleProtobufAnyGetTypeRetType) {
|
||||
setGoogleProtobufAnyGetTypeAttributeType(&o.Type, v)
|
||||
}
|
||||
|
||||
func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type); ok {
|
||||
toSerialize["Type"] = val
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
11
pkg/certificatesbeta/model_google_protobuf_any_test.go
Normal file
11
pkg/certificatesbeta/model_google_protobuf_any_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
176
pkg/certificatesbeta/model_list_certificates_response.go
Normal file
176
pkg/certificatesbeta/model_list_certificates_response.go
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the ListCertificatesResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &ListCertificatesResponse{}
|
||||
|
||||
/*
|
||||
types and functions for items
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type ListCertificatesResponseGetItemsAttributeType = *[]GetCertificateResponse
|
||||
type ListCertificatesResponseGetItemsArgType = []GetCertificateResponse
|
||||
type ListCertificatesResponseGetItemsRetType = []GetCertificateResponse
|
||||
|
||||
func getListCertificatesResponseGetItemsAttributeTypeOk(arg ListCertificatesResponseGetItemsAttributeType) (ret ListCertificatesResponseGetItemsRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setListCertificatesResponseGetItemsAttributeType(arg *ListCertificatesResponseGetItemsAttributeType, val ListCertificatesResponseGetItemsRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for nextPageId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type ListCertificatesResponseGetNextPageIdAttributeType = *string
|
||||
|
||||
func getListCertificatesResponseGetNextPageIdAttributeTypeOk(arg ListCertificatesResponseGetNextPageIdAttributeType) (ret ListCertificatesResponseGetNextPageIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setListCertificatesResponseGetNextPageIdAttributeType(arg *ListCertificatesResponseGetNextPageIdAttributeType, val ListCertificatesResponseGetNextPageIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type ListCertificatesResponseGetNextPageIdArgType = string
|
||||
type ListCertificatesResponseGetNextPageIdRetType = string
|
||||
|
||||
// ListCertificatesResponse ListCertificateResponse returns a list of certificate responses
|
||||
type ListCertificatesResponse struct {
|
||||
Items ListCertificatesResponseGetItemsAttributeType `json:"items,omitempty"`
|
||||
// Continue token from the ListCertificatesResponse with Limit option
|
||||
NextPageId ListCertificatesResponseGetNextPageIdAttributeType `json:"nextPageId,omitempty"`
|
||||
}
|
||||
|
||||
// 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() (res ListCertificatesResponseGetItemsRetType) {
|
||||
res, _ = o.GetItemsOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetItemsOk returns a tuple with the Items field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *ListCertificatesResponse) GetItemsOk() (ret ListCertificatesResponseGetItemsRetType, ok bool) {
|
||||
return getListCertificatesResponseGetItemsAttributeTypeOk(o.Items)
|
||||
}
|
||||
|
||||
// HasItems returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *ListCertificatesResponse) SetItems(v ListCertificatesResponseGetItemsRetType) {
|
||||
setListCertificatesResponseGetItemsAttributeType(&o.Items, v)
|
||||
}
|
||||
|
||||
// GetNextPageId returns the NextPageId field value if set, zero value otherwise.
|
||||
func (o *ListCertificatesResponse) GetNextPageId() (res ListCertificatesResponseGetNextPageIdRetType) {
|
||||
res, _ = o.GetNextPageIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// 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() (ret ListCertificatesResponseGetNextPageIdRetType, ok bool) {
|
||||
return getListCertificatesResponseGetNextPageIdAttributeTypeOk(o.NextPageId)
|
||||
}
|
||||
|
||||
// HasNextPageId returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *ListCertificatesResponse) SetNextPageId(v ListCertificatesResponseGetNextPageIdRetType) {
|
||||
setListCertificatesResponseGetNextPageIdAttributeType(&o.NextPageId, v)
|
||||
}
|
||||
|
||||
func (o ListCertificatesResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getListCertificatesResponseGetItemsAttributeTypeOk(o.Items); ok {
|
||||
toSerialize["Items"] = val
|
||||
}
|
||||
if val, ok := getListCertificatesResponseGetNextPageIdAttributeTypeOk(o.NextPageId); ok {
|
||||
toSerialize["NextPageId"] = val
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
226
pkg/certificatesbeta/model_status.go
Normal file
226
pkg/certificatesbeta/model_status.go
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Status type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Status{}
|
||||
|
||||
/*
|
||||
types and functions for code
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type StatusGetCodeAttributeType = *int64
|
||||
type StatusGetCodeArgType = int64
|
||||
type StatusGetCodeRetType = int64
|
||||
|
||||
func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret StatusGetCodeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGetCodeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for details
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type StatusGetDetailsAttributeType = *[]GoogleProtobufAny
|
||||
type StatusGetDetailsArgType = []GoogleProtobufAny
|
||||
type StatusGetDetailsRetType = []GoogleProtobufAny
|
||||
|
||||
func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret StatusGetDetailsRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val StatusGetDetailsRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for message
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type StatusGetMessageAttributeType = *string
|
||||
|
||||
func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret StatusGetMessageRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setStatusGetMessageAttributeType(arg *StatusGetMessageAttributeType, val StatusGetMessageRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type StatusGetMessageArgType = string
|
||||
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).
|
||||
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.
|
||||
Code StatusGetCodeAttributeType `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 StatusGetDetailsAttributeType `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 StatusGetMessageAttributeType `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() (res StatusGetCodeRetType) {
|
||||
res, _ = o.GetCodeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCodeOk returns a tuple with the Code field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Status) GetCodeOk() (ret StatusGetCodeRetType, ok bool) {
|
||||
return getStatusGetCodeAttributeTypeOk(o.Code)
|
||||
}
|
||||
|
||||
// HasCode returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *Status) SetCode(v StatusGetCodeRetType) {
|
||||
setStatusGetCodeAttributeType(&o.Code, v)
|
||||
}
|
||||
|
||||
// GetDetails returns the Details field value if set, zero value otherwise.
|
||||
func (o *Status) GetDetails() (res StatusGetDetailsRetType) {
|
||||
res, _ = o.GetDetailsOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Status) GetDetailsOk() (ret StatusGetDetailsRetType, ok bool) {
|
||||
return getStatusGetDetailsAttributeTypeOk(o.Details)
|
||||
}
|
||||
|
||||
// HasDetails returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *Status) SetDetails(v StatusGetDetailsRetType) {
|
||||
setStatusGetDetailsAttributeType(&o.Details, v)
|
||||
}
|
||||
|
||||
// GetMessage returns the Message field value if set, zero value otherwise.
|
||||
func (o *Status) GetMessage() (res StatusGetMessageRetType) {
|
||||
res, _ = o.GetMessageOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Status) GetMessageOk() (ret StatusGetMessageRetType, ok bool) {
|
||||
return getStatusGetMessageAttributeTypeOk(o.Message)
|
||||
}
|
||||
|
||||
// HasMessage returns a boolean if a field has been set.
|
||||
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.
|
||||
func (o *Status) SetMessage(v StatusGetMessageRetType) {
|
||||
setStatusGetMessageAttributeType(&o.Message, v)
|
||||
}
|
||||
|
||||
func (o Status) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getStatusGetCodeAttributeTypeOk(o.Code); ok {
|
||||
toSerialize["Code"] = val
|
||||
}
|
||||
if val, ok := getStatusGetDetailsAttributeTypeOk(o.Details); ok {
|
||||
toSerialize["Details"] = val
|
||||
}
|
||||
if val, ok := getStatusGetMessageAttributeTypeOk(o.Message); ok {
|
||||
toSerialize["Message"] = val
|
||||
}
|
||||
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)
|
||||
}
|
||||
11
pkg/certificatesbeta/model_status_test.go
Normal file
11
pkg/certificatesbeta/model_status_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
385
pkg/certificatesbeta/utils.go
Normal file
385
pkg/certificatesbeta/utils.go
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
/*
|
||||
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 certificatesbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"math/rand"
|
||||
"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 NullableValue[T any] struct {
|
||||
value *T
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableValue[T]) Get() *T {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableValue[T]) Set(val *T) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableValue[T]) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableValue[T]) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
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 v.value.MarshalJSON()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
if t, ok := i.(interface{ IsSet() bool }); ok {
|
||||
return !t.IsSet()
|
||||
}
|
||||
switch reflect.TypeOf(i).Kind() {
|
||||
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
|
||||
return reflect.ValueOf(i).IsNil()
|
||||
case reflect.Array:
|
||||
return reflect.ValueOf(i).IsZero()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type MappedNullable interface {
|
||||
ToMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
// randString returns a random string with a specified length. It panics if n <= 0.
|
||||
func randString(n int) string {
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterRunes[rand.Intn(len(letterRunes))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue