feat: auto generated files and new structure (#4)
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
979220be66
commit
9f41c4da7f
1283 changed files with 273211 additions and 4614 deletions
1
pkg/runcommandbeta/.openapi-generator/VERSION
Normal file
1
pkg/runcommandbeta/.openapi-generator/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
6.6.0
|
||||
982
pkg/runcommandbeta/api_default.go
Normal file
982
pkg/runcommandbeta/api_default.go
Normal file
|
|
@ -0,0 +1,982 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
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 {
|
||||
/*
|
||||
CreateCommand Method for CreateCommand
|
||||
Creates a new command for execution
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param region region
|
||||
@return ApiCreateCommandRequest
|
||||
*/
|
||||
CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest
|
||||
/*
|
||||
CreateCommandExecute executes the request
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param region region
|
||||
@return NewCommandResponse
|
||||
|
||||
*/
|
||||
CreateCommandExecute(ctx context.Context, projectId string, serverId string, region string) (*NewCommandResponse, error)
|
||||
/*
|
||||
GetCommand Method for GetCommand
|
||||
Returns details about a command
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param region region
|
||||
@param serverId Server ID of the machine
|
||||
@param commandId ID of the command
|
||||
@return ApiGetCommandRequest
|
||||
*/
|
||||
GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest
|
||||
/*
|
||||
GetCommandExecute executes the request
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param region region
|
||||
@param serverId Server ID of the machine
|
||||
@param commandId ID of the command
|
||||
@return CommandDetails
|
||||
|
||||
*/
|
||||
GetCommandExecute(ctx context.Context, projectId string, region string, serverId string, commandId string) (*CommandDetails, error)
|
||||
/*
|
||||
GetCommandTemplate Method for GetCommandTemplate
|
||||
Returns details about a command template
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param commandTemplateName Name of the template
|
||||
@param region region
|
||||
@return ApiGetCommandTemplateRequest
|
||||
*/
|
||||
GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest
|
||||
/*
|
||||
GetCommandTemplateExecute executes the request
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param commandTemplateName Name of the template
|
||||
@param region region
|
||||
@return CommandTemplateSchema
|
||||
|
||||
*/
|
||||
GetCommandTemplateExecute(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) (*CommandTemplateSchema, error)
|
||||
/*
|
||||
ListCommandTemplates Method for ListCommandTemplates
|
||||
Returns a list of command templates
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiListCommandTemplatesRequest
|
||||
*/
|
||||
ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest
|
||||
/*
|
||||
ListCommandTemplatesExecute executes the request
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return CommandTemplateResponse
|
||||
|
||||
*/
|
||||
ListCommandTemplatesExecute(ctx context.Context) (*CommandTemplateResponse, error)
|
||||
/*
|
||||
ListCommands Method for ListCommands
|
||||
Returns a list of commands
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param region region
|
||||
@return ApiListCommandsRequest
|
||||
*/
|
||||
ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest
|
||||
/*
|
||||
ListCommandsExecute executes the request
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param region region
|
||||
@return GetCommandsResponse
|
||||
|
||||
*/
|
||||
ListCommandsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetCommandsResponse, error)
|
||||
}
|
||||
|
||||
type ApiCreateCommandRequest interface {
|
||||
// Command to post
|
||||
CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest
|
||||
Execute() (*NewCommandResponse, error)
|
||||
}
|
||||
|
||||
type ApiGetCommandRequest interface {
|
||||
Execute() (*CommandDetails, error)
|
||||
}
|
||||
|
||||
type ApiGetCommandTemplateRequest interface {
|
||||
Execute() (*CommandTemplateSchema, error)
|
||||
}
|
||||
|
||||
type ApiListCommandTemplatesRequest interface {
|
||||
// The type of the Operating System (windows or linux). If not provided will return data for all OS types.
|
||||
OsType(osType string) ApiListCommandTemplatesRequest
|
||||
Execute() (*CommandTemplateResponse, error)
|
||||
}
|
||||
|
||||
type ApiListCommandsRequest interface {
|
||||
Execute() (*GetCommandsResponse, error)
|
||||
}
|
||||
|
||||
// DefaultApiService DefaultApi service
|
||||
type DefaultApiService service
|
||||
|
||||
type CreateCommandRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
serverId string
|
||||
region string
|
||||
createCommandPayload *CreateCommandPayload
|
||||
}
|
||||
|
||||
// Command to post
|
||||
|
||||
func (r CreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest {
|
||||
r.createCommandPayload = &createCommandPayload
|
||||
return r
|
||||
}
|
||||
|
||||
func (r CreateCommandRequest) Execute() (*NewCommandResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *NewCommandResponse
|
||||
)
|
||||
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.CreateCommand")
|
||||
if err != nil {
|
||||
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// 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.createCommandPayload
|
||||
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 == 400 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 404 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
CreateCommand: Method for CreateCommand
|
||||
|
||||
Creates a new command for execution
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param region region
|
||||
@return ApiCreateCommandRequest
|
||||
*/
|
||||
func (a *APIClient) CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest {
|
||||
return CreateCommandRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
serverId: serverId,
|
||||
region: region,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) CreateCommandExecute(ctx context.Context, projectId string, serverId string, region string) (*NewCommandResponse, error) {
|
||||
r := CreateCommandRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
serverId: serverId,
|
||||
region: region,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type GetCommandRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
region string
|
||||
serverId string
|
||||
commandId string
|
||||
}
|
||||
|
||||
func (r GetCommandRequest) Execute() (*CommandDetails, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *CommandDetails
|
||||
)
|
||||
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.GetCommand")
|
||||
if err != nil {
|
||||
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands/{commandId}"
|
||||
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, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"commandId"+"}", url.PathEscape(ParameterValueToString(r.commandId, "commandId")), -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 == 400 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 404 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
GetCommand: Method for GetCommand
|
||||
|
||||
Returns details about a command
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param region region
|
||||
@param serverId Server ID of the machine
|
||||
@param commandId ID of the command
|
||||
@return ApiGetCommandRequest
|
||||
*/
|
||||
func (a *APIClient) GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest {
|
||||
return GetCommandRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
serverId: serverId,
|
||||
commandId: commandId,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) GetCommandExecute(ctx context.Context, projectId string, region string, serverId string, commandId string) (*CommandDetails, error) {
|
||||
r := GetCommandRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
region: region,
|
||||
serverId: serverId,
|
||||
commandId: commandId,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type GetCommandTemplateRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
serverId string
|
||||
commandTemplateName string
|
||||
region string
|
||||
}
|
||||
|
||||
func (r GetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *CommandTemplateSchema
|
||||
)
|
||||
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.GetCommandTemplate")
|
||||
if err != nil {
|
||||
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/command-templates/{commandTemplateName}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"commandTemplateName"+"}", url.PathEscape(ParameterValueToString(r.commandTemplateName, "commandTemplateName")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -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 == 400 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 404 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
GetCommandTemplate: Method for GetCommandTemplate
|
||||
|
||||
Returns details about a command template
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param commandTemplateName Name of the template
|
||||
@param region region
|
||||
@return ApiGetCommandTemplateRequest
|
||||
*/
|
||||
func (a *APIClient) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest {
|
||||
return GetCommandTemplateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
serverId: serverId,
|
||||
commandTemplateName: commandTemplateName,
|
||||
region: region,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) GetCommandTemplateExecute(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) (*CommandTemplateSchema, error) {
|
||||
r := GetCommandTemplateRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
serverId: serverId,
|
||||
commandTemplateName: commandTemplateName,
|
||||
region: region,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type ListCommandTemplatesRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
osType *string
|
||||
}
|
||||
|
||||
// The type of the Operating System (windows or linux). If not provided will return data for all OS types.
|
||||
|
||||
func (r ListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest {
|
||||
r.osType = &osType
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *CommandTemplateResponse
|
||||
)
|
||||
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.ListCommandTemplates")
|
||||
if err != nil {
|
||||
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/v2beta/command-templates"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.osType != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "osType", r.osType, "")
|
||||
}
|
||||
// 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 == 400 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
ListCommandTemplates: Method for ListCommandTemplates
|
||||
|
||||
Returns a list of command templates
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiListCommandTemplatesRequest
|
||||
*/
|
||||
func (a *APIClient) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest {
|
||||
return ListCommandTemplatesRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) ListCommandTemplatesExecute(ctx context.Context) (*CommandTemplateResponse, error) {
|
||||
r := ListCommandTemplatesRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
|
||||
type ListCommandsRequest struct {
|
||||
ctx context.Context
|
||||
apiService *DefaultApiService
|
||||
projectId string
|
||||
serverId string
|
||||
region string
|
||||
}
|
||||
|
||||
func (r ListCommandsRequest) Execute() (*GetCommandsResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *GetCommandsResponse
|
||||
)
|
||||
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.ListCommands")
|
||||
if err != nil {
|
||||
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -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 == 400 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 401 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 404 {
|
||||
var v ErrorResponse
|
||||
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
|
||||
}
|
||||
|
||||
/*
|
||||
ListCommands: Method for ListCommands
|
||||
|
||||
Returns a list of commands
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param projectId ID of the project
|
||||
@param serverId Server ID of the machine
|
||||
@param region region
|
||||
@return ApiListCommandsRequest
|
||||
*/
|
||||
func (a *APIClient) ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest {
|
||||
return ListCommandsRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
serverId: serverId,
|
||||
region: region,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *APIClient) ListCommandsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetCommandsResponse, error) {
|
||||
r := ListCommandsRequest{
|
||||
apiService: a.defaultApi,
|
||||
ctx: ctx,
|
||||
projectId: projectId,
|
||||
serverId: serverId,
|
||||
region: region,
|
||||
}
|
||||
return r.Execute()
|
||||
}
|
||||
312
pkg/runcommandbeta/api_default_test.go
Normal file
312
pkg/runcommandbeta/api_default_test.go
Normal file
|
|
@ -0,0 +1,312 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
Testing DefaultApiService
|
||||
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
)
|
||||
|
||||
func Test_runcommandbeta_DefaultApiService(t *testing.T) {
|
||||
|
||||
t.Run("Test DefaultApiService CreateCommand", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
serverIdValue := "serverId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 := NewCommandResponse{}
|
||||
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 runcommandbeta_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
|
||||
serverId := serverIdValue
|
||||
region := regionValue
|
||||
|
||||
resp, reqErr := apiClient.CreateCommand(context.Background(), projectId, serverId, region).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService GetCommand", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands/{commandId}"
|
||||
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)
|
||||
serverIdValue := "serverId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
||||
commandIdValue := "commandId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"commandId"+"}", url.PathEscape(ParameterValueToString(commandIdValue, "commandId")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := CommandDetails{}
|
||||
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 runcommandbeta_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
|
||||
serverId := serverIdValue
|
||||
commandId := commandIdValue
|
||||
|
||||
resp, reqErr := apiClient.GetCommand(context.Background(), projectId, region, serverId, commandId).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService GetCommandTemplate", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/command-templates/{commandTemplateName}"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
serverIdValue := "serverId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1)
|
||||
commandTemplateNameValue := "commandTemplateName-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"commandTemplateName"+"}", url.PathEscape(ParameterValueToString(commandTemplateNameValue, "commandTemplateName")), -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 := CommandTemplateSchema{}
|
||||
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 runcommandbeta_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
|
||||
serverId := serverIdValue
|
||||
commandTemplateName := commandTemplateNameValue
|
||||
region := regionValue
|
||||
|
||||
resp, reqErr := apiClient.GetCommandTemplate(context.Background(), projectId, serverId, commandTemplateName, region).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService ListCommandTemplates", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/command-templates"
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := CommandTemplateResponse{}
|
||||
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 runcommandbeta_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)
|
||||
}
|
||||
|
||||
resp, reqErr := apiClient.ListCommandTemplates(context.Background()).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService ListCommands", func(t *testing.T) {
|
||||
_apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands"
|
||||
projectIdValue := "projectId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
serverIdValue := "serverId-value"
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -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 := GetCommandsResponse{}
|
||||
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 runcommandbeta_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
|
||||
serverId := serverIdValue
|
||||
region := regionValue
|
||||
|
||||
resp, reqErr := apiClient.ListCommands(context.Background(), projectId, serverId, region).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
628
pkg/runcommandbeta/client.go
Normal file
628
pkg/runcommandbeta/client.go
Normal file
|
|
@ -0,0 +1,628 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
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 Run Commands Service API API v2beta.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
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
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/runcommandbeta/configuration.go
Normal file
38
pkg/runcommandbeta/configuration.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
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/runcommandbeta",
|
||||
Debug: false,
|
||||
Servers: config.ServerConfigurations{
|
||||
{
|
||||
URL: "https://run-command.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
|
||||
}
|
||||
620
pkg/runcommandbeta/model_command_details.go
Normal file
620
pkg/runcommandbeta/model_command_details.go
Normal file
|
|
@ -0,0 +1,620 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// checks if the CommandDetails type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CommandDetails{}
|
||||
|
||||
/*
|
||||
types and functions for commandTemplateName
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandDetailsGetCommandTemplateNameAttributeType = *string
|
||||
|
||||
func getCommandDetailsGetCommandTemplateNameAttributeTypeOk(arg CommandDetailsGetCommandTemplateNameAttributeType) (ret CommandDetailsGetCommandTemplateNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetCommandTemplateNameAttributeType(arg *CommandDetailsGetCommandTemplateNameAttributeType, val CommandDetailsGetCommandTemplateNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandDetailsGetCommandTemplateNameArgType = string
|
||||
type CommandDetailsGetCommandTemplateNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for commandTemplateTitle
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandDetailsGetCommandTemplateTitleAttributeType = *string
|
||||
|
||||
func getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(arg CommandDetailsGetCommandTemplateTitleAttributeType) (ret CommandDetailsGetCommandTemplateTitleRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetCommandTemplateTitleAttributeType(arg *CommandDetailsGetCommandTemplateTitleAttributeType, val CommandDetailsGetCommandTemplateTitleRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandDetailsGetCommandTemplateTitleArgType = string
|
||||
type CommandDetailsGetCommandTemplateTitleRetType = string
|
||||
|
||||
/*
|
||||
types and functions for exitCode
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type CommandDetailsGetExitCodeAttributeType = *int64
|
||||
type CommandDetailsGetExitCodeArgType = int64
|
||||
type CommandDetailsGetExitCodeRetType = int64
|
||||
|
||||
func getCommandDetailsGetExitCodeAttributeTypeOk(arg CommandDetailsGetExitCodeAttributeType) (ret CommandDetailsGetExitCodeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetExitCodeAttributeType(arg *CommandDetailsGetExitCodeAttributeType, val CommandDetailsGetExitCodeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for finishedAt
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandDetailsGetFinishedAtAttributeType = *string
|
||||
|
||||
func getCommandDetailsGetFinishedAtAttributeTypeOk(arg CommandDetailsGetFinishedAtAttributeType) (ret CommandDetailsGetFinishedAtRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetFinishedAtAttributeType(arg *CommandDetailsGetFinishedAtAttributeType, val CommandDetailsGetFinishedAtRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandDetailsGetFinishedAtArgType = string
|
||||
type CommandDetailsGetFinishedAtRetType = string
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type CommandDetailsGetIdAttributeType = *int64
|
||||
type CommandDetailsGetIdArgType = int64
|
||||
type CommandDetailsGetIdRetType = int64
|
||||
|
||||
func getCommandDetailsGetIdAttributeTypeOk(arg CommandDetailsGetIdAttributeType) (ret CommandDetailsGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetIdAttributeType(arg *CommandDetailsGetIdAttributeType, val CommandDetailsGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for output
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandDetailsGetOutputAttributeType = *string
|
||||
|
||||
func getCommandDetailsGetOutputAttributeTypeOk(arg CommandDetailsGetOutputAttributeType) (ret CommandDetailsGetOutputRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetOutputAttributeType(arg *CommandDetailsGetOutputAttributeType, val CommandDetailsGetOutputRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandDetailsGetOutputArgType = string
|
||||
type CommandDetailsGetOutputRetType = string
|
||||
|
||||
/*
|
||||
types and functions for script
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandDetailsGetScriptAttributeType = *string
|
||||
|
||||
func getCommandDetailsGetScriptAttributeTypeOk(arg CommandDetailsGetScriptAttributeType) (ret CommandDetailsGetScriptRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetScriptAttributeType(arg *CommandDetailsGetScriptAttributeType, val CommandDetailsGetScriptRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandDetailsGetScriptArgType = string
|
||||
type CommandDetailsGetScriptRetType = string
|
||||
|
||||
/*
|
||||
types and functions for startedAt
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandDetailsGetStartedAtAttributeType = *string
|
||||
|
||||
func getCommandDetailsGetStartedAtAttributeTypeOk(arg CommandDetailsGetStartedAtAttributeType) (ret CommandDetailsGetStartedAtRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetStartedAtAttributeType(arg *CommandDetailsGetStartedAtAttributeType, val CommandDetailsGetStartedAtRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandDetailsGetStartedAtArgType = string
|
||||
type CommandDetailsGetStartedAtRetType = string
|
||||
|
||||
/*
|
||||
types and functions for status
|
||||
*/
|
||||
|
||||
// isEnum
|
||||
|
||||
// CommandDetailsStatus the model 'CommandDetails'
|
||||
// value type for enums
|
||||
type CommandDetailsStatus string
|
||||
|
||||
// List of Status
|
||||
const (
|
||||
COMMANDDETAILSSTATUS_PENDING CommandDetailsStatus = "pending"
|
||||
COMMANDDETAILSSTATUS_RUNNING CommandDetailsStatus = "running"
|
||||
COMMANDDETAILSSTATUS_COMPLETED CommandDetailsStatus = "completed"
|
||||
COMMANDDETAILSSTATUS_FAILED CommandDetailsStatus = "failed"
|
||||
)
|
||||
|
||||
// All allowed values of CommandDetails enum
|
||||
var AllowedCommandDetailsStatusEnumValues = []CommandDetailsStatus{
|
||||
"pending",
|
||||
"running",
|
||||
"completed",
|
||||
"failed",
|
||||
}
|
||||
|
||||
func (v *CommandDetailsStatus) UnmarshalJSON(src []byte) error {
|
||||
// use a type alias to prevent infinite recursion during unmarshal,
|
||||
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
|
||||
type TmpJson CommandDetailsStatus
|
||||
var value TmpJson
|
||||
err := json.Unmarshal(src, &value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Allow unmarshalling zero value for testing purposes
|
||||
var zeroValue TmpJson
|
||||
if value == zeroValue {
|
||||
return nil
|
||||
}
|
||||
enumTypeValue := CommandDetailsStatus(value)
|
||||
for _, existing := range AllowedCommandDetailsStatusEnumValues {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid CommandDetails", value)
|
||||
}
|
||||
|
||||
// NewCommandDetailsStatusFromValue returns a pointer to a valid CommandDetailsStatus
|
||||
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
||||
func NewCommandDetailsStatusFromValue(v CommandDetailsStatus) (*CommandDetailsStatus, error) {
|
||||
ev := CommandDetailsStatus(v)
|
||||
if ev.IsValid() {
|
||||
return &ev, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("invalid value '%v' for CommandDetailsStatus: valid values are %v", v, AllowedCommandDetailsStatusEnumValues)
|
||||
}
|
||||
}
|
||||
|
||||
// IsValid return true if the value is valid for the enum, false otherwise
|
||||
func (v CommandDetailsStatus) IsValid() bool {
|
||||
for _, existing := range AllowedCommandDetailsStatusEnumValues {
|
||||
if existing == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Ptr returns reference to StatusStatus value
|
||||
func (v CommandDetailsStatus) Ptr() *CommandDetailsStatus {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableCommandDetailsStatus struct {
|
||||
value *CommandDetailsStatus
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommandDetailsStatus) Get() *CommandDetailsStatus {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommandDetailsStatus) Set(val *CommandDetailsStatus) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommandDetailsStatus) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommandDetailsStatus) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommandDetailsStatus(val *CommandDetailsStatus) *NullableCommandDetailsStatus {
|
||||
return &NullableCommandDetailsStatus{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommandDetailsStatus) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommandDetailsStatus) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
type CommandDetailsGetStatusAttributeType = *CommandDetailsStatus
|
||||
type CommandDetailsGetStatusArgType = CommandDetailsStatus
|
||||
type CommandDetailsGetStatusRetType = CommandDetailsStatus
|
||||
|
||||
func getCommandDetailsGetStatusAttributeTypeOk(arg CommandDetailsGetStatusAttributeType) (ret CommandDetailsGetStatusRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandDetailsGetStatusAttributeType(arg *CommandDetailsGetStatusAttributeType, val CommandDetailsGetStatusRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// CommandDetails struct for CommandDetails
|
||||
type CommandDetails struct {
|
||||
CommandTemplateName CommandDetailsGetCommandTemplateNameAttributeType `json:"commandTemplateName,omitempty"`
|
||||
CommandTemplateTitle CommandDetailsGetCommandTemplateTitleAttributeType `json:"commandTemplateTitle,omitempty"`
|
||||
// Can be cast to int32 without loss of precision.
|
||||
ExitCode CommandDetailsGetExitCodeAttributeType `json:"exitCode,omitempty"`
|
||||
FinishedAt CommandDetailsGetFinishedAtAttributeType `json:"finishedAt,omitempty"`
|
||||
// Can be cast to int32 without loss of precision.
|
||||
Id CommandDetailsGetIdAttributeType `json:"id,omitempty"`
|
||||
Output CommandDetailsGetOutputAttributeType `json:"output,omitempty"`
|
||||
Script CommandDetailsGetScriptAttributeType `json:"script,omitempty"`
|
||||
StartedAt CommandDetailsGetStartedAtAttributeType `json:"startedAt,omitempty"`
|
||||
Status CommandDetailsGetStatusAttributeType `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// NewCommandDetails instantiates a new CommandDetails 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 NewCommandDetails() *CommandDetails {
|
||||
this := CommandDetails{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCommandDetailsWithDefaults instantiates a new CommandDetails 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 NewCommandDetailsWithDefaults() *CommandDetails {
|
||||
this := CommandDetails{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetCommandTemplateName returns the CommandTemplateName field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetCommandTemplateName() (res CommandDetailsGetCommandTemplateNameRetType) {
|
||||
res, _ = o.GetCommandTemplateNameOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetCommandTemplateNameOk() (ret CommandDetailsGetCommandTemplateNameRetType, ok bool) {
|
||||
return getCommandDetailsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName)
|
||||
}
|
||||
|
||||
// HasCommandTemplateName returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasCommandTemplateName() bool {
|
||||
_, ok := o.GetCommandTemplateNameOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field.
|
||||
func (o *CommandDetails) SetCommandTemplateName(v CommandDetailsGetCommandTemplateNameRetType) {
|
||||
setCommandDetailsGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v)
|
||||
}
|
||||
|
||||
// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetCommandTemplateTitle() (res CommandDetailsGetCommandTemplateTitleRetType) {
|
||||
res, _ = o.GetCommandTemplateTitleOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCommandTemplateTitleOk returns a tuple with the CommandTemplateTitle field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetCommandTemplateTitleOk() (ret CommandDetailsGetCommandTemplateTitleRetType, ok bool) {
|
||||
return getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle)
|
||||
}
|
||||
|
||||
// HasCommandTemplateTitle returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasCommandTemplateTitle() bool {
|
||||
_, ok := o.GetCommandTemplateTitleOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field.
|
||||
func (o *CommandDetails) SetCommandTemplateTitle(v CommandDetailsGetCommandTemplateTitleRetType) {
|
||||
setCommandDetailsGetCommandTemplateTitleAttributeType(&o.CommandTemplateTitle, v)
|
||||
}
|
||||
|
||||
// GetExitCode returns the ExitCode field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetExitCode() (res CommandDetailsGetExitCodeRetType) {
|
||||
res, _ = o.GetExitCodeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetExitCodeOk returns a tuple with the ExitCode field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetExitCodeOk() (ret CommandDetailsGetExitCodeRetType, ok bool) {
|
||||
return getCommandDetailsGetExitCodeAttributeTypeOk(o.ExitCode)
|
||||
}
|
||||
|
||||
// HasExitCode returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasExitCode() bool {
|
||||
_, ok := o.GetExitCodeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetExitCode gets a reference to the given int64 and assigns it to the ExitCode field.
|
||||
func (o *CommandDetails) SetExitCode(v CommandDetailsGetExitCodeRetType) {
|
||||
setCommandDetailsGetExitCodeAttributeType(&o.ExitCode, v)
|
||||
}
|
||||
|
||||
// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetFinishedAt() (res CommandDetailsGetFinishedAtRetType) {
|
||||
res, _ = o.GetFinishedAtOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetFinishedAtOk() (ret CommandDetailsGetFinishedAtRetType, ok bool) {
|
||||
return getCommandDetailsGetFinishedAtAttributeTypeOk(o.FinishedAt)
|
||||
}
|
||||
|
||||
// HasFinishedAt returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasFinishedAt() bool {
|
||||
_, ok := o.GetFinishedAtOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field.
|
||||
func (o *CommandDetails) SetFinishedAt(v CommandDetailsGetFinishedAtRetType) {
|
||||
setCommandDetailsGetFinishedAtAttributeType(&o.FinishedAt, v)
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetId() (res CommandDetailsGetIdRetType) {
|
||||
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 *CommandDetails) GetIdOk() (ret CommandDetailsGetIdRetType, ok bool) {
|
||||
return getCommandDetailsGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasId() bool {
|
||||
_, ok := o.GetIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given int64 and assigns it to the Id field.
|
||||
func (o *CommandDetails) SetId(v CommandDetailsGetIdRetType) {
|
||||
setCommandDetailsGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
// GetOutput returns the Output field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetOutput() (res CommandDetailsGetOutputRetType) {
|
||||
res, _ = o.GetOutputOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetOutputOk returns a tuple with the Output field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetOutputOk() (ret CommandDetailsGetOutputRetType, ok bool) {
|
||||
return getCommandDetailsGetOutputAttributeTypeOk(o.Output)
|
||||
}
|
||||
|
||||
// HasOutput returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasOutput() bool {
|
||||
_, ok := o.GetOutputOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetOutput gets a reference to the given string and assigns it to the Output field.
|
||||
func (o *CommandDetails) SetOutput(v CommandDetailsGetOutputRetType) {
|
||||
setCommandDetailsGetOutputAttributeType(&o.Output, v)
|
||||
}
|
||||
|
||||
// GetScript returns the Script field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetScript() (res CommandDetailsGetScriptRetType) {
|
||||
res, _ = o.GetScriptOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetScriptOk returns a tuple with the Script field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetScriptOk() (ret CommandDetailsGetScriptRetType, ok bool) {
|
||||
return getCommandDetailsGetScriptAttributeTypeOk(o.Script)
|
||||
}
|
||||
|
||||
// HasScript returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasScript() bool {
|
||||
_, ok := o.GetScriptOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetScript gets a reference to the given string and assigns it to the Script field.
|
||||
func (o *CommandDetails) SetScript(v CommandDetailsGetScriptRetType) {
|
||||
setCommandDetailsGetScriptAttributeType(&o.Script, v)
|
||||
}
|
||||
|
||||
// GetStartedAt returns the StartedAt field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetStartedAt() (res CommandDetailsGetStartedAtRetType) {
|
||||
res, _ = o.GetStartedAtOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetStartedAtOk() (ret CommandDetailsGetStartedAtRetType, ok bool) {
|
||||
return getCommandDetailsGetStartedAtAttributeTypeOk(o.StartedAt)
|
||||
}
|
||||
|
||||
// HasStartedAt returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasStartedAt() bool {
|
||||
_, ok := o.GetStartedAtOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field.
|
||||
func (o *CommandDetails) SetStartedAt(v CommandDetailsGetStartedAtRetType) {
|
||||
setCommandDetailsGetStartedAtAttributeType(&o.StartedAt, v)
|
||||
}
|
||||
|
||||
// GetStatus returns the Status field value if set, zero value otherwise.
|
||||
func (o *CommandDetails) GetStatus() (res CommandDetailsGetStatusRetType) {
|
||||
res, _ = o.GetStatusOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandDetails) GetStatusOk() (ret CommandDetailsGetStatusRetType, ok bool) {
|
||||
return getCommandDetailsGetStatusAttributeTypeOk(o.Status)
|
||||
}
|
||||
|
||||
// HasStatus returns a boolean if a field has been set.
|
||||
func (o *CommandDetails) HasStatus() bool {
|
||||
_, ok := o.GetStatusOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetStatus gets a reference to the given string and assigns it to the Status field.
|
||||
func (o *CommandDetails) SetStatus(v CommandDetailsGetStatusRetType) {
|
||||
setCommandDetailsGetStatusAttributeType(&o.Status, v)
|
||||
}
|
||||
|
||||
func (o CommandDetails) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCommandDetailsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok {
|
||||
toSerialize["CommandTemplateName"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle); ok {
|
||||
toSerialize["CommandTemplateTitle"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetExitCodeAttributeTypeOk(o.ExitCode); ok {
|
||||
toSerialize["ExitCode"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetFinishedAtAttributeTypeOk(o.FinishedAt); ok {
|
||||
toSerialize["FinishedAt"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetOutputAttributeTypeOk(o.Output); ok {
|
||||
toSerialize["Output"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetScriptAttributeTypeOk(o.Script); ok {
|
||||
toSerialize["Script"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetStartedAtAttributeTypeOk(o.StartedAt); ok {
|
||||
toSerialize["StartedAt"] = val
|
||||
}
|
||||
if val, ok := getCommandDetailsGetStatusAttributeTypeOk(o.Status); ok {
|
||||
toSerialize["Status"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCommandDetails struct {
|
||||
value *CommandDetails
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommandDetails) Get() *CommandDetails {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommandDetails) Set(val *CommandDetails) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommandDetails) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommandDetails) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommandDetails(val *CommandDetails) *NullableCommandDetails {
|
||||
return &NullableCommandDetails{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommandDetails) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommandDetails) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
72
pkg/runcommandbeta/model_command_details_test.go
Normal file
72
pkg/runcommandbeta/model_command_details_test.go
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// isEnum
|
||||
|
||||
func TestCommandDetailsStatus_UnmarshalJSON(t *testing.T) {
|
||||
type args struct {
|
||||
src []byte
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: `success - possible enum value no. 1`,
|
||||
args: args{
|
||||
src: []byte(`"pending"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 2`,
|
||||
args: args{
|
||||
src: []byte(`"running"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 3`,
|
||||
args: args{
|
||||
src: []byte(`"completed"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 4`,
|
||||
args: args{
|
||||
src: []byte(`"failed"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "fail",
|
||||
args: args{
|
||||
src: []byte("\"FOOBAR\""),
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
v := CommandDetailsStatus("")
|
||||
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
|
||||
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
223
pkg/runcommandbeta/model_command_template.go
Normal file
223
pkg/runcommandbeta/model_command_template.go
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CommandTemplate type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CommandTemplate{}
|
||||
|
||||
/*
|
||||
types and functions for name
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandTemplateGetNameAttributeType = *string
|
||||
|
||||
func getCommandTemplateGetNameAttributeTypeOk(arg CommandTemplateGetNameAttributeType) (ret CommandTemplateGetNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateGetNameAttributeType(arg *CommandTemplateGetNameAttributeType, val CommandTemplateGetNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandTemplateGetNameArgType = string
|
||||
type CommandTemplateGetNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for osType
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type CommandTemplateGetOsTypeAttributeType = *[]string
|
||||
type CommandTemplateGetOsTypeArgType = []string
|
||||
type CommandTemplateGetOsTypeRetType = []string
|
||||
|
||||
func getCommandTemplateGetOsTypeAttributeTypeOk(arg CommandTemplateGetOsTypeAttributeType) (ret CommandTemplateGetOsTypeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateGetOsTypeAttributeType(arg *CommandTemplateGetOsTypeAttributeType, val CommandTemplateGetOsTypeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for title
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandTemplateGetTitleAttributeType = *string
|
||||
|
||||
func getCommandTemplateGetTitleAttributeTypeOk(arg CommandTemplateGetTitleAttributeType) (ret CommandTemplateGetTitleRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateGetTitleAttributeType(arg *CommandTemplateGetTitleAttributeType, val CommandTemplateGetTitleRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandTemplateGetTitleArgType = string
|
||||
type CommandTemplateGetTitleRetType = string
|
||||
|
||||
// CommandTemplate struct for CommandTemplate
|
||||
type CommandTemplate struct {
|
||||
Name CommandTemplateGetNameAttributeType `json:"name,omitempty"`
|
||||
OsType CommandTemplateGetOsTypeAttributeType `json:"osType,omitempty"`
|
||||
Title CommandTemplateGetTitleAttributeType `json:"title,omitempty"`
|
||||
}
|
||||
|
||||
// NewCommandTemplate instantiates a new CommandTemplate 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 NewCommandTemplate() *CommandTemplate {
|
||||
this := CommandTemplate{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCommandTemplateWithDefaults instantiates a new CommandTemplate 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 NewCommandTemplateWithDefaults() *CommandTemplate {
|
||||
this := CommandTemplate{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetName returns the Name field value if set, zero value otherwise.
|
||||
func (o *CommandTemplate) GetName() (res CommandTemplateGetNameRetType) {
|
||||
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 *CommandTemplate) GetNameOk() (ret CommandTemplateGetNameRetType, ok bool) {
|
||||
return getCommandTemplateGetNameAttributeTypeOk(o.Name)
|
||||
}
|
||||
|
||||
// HasName returns a boolean if a field has been set.
|
||||
func (o *CommandTemplate) HasName() bool {
|
||||
_, ok := o.GetNameOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetName gets a reference to the given string and assigns it to the Name field.
|
||||
func (o *CommandTemplate) SetName(v CommandTemplateGetNameRetType) {
|
||||
setCommandTemplateGetNameAttributeType(&o.Name, v)
|
||||
}
|
||||
|
||||
// GetOsType returns the OsType field value if set, zero value otherwise.
|
||||
func (o *CommandTemplate) GetOsType() (res CommandTemplateGetOsTypeRetType) {
|
||||
res, _ = o.GetOsTypeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetOsTypeOk returns a tuple with the OsType field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandTemplate) GetOsTypeOk() (ret CommandTemplateGetOsTypeRetType, ok bool) {
|
||||
return getCommandTemplateGetOsTypeAttributeTypeOk(o.OsType)
|
||||
}
|
||||
|
||||
// HasOsType returns a boolean if a field has been set.
|
||||
func (o *CommandTemplate) HasOsType() bool {
|
||||
_, ok := o.GetOsTypeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetOsType gets a reference to the given []string and assigns it to the OsType field.
|
||||
func (o *CommandTemplate) SetOsType(v CommandTemplateGetOsTypeRetType) {
|
||||
setCommandTemplateGetOsTypeAttributeType(&o.OsType, v)
|
||||
}
|
||||
|
||||
// GetTitle returns the Title field value if set, zero value otherwise.
|
||||
func (o *CommandTemplate) GetTitle() (res CommandTemplateGetTitleRetType) {
|
||||
res, _ = o.GetTitleOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandTemplate) GetTitleOk() (ret CommandTemplateGetTitleRetType, ok bool) {
|
||||
return getCommandTemplateGetTitleAttributeTypeOk(o.Title)
|
||||
}
|
||||
|
||||
// HasTitle returns a boolean if a field has been set.
|
||||
func (o *CommandTemplate) HasTitle() bool {
|
||||
_, ok := o.GetTitleOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetTitle gets a reference to the given string and assigns it to the Title field.
|
||||
func (o *CommandTemplate) SetTitle(v CommandTemplateGetTitleRetType) {
|
||||
setCommandTemplateGetTitleAttributeType(&o.Title, v)
|
||||
}
|
||||
|
||||
func (o CommandTemplate) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCommandTemplateGetNameAttributeTypeOk(o.Name); ok {
|
||||
toSerialize["Name"] = val
|
||||
}
|
||||
if val, ok := getCommandTemplateGetOsTypeAttributeTypeOk(o.OsType); ok {
|
||||
toSerialize["OsType"] = val
|
||||
}
|
||||
if val, ok := getCommandTemplateGetTitleAttributeTypeOk(o.Title); ok {
|
||||
toSerialize["Title"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCommandTemplate struct {
|
||||
value *CommandTemplate
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplate) Get() *CommandTemplate {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplate) Set(val *CommandTemplate) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplate) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplate) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommandTemplate(val *CommandTemplate) *NullableCommandTemplate {
|
||||
return &NullableCommandTemplate{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplate) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplate) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
127
pkg/runcommandbeta/model_command_template_response.go
Normal file
127
pkg/runcommandbeta/model_command_template_response.go
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CommandTemplateResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CommandTemplateResponse{}
|
||||
|
||||
/*
|
||||
types and functions for items
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type CommandTemplateResponseGetItemsAttributeType = *[]CommandTemplate
|
||||
type CommandTemplateResponseGetItemsArgType = []CommandTemplate
|
||||
type CommandTemplateResponseGetItemsRetType = []CommandTemplate
|
||||
|
||||
func getCommandTemplateResponseGetItemsAttributeTypeOk(arg CommandTemplateResponseGetItemsAttributeType) (ret CommandTemplateResponseGetItemsRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateResponseGetItemsAttributeType(arg *CommandTemplateResponseGetItemsAttributeType, val CommandTemplateResponseGetItemsRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// CommandTemplateResponse struct for CommandTemplateResponse
|
||||
type CommandTemplateResponse struct {
|
||||
Items CommandTemplateResponseGetItemsAttributeType `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
// NewCommandTemplateResponse instantiates a new CommandTemplateResponse 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 NewCommandTemplateResponse() *CommandTemplateResponse {
|
||||
this := CommandTemplateResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCommandTemplateResponseWithDefaults instantiates a new CommandTemplateResponse 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 NewCommandTemplateResponseWithDefaults() *CommandTemplateResponse {
|
||||
this := CommandTemplateResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetItems returns the Items field value if set, zero value otherwise.
|
||||
func (o *CommandTemplateResponse) GetItems() (res CommandTemplateResponseGetItemsRetType) {
|
||||
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 *CommandTemplateResponse) GetItemsOk() (ret CommandTemplateResponseGetItemsRetType, ok bool) {
|
||||
return getCommandTemplateResponseGetItemsAttributeTypeOk(o.Items)
|
||||
}
|
||||
|
||||
// HasItems returns a boolean if a field has been set.
|
||||
func (o *CommandTemplateResponse) HasItems() bool {
|
||||
_, ok := o.GetItemsOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field.
|
||||
func (o *CommandTemplateResponse) SetItems(v CommandTemplateResponseGetItemsRetType) {
|
||||
setCommandTemplateResponseGetItemsAttributeType(&o.Items, v)
|
||||
}
|
||||
|
||||
func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCommandTemplateResponseGetItemsAttributeTypeOk(o.Items); ok {
|
||||
toSerialize["Items"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCommandTemplateResponse struct {
|
||||
value *CommandTemplateResponse
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplateResponse) Get() *CommandTemplateResponse {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplateResponse) Set(val *CommandTemplateResponse) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplateResponse) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplateResponse) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommandTemplateResponse(val *CommandTemplateResponse) *NullableCommandTemplateResponse {
|
||||
return &NullableCommandTemplateResponse{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplateResponse) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplateResponse) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_command_template_response_test.go
Normal file
11
pkg/runcommandbeta/model_command_template_response_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
318
pkg/runcommandbeta/model_command_template_schema.go
Normal file
318
pkg/runcommandbeta/model_command_template_schema.go
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CommandTemplateSchema type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CommandTemplateSchema{}
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandTemplateSchemaGetDescriptionAttributeType = *string
|
||||
|
||||
func getCommandTemplateSchemaGetDescriptionAttributeTypeOk(arg CommandTemplateSchemaGetDescriptionAttributeType) (ret CommandTemplateSchemaGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateSchemaGetDescriptionAttributeType(arg *CommandTemplateSchemaGetDescriptionAttributeType, val CommandTemplateSchemaGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandTemplateSchemaGetDescriptionArgType = string
|
||||
type CommandTemplateSchemaGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for name
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandTemplateSchemaGetNameAttributeType = *string
|
||||
|
||||
func getCommandTemplateSchemaGetNameAttributeTypeOk(arg CommandTemplateSchemaGetNameAttributeType) (ret CommandTemplateSchemaGetNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateSchemaGetNameAttributeType(arg *CommandTemplateSchemaGetNameAttributeType, val CommandTemplateSchemaGetNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandTemplateSchemaGetNameArgType = string
|
||||
type CommandTemplateSchemaGetNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for osType
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type CommandTemplateSchemaGetOsTypeAttributeType = *[]string
|
||||
type CommandTemplateSchemaGetOsTypeArgType = []string
|
||||
type CommandTemplateSchemaGetOsTypeRetType = []string
|
||||
|
||||
func getCommandTemplateSchemaGetOsTypeAttributeTypeOk(arg CommandTemplateSchemaGetOsTypeAttributeType) (ret CommandTemplateSchemaGetOsTypeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateSchemaGetOsTypeAttributeType(arg *CommandTemplateSchemaGetOsTypeAttributeType, val CommandTemplateSchemaGetOsTypeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for parameterSchema
|
||||
*/
|
||||
|
||||
// isModel
|
||||
type CommandTemplateSchemaGetParameterSchemaAttributeType = *ParametersSchema
|
||||
type CommandTemplateSchemaGetParameterSchemaArgType = ParametersSchema
|
||||
type CommandTemplateSchemaGetParameterSchemaRetType = ParametersSchema
|
||||
|
||||
func getCommandTemplateSchemaGetParameterSchemaAttributeTypeOk(arg CommandTemplateSchemaGetParameterSchemaAttributeType) (ret CommandTemplateSchemaGetParameterSchemaRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateSchemaGetParameterSchemaAttributeType(arg *CommandTemplateSchemaGetParameterSchemaAttributeType, val CommandTemplateSchemaGetParameterSchemaRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for title
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandTemplateSchemaGetTitleAttributeType = *string
|
||||
|
||||
func getCommandTemplateSchemaGetTitleAttributeTypeOk(arg CommandTemplateSchemaGetTitleAttributeType) (ret CommandTemplateSchemaGetTitleRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandTemplateSchemaGetTitleAttributeType(arg *CommandTemplateSchemaGetTitleAttributeType, val CommandTemplateSchemaGetTitleRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandTemplateSchemaGetTitleArgType = string
|
||||
type CommandTemplateSchemaGetTitleRetType = string
|
||||
|
||||
// CommandTemplateSchema struct for CommandTemplateSchema
|
||||
type CommandTemplateSchema struct {
|
||||
Description CommandTemplateSchemaGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
Name CommandTemplateSchemaGetNameAttributeType `json:"name,omitempty"`
|
||||
OsType CommandTemplateSchemaGetOsTypeAttributeType `json:"osType,omitempty"`
|
||||
ParameterSchema CommandTemplateSchemaGetParameterSchemaAttributeType `json:"parameterSchema,omitempty"`
|
||||
Title CommandTemplateSchemaGetTitleAttributeType `json:"title,omitempty"`
|
||||
}
|
||||
|
||||
// NewCommandTemplateSchema instantiates a new CommandTemplateSchema 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 NewCommandTemplateSchema() *CommandTemplateSchema {
|
||||
this := CommandTemplateSchema{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCommandTemplateSchemaWithDefaults instantiates a new CommandTemplateSchema 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 NewCommandTemplateSchemaWithDefaults() *CommandTemplateSchema {
|
||||
this := CommandTemplateSchema{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *CommandTemplateSchema) GetDescription() (res CommandTemplateSchemaGetDescriptionRetType) {
|
||||
res, _ = o.GetDescriptionOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandTemplateSchema) GetDescriptionOk() (ret CommandTemplateSchemaGetDescriptionRetType, ok bool) {
|
||||
return getCommandTemplateSchemaGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *CommandTemplateSchema) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *CommandTemplateSchema) SetDescription(v CommandTemplateSchemaGetDescriptionRetType) {
|
||||
setCommandTemplateSchemaGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetName returns the Name field value if set, zero value otherwise.
|
||||
func (o *CommandTemplateSchema) GetName() (res CommandTemplateSchemaGetNameRetType) {
|
||||
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 *CommandTemplateSchema) GetNameOk() (ret CommandTemplateSchemaGetNameRetType, ok bool) {
|
||||
return getCommandTemplateSchemaGetNameAttributeTypeOk(o.Name)
|
||||
}
|
||||
|
||||
// HasName returns a boolean if a field has been set.
|
||||
func (o *CommandTemplateSchema) HasName() bool {
|
||||
_, ok := o.GetNameOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetName gets a reference to the given string and assigns it to the Name field.
|
||||
func (o *CommandTemplateSchema) SetName(v CommandTemplateSchemaGetNameRetType) {
|
||||
setCommandTemplateSchemaGetNameAttributeType(&o.Name, v)
|
||||
}
|
||||
|
||||
// GetOsType returns the OsType field value if set, zero value otherwise.
|
||||
func (o *CommandTemplateSchema) GetOsType() (res CommandTemplateSchemaGetOsTypeRetType) {
|
||||
res, _ = o.GetOsTypeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetOsTypeOk returns a tuple with the OsType field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandTemplateSchema) GetOsTypeOk() (ret CommandTemplateSchemaGetOsTypeRetType, ok bool) {
|
||||
return getCommandTemplateSchemaGetOsTypeAttributeTypeOk(o.OsType)
|
||||
}
|
||||
|
||||
// HasOsType returns a boolean if a field has been set.
|
||||
func (o *CommandTemplateSchema) HasOsType() bool {
|
||||
_, ok := o.GetOsTypeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetOsType gets a reference to the given []string and assigns it to the OsType field.
|
||||
func (o *CommandTemplateSchema) SetOsType(v CommandTemplateSchemaGetOsTypeRetType) {
|
||||
setCommandTemplateSchemaGetOsTypeAttributeType(&o.OsType, v)
|
||||
}
|
||||
|
||||
// GetParameterSchema returns the ParameterSchema field value if set, zero value otherwise.
|
||||
func (o *CommandTemplateSchema) GetParameterSchema() (res CommandTemplateSchemaGetParameterSchemaRetType) {
|
||||
res, _ = o.GetParameterSchemaOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetParameterSchemaOk returns a tuple with the ParameterSchema field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandTemplateSchema) GetParameterSchemaOk() (ret CommandTemplateSchemaGetParameterSchemaRetType, ok bool) {
|
||||
return getCommandTemplateSchemaGetParameterSchemaAttributeTypeOk(o.ParameterSchema)
|
||||
}
|
||||
|
||||
// HasParameterSchema returns a boolean if a field has been set.
|
||||
func (o *CommandTemplateSchema) HasParameterSchema() bool {
|
||||
_, ok := o.GetParameterSchemaOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetParameterSchema gets a reference to the given ParametersSchema and assigns it to the ParameterSchema field.
|
||||
func (o *CommandTemplateSchema) SetParameterSchema(v CommandTemplateSchemaGetParameterSchemaRetType) {
|
||||
setCommandTemplateSchemaGetParameterSchemaAttributeType(&o.ParameterSchema, v)
|
||||
}
|
||||
|
||||
// GetTitle returns the Title field value if set, zero value otherwise.
|
||||
func (o *CommandTemplateSchema) GetTitle() (res CommandTemplateSchemaGetTitleRetType) {
|
||||
res, _ = o.GetTitleOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CommandTemplateSchema) GetTitleOk() (ret CommandTemplateSchemaGetTitleRetType, ok bool) {
|
||||
return getCommandTemplateSchemaGetTitleAttributeTypeOk(o.Title)
|
||||
}
|
||||
|
||||
// HasTitle returns a boolean if a field has been set.
|
||||
func (o *CommandTemplateSchema) HasTitle() bool {
|
||||
_, ok := o.GetTitleOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetTitle gets a reference to the given string and assigns it to the Title field.
|
||||
func (o *CommandTemplateSchema) SetTitle(v CommandTemplateSchemaGetTitleRetType) {
|
||||
setCommandTemplateSchemaGetTitleAttributeType(&o.Title, v)
|
||||
}
|
||||
|
||||
func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCommandTemplateSchemaGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getCommandTemplateSchemaGetNameAttributeTypeOk(o.Name); ok {
|
||||
toSerialize["Name"] = val
|
||||
}
|
||||
if val, ok := getCommandTemplateSchemaGetOsTypeAttributeTypeOk(o.OsType); ok {
|
||||
toSerialize["OsType"] = val
|
||||
}
|
||||
if val, ok := getCommandTemplateSchemaGetParameterSchemaAttributeTypeOk(o.ParameterSchema); ok {
|
||||
toSerialize["ParameterSchema"] = val
|
||||
}
|
||||
if val, ok := getCommandTemplateSchemaGetTitleAttributeTypeOk(o.Title); ok {
|
||||
toSerialize["Title"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCommandTemplateSchema struct {
|
||||
value *CommandTemplateSchema
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplateSchema) Get() *CommandTemplateSchema {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplateSchema) Set(val *CommandTemplateSchema) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplateSchema) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplateSchema) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommandTemplateSchema(val *CommandTemplateSchema) *NullableCommandTemplateSchema {
|
||||
return &NullableCommandTemplateSchema{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommandTemplateSchema) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommandTemplateSchema) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_command_template_schema_test.go
Normal file
11
pkg/runcommandbeta/model_command_template_schema_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
11
pkg/runcommandbeta/model_command_template_test.go
Normal file
11
pkg/runcommandbeta/model_command_template_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
476
pkg/runcommandbeta/model_commands.go
Normal file
476
pkg/runcommandbeta/model_commands.go
Normal file
|
|
@ -0,0 +1,476 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// checks if the Commands type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Commands{}
|
||||
|
||||
/*
|
||||
types and functions for commandTemplateName
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandsGetCommandTemplateNameAttributeType = *string
|
||||
|
||||
func getCommandsGetCommandTemplateNameAttributeTypeOk(arg CommandsGetCommandTemplateNameAttributeType) (ret CommandsGetCommandTemplateNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandsGetCommandTemplateNameAttributeType(arg *CommandsGetCommandTemplateNameAttributeType, val CommandsGetCommandTemplateNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandsGetCommandTemplateNameArgType = string
|
||||
type CommandsGetCommandTemplateNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for commandTemplateTitle
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandsGetCommandTemplateTitleAttributeType = *string
|
||||
|
||||
func getCommandsGetCommandTemplateTitleAttributeTypeOk(arg CommandsGetCommandTemplateTitleAttributeType) (ret CommandsGetCommandTemplateTitleRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandsGetCommandTemplateTitleAttributeType(arg *CommandsGetCommandTemplateTitleAttributeType, val CommandsGetCommandTemplateTitleRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandsGetCommandTemplateTitleArgType = string
|
||||
type CommandsGetCommandTemplateTitleRetType = string
|
||||
|
||||
/*
|
||||
types and functions for finishedAt
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandsGetFinishedAtAttributeType = *string
|
||||
|
||||
func getCommandsGetFinishedAtAttributeTypeOk(arg CommandsGetFinishedAtAttributeType) (ret CommandsGetFinishedAtRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandsGetFinishedAtAttributeType(arg *CommandsGetFinishedAtAttributeType, val CommandsGetFinishedAtRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandsGetFinishedAtArgType = string
|
||||
type CommandsGetFinishedAtRetType = string
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type CommandsGetIdAttributeType = *int64
|
||||
type CommandsGetIdArgType = int64
|
||||
type CommandsGetIdRetType = int64
|
||||
|
||||
func getCommandsGetIdAttributeTypeOk(arg CommandsGetIdAttributeType) (ret CommandsGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandsGetIdAttributeType(arg *CommandsGetIdAttributeType, val CommandsGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for startedAt
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CommandsGetStartedAtAttributeType = *string
|
||||
|
||||
func getCommandsGetStartedAtAttributeTypeOk(arg CommandsGetStartedAtAttributeType) (ret CommandsGetStartedAtRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandsGetStartedAtAttributeType(arg *CommandsGetStartedAtAttributeType, val CommandsGetStartedAtRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CommandsGetStartedAtArgType = string
|
||||
type CommandsGetStartedAtRetType = string
|
||||
|
||||
/*
|
||||
types and functions for status
|
||||
*/
|
||||
|
||||
// isEnum
|
||||
|
||||
// CommandsStatus the model 'Commands'
|
||||
// value type for enums
|
||||
type CommandsStatus string
|
||||
|
||||
// List of Status
|
||||
const (
|
||||
COMMANDSSTATUS_PENDING CommandsStatus = "pending"
|
||||
COMMANDSSTATUS_RUNNING CommandsStatus = "running"
|
||||
COMMANDSSTATUS_COMPLETED CommandsStatus = "completed"
|
||||
COMMANDSSTATUS_FAILED CommandsStatus = "failed"
|
||||
)
|
||||
|
||||
// All allowed values of Commands enum
|
||||
var AllowedCommandsStatusEnumValues = []CommandsStatus{
|
||||
"pending",
|
||||
"running",
|
||||
"completed",
|
||||
"failed",
|
||||
}
|
||||
|
||||
func (v *CommandsStatus) UnmarshalJSON(src []byte) error {
|
||||
// use a type alias to prevent infinite recursion during unmarshal,
|
||||
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
|
||||
type TmpJson CommandsStatus
|
||||
var value TmpJson
|
||||
err := json.Unmarshal(src, &value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Allow unmarshalling zero value for testing purposes
|
||||
var zeroValue TmpJson
|
||||
if value == zeroValue {
|
||||
return nil
|
||||
}
|
||||
enumTypeValue := CommandsStatus(value)
|
||||
for _, existing := range AllowedCommandsStatusEnumValues {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid Commands", value)
|
||||
}
|
||||
|
||||
// NewCommandsStatusFromValue returns a pointer to a valid CommandsStatus
|
||||
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
||||
func NewCommandsStatusFromValue(v CommandsStatus) (*CommandsStatus, error) {
|
||||
ev := CommandsStatus(v)
|
||||
if ev.IsValid() {
|
||||
return &ev, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("invalid value '%v' for CommandsStatus: valid values are %v", v, AllowedCommandsStatusEnumValues)
|
||||
}
|
||||
}
|
||||
|
||||
// IsValid return true if the value is valid for the enum, false otherwise
|
||||
func (v CommandsStatus) IsValid() bool {
|
||||
for _, existing := range AllowedCommandsStatusEnumValues {
|
||||
if existing == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Ptr returns reference to StatusStatus value
|
||||
func (v CommandsStatus) Ptr() *CommandsStatus {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableCommandsStatus struct {
|
||||
value *CommandsStatus
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommandsStatus) Get() *CommandsStatus {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommandsStatus) Set(val *CommandsStatus) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommandsStatus) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommandsStatus) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommandsStatus(val *CommandsStatus) *NullableCommandsStatus {
|
||||
return &NullableCommandsStatus{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommandsStatus) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommandsStatus) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
type CommandsGetStatusAttributeType = *CommandsStatus
|
||||
type CommandsGetStatusArgType = CommandsStatus
|
||||
type CommandsGetStatusRetType = CommandsStatus
|
||||
|
||||
func getCommandsGetStatusAttributeTypeOk(arg CommandsGetStatusAttributeType) (ret CommandsGetStatusRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCommandsGetStatusAttributeType(arg *CommandsGetStatusAttributeType, val CommandsGetStatusRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// Commands struct for Commands
|
||||
type Commands struct {
|
||||
CommandTemplateName CommandsGetCommandTemplateNameAttributeType `json:"commandTemplateName,omitempty"`
|
||||
CommandTemplateTitle CommandsGetCommandTemplateTitleAttributeType `json:"commandTemplateTitle,omitempty"`
|
||||
FinishedAt CommandsGetFinishedAtAttributeType `json:"finishedAt,omitempty"`
|
||||
// Can be cast to int32 without loss of precision.
|
||||
Id CommandsGetIdAttributeType `json:"id,omitempty"`
|
||||
StartedAt CommandsGetStartedAtAttributeType `json:"startedAt,omitempty"`
|
||||
Status CommandsGetStatusAttributeType `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// NewCommands instantiates a new Commands 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 NewCommands() *Commands {
|
||||
this := Commands{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCommandsWithDefaults instantiates a new Commands 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 NewCommandsWithDefaults() *Commands {
|
||||
this := Commands{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetCommandTemplateName returns the CommandTemplateName field value if set, zero value otherwise.
|
||||
func (o *Commands) GetCommandTemplateName() (res CommandsGetCommandTemplateNameRetType) {
|
||||
res, _ = o.GetCommandTemplateNameOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Commands) GetCommandTemplateNameOk() (ret CommandsGetCommandTemplateNameRetType, ok bool) {
|
||||
return getCommandsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName)
|
||||
}
|
||||
|
||||
// HasCommandTemplateName returns a boolean if a field has been set.
|
||||
func (o *Commands) HasCommandTemplateName() bool {
|
||||
_, ok := o.GetCommandTemplateNameOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field.
|
||||
func (o *Commands) SetCommandTemplateName(v CommandsGetCommandTemplateNameRetType) {
|
||||
setCommandsGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v)
|
||||
}
|
||||
|
||||
// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise.
|
||||
func (o *Commands) GetCommandTemplateTitle() (res CommandsGetCommandTemplateTitleRetType) {
|
||||
res, _ = o.GetCommandTemplateTitleOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCommandTemplateTitleOk returns a tuple with the CommandTemplateTitle field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Commands) GetCommandTemplateTitleOk() (ret CommandsGetCommandTemplateTitleRetType, ok bool) {
|
||||
return getCommandsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle)
|
||||
}
|
||||
|
||||
// HasCommandTemplateTitle returns a boolean if a field has been set.
|
||||
func (o *Commands) HasCommandTemplateTitle() bool {
|
||||
_, ok := o.GetCommandTemplateTitleOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field.
|
||||
func (o *Commands) SetCommandTemplateTitle(v CommandsGetCommandTemplateTitleRetType) {
|
||||
setCommandsGetCommandTemplateTitleAttributeType(&o.CommandTemplateTitle, v)
|
||||
}
|
||||
|
||||
// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise.
|
||||
func (o *Commands) GetFinishedAt() (res CommandsGetFinishedAtRetType) {
|
||||
res, _ = o.GetFinishedAtOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Commands) GetFinishedAtOk() (ret CommandsGetFinishedAtRetType, ok bool) {
|
||||
return getCommandsGetFinishedAtAttributeTypeOk(o.FinishedAt)
|
||||
}
|
||||
|
||||
// HasFinishedAt returns a boolean if a field has been set.
|
||||
func (o *Commands) HasFinishedAt() bool {
|
||||
_, ok := o.GetFinishedAtOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field.
|
||||
func (o *Commands) SetFinishedAt(v CommandsGetFinishedAtRetType) {
|
||||
setCommandsGetFinishedAtAttributeType(&o.FinishedAt, v)
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise.
|
||||
func (o *Commands) GetId() (res CommandsGetIdRetType) {
|
||||
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 *Commands) GetIdOk() (ret CommandsGetIdRetType, ok bool) {
|
||||
return getCommandsGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *Commands) HasId() bool {
|
||||
_, ok := o.GetIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given int64 and assigns it to the Id field.
|
||||
func (o *Commands) SetId(v CommandsGetIdRetType) {
|
||||
setCommandsGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
// GetStartedAt returns the StartedAt field value if set, zero value otherwise.
|
||||
func (o *Commands) GetStartedAt() (res CommandsGetStartedAtRetType) {
|
||||
res, _ = o.GetStartedAtOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Commands) GetStartedAtOk() (ret CommandsGetStartedAtRetType, ok bool) {
|
||||
return getCommandsGetStartedAtAttributeTypeOk(o.StartedAt)
|
||||
}
|
||||
|
||||
// HasStartedAt returns a boolean if a field has been set.
|
||||
func (o *Commands) HasStartedAt() bool {
|
||||
_, ok := o.GetStartedAtOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field.
|
||||
func (o *Commands) SetStartedAt(v CommandsGetStartedAtRetType) {
|
||||
setCommandsGetStartedAtAttributeType(&o.StartedAt, v)
|
||||
}
|
||||
|
||||
// GetStatus returns the Status field value if set, zero value otherwise.
|
||||
func (o *Commands) GetStatus() (res CommandsGetStatusRetType) {
|
||||
res, _ = o.GetStatusOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Commands) GetStatusOk() (ret CommandsGetStatusRetType, ok bool) {
|
||||
return getCommandsGetStatusAttributeTypeOk(o.Status)
|
||||
}
|
||||
|
||||
// HasStatus returns a boolean if a field has been set.
|
||||
func (o *Commands) HasStatus() bool {
|
||||
_, ok := o.GetStatusOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetStatus gets a reference to the given string and assigns it to the Status field.
|
||||
func (o *Commands) SetStatus(v CommandsGetStatusRetType) {
|
||||
setCommandsGetStatusAttributeType(&o.Status, v)
|
||||
}
|
||||
|
||||
func (o Commands) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCommandsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok {
|
||||
toSerialize["CommandTemplateName"] = val
|
||||
}
|
||||
if val, ok := getCommandsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle); ok {
|
||||
toSerialize["CommandTemplateTitle"] = val
|
||||
}
|
||||
if val, ok := getCommandsGetFinishedAtAttributeTypeOk(o.FinishedAt); ok {
|
||||
toSerialize["FinishedAt"] = val
|
||||
}
|
||||
if val, ok := getCommandsGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
if val, ok := getCommandsGetStartedAtAttributeTypeOk(o.StartedAt); ok {
|
||||
toSerialize["StartedAt"] = val
|
||||
}
|
||||
if val, ok := getCommandsGetStatusAttributeTypeOk(o.Status); ok {
|
||||
toSerialize["Status"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCommands struct {
|
||||
value *Commands
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCommands) Get() *Commands {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCommands) Set(val *Commands) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCommands) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCommands) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCommands(val *Commands) *NullableCommands {
|
||||
return &NullableCommands{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCommands) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCommands) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
72
pkg/runcommandbeta/model_commands_test.go
Normal file
72
pkg/runcommandbeta/model_commands_test.go
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// isEnum
|
||||
|
||||
func TestCommandsStatus_UnmarshalJSON(t *testing.T) {
|
||||
type args struct {
|
||||
src []byte
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: `success - possible enum value no. 1`,
|
||||
args: args{
|
||||
src: []byte(`"pending"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 2`,
|
||||
args: args{
|
||||
src: []byte(`"running"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 3`,
|
||||
args: args{
|
||||
src: []byte(`"completed"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 4`,
|
||||
args: args{
|
||||
src: []byte(`"failed"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "fail",
|
||||
args: args{
|
||||
src: []byte("\"FOOBAR\""),
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
v := CommandsStatus("")
|
||||
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
|
||||
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
173
pkg/runcommandbeta/model_create_command_payload.go
Normal file
173
pkg/runcommandbeta/model_create_command_payload.go
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CreateCommandPayload type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CreateCommandPayload{}
|
||||
|
||||
/*
|
||||
types and functions for commandTemplateName
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateCommandPayloadGetCommandTemplateNameAttributeType = *string
|
||||
|
||||
func getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(arg CreateCommandPayloadGetCommandTemplateNameAttributeType) (ret CreateCommandPayloadGetCommandTemplateNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCommandPayloadGetCommandTemplateNameAttributeType(arg *CreateCommandPayloadGetCommandTemplateNameAttributeType, val CreateCommandPayloadGetCommandTemplateNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateCommandPayloadGetCommandTemplateNameArgType = string
|
||||
type CreateCommandPayloadGetCommandTemplateNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for parameters
|
||||
*/
|
||||
|
||||
// isContainer
|
||||
type CreateCommandPayloadGetParametersAttributeType = *map[string]string
|
||||
type CreateCommandPayloadGetParametersArgType = map[string]string
|
||||
type CreateCommandPayloadGetParametersRetType = map[string]string
|
||||
|
||||
func getCreateCommandPayloadGetParametersAttributeTypeOk(arg CreateCommandPayloadGetParametersAttributeType) (ret CreateCommandPayloadGetParametersRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateCommandPayloadGetParametersAttributeType(arg *CreateCommandPayloadGetParametersAttributeType, val CreateCommandPayloadGetParametersRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// CreateCommandPayload struct for CreateCommandPayload
|
||||
type CreateCommandPayload struct {
|
||||
// REQUIRED
|
||||
CommandTemplateName CreateCommandPayloadGetCommandTemplateNameAttributeType `json:"commandTemplateName" required:"true"`
|
||||
Parameters CreateCommandPayloadGetParametersAttributeType `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
type _CreateCommandPayload CreateCommandPayload
|
||||
|
||||
// NewCreateCommandPayload instantiates a new CreateCommandPayload 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 NewCreateCommandPayload(commandTemplateName CreateCommandPayloadGetCommandTemplateNameArgType) *CreateCommandPayload {
|
||||
this := CreateCommandPayload{}
|
||||
setCreateCommandPayloadGetCommandTemplateNameAttributeType(&this.CommandTemplateName, commandTemplateName)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCreateCommandPayloadWithDefaults instantiates a new CreateCommandPayload 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 NewCreateCommandPayloadWithDefaults() *CreateCommandPayload {
|
||||
this := CreateCommandPayload{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetCommandTemplateName returns the CommandTemplateName field value
|
||||
func (o *CreateCommandPayload) GetCommandTemplateName() (ret CreateCommandPayloadGetCommandTemplateNameRetType) {
|
||||
ret, _ = o.GetCommandTemplateNameOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CreateCommandPayload) GetCommandTemplateNameOk() (ret CreateCommandPayloadGetCommandTemplateNameRetType, ok bool) {
|
||||
return getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName)
|
||||
}
|
||||
|
||||
// SetCommandTemplateName sets field value
|
||||
func (o *CreateCommandPayload) SetCommandTemplateName(v CreateCommandPayloadGetCommandTemplateNameRetType) {
|
||||
setCreateCommandPayloadGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v)
|
||||
}
|
||||
|
||||
// GetParameters returns the Parameters field value if set, zero value otherwise.
|
||||
func (o *CreateCommandPayload) GetParameters() (res CreateCommandPayloadGetParametersRetType) {
|
||||
res, _ = o.GetParametersOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CreateCommandPayload) GetParametersOk() (ret CreateCommandPayloadGetParametersRetType, ok bool) {
|
||||
return getCreateCommandPayloadGetParametersAttributeTypeOk(o.Parameters)
|
||||
}
|
||||
|
||||
// HasParameters returns a boolean if a field has been set.
|
||||
func (o *CreateCommandPayload) HasParameters() bool {
|
||||
_, ok := o.GetParametersOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field.
|
||||
func (o *CreateCommandPayload) SetParameters(v CreateCommandPayloadGetParametersRetType) {
|
||||
setCreateCommandPayloadGetParametersAttributeType(&o.Parameters, v)
|
||||
}
|
||||
|
||||
func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok {
|
||||
toSerialize["CommandTemplateName"] = val
|
||||
}
|
||||
if val, ok := getCreateCommandPayloadGetParametersAttributeTypeOk(o.Parameters); ok {
|
||||
toSerialize["Parameters"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCreateCommandPayload struct {
|
||||
value *CreateCommandPayload
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCreateCommandPayload) Get() *CreateCommandPayload {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCreateCommandPayload) Set(val *CreateCommandPayload) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCreateCommandPayload) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCreateCommandPayload) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCreateCommandPayload(val *CreateCommandPayload) *NullableCreateCommandPayload {
|
||||
return &NullableCreateCommandPayload{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCreateCommandPayload) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCreateCommandPayload) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_create_command_payload_test.go
Normal file
11
pkg/runcommandbeta/model_create_command_payload_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
172
pkg/runcommandbeta/model_error_response.go
Normal file
172
pkg/runcommandbeta/model_error_response.go
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &ErrorResponse{}
|
||||
|
||||
/*
|
||||
types and functions for message
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type ErrorResponseGetMessageAttributeType = *string
|
||||
|
||||
func getErrorResponseGetMessageAttributeTypeOk(arg ErrorResponseGetMessageAttributeType) (ret ErrorResponseGetMessageRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setErrorResponseGetMessageAttributeType(arg *ErrorResponseGetMessageAttributeType, val ErrorResponseGetMessageRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type ErrorResponseGetMessageArgType = string
|
||||
type ErrorResponseGetMessageRetType = string
|
||||
|
||||
/*
|
||||
types and functions for status
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type ErrorResponseGetStatusAttributeType = *string
|
||||
|
||||
func getErrorResponseGetStatusAttributeTypeOk(arg ErrorResponseGetStatusAttributeType) (ret ErrorResponseGetStatusRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setErrorResponseGetStatusAttributeType(arg *ErrorResponseGetStatusAttributeType, val ErrorResponseGetStatusRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type ErrorResponseGetStatusArgType = string
|
||||
type ErrorResponseGetStatusRetType = string
|
||||
|
||||
// ErrorResponse struct for ErrorResponse
|
||||
type ErrorResponse struct {
|
||||
// Details about the error
|
||||
// REQUIRED
|
||||
Message ErrorResponseGetMessageAttributeType `json:"message" required:"true"`
|
||||
// The string representation of the http status code (i.e. Not Found, Bad Request, etc)
|
||||
// REQUIRED
|
||||
Status ErrorResponseGetStatusAttributeType `json:"status" required:"true"`
|
||||
}
|
||||
|
||||
type _ErrorResponse ErrorResponse
|
||||
|
||||
// NewErrorResponse instantiates a new ErrorResponse 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 NewErrorResponse(message ErrorResponseGetMessageArgType, status ErrorResponseGetStatusArgType) *ErrorResponse {
|
||||
this := ErrorResponse{}
|
||||
setErrorResponseGetMessageAttributeType(&this.Message, message)
|
||||
setErrorResponseGetStatusAttributeType(&this.Status, status)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewErrorResponseWithDefaults instantiates a new ErrorResponse 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 NewErrorResponseWithDefaults() *ErrorResponse {
|
||||
this := ErrorResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetMessage returns the Message field value
|
||||
func (o *ErrorResponse) GetMessage() (ret ErrorResponseGetMessageRetType) {
|
||||
ret, _ = o.GetMessageOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetMessageOk returns a tuple with the Message field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *ErrorResponse) GetMessageOk() (ret ErrorResponseGetMessageRetType, ok bool) {
|
||||
return getErrorResponseGetMessageAttributeTypeOk(o.Message)
|
||||
}
|
||||
|
||||
// SetMessage sets field value
|
||||
func (o *ErrorResponse) SetMessage(v ErrorResponseGetMessageRetType) {
|
||||
setErrorResponseGetMessageAttributeType(&o.Message, v)
|
||||
}
|
||||
|
||||
// GetStatus returns the Status field value
|
||||
func (o *ErrorResponse) GetStatus() (ret ErrorResponseGetStatusRetType) {
|
||||
ret, _ = o.GetStatusOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetStatusOk returns a tuple with the Status field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *ErrorResponse) GetStatusOk() (ret ErrorResponseGetStatusRetType, ok bool) {
|
||||
return getErrorResponseGetStatusAttributeTypeOk(o.Status)
|
||||
}
|
||||
|
||||
// SetStatus sets field value
|
||||
func (o *ErrorResponse) SetStatus(v ErrorResponseGetStatusRetType) {
|
||||
setErrorResponseGetStatusAttributeType(&o.Status, v)
|
||||
}
|
||||
|
||||
func (o ErrorResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getErrorResponseGetMessageAttributeTypeOk(o.Message); ok {
|
||||
toSerialize["Message"] = val
|
||||
}
|
||||
if val, ok := getErrorResponseGetStatusAttributeTypeOk(o.Status); ok {
|
||||
toSerialize["Status"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableErrorResponse struct {
|
||||
value *ErrorResponse
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableErrorResponse) Get() *ErrorResponse {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableErrorResponse) Set(val *ErrorResponse) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableErrorResponse) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableErrorResponse) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse {
|
||||
return &NullableErrorResponse{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableErrorResponse) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_error_response_test.go
Normal file
11
pkg/runcommandbeta/model_error_response_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
415
pkg/runcommandbeta/model_field.go
Normal file
415
pkg/runcommandbeta/model_field.go
Normal file
|
|
@ -0,0 +1,415 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Field type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Field{}
|
||||
|
||||
/*
|
||||
types and functions for default
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type FieldGetDefaultAttributeType = *string
|
||||
|
||||
func getFieldGetDefaultAttributeTypeOk(arg FieldGetDefaultAttributeType) (ret FieldGetDefaultRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldGetDefaultAttributeType(arg *FieldGetDefaultAttributeType, val FieldGetDefaultRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type FieldGetDefaultArgType = string
|
||||
type FieldGetDefaultRetType = string
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type FieldGetDescriptionAttributeType = *string
|
||||
|
||||
func getFieldGetDescriptionAttributeTypeOk(arg FieldGetDescriptionAttributeType) (ret FieldGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldGetDescriptionAttributeType(arg *FieldGetDescriptionAttributeType, val FieldGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type FieldGetDescriptionArgType = string
|
||||
type FieldGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for maxLen
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type FieldGetMaxLenAttributeType = *int64
|
||||
type FieldGetMaxLenArgType = int64
|
||||
type FieldGetMaxLenRetType = int64
|
||||
|
||||
func getFieldGetMaxLenAttributeTypeOk(arg FieldGetMaxLenAttributeType) (ret FieldGetMaxLenRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldGetMaxLenAttributeType(arg *FieldGetMaxLenAttributeType, val FieldGetMaxLenRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for minLen
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type FieldGetMinLenAttributeType = *int64
|
||||
type FieldGetMinLenArgType = int64
|
||||
type FieldGetMinLenRetType = int64
|
||||
|
||||
func getFieldGetMinLenAttributeTypeOk(arg FieldGetMinLenAttributeType) (ret FieldGetMinLenRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldGetMinLenAttributeType(arg *FieldGetMinLenAttributeType, val FieldGetMinLenRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for readOnly
|
||||
*/
|
||||
|
||||
// isBoolean
|
||||
type FieldgetReadOnlyAttributeType = *bool
|
||||
type FieldgetReadOnlyArgType = bool
|
||||
type FieldgetReadOnlyRetType = bool
|
||||
|
||||
func getFieldgetReadOnlyAttributeTypeOk(arg FieldgetReadOnlyAttributeType) (ret FieldgetReadOnlyRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldgetReadOnlyAttributeType(arg *FieldgetReadOnlyAttributeType, val FieldgetReadOnlyRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for title
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type FieldGetTitleAttributeType = *string
|
||||
|
||||
func getFieldGetTitleAttributeTypeOk(arg FieldGetTitleAttributeType) (ret FieldGetTitleRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldGetTitleAttributeType(arg *FieldGetTitleAttributeType, val FieldGetTitleRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type FieldGetTitleArgType = string
|
||||
type FieldGetTitleRetType = string
|
||||
|
||||
/*
|
||||
types and functions for type
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type FieldGetTypeAttributeType = *string
|
||||
|
||||
func getFieldGetTypeAttributeTypeOk(arg FieldGetTypeAttributeType) (ret FieldGetTypeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setFieldGetTypeAttributeType(arg *FieldGetTypeAttributeType, val FieldGetTypeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type FieldGetTypeArgType = string
|
||||
type FieldGetTypeRetType = string
|
||||
|
||||
// Field struct for Field
|
||||
type Field struct {
|
||||
Default FieldGetDefaultAttributeType `json:"default,omitempty"`
|
||||
Description FieldGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
// Can be cast to int32 without loss of precision.
|
||||
MaxLen FieldGetMaxLenAttributeType `json:"maxLen,omitempty"`
|
||||
// Can be cast to int32 without loss of precision.
|
||||
MinLen FieldGetMinLenAttributeType `json:"minLen,omitempty"`
|
||||
ReadOnly FieldgetReadOnlyAttributeType `json:"readOnly,omitempty"`
|
||||
Title FieldGetTitleAttributeType `json:"title,omitempty"`
|
||||
Type FieldGetTypeAttributeType `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// NewField instantiates a new Field 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 NewField() *Field {
|
||||
this := Field{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewFieldWithDefaults instantiates a new Field 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 NewFieldWithDefaults() *Field {
|
||||
this := Field{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDefault returns the Default field value if set, zero value otherwise.
|
||||
func (o *Field) GetDefault() (res FieldGetDefaultRetType) {
|
||||
res, _ = o.GetDefaultOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Field) GetDefaultOk() (ret FieldGetDefaultRetType, ok bool) {
|
||||
return getFieldGetDefaultAttributeTypeOk(o.Default)
|
||||
}
|
||||
|
||||
// HasDefault returns a boolean if a field has been set.
|
||||
func (o *Field) HasDefault() bool {
|
||||
_, ok := o.GetDefaultOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDefault gets a reference to the given string and assigns it to the Default field.
|
||||
func (o *Field) SetDefault(v FieldGetDefaultRetType) {
|
||||
setFieldGetDefaultAttributeType(&o.Default, v)
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *Field) GetDescription() (res FieldGetDescriptionRetType) {
|
||||
res, _ = o.GetDescriptionOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Field) GetDescriptionOk() (ret FieldGetDescriptionRetType, ok bool) {
|
||||
return getFieldGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *Field) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *Field) SetDescription(v FieldGetDescriptionRetType) {
|
||||
setFieldGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetMaxLen returns the MaxLen field value if set, zero value otherwise.
|
||||
func (o *Field) GetMaxLen() (res FieldGetMaxLenRetType) {
|
||||
res, _ = o.GetMaxLenOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetMaxLenOk returns a tuple with the MaxLen field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Field) GetMaxLenOk() (ret FieldGetMaxLenRetType, ok bool) {
|
||||
return getFieldGetMaxLenAttributeTypeOk(o.MaxLen)
|
||||
}
|
||||
|
||||
// HasMaxLen returns a boolean if a field has been set.
|
||||
func (o *Field) HasMaxLen() bool {
|
||||
_, ok := o.GetMaxLenOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetMaxLen gets a reference to the given int64 and assigns it to the MaxLen field.
|
||||
func (o *Field) SetMaxLen(v FieldGetMaxLenRetType) {
|
||||
setFieldGetMaxLenAttributeType(&o.MaxLen, v)
|
||||
}
|
||||
|
||||
// GetMinLen returns the MinLen field value if set, zero value otherwise.
|
||||
func (o *Field) GetMinLen() (res FieldGetMinLenRetType) {
|
||||
res, _ = o.GetMinLenOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetMinLenOk returns a tuple with the MinLen field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Field) GetMinLenOk() (ret FieldGetMinLenRetType, ok bool) {
|
||||
return getFieldGetMinLenAttributeTypeOk(o.MinLen)
|
||||
}
|
||||
|
||||
// HasMinLen returns a boolean if a field has been set.
|
||||
func (o *Field) HasMinLen() bool {
|
||||
_, ok := o.GetMinLenOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetMinLen gets a reference to the given int64 and assigns it to the MinLen field.
|
||||
func (o *Field) SetMinLen(v FieldGetMinLenRetType) {
|
||||
setFieldGetMinLenAttributeType(&o.MinLen, v)
|
||||
}
|
||||
|
||||
// GetReadOnly returns the ReadOnly field value if set, zero value otherwise.
|
||||
func (o *Field) GetReadOnly() (res FieldgetReadOnlyRetType) {
|
||||
res, _ = o.GetReadOnlyOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Field) GetReadOnlyOk() (ret FieldgetReadOnlyRetType, ok bool) {
|
||||
return getFieldgetReadOnlyAttributeTypeOk(o.ReadOnly)
|
||||
}
|
||||
|
||||
// HasReadOnly returns a boolean if a field has been set.
|
||||
func (o *Field) HasReadOnly() bool {
|
||||
_, ok := o.GetReadOnlyOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field.
|
||||
func (o *Field) SetReadOnly(v FieldgetReadOnlyRetType) {
|
||||
setFieldgetReadOnlyAttributeType(&o.ReadOnly, v)
|
||||
}
|
||||
|
||||
// GetTitle returns the Title field value if set, zero value otherwise.
|
||||
func (o *Field) GetTitle() (res FieldGetTitleRetType) {
|
||||
res, _ = o.GetTitleOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetTitleOk returns a tuple with the Title field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Field) GetTitleOk() (ret FieldGetTitleRetType, ok bool) {
|
||||
return getFieldGetTitleAttributeTypeOk(o.Title)
|
||||
}
|
||||
|
||||
// HasTitle returns a boolean if a field has been set.
|
||||
func (o *Field) HasTitle() bool {
|
||||
_, ok := o.GetTitleOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetTitle gets a reference to the given string and assigns it to the Title field.
|
||||
func (o *Field) SetTitle(v FieldGetTitleRetType) {
|
||||
setFieldGetTitleAttributeType(&o.Title, v)
|
||||
}
|
||||
|
||||
// GetType returns the Type field value if set, zero value otherwise.
|
||||
func (o *Field) GetType() (res FieldGetTypeRetType) {
|
||||
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 *Field) GetTypeOk() (ret FieldGetTypeRetType, ok bool) {
|
||||
return getFieldGetTypeAttributeTypeOk(o.Type)
|
||||
}
|
||||
|
||||
// HasType returns a boolean if a field has been set.
|
||||
func (o *Field) HasType() bool {
|
||||
_, ok := o.GetTypeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetType gets a reference to the given string and assigns it to the Type field.
|
||||
func (o *Field) SetType(v FieldGetTypeRetType) {
|
||||
setFieldGetTypeAttributeType(&o.Type, v)
|
||||
}
|
||||
|
||||
func (o Field) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getFieldGetDefaultAttributeTypeOk(o.Default); ok {
|
||||
toSerialize["Default"] = val
|
||||
}
|
||||
if val, ok := getFieldGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getFieldGetMaxLenAttributeTypeOk(o.MaxLen); ok {
|
||||
toSerialize["MaxLen"] = val
|
||||
}
|
||||
if val, ok := getFieldGetMinLenAttributeTypeOk(o.MinLen); ok {
|
||||
toSerialize["MinLen"] = val
|
||||
}
|
||||
if val, ok := getFieldgetReadOnlyAttributeTypeOk(o.ReadOnly); ok {
|
||||
toSerialize["ReadOnly"] = val
|
||||
}
|
||||
if val, ok := getFieldGetTitleAttributeTypeOk(o.Title); ok {
|
||||
toSerialize["Title"] = val
|
||||
}
|
||||
if val, ok := getFieldGetTypeAttributeTypeOk(o.Type); ok {
|
||||
toSerialize["Type"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableField struct {
|
||||
value *Field
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableField) Get() *Field {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableField) Set(val *Field) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableField) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableField) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableField(val *Field) *NullableField {
|
||||
return &NullableField{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableField) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableField) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_field_test.go
Normal file
11
pkg/runcommandbeta/model_field_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
127
pkg/runcommandbeta/model_get_commands_response.go
Normal file
127
pkg/runcommandbeta/model_get_commands_response.go
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the GetCommandsResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &GetCommandsResponse{}
|
||||
|
||||
/*
|
||||
types and functions for items
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type GetCommandsResponseGetItemsAttributeType = *[]Commands
|
||||
type GetCommandsResponseGetItemsArgType = []Commands
|
||||
type GetCommandsResponseGetItemsRetType = []Commands
|
||||
|
||||
func getGetCommandsResponseGetItemsAttributeTypeOk(arg GetCommandsResponseGetItemsAttributeType) (ret GetCommandsResponseGetItemsRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setGetCommandsResponseGetItemsAttributeType(arg *GetCommandsResponseGetItemsAttributeType, val GetCommandsResponseGetItemsRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// GetCommandsResponse struct for GetCommandsResponse
|
||||
type GetCommandsResponse struct {
|
||||
Items GetCommandsResponseGetItemsAttributeType `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetCommandsResponse instantiates a new GetCommandsResponse 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 NewGetCommandsResponse() *GetCommandsResponse {
|
||||
this := GetCommandsResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewGetCommandsResponseWithDefaults instantiates a new GetCommandsResponse 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 NewGetCommandsResponseWithDefaults() *GetCommandsResponse {
|
||||
this := GetCommandsResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetItems returns the Items field value if set, zero value otherwise.
|
||||
func (o *GetCommandsResponse) GetItems() (res GetCommandsResponseGetItemsRetType) {
|
||||
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 *GetCommandsResponse) GetItemsOk() (ret GetCommandsResponseGetItemsRetType, ok bool) {
|
||||
return getGetCommandsResponseGetItemsAttributeTypeOk(o.Items)
|
||||
}
|
||||
|
||||
// HasItems returns a boolean if a field has been set.
|
||||
func (o *GetCommandsResponse) HasItems() bool {
|
||||
_, ok := o.GetItemsOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetItems gets a reference to the given []Commands and assigns it to the Items field.
|
||||
func (o *GetCommandsResponse) SetItems(v GetCommandsResponseGetItemsRetType) {
|
||||
setGetCommandsResponseGetItemsAttributeType(&o.Items, v)
|
||||
}
|
||||
|
||||
func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getGetCommandsResponseGetItemsAttributeTypeOk(o.Items); ok {
|
||||
toSerialize["Items"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableGetCommandsResponse struct {
|
||||
value *GetCommandsResponse
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableGetCommandsResponse) Get() *GetCommandsResponse {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableGetCommandsResponse) Set(val *GetCommandsResponse) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableGetCommandsResponse) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableGetCommandsResponse) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableGetCommandsResponse(val *GetCommandsResponse) *NullableGetCommandsResponse {
|
||||
return &NullableGetCommandsResponse{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableGetCommandsResponse) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableGetCommandsResponse) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_get_commands_response_test.go
Normal file
11
pkg/runcommandbeta/model_get_commands_response_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
128
pkg/runcommandbeta/model_new_command_response.go
Normal file
128
pkg/runcommandbeta/model_new_command_response.go
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the NewCommandResponse type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &NewCommandResponse{}
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type NewCommandResponseGetIdAttributeType = *int64
|
||||
type NewCommandResponseGetIdArgType = int64
|
||||
type NewCommandResponseGetIdRetType = int64
|
||||
|
||||
func getNewCommandResponseGetIdAttributeTypeOk(arg NewCommandResponseGetIdAttributeType) (ret NewCommandResponseGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setNewCommandResponseGetIdAttributeType(arg *NewCommandResponseGetIdAttributeType, val NewCommandResponseGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// NewCommandResponse struct for NewCommandResponse
|
||||
type NewCommandResponse struct {
|
||||
// Can be cast to int32 without loss of precision.
|
||||
Id NewCommandResponseGetIdAttributeType `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// NewNewCommandResponse instantiates a new NewCommandResponse 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 NewNewCommandResponse() *NewCommandResponse {
|
||||
this := NewCommandResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewNewCommandResponseWithDefaults instantiates a new NewCommandResponse 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 NewNewCommandResponseWithDefaults() *NewCommandResponse {
|
||||
this := NewCommandResponse{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise.
|
||||
func (o *NewCommandResponse) GetId() (res NewCommandResponseGetIdRetType) {
|
||||
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 *NewCommandResponse) GetIdOk() (ret NewCommandResponseGetIdRetType, ok bool) {
|
||||
return getNewCommandResponseGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *NewCommandResponse) HasId() bool {
|
||||
_, ok := o.GetIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given int64 and assigns it to the Id field.
|
||||
func (o *NewCommandResponse) SetId(v NewCommandResponseGetIdRetType) {
|
||||
setNewCommandResponseGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
func (o NewCommandResponse) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getNewCommandResponseGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableNewCommandResponse struct {
|
||||
value *NewCommandResponse
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableNewCommandResponse) Get() *NewCommandResponse {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableNewCommandResponse) Set(val *NewCommandResponse) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableNewCommandResponse) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableNewCommandResponse) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableNewCommandResponse(val *NewCommandResponse) *NullableNewCommandResponse {
|
||||
return &NullableNewCommandResponse{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableNewCommandResponse) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableNewCommandResponse) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_new_command_response_test.go
Normal file
11
pkg/runcommandbeta/model_new_command_response_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
127
pkg/runcommandbeta/model_parameters_schema.go
Normal file
127
pkg/runcommandbeta/model_parameters_schema.go
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the ParametersSchema type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &ParametersSchema{}
|
||||
|
||||
/*
|
||||
types and functions for properties
|
||||
*/
|
||||
|
||||
// isModel
|
||||
type ParametersSchemaGetPropertiesAttributeType = *Properties
|
||||
type ParametersSchemaGetPropertiesArgType = Properties
|
||||
type ParametersSchemaGetPropertiesRetType = Properties
|
||||
|
||||
func getParametersSchemaGetPropertiesAttributeTypeOk(arg ParametersSchemaGetPropertiesAttributeType) (ret ParametersSchemaGetPropertiesRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setParametersSchemaGetPropertiesAttributeType(arg *ParametersSchemaGetPropertiesAttributeType, val ParametersSchemaGetPropertiesRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// ParametersSchema struct for ParametersSchema
|
||||
type ParametersSchema struct {
|
||||
Properties ParametersSchemaGetPropertiesAttributeType `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// NewParametersSchema instantiates a new ParametersSchema 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 NewParametersSchema() *ParametersSchema {
|
||||
this := ParametersSchema{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewParametersSchemaWithDefaults instantiates a new ParametersSchema 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 NewParametersSchemaWithDefaults() *ParametersSchema {
|
||||
this := ParametersSchema{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetProperties returns the Properties field value if set, zero value otherwise.
|
||||
func (o *ParametersSchema) GetProperties() (res ParametersSchemaGetPropertiesRetType) {
|
||||
res, _ = o.GetPropertiesOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *ParametersSchema) GetPropertiesOk() (ret ParametersSchemaGetPropertiesRetType, ok bool) {
|
||||
return getParametersSchemaGetPropertiesAttributeTypeOk(o.Properties)
|
||||
}
|
||||
|
||||
// HasProperties returns a boolean if a field has been set.
|
||||
func (o *ParametersSchema) HasProperties() bool {
|
||||
_, ok := o.GetPropertiesOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetProperties gets a reference to the given Properties and assigns it to the Properties field.
|
||||
func (o *ParametersSchema) SetProperties(v ParametersSchemaGetPropertiesRetType) {
|
||||
setParametersSchemaGetPropertiesAttributeType(&o.Properties, v)
|
||||
}
|
||||
|
||||
func (o ParametersSchema) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getParametersSchemaGetPropertiesAttributeTypeOk(o.Properties); ok {
|
||||
toSerialize["Properties"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableParametersSchema struct {
|
||||
value *ParametersSchema
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableParametersSchema) Get() *ParametersSchema {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableParametersSchema) Set(val *ParametersSchema) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableParametersSchema) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableParametersSchema) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableParametersSchema(val *ParametersSchema) *NullableParametersSchema {
|
||||
return &NullableParametersSchema{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableParametersSchema) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableParametersSchema) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_parameters_schema_test.go
Normal file
11
pkg/runcommandbeta/model_parameters_schema_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
363
pkg/runcommandbeta/model_properties.go
Normal file
363
pkg/runcommandbeta/model_properties.go
Normal file
|
|
@ -0,0 +1,363 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Properties type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Properties{}
|
||||
|
||||
/*
|
||||
types and functions for ConfirmPassword
|
||||
*/
|
||||
|
||||
// isModel
|
||||
type PropertiesGetConfirmPasswordAttributeType = *Field
|
||||
type PropertiesGetConfirmPasswordArgType = Field
|
||||
type PropertiesGetConfirmPasswordRetType = Field
|
||||
|
||||
func getPropertiesGetConfirmPasswordAttributeTypeOk(arg PropertiesGetConfirmPasswordAttributeType) (ret PropertiesGetConfirmPasswordRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPropertiesGetConfirmPasswordAttributeType(arg *PropertiesGetConfirmPasswordAttributeType, val PropertiesGetConfirmPasswordRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for Password
|
||||
*/
|
||||
|
||||
// isModel
|
||||
type PropertiesGetPasswordAttributeType = *Field
|
||||
type PropertiesGetPasswordArgType = Field
|
||||
type PropertiesGetPasswordRetType = Field
|
||||
|
||||
func getPropertiesGetPasswordAttributeTypeOk(arg PropertiesGetPasswordAttributeType) (ret PropertiesGetPasswordRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPropertiesGetPasswordAttributeType(arg *PropertiesGetPasswordAttributeType, val PropertiesGetPasswordRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for Script
|
||||
*/
|
||||
|
||||
// isModel
|
||||
type PropertiesGetScriptAttributeType = *Field
|
||||
type PropertiesGetScriptArgType = Field
|
||||
type PropertiesGetScriptRetType = Field
|
||||
|
||||
func getPropertiesGetScriptAttributeTypeOk(arg PropertiesGetScriptAttributeType) (ret PropertiesGetScriptRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPropertiesGetScriptAttributeType(arg *PropertiesGetScriptAttributeType, val PropertiesGetScriptRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for Username
|
||||
*/
|
||||
|
||||
// isModel
|
||||
type PropertiesGetUsernameAttributeType = *Field
|
||||
type PropertiesGetUsernameArgType = Field
|
||||
type PropertiesGetUsernameRetType = Field
|
||||
|
||||
func getPropertiesGetUsernameAttributeTypeOk(arg PropertiesGetUsernameAttributeType) (ret PropertiesGetUsernameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPropertiesGetUsernameAttributeType(arg *PropertiesGetUsernameAttributeType, val PropertiesGetUsernameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for required
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type PropertiesGetRequiredAttributeType = *[]string
|
||||
type PropertiesGetRequiredArgType = []string
|
||||
type PropertiesGetRequiredRetType = []string
|
||||
|
||||
func getPropertiesGetRequiredAttributeTypeOk(arg PropertiesGetRequiredAttributeType) (ret PropertiesGetRequiredRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPropertiesGetRequiredAttributeType(arg *PropertiesGetRequiredAttributeType, val PropertiesGetRequiredRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for type
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type PropertiesGetTypeAttributeType = *string
|
||||
|
||||
func getPropertiesGetTypeAttributeTypeOk(arg PropertiesGetTypeAttributeType) (ret PropertiesGetTypeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPropertiesGetTypeAttributeType(arg *PropertiesGetTypeAttributeType, val PropertiesGetTypeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type PropertiesGetTypeArgType = string
|
||||
type PropertiesGetTypeRetType = string
|
||||
|
||||
// Properties struct for Properties
|
||||
type Properties struct {
|
||||
ConfirmPassword PropertiesGetConfirmPasswordAttributeType `json:"ConfirmPassword,omitempty"`
|
||||
Password PropertiesGetPasswordAttributeType `json:"Password,omitempty"`
|
||||
Script PropertiesGetScriptAttributeType `json:"Script,omitempty"`
|
||||
Username PropertiesGetUsernameAttributeType `json:"Username,omitempty"`
|
||||
Required PropertiesGetRequiredAttributeType `json:"required,omitempty"`
|
||||
Type PropertiesGetTypeAttributeType `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// NewProperties instantiates a new Properties 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 NewProperties() *Properties {
|
||||
this := Properties{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewPropertiesWithDefaults instantiates a new Properties 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 NewPropertiesWithDefaults() *Properties {
|
||||
this := Properties{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetConfirmPassword returns the ConfirmPassword field value if set, zero value otherwise.
|
||||
func (o *Properties) GetConfirmPassword() (res PropertiesGetConfirmPasswordRetType) {
|
||||
res, _ = o.GetConfirmPasswordOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfirmPasswordOk returns a tuple with the ConfirmPassword field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Properties) GetConfirmPasswordOk() (ret PropertiesGetConfirmPasswordRetType, ok bool) {
|
||||
return getPropertiesGetConfirmPasswordAttributeTypeOk(o.ConfirmPassword)
|
||||
}
|
||||
|
||||
// HasConfirmPassword returns a boolean if a field has been set.
|
||||
func (o *Properties) HasConfirmPassword() bool {
|
||||
_, ok := o.GetConfirmPasswordOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field.
|
||||
func (o *Properties) SetConfirmPassword(v PropertiesGetConfirmPasswordRetType) {
|
||||
setPropertiesGetConfirmPasswordAttributeType(&o.ConfirmPassword, v)
|
||||
}
|
||||
|
||||
// GetPassword returns the Password field value if set, zero value otherwise.
|
||||
func (o *Properties) GetPassword() (res PropertiesGetPasswordRetType) {
|
||||
res, _ = o.GetPasswordOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Properties) GetPasswordOk() (ret PropertiesGetPasswordRetType, ok bool) {
|
||||
return getPropertiesGetPasswordAttributeTypeOk(o.Password)
|
||||
}
|
||||
|
||||
// HasPassword returns a boolean if a field has been set.
|
||||
func (o *Properties) HasPassword() bool {
|
||||
_, ok := o.GetPasswordOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetPassword gets a reference to the given Field and assigns it to the Password field.
|
||||
func (o *Properties) SetPassword(v PropertiesGetPasswordRetType) {
|
||||
setPropertiesGetPasswordAttributeType(&o.Password, v)
|
||||
}
|
||||
|
||||
// GetScript returns the Script field value if set, zero value otherwise.
|
||||
func (o *Properties) GetScript() (res PropertiesGetScriptRetType) {
|
||||
res, _ = o.GetScriptOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetScriptOk returns a tuple with the Script field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Properties) GetScriptOk() (ret PropertiesGetScriptRetType, ok bool) {
|
||||
return getPropertiesGetScriptAttributeTypeOk(o.Script)
|
||||
}
|
||||
|
||||
// HasScript returns a boolean if a field has been set.
|
||||
func (o *Properties) HasScript() bool {
|
||||
_, ok := o.GetScriptOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetScript gets a reference to the given Field and assigns it to the Script field.
|
||||
func (o *Properties) SetScript(v PropertiesGetScriptRetType) {
|
||||
setPropertiesGetScriptAttributeType(&o.Script, v)
|
||||
}
|
||||
|
||||
// GetUsername returns the Username field value if set, zero value otherwise.
|
||||
func (o *Properties) GetUsername() (res PropertiesGetUsernameRetType) {
|
||||
res, _ = o.GetUsernameOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Properties) GetUsernameOk() (ret PropertiesGetUsernameRetType, ok bool) {
|
||||
return getPropertiesGetUsernameAttributeTypeOk(o.Username)
|
||||
}
|
||||
|
||||
// HasUsername returns a boolean if a field has been set.
|
||||
func (o *Properties) HasUsername() bool {
|
||||
_, ok := o.GetUsernameOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetUsername gets a reference to the given Field and assigns it to the Username field.
|
||||
func (o *Properties) SetUsername(v PropertiesGetUsernameRetType) {
|
||||
setPropertiesGetUsernameAttributeType(&o.Username, v)
|
||||
}
|
||||
|
||||
// GetRequired returns the Required field value if set, zero value otherwise.
|
||||
func (o *Properties) GetRequired() (res PropertiesGetRequiredRetType) {
|
||||
res, _ = o.GetRequiredOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Properties) GetRequiredOk() (ret PropertiesGetRequiredRetType, ok bool) {
|
||||
return getPropertiesGetRequiredAttributeTypeOk(o.Required)
|
||||
}
|
||||
|
||||
// HasRequired returns a boolean if a field has been set.
|
||||
func (o *Properties) HasRequired() bool {
|
||||
_, ok := o.GetRequiredOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetRequired gets a reference to the given []string and assigns it to the Required field.
|
||||
func (o *Properties) SetRequired(v PropertiesGetRequiredRetType) {
|
||||
setPropertiesGetRequiredAttributeType(&o.Required, v)
|
||||
}
|
||||
|
||||
// GetType returns the Type field value if set, zero value otherwise.
|
||||
func (o *Properties) GetType() (res PropertiesGetTypeRetType) {
|
||||
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 *Properties) GetTypeOk() (ret PropertiesGetTypeRetType, ok bool) {
|
||||
return getPropertiesGetTypeAttributeTypeOk(o.Type)
|
||||
}
|
||||
|
||||
// HasType returns a boolean if a field has been set.
|
||||
func (o *Properties) HasType() bool {
|
||||
_, ok := o.GetTypeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetType gets a reference to the given string and assigns it to the Type field.
|
||||
func (o *Properties) SetType(v PropertiesGetTypeRetType) {
|
||||
setPropertiesGetTypeAttributeType(&o.Type, v)
|
||||
}
|
||||
|
||||
func (o Properties) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getPropertiesGetConfirmPasswordAttributeTypeOk(o.ConfirmPassword); ok {
|
||||
toSerialize["ConfirmPassword"] = val
|
||||
}
|
||||
if val, ok := getPropertiesGetPasswordAttributeTypeOk(o.Password); ok {
|
||||
toSerialize["Password"] = val
|
||||
}
|
||||
if val, ok := getPropertiesGetScriptAttributeTypeOk(o.Script); ok {
|
||||
toSerialize["Script"] = val
|
||||
}
|
||||
if val, ok := getPropertiesGetUsernameAttributeTypeOk(o.Username); ok {
|
||||
toSerialize["Username"] = val
|
||||
}
|
||||
if val, ok := getPropertiesGetRequiredAttributeTypeOk(o.Required); ok {
|
||||
toSerialize["Required"] = val
|
||||
}
|
||||
if val, ok := getPropertiesGetTypeAttributeTypeOk(o.Type); ok {
|
||||
toSerialize["Type"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableProperties struct {
|
||||
value *Properties
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableProperties) Get() *Properties {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableProperties) Set(val *Properties) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableProperties) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableProperties) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableProperties(val *Properties) *NullableProperties {
|
||||
return &NullableProperties{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableProperties) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableProperties) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/runcommandbeta/model_properties_test.go
Normal file
11
pkg/runcommandbeta/model_properties_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
385
pkg/runcommandbeta/utils.go
Normal file
385
pkg/runcommandbeta/utils.go
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
/*
|
||||
STACKIT Run Commands Service API
|
||||
|
||||
API endpoints for the STACKIT Run Commands Service API
|
||||
|
||||
API version: 2beta.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package runcommandbeta
|
||||
|
||||
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