diff --git a/services/runcommand/api_default.go b/services/runcommand/api_default.go index e4acaad9f..2ac6bb1fc 100644 --- a/services/runcommand/api_default.go +++ b/services/runcommand/api_default.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -23,6 +24,7 @@ import ( "github.com/stackitcloud/stackit-sdk-go/core/oapierror" ) +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApi interface { /* CreateCommand Method for CreateCommand @@ -33,6 +35,8 @@ type DefaultApi interface { @param serverId Server ID of the machine @param region region @return ApiCreateCommandRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest /* @@ -44,6 +48,7 @@ type DefaultApi interface { @param region region @return NewCommandResponse + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateCommandExecute(ctx context.Context, projectId string, serverId string, region string) (*NewCommandResponse, error) /* @@ -56,6 +61,8 @@ type DefaultApi interface { @param serverId Server ID of the machine @param commandId ID of the command @return ApiGetCommandRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest /* @@ -68,6 +75,7 @@ type DefaultApi interface { @param commandId ID of the command @return CommandDetails + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetCommandExecute(ctx context.Context, projectId string, region string, serverId string, commandId string) (*CommandDetails, error) /* @@ -80,6 +88,8 @@ type DefaultApi interface { @param commandTemplateName Name of the template @param region region @return ApiGetCommandTemplateRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest /* @@ -92,6 +102,7 @@ type DefaultApi interface { @param region region @return CommandTemplateSchema + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetCommandTemplateExecute(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) (*CommandTemplateSchema, error) /* @@ -100,6 +111,8 @@ type DefaultApi interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiListCommandTemplatesRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest /* @@ -108,6 +121,7 @@ type DefaultApi interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return CommandTemplateResponse + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListCommandTemplatesExecute(ctx context.Context) (*CommandTemplateResponse, error) /* @@ -119,6 +133,8 @@ type DefaultApi interface { @param serverId Server ID of the machine @param region region @return ApiListCommandsRequest + + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest /* @@ -130,37 +146,52 @@ type DefaultApi interface { @param region region @return GetCommandsResponse + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListCommandsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetCommandsResponse, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiCreateCommandRequest interface { // Command to post + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*NewCommandResponse, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiGetCommandRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*CommandDetails, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiGetCommandTemplateRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*CommandTemplateSchema, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListCommandTemplatesRequest interface { // The type of the Operating System (windows or linux). If not provided will return data for all OS types. + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead OsType(osType string) ApiListCommandTemplatesRequest + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*CommandTemplateResponse, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListCommandsRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead Execute() (*GetCommandsResponse, error) } // DefaultApiService DefaultApi service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApiService service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandRequest struct { ctx context.Context apiService *DefaultApiService @@ -171,12 +202,13 @@ type CreateCommandRequest struct { } // Command to post - +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest { r.createCommandPayload = &createCommandPayload return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateCommandRequest) Execute() (*NewCommandResponse, error) { var ( localVarHTTPMethod = http.MethodPost @@ -305,7 +337,7 @@ func (r CreateCommandRequest) Execute() (*NewCommandResponse, error) { /* CreateCommand: Method for CreateCommand -Creates a new command for execution +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId ID of the project @@ -323,6 +355,7 @@ func (a *APIClient) CreateCommand(ctx context.Context, projectId string, serverI } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) CreateCommandExecute(ctx context.Context, projectId string, serverId string, region string) (*NewCommandResponse, error) { r := CreateCommandRequest{ apiService: a.defaultApi, @@ -334,6 +367,7 @@ func (a *APIClient) CreateCommandExecute(ctx context.Context, projectId string, return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCommandRequest struct { ctx context.Context apiService *DefaultApiService @@ -343,6 +377,7 @@ type GetCommandRequest struct { commandId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r GetCommandRequest) Execute() (*CommandDetails, error) { var ( localVarHTTPMethod = http.MethodGet @@ -470,7 +505,7 @@ func (r GetCommandRequest) Execute() (*CommandDetails, error) { /* GetCommand: Method for GetCommand -Returns details about a command +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId ID of the project @@ -490,6 +525,7 @@ func (a *APIClient) GetCommand(ctx context.Context, projectId string, region str } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) GetCommandExecute(ctx context.Context, projectId string, region string, serverId string, commandId string) (*CommandDetails, error) { r := GetCommandRequest{ apiService: a.defaultApi, @@ -502,6 +538,7 @@ func (a *APIClient) GetCommandExecute(ctx context.Context, projectId string, reg return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCommandTemplateRequest struct { ctx context.Context apiService *DefaultApiService @@ -511,6 +548,7 @@ type GetCommandTemplateRequest struct { region string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r GetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { var ( localVarHTTPMethod = http.MethodGet @@ -638,7 +676,7 @@ func (r GetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { /* GetCommandTemplate: Method for GetCommandTemplate -Returns details about a command template +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId ID of the project @@ -658,6 +696,7 @@ func (a *APIClient) GetCommandTemplate(ctx context.Context, projectId string, se } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) GetCommandTemplateExecute(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) (*CommandTemplateSchema, error) { r := GetCommandTemplateRequest{ apiService: a.defaultApi, @@ -670,6 +709,7 @@ func (a *APIClient) GetCommandTemplateExecute(ctx context.Context, projectId str return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCommandTemplatesRequest struct { ctx context.Context apiService *DefaultApiService @@ -677,12 +717,13 @@ type ListCommandTemplatesRequest struct { } // The type of the Operating System (windows or linux). If not provided will return data for all OS types. - +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest { r.osType = &osType return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) { var ( localVarHTTPMethod = http.MethodGet @@ -798,7 +839,7 @@ func (r ListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) /* ListCommandTemplates: Method for ListCommandTemplates -Returns a list of command templates +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return ApiListCommandTemplatesRequest @@ -810,6 +851,7 @@ func (a *APIClient) ListCommandTemplates(ctx context.Context) ApiListCommandTemp } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) ListCommandTemplatesExecute(ctx context.Context) (*CommandTemplateResponse, error) { r := ListCommandTemplatesRequest{ apiService: a.defaultApi, @@ -818,6 +860,7 @@ func (a *APIClient) ListCommandTemplatesExecute(ctx context.Context) (*CommandTe return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListCommandsRequest struct { ctx context.Context apiService *DefaultApiService @@ -826,6 +869,7 @@ type ListCommandsRequest struct { region string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListCommandsRequest) Execute() (*GetCommandsResponse, error) { var ( localVarHTTPMethod = http.MethodGet @@ -952,7 +996,7 @@ func (r ListCommandsRequest) Execute() (*GetCommandsResponse, error) { /* ListCommands: Method for ListCommands -Returns a list of commands +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId ID of the project @@ -970,6 +1014,7 @@ func (a *APIClient) ListCommands(ctx context.Context, projectId string, serverId } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) ListCommandsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetCommandsResponse, error) { r := ListCommandsRequest{ apiService: a.defaultApi, diff --git a/services/runcommand/client.go b/services/runcommand/client.go index 30dadcf13..c4d785890 100644 --- a/services/runcommand/client.go +++ b/services/runcommand/client.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -44,18 +45,21 @@ var ( // APIClient manages communication with the STACKIT Run Commands Service API API v2.0 // In most cases there should be only one, shared, APIClient. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type APIClient struct { cfg *config.Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. defaultApi *DefaultApiService } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type service struct { client DefaultApi } // NewAPIClient creates a new API client. // Optionally receives configuration options +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { cfg := NewConfiguration() @@ -147,6 +151,7 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func ParameterValueToString(obj interface{}, key string) string { if reflect.TypeOf(obj).Kind() != reflect.Ptr { return fmt.Sprintf("%v", obj) @@ -285,6 +290,7 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { // Allow modification of underlying config for alternate implementations and testing // Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (c *APIClient) GetConfig() *config.Configuration { return c.cfg } @@ -595,6 +601,7 @@ func parseCacheControl(headers http.Header) cacheControl { } // CacheExpires helper function to determine remaining time before repeating a request. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time diff --git a/services/runcommand/configuration.go b/services/runcommand/configuration.go index cbbeaa05a..8e3a8f68c 100644 --- a/services/runcommand/configuration.go +++ b/services/runcommand/configuration.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -15,6 +16,7 @@ import ( ) // NewConfiguration returns a new Configuration object +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewConfiguration() *config.Configuration { cfg := &config.Configuration{ DefaultHeader: make(map[string]string), diff --git a/services/runcommand/go.mod b/services/runcommand/go.mod index 4d03b4d47..72f0d61ae 100644 --- a/services/runcommand/go.mod +++ b/services/runcommand/go.mod @@ -2,7 +2,7 @@ module github.com/stackitcloud/stackit-sdk-go/services/runcommand go 1.21 -require github.com/stackitcloud/stackit-sdk-go/core v0.21.1 +require github.com/stackitcloud/stackit-sdk-go/core v0.22.0 require ( github.com/golang-jwt/jwt/v5 v5.3.1 // indirect diff --git a/services/runcommand/go.sum b/services/runcommand/go.sum index ca103c909..195011dd5 100644 --- a/services/runcommand/go.sum +++ b/services/runcommand/go.sum @@ -4,5 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts= -github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= diff --git a/services/runcommand/model_command_details.go b/services/runcommand/model_command_details.go index c766b6d06..71bb09c0a 100644 --- a/services/runcommand/model_command_details.go +++ b/services/runcommand/model_command_details.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -23,8 +24,10 @@ var _ MappedNullable = &CommandDetails{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetCommandTemplateNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetCommandTemplateNameAttributeTypeOk(arg CommandDetailsGetCommandTemplateNameAttributeType) (ret CommandDetailsGetCommandTemplateNameRetType, ok bool) { if arg == nil { return ret, false @@ -32,11 +35,15 @@ func getCommandDetailsGetCommandTemplateNameAttributeTypeOk(arg CommandDetailsGe return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetCommandTemplateNameAttributeType(arg *CommandDetailsGetCommandTemplateNameAttributeType, val CommandDetailsGetCommandTemplateNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetCommandTemplateNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetCommandTemplateNameRetType = string /* @@ -44,8 +51,10 @@ type CommandDetailsGetCommandTemplateNameRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetCommandTemplateTitleAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(arg CommandDetailsGetCommandTemplateTitleAttributeType) (ret CommandDetailsGetCommandTemplateTitleRetType, ok bool) { if arg == nil { return ret, false @@ -53,11 +62,15 @@ func getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(arg CommandDetailsG return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetCommandTemplateTitleAttributeType(arg *CommandDetailsGetCommandTemplateTitleAttributeType, val CommandDetailsGetCommandTemplateTitleRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetCommandTemplateTitleArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetCommandTemplateTitleRetType = string /* @@ -65,10 +78,16 @@ type CommandDetailsGetCommandTemplateTitleRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetExitCodeAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetExitCodeArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetExitCodeRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetExitCodeAttributeTypeOk(arg CommandDetailsGetExitCodeAttributeType) (ret CommandDetailsGetExitCodeRetType, ok bool) { if arg == nil { return ret, false @@ -76,6 +95,7 @@ func getCommandDetailsGetExitCodeAttributeTypeOk(arg CommandDetailsGetExitCodeAt return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetExitCodeAttributeType(arg *CommandDetailsGetExitCodeAttributeType, val CommandDetailsGetExitCodeRetType) { *arg = &val } @@ -85,8 +105,10 @@ func setCommandDetailsGetExitCodeAttributeType(arg *CommandDetailsGetExitCodeAtt */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetFinishedAtAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetFinishedAtAttributeTypeOk(arg CommandDetailsGetFinishedAtAttributeType) (ret CommandDetailsGetFinishedAtRetType, ok bool) { if arg == nil { return ret, false @@ -94,11 +116,15 @@ func getCommandDetailsGetFinishedAtAttributeTypeOk(arg CommandDetailsGetFinished return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetFinishedAtAttributeType(arg *CommandDetailsGetFinishedAtAttributeType, val CommandDetailsGetFinishedAtRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetFinishedAtArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetFinishedAtRetType = string /* @@ -106,10 +132,16 @@ type CommandDetailsGetFinishedAtRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetIdAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetIdArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetIdRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetIdAttributeTypeOk(arg CommandDetailsGetIdAttributeType) (ret CommandDetailsGetIdRetType, ok bool) { if arg == nil { return ret, false @@ -117,6 +149,7 @@ func getCommandDetailsGetIdAttributeTypeOk(arg CommandDetailsGetIdAttributeType) return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetIdAttributeType(arg *CommandDetailsGetIdAttributeType, val CommandDetailsGetIdRetType) { *arg = &val } @@ -126,8 +159,10 @@ func setCommandDetailsGetIdAttributeType(arg *CommandDetailsGetIdAttributeType, */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetOutputAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetOutputAttributeTypeOk(arg CommandDetailsGetOutputAttributeType) (ret CommandDetailsGetOutputRetType, ok bool) { if arg == nil { return ret, false @@ -135,11 +170,15 @@ func getCommandDetailsGetOutputAttributeTypeOk(arg CommandDetailsGetOutputAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetOutputAttributeType(arg *CommandDetailsGetOutputAttributeType, val CommandDetailsGetOutputRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetOutputArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetOutputRetType = string /* @@ -147,8 +186,10 @@ type CommandDetailsGetOutputRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetScriptAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetScriptAttributeTypeOk(arg CommandDetailsGetScriptAttributeType) (ret CommandDetailsGetScriptRetType, ok bool) { if arg == nil { return ret, false @@ -156,11 +197,15 @@ func getCommandDetailsGetScriptAttributeTypeOk(arg CommandDetailsGetScriptAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetScriptAttributeType(arg *CommandDetailsGetScriptAttributeType, val CommandDetailsGetScriptRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetScriptArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetScriptRetType = string /* @@ -168,8 +213,10 @@ type CommandDetailsGetScriptRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetStartedAtAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetStartedAtAttributeTypeOk(arg CommandDetailsGetStartedAtAttributeType) (ret CommandDetailsGetStartedAtRetType, ok bool) { if arg == nil { return ret, false @@ -177,11 +224,15 @@ func getCommandDetailsGetStartedAtAttributeTypeOk(arg CommandDetailsGetStartedAt return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetStartedAtAttributeType(arg *CommandDetailsGetStartedAtAttributeType, val CommandDetailsGetStartedAtRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetStartedAtArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetStartedAtRetType = string /* @@ -192,17 +243,23 @@ type CommandDetailsGetStartedAtRetType = string // CommandDetailsStatus the model 'CommandDetails' // value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsStatus string // List of Status const ( - COMMANDDETAILSSTATUS_PENDING CommandDetailsStatus = "pending" - COMMANDDETAILSSTATUS_RUNNING CommandDetailsStatus = "running" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + COMMANDDETAILSSTATUS_PENDING CommandDetailsStatus = "pending" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + COMMANDDETAILSSTATUS_RUNNING CommandDetailsStatus = "running" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead COMMANDDETAILSSTATUS_COMPLETED CommandDetailsStatus = "completed" - COMMANDDETAILSSTATUS_FAILED CommandDetailsStatus = "failed" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + COMMANDDETAILSSTATUS_FAILED CommandDetailsStatus = "failed" ) // All allowed values of CommandDetails enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead var AllowedCommandDetailsStatusEnumValues = []CommandDetailsStatus{ "pending", "running", @@ -210,6 +267,7 @@ var AllowedCommandDetailsStatusEnumValues = []CommandDetailsStatus{ "failed", } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead 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 @@ -237,6 +295,7 @@ func (v *CommandDetailsStatus) UnmarshalJSON(src []byte) error { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandDetailsStatusFromValue(v CommandDetailsStatus) (*CommandDetailsStatus, error) { ev := CommandDetailsStatus(v) if ev.IsValid() { @@ -247,6 +306,7 @@ func NewCommandDetailsStatusFromValue(v CommandDetailsStatus) (*CommandDetailsSt } // IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v CommandDetailsStatus) IsValid() bool { for _, existing := range AllowedCommandDetailsStatusEnumValues { if existing == v { @@ -257,50 +317,65 @@ func (v CommandDetailsStatus) IsValid() bool { } // Ptr returns reference to StatusStatus value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v CommandDetailsStatus) Ptr() *CommandDetailsStatus { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommandDetailsStatus struct { value *CommandDetailsStatus isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandDetailsStatus) Get() *CommandDetailsStatus { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandDetailsStatus) Set(val *CommandDetailsStatus) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandDetailsStatus) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandDetailsStatus) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommandDetailsStatus(val *CommandDetailsStatus) *NullableCommandDetailsStatus { return &NullableCommandDetailsStatus{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandDetailsStatus) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandDetailsStatus) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetStatusAttributeType = *CommandDetailsStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetStatusArgType = CommandDetailsStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetailsGetStatusRetType = CommandDetailsStatus +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandDetailsGetStatusAttributeTypeOk(arg CommandDetailsGetStatusAttributeType) (ret CommandDetailsGetStatusRetType, ok bool) { if arg == nil { return ret, false @@ -308,11 +383,13 @@ func getCommandDetailsGetStatusAttributeTypeOk(arg CommandDetailsGetStatusAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandDetailsGetStatusAttributeType(arg *CommandDetailsGetStatusAttributeType, val CommandDetailsGetStatusRetType) { *arg = &val } // CommandDetails struct for CommandDetails +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandDetails struct { CommandTemplateName CommandDetailsGetCommandTemplateNameAttributeType `json:"commandTemplateName,omitempty"` CommandTemplateTitle CommandDetailsGetCommandTemplateTitleAttributeType `json:"commandTemplateTitle,omitempty"` @@ -331,6 +408,7 @@ type CommandDetails struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandDetails() *CommandDetails { this := CommandDetails{} return &this @@ -339,12 +417,14 @@ func NewCommandDetails() *CommandDetails { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandDetailsWithDefaults() *CommandDetails { this := CommandDetails{} return &this } // GetCommandTemplateName returns the CommandTemplateName field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetCommandTemplateName() (res CommandDetailsGetCommandTemplateNameRetType) { res, _ = o.GetCommandTemplateNameOk() return @@ -352,22 +432,26 @@ func (o *CommandDetails) GetCommandTemplateName() (res CommandDetailsGetCommandT // GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetCommandTemplateNameOk() (ret CommandDetailsGetCommandTemplateNameRetType, ok bool) { return getCommandDetailsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName) } // HasCommandTemplateName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasCommandTemplateName() bool { _, ok := o.GetCommandTemplateNameOk() return ok } // SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetCommandTemplateName(v CommandDetailsGetCommandTemplateNameRetType) { setCommandDetailsGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v) } // GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetCommandTemplateTitle() (res CommandDetailsGetCommandTemplateTitleRetType) { res, _ = o.GetCommandTemplateTitleOk() return @@ -375,22 +459,26 @@ func (o *CommandDetails) GetCommandTemplateTitle() (res CommandDetailsGetCommand // GetCommandTemplateTitleOk returns a tuple with the CommandTemplateTitle field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetCommandTemplateTitleOk() (ret CommandDetailsGetCommandTemplateTitleRetType, ok bool) { return getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle) } // HasCommandTemplateTitle returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasCommandTemplateTitle() bool { _, ok := o.GetCommandTemplateTitleOk() return ok } // SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetCommandTemplateTitle(v CommandDetailsGetCommandTemplateTitleRetType) { setCommandDetailsGetCommandTemplateTitleAttributeType(&o.CommandTemplateTitle, v) } // GetExitCode returns the ExitCode field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetExitCode() (res CommandDetailsGetExitCodeRetType) { res, _ = o.GetExitCodeOk() return @@ -398,22 +486,26 @@ func (o *CommandDetails) GetExitCode() (res CommandDetailsGetExitCodeRetType) { // GetExitCodeOk returns a tuple with the ExitCode field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetExitCodeOk() (ret CommandDetailsGetExitCodeRetType, ok bool) { return getCommandDetailsGetExitCodeAttributeTypeOk(o.ExitCode) } // HasExitCode returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasExitCode() bool { _, ok := o.GetExitCodeOk() return ok } // SetExitCode gets a reference to the given int64 and assigns it to the ExitCode field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetExitCode(v CommandDetailsGetExitCodeRetType) { setCommandDetailsGetExitCodeAttributeType(&o.ExitCode, v) } // GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetFinishedAt() (res CommandDetailsGetFinishedAtRetType) { res, _ = o.GetFinishedAtOk() return @@ -421,22 +513,26 @@ func (o *CommandDetails) GetFinishedAt() (res CommandDetailsGetFinishedAtRetType // GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetFinishedAtOk() (ret CommandDetailsGetFinishedAtRetType, ok bool) { return getCommandDetailsGetFinishedAtAttributeTypeOk(o.FinishedAt) } // HasFinishedAt returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasFinishedAt() bool { _, ok := o.GetFinishedAtOk() return ok } // SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetFinishedAt(v CommandDetailsGetFinishedAtRetType) { setCommandDetailsGetFinishedAtAttributeType(&o.FinishedAt, v) } // GetId returns the Id field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetId() (res CommandDetailsGetIdRetType) { res, _ = o.GetIdOk() return @@ -444,22 +540,26 @@ func (o *CommandDetails) GetId() (res CommandDetailsGetIdRetType) { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetIdOk() (ret CommandDetailsGetIdRetType, ok bool) { return getCommandDetailsGetIdAttributeTypeOk(o.Id) } // HasId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasId() bool { _, ok := o.GetIdOk() return ok } // SetId gets a reference to the given int64 and assigns it to the Id field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetId(v CommandDetailsGetIdRetType) { setCommandDetailsGetIdAttributeType(&o.Id, v) } // GetOutput returns the Output field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetOutput() (res CommandDetailsGetOutputRetType) { res, _ = o.GetOutputOk() return @@ -467,22 +567,26 @@ func (o *CommandDetails) GetOutput() (res CommandDetailsGetOutputRetType) { // GetOutputOk returns a tuple with the Output field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetOutputOk() (ret CommandDetailsGetOutputRetType, ok bool) { return getCommandDetailsGetOutputAttributeTypeOk(o.Output) } // HasOutput returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasOutput() bool { _, ok := o.GetOutputOk() return ok } // SetOutput gets a reference to the given string and assigns it to the Output field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetOutput(v CommandDetailsGetOutputRetType) { setCommandDetailsGetOutputAttributeType(&o.Output, v) } // GetScript returns the Script field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetScript() (res CommandDetailsGetScriptRetType) { res, _ = o.GetScriptOk() return @@ -490,22 +594,26 @@ func (o *CommandDetails) GetScript() (res CommandDetailsGetScriptRetType) { // GetScriptOk returns a tuple with the Script field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetScriptOk() (ret CommandDetailsGetScriptRetType, ok bool) { return getCommandDetailsGetScriptAttributeTypeOk(o.Script) } // HasScript returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasScript() bool { _, ok := o.GetScriptOk() return ok } // SetScript gets a reference to the given string and assigns it to the Script field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetScript(v CommandDetailsGetScriptRetType) { setCommandDetailsGetScriptAttributeType(&o.Script, v) } // GetStartedAt returns the StartedAt field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetStartedAt() (res CommandDetailsGetStartedAtRetType) { res, _ = o.GetStartedAtOk() return @@ -513,22 +621,26 @@ func (o *CommandDetails) GetStartedAt() (res CommandDetailsGetStartedAtRetType) // GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetStartedAtOk() (ret CommandDetailsGetStartedAtRetType, ok bool) { return getCommandDetailsGetStartedAtAttributeTypeOk(o.StartedAt) } // HasStartedAt returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasStartedAt() bool { _, ok := o.GetStartedAtOk() return ok } // SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetStartedAt(v CommandDetailsGetStartedAtRetType) { setCommandDetailsGetStartedAtAttributeType(&o.StartedAt, v) } // GetStatus returns the Status field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetStatus() (res CommandDetailsGetStatusRetType) { res, _ = o.GetStatusOk() return @@ -536,21 +648,25 @@ func (o *CommandDetails) GetStatus() (res CommandDetailsGetStatusRetType) { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) GetStatusOk() (ret CommandDetailsGetStatusRetType, ok bool) { return getCommandDetailsGetStatusAttributeTypeOk(o.Status) } // HasStatus returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) HasStatus() bool { _, ok := o.GetStatusOk() return ok } // SetStatus gets a reference to the given string and assigns it to the Status field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandDetails) SetStatus(v CommandDetailsGetStatusRetType) { setCommandDetailsGetStatusAttributeType(&o.Status, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CommandDetails) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCommandDetailsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok { @@ -583,37 +699,45 @@ func (o CommandDetails) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommandDetails struct { value *CommandDetails isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandDetails) Get() *CommandDetails { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandDetails) Set(val *CommandDetails) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandDetails) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandDetails) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommandDetails(val *CommandDetails) *NullableCommandDetails { return &NullableCommandDetails{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandDetails) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandDetails) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_command_template.go b/services/runcommand/model_command_template.go index 7a134e74f..7fad11af4 100644 --- a/services/runcommand/model_command_template.go +++ b/services/runcommand/model_command_template.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &CommandTemplate{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateGetNameAttributeTypeOk(arg CommandTemplateGetNameAttributeType) (ret CommandTemplateGetNameRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getCommandTemplateGetNameAttributeTypeOk(arg CommandTemplateGetNameAttribut return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateGetNameAttributeType(arg *CommandTemplateGetNameAttributeType, val CommandTemplateGetNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetNameRetType = string /* @@ -43,10 +50,16 @@ type CommandTemplateGetNameRetType = string */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetOsTypeAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetOsTypeArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetOsTypeRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateGetOsTypeAttributeTypeOk(arg CommandTemplateGetOsTypeAttributeType) (ret CommandTemplateGetOsTypeRetType, ok bool) { if arg == nil { return ret, false @@ -54,6 +67,7 @@ func getCommandTemplateGetOsTypeAttributeTypeOk(arg CommandTemplateGetOsTypeAttr return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateGetOsTypeAttributeType(arg *CommandTemplateGetOsTypeAttributeType, val CommandTemplateGetOsTypeRetType) { *arg = &val } @@ -63,8 +77,10 @@ func setCommandTemplateGetOsTypeAttributeType(arg *CommandTemplateGetOsTypeAttri */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetTitleAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateGetTitleAttributeTypeOk(arg CommandTemplateGetTitleAttributeType) (ret CommandTemplateGetTitleRetType, ok bool) { if arg == nil { return ret, false @@ -72,14 +88,19 @@ func getCommandTemplateGetTitleAttributeTypeOk(arg CommandTemplateGetTitleAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateGetTitleAttributeType(arg *CommandTemplateGetTitleAttributeType, val CommandTemplateGetTitleRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetTitleArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateGetTitleRetType = string // CommandTemplate struct for CommandTemplate +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplate struct { Name CommandTemplateGetNameAttributeType `json:"name,omitempty"` OsType CommandTemplateGetOsTypeAttributeType `json:"osType,omitempty"` @@ -90,6 +111,7 @@ type CommandTemplate struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandTemplate() *CommandTemplate { this := CommandTemplate{} return &this @@ -98,12 +120,14 @@ func NewCommandTemplate() *CommandTemplate { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandTemplateWithDefaults() *CommandTemplate { this := CommandTemplate{} return &this } // GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) GetName() (res CommandTemplateGetNameRetType) { res, _ = o.GetNameOk() return @@ -111,22 +135,26 @@ func (o *CommandTemplate) GetName() (res CommandTemplateGetNameRetType) { // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) GetNameOk() (ret CommandTemplateGetNameRetType, ok bool) { return getCommandTemplateGetNameAttributeTypeOk(o.Name) } // HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) HasName() bool { _, ok := o.GetNameOk() return ok } // SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) SetName(v CommandTemplateGetNameRetType) { setCommandTemplateGetNameAttributeType(&o.Name, v) } // GetOsType returns the OsType field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) GetOsType() (res CommandTemplateGetOsTypeRetType) { res, _ = o.GetOsTypeOk() return @@ -134,22 +162,26 @@ func (o *CommandTemplate) GetOsType() (res CommandTemplateGetOsTypeRetType) { // GetOsTypeOk returns a tuple with the OsType field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) GetOsTypeOk() (ret CommandTemplateGetOsTypeRetType, ok bool) { return getCommandTemplateGetOsTypeAttributeTypeOk(o.OsType) } // HasOsType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) HasOsType() bool { _, ok := o.GetOsTypeOk() return ok } // SetOsType gets a reference to the given []string and assigns it to the OsType field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) SetOsType(v CommandTemplateGetOsTypeRetType) { setCommandTemplateGetOsTypeAttributeType(&o.OsType, v) } // GetTitle returns the Title field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) GetTitle() (res CommandTemplateGetTitleRetType) { res, _ = o.GetTitleOk() return @@ -157,21 +189,25 @@ func (o *CommandTemplate) GetTitle() (res CommandTemplateGetTitleRetType) { // GetTitleOk returns a tuple with the Title field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) GetTitleOk() (ret CommandTemplateGetTitleRetType, ok bool) { return getCommandTemplateGetTitleAttributeTypeOk(o.Title) } // HasTitle returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) HasTitle() bool { _, ok := o.GetTitleOk() return ok } // SetTitle gets a reference to the given string and assigns it to the Title field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplate) SetTitle(v CommandTemplateGetTitleRetType) { setCommandTemplateGetTitleAttributeType(&o.Title, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CommandTemplate) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCommandTemplateGetNameAttributeTypeOk(o.Name); ok { @@ -186,37 +222,45 @@ func (o CommandTemplate) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommandTemplate struct { value *CommandTemplate isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplate) Get() *CommandTemplate { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplate) Set(val *CommandTemplate) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplate) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplate) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommandTemplate(val *CommandTemplate) *NullableCommandTemplate { return &NullableCommandTemplate{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplate) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplate) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_command_template_response.go b/services/runcommand/model_command_template_response.go index 8c4692604..8508488e2 100644 --- a/services/runcommand/model_command_template_response.go +++ b/services/runcommand/model_command_template_response.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &CommandTemplateResponse{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateResponseGetItemsAttributeType = *[]CommandTemplate + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateResponseGetItemsArgType = []CommandTemplate + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateResponseGetItemsRetType = []CommandTemplate +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateResponseGetItemsAttributeTypeOk(arg CommandTemplateResponseGetItemsAttributeType) (ret CommandTemplateResponseGetItemsRetType, ok bool) { if arg == nil { return ret, false @@ -33,11 +40,13 @@ func getCommandTemplateResponseGetItemsAttributeTypeOk(arg CommandTemplateRespon return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateResponseGetItemsAttributeType(arg *CommandTemplateResponseGetItemsAttributeType, val CommandTemplateResponseGetItemsRetType) { *arg = &val } // CommandTemplateResponse struct for CommandTemplateResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateResponse struct { Items CommandTemplateResponseGetItemsAttributeType `json:"items,omitempty"` } @@ -46,6 +55,7 @@ type CommandTemplateResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandTemplateResponse() *CommandTemplateResponse { this := CommandTemplateResponse{} return &this @@ -54,12 +64,14 @@ func NewCommandTemplateResponse() *CommandTemplateResponse { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandTemplateResponseWithDefaults() *CommandTemplateResponse { this := CommandTemplateResponse{} return &this } // GetItems returns the Items field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateResponse) GetItems() (res CommandTemplateResponseGetItemsRetType) { res, _ = o.GetItemsOk() return @@ -67,21 +79,25 @@ func (o *CommandTemplateResponse) GetItems() (res CommandTemplateResponseGetItem // GetItemsOk returns a tuple with the Items field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateResponse) GetItemsOk() (ret CommandTemplateResponseGetItemsRetType, ok bool) { return getCommandTemplateResponseGetItemsAttributeTypeOk(o.Items) } // HasItems returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateResponse) HasItems() bool { _, ok := o.GetItemsOk() return ok } // SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateResponse) SetItems(v CommandTemplateResponseGetItemsRetType) { setCommandTemplateResponseGetItemsAttributeType(&o.Items, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCommandTemplateResponseGetItemsAttributeTypeOk(o.Items); ok { @@ -90,37 +106,45 @@ func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommandTemplateResponse struct { value *CommandTemplateResponse isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplateResponse) Get() *CommandTemplateResponse { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplateResponse) Set(val *CommandTemplateResponse) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplateResponse) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplateResponse) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommandTemplateResponse(val *CommandTemplateResponse) *NullableCommandTemplateResponse { return &NullableCommandTemplateResponse{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplateResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplateResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_command_template_schema.go b/services/runcommand/model_command_template_schema.go index 99308cfe6..80ac0e6ea 100644 --- a/services/runcommand/model_command_template_schema.go +++ b/services/runcommand/model_command_template_schema.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &CommandTemplateSchema{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateSchemaGetDescriptionAttributeTypeOk(arg CommandTemplateSchemaGetDescriptionAttributeType) (ret CommandTemplateSchemaGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getCommandTemplateSchemaGetDescriptionAttributeTypeOk(arg CommandTemplateSc return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateSchemaGetDescriptionAttributeType(arg *CommandTemplateSchemaGetDescriptionAttributeType, val CommandTemplateSchemaGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetDescriptionRetType = string /* @@ -43,8 +50,10 @@ type CommandTemplateSchemaGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateSchemaGetNameAttributeTypeOk(arg CommandTemplateSchemaGetNameAttributeType) (ret CommandTemplateSchemaGetNameRetType, ok bool) { if arg == nil { return ret, false @@ -52,11 +61,15 @@ func getCommandTemplateSchemaGetNameAttributeTypeOk(arg CommandTemplateSchemaGet return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateSchemaGetNameAttributeType(arg *CommandTemplateSchemaGetNameAttributeType, val CommandTemplateSchemaGetNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetNameRetType = string /* @@ -64,10 +77,16 @@ type CommandTemplateSchemaGetNameRetType = string */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetOsTypeAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetOsTypeArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetOsTypeRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateSchemaGetOsTypeAttributeTypeOk(arg CommandTemplateSchemaGetOsTypeAttributeType) (ret CommandTemplateSchemaGetOsTypeRetType, ok bool) { if arg == nil { return ret, false @@ -75,6 +94,7 @@ func getCommandTemplateSchemaGetOsTypeAttributeTypeOk(arg CommandTemplateSchemaG return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateSchemaGetOsTypeAttributeType(arg *CommandTemplateSchemaGetOsTypeAttributeType, val CommandTemplateSchemaGetOsTypeRetType) { *arg = &val } @@ -84,10 +104,16 @@ func setCommandTemplateSchemaGetOsTypeAttributeType(arg *CommandTemplateSchemaGe */ // isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetParametersSchemaAttributeType = *ParametersSchema + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetParametersSchemaArgType = ParametersSchema + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetParametersSchemaRetType = ParametersSchema +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateSchemaGetParametersSchemaAttributeTypeOk(arg CommandTemplateSchemaGetParametersSchemaAttributeType) (ret CommandTemplateSchemaGetParametersSchemaRetType, ok bool) { if arg == nil { return ret, false @@ -95,6 +121,7 @@ func getCommandTemplateSchemaGetParametersSchemaAttributeTypeOk(arg CommandTempl return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateSchemaGetParametersSchemaAttributeType(arg *CommandTemplateSchemaGetParametersSchemaAttributeType, val CommandTemplateSchemaGetParametersSchemaRetType) { *arg = &val } @@ -104,8 +131,10 @@ func setCommandTemplateSchemaGetParametersSchemaAttributeType(arg *CommandTempla */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetTitleAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandTemplateSchemaGetTitleAttributeTypeOk(arg CommandTemplateSchemaGetTitleAttributeType) (ret CommandTemplateSchemaGetTitleRetType, ok bool) { if arg == nil { return ret, false @@ -113,14 +142,19 @@ func getCommandTemplateSchemaGetTitleAttributeTypeOk(arg CommandTemplateSchemaGe return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandTemplateSchemaGetTitleAttributeType(arg *CommandTemplateSchemaGetTitleAttributeType, val CommandTemplateSchemaGetTitleRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetTitleArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchemaGetTitleRetType = string // CommandTemplateSchema struct for CommandTemplateSchema +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandTemplateSchema struct { Description CommandTemplateSchemaGetDescriptionAttributeType `json:"description,omitempty"` Name CommandTemplateSchemaGetNameAttributeType `json:"name,omitempty"` @@ -133,6 +167,7 @@ type CommandTemplateSchema struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandTemplateSchema() *CommandTemplateSchema { this := CommandTemplateSchema{} return &this @@ -141,12 +176,14 @@ func NewCommandTemplateSchema() *CommandTemplateSchema { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandTemplateSchemaWithDefaults() *CommandTemplateSchema { this := CommandTemplateSchema{} return &this } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetDescription() (res CommandTemplateSchemaGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -154,22 +191,26 @@ func (o *CommandTemplateSchema) GetDescription() (res CommandTemplateSchemaGetDe // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetDescriptionOk() (ret CommandTemplateSchemaGetDescriptionRetType, ok bool) { return getCommandTemplateSchemaGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) SetDescription(v CommandTemplateSchemaGetDescriptionRetType) { setCommandTemplateSchemaGetDescriptionAttributeType(&o.Description, v) } // GetName returns the Name field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetName() (res CommandTemplateSchemaGetNameRetType) { res, _ = o.GetNameOk() return @@ -177,22 +218,26 @@ func (o *CommandTemplateSchema) GetName() (res CommandTemplateSchemaGetNameRetTy // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetNameOk() (ret CommandTemplateSchemaGetNameRetType, ok bool) { return getCommandTemplateSchemaGetNameAttributeTypeOk(o.Name) } // HasName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) HasName() bool { _, ok := o.GetNameOk() return ok } // SetName gets a reference to the given string and assigns it to the Name field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) SetName(v CommandTemplateSchemaGetNameRetType) { setCommandTemplateSchemaGetNameAttributeType(&o.Name, v) } // GetOsType returns the OsType field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetOsType() (res CommandTemplateSchemaGetOsTypeRetType) { res, _ = o.GetOsTypeOk() return @@ -200,22 +245,26 @@ func (o *CommandTemplateSchema) GetOsType() (res CommandTemplateSchemaGetOsTypeR // GetOsTypeOk returns a tuple with the OsType field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetOsTypeOk() (ret CommandTemplateSchemaGetOsTypeRetType, ok bool) { return getCommandTemplateSchemaGetOsTypeAttributeTypeOk(o.OsType) } // HasOsType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) HasOsType() bool { _, ok := o.GetOsTypeOk() return ok } // SetOsType gets a reference to the given []string and assigns it to the OsType field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) SetOsType(v CommandTemplateSchemaGetOsTypeRetType) { setCommandTemplateSchemaGetOsTypeAttributeType(&o.OsType, v) } // GetParametersSchema returns the ParametersSchema field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetParametersSchema() (res CommandTemplateSchemaGetParametersSchemaRetType) { res, _ = o.GetParametersSchemaOk() return @@ -223,22 +272,26 @@ func (o *CommandTemplateSchema) GetParametersSchema() (res CommandTemplateSchema // GetParametersSchemaOk returns a tuple with the ParametersSchema field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetParametersSchemaOk() (ret CommandTemplateSchemaGetParametersSchemaRetType, ok bool) { return getCommandTemplateSchemaGetParametersSchemaAttributeTypeOk(o.ParametersSchema) } // HasParametersSchema returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) HasParametersSchema() bool { _, ok := o.GetParametersSchemaOk() return ok } // SetParametersSchema gets a reference to the given ParametersSchema and assigns it to the ParametersSchema field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) SetParametersSchema(v CommandTemplateSchemaGetParametersSchemaRetType) { setCommandTemplateSchemaGetParametersSchemaAttributeType(&o.ParametersSchema, v) } // GetTitle returns the Title field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetTitle() (res CommandTemplateSchemaGetTitleRetType) { res, _ = o.GetTitleOk() return @@ -246,21 +299,25 @@ func (o *CommandTemplateSchema) GetTitle() (res CommandTemplateSchemaGetTitleRet // GetTitleOk returns a tuple with the Title field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) GetTitleOk() (ret CommandTemplateSchemaGetTitleRetType, ok bool) { return getCommandTemplateSchemaGetTitleAttributeTypeOk(o.Title) } // HasTitle returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) HasTitle() bool { _, ok := o.GetTitleOk() return ok } // SetTitle gets a reference to the given string and assigns it to the Title field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CommandTemplateSchema) SetTitle(v CommandTemplateSchemaGetTitleRetType) { setCommandTemplateSchemaGetTitleAttributeType(&o.Title, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCommandTemplateSchemaGetDescriptionAttributeTypeOk(o.Description); ok { @@ -281,37 +338,45 @@ func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommandTemplateSchema struct { value *CommandTemplateSchema isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplateSchema) Get() *CommandTemplateSchema { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplateSchema) Set(val *CommandTemplateSchema) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplateSchema) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplateSchema) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommandTemplateSchema(val *CommandTemplateSchema) *NullableCommandTemplateSchema { return &NullableCommandTemplateSchema{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandTemplateSchema) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandTemplateSchema) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_commands.go b/services/runcommand/model_commands.go index 120aff9a1..0f098192e 100644 --- a/services/runcommand/model_commands.go +++ b/services/runcommand/model_commands.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -23,8 +24,10 @@ var _ MappedNullable = &Commands{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetCommandTemplateNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandsGetCommandTemplateNameAttributeTypeOk(arg CommandsGetCommandTemplateNameAttributeType) (ret CommandsGetCommandTemplateNameRetType, ok bool) { if arg == nil { return ret, false @@ -32,11 +35,15 @@ func getCommandsGetCommandTemplateNameAttributeTypeOk(arg CommandsGetCommandTemp return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandsGetCommandTemplateNameAttributeType(arg *CommandsGetCommandTemplateNameAttributeType, val CommandsGetCommandTemplateNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetCommandTemplateNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetCommandTemplateNameRetType = string /* @@ -44,8 +51,10 @@ type CommandsGetCommandTemplateNameRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetCommandTemplateTitleAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandsGetCommandTemplateTitleAttributeTypeOk(arg CommandsGetCommandTemplateTitleAttributeType) (ret CommandsGetCommandTemplateTitleRetType, ok bool) { if arg == nil { return ret, false @@ -53,11 +62,15 @@ func getCommandsGetCommandTemplateTitleAttributeTypeOk(arg CommandsGetCommandTem return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandsGetCommandTemplateTitleAttributeType(arg *CommandsGetCommandTemplateTitleAttributeType, val CommandsGetCommandTemplateTitleRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetCommandTemplateTitleArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetCommandTemplateTitleRetType = string /* @@ -65,8 +78,10 @@ type CommandsGetCommandTemplateTitleRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetFinishedAtAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandsGetFinishedAtAttributeTypeOk(arg CommandsGetFinishedAtAttributeType) (ret CommandsGetFinishedAtRetType, ok bool) { if arg == nil { return ret, false @@ -74,11 +89,15 @@ func getCommandsGetFinishedAtAttributeTypeOk(arg CommandsGetFinishedAtAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandsGetFinishedAtAttributeType(arg *CommandsGetFinishedAtAttributeType, val CommandsGetFinishedAtRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetFinishedAtArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetFinishedAtRetType = string /* @@ -86,10 +105,16 @@ type CommandsGetFinishedAtRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetIdAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetIdArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetIdRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandsGetIdAttributeTypeOk(arg CommandsGetIdAttributeType) (ret CommandsGetIdRetType, ok bool) { if arg == nil { return ret, false @@ -97,6 +122,7 @@ func getCommandsGetIdAttributeTypeOk(arg CommandsGetIdAttributeType) (ret Comman return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandsGetIdAttributeType(arg *CommandsGetIdAttributeType, val CommandsGetIdRetType) { *arg = &val } @@ -106,8 +132,10 @@ func setCommandsGetIdAttributeType(arg *CommandsGetIdAttributeType, val Commands */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetStartedAtAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandsGetStartedAtAttributeTypeOk(arg CommandsGetStartedAtAttributeType) (ret CommandsGetStartedAtRetType, ok bool) { if arg == nil { return ret, false @@ -115,11 +143,15 @@ func getCommandsGetStartedAtAttributeTypeOk(arg CommandsGetStartedAtAttributeTyp return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandsGetStartedAtAttributeType(arg *CommandsGetStartedAtAttributeType, val CommandsGetStartedAtRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetStartedAtArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetStartedAtRetType = string /* @@ -130,17 +162,23 @@ type CommandsGetStartedAtRetType = string // CommandsStatus the model 'Commands' // value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsStatus string // List of Status const ( - COMMANDSSTATUS_PENDING CommandsStatus = "pending" - COMMANDSSTATUS_RUNNING CommandsStatus = "running" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + COMMANDSSTATUS_PENDING CommandsStatus = "pending" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + COMMANDSSTATUS_RUNNING CommandsStatus = "running" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead COMMANDSSTATUS_COMPLETED CommandsStatus = "completed" - COMMANDSSTATUS_FAILED CommandsStatus = "failed" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + COMMANDSSTATUS_FAILED CommandsStatus = "failed" ) // All allowed values of Commands enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead var AllowedCommandsStatusEnumValues = []CommandsStatus{ "pending", "running", @@ -148,6 +186,7 @@ var AllowedCommandsStatusEnumValues = []CommandsStatus{ "failed", } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead 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 @@ -175,6 +214,7 @@ func (v *CommandsStatus) UnmarshalJSON(src []byte) error { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandsStatusFromValue(v CommandsStatus) (*CommandsStatus, error) { ev := CommandsStatus(v) if ev.IsValid() { @@ -185,6 +225,7 @@ func NewCommandsStatusFromValue(v CommandsStatus) (*CommandsStatus, error) { } // IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v CommandsStatus) IsValid() bool { for _, existing := range AllowedCommandsStatusEnumValues { if existing == v { @@ -195,50 +236,65 @@ func (v CommandsStatus) IsValid() bool { } // Ptr returns reference to StatusStatus value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v CommandsStatus) Ptr() *CommandsStatus { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommandsStatus struct { value *CommandsStatus isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandsStatus) Get() *CommandsStatus { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandsStatus) Set(val *CommandsStatus) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandsStatus) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandsStatus) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommandsStatus(val *CommandsStatus) *NullableCommandsStatus { return &NullableCommandsStatus{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommandsStatus) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommandsStatus) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetStatusAttributeType = *CommandsStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetStatusArgType = CommandsStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CommandsGetStatusRetType = CommandsStatus +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCommandsGetStatusAttributeTypeOk(arg CommandsGetStatusAttributeType) (ret CommandsGetStatusRetType, ok bool) { if arg == nil { return ret, false @@ -246,11 +302,13 @@ func getCommandsGetStatusAttributeTypeOk(arg CommandsGetStatusAttributeType) (re return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCommandsGetStatusAttributeType(arg *CommandsGetStatusAttributeType, val CommandsGetStatusRetType) { *arg = &val } // Commands struct for Commands +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type Commands struct { CommandTemplateName CommandsGetCommandTemplateNameAttributeType `json:"commandTemplateName,omitempty"` CommandTemplateTitle CommandsGetCommandTemplateTitleAttributeType `json:"commandTemplateTitle,omitempty"` @@ -265,6 +323,7 @@ type Commands struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommands() *Commands { this := Commands{} return &this @@ -273,12 +332,14 @@ func NewCommands() *Commands { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCommandsWithDefaults() *Commands { this := Commands{} return &this } // GetCommandTemplateName returns the CommandTemplateName field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetCommandTemplateName() (res CommandsGetCommandTemplateNameRetType) { res, _ = o.GetCommandTemplateNameOk() return @@ -286,22 +347,26 @@ func (o *Commands) GetCommandTemplateName() (res CommandsGetCommandTemplateNameR // GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetCommandTemplateNameOk() (ret CommandsGetCommandTemplateNameRetType, ok bool) { return getCommandsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName) } // HasCommandTemplateName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) HasCommandTemplateName() bool { _, ok := o.GetCommandTemplateNameOk() return ok } // SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) SetCommandTemplateName(v CommandsGetCommandTemplateNameRetType) { setCommandsGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v) } // GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetCommandTemplateTitle() (res CommandsGetCommandTemplateTitleRetType) { res, _ = o.GetCommandTemplateTitleOk() return @@ -309,22 +374,26 @@ func (o *Commands) GetCommandTemplateTitle() (res CommandsGetCommandTemplateTitl // GetCommandTemplateTitleOk returns a tuple with the CommandTemplateTitle field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetCommandTemplateTitleOk() (ret CommandsGetCommandTemplateTitleRetType, ok bool) { return getCommandsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle) } // HasCommandTemplateTitle returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) HasCommandTemplateTitle() bool { _, ok := o.GetCommandTemplateTitleOk() return ok } // SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) SetCommandTemplateTitle(v CommandsGetCommandTemplateTitleRetType) { setCommandsGetCommandTemplateTitleAttributeType(&o.CommandTemplateTitle, v) } // GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetFinishedAt() (res CommandsGetFinishedAtRetType) { res, _ = o.GetFinishedAtOk() return @@ -332,22 +401,26 @@ func (o *Commands) GetFinishedAt() (res CommandsGetFinishedAtRetType) { // GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetFinishedAtOk() (ret CommandsGetFinishedAtRetType, ok bool) { return getCommandsGetFinishedAtAttributeTypeOk(o.FinishedAt) } // HasFinishedAt returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) HasFinishedAt() bool { _, ok := o.GetFinishedAtOk() return ok } // SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) SetFinishedAt(v CommandsGetFinishedAtRetType) { setCommandsGetFinishedAtAttributeType(&o.FinishedAt, v) } // GetId returns the Id field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetId() (res CommandsGetIdRetType) { res, _ = o.GetIdOk() return @@ -355,22 +428,26 @@ func (o *Commands) GetId() (res CommandsGetIdRetType) { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetIdOk() (ret CommandsGetIdRetType, ok bool) { return getCommandsGetIdAttributeTypeOk(o.Id) } // HasId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) HasId() bool { _, ok := o.GetIdOk() return ok } // SetId gets a reference to the given int64 and assigns it to the Id field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) SetId(v CommandsGetIdRetType) { setCommandsGetIdAttributeType(&o.Id, v) } // GetStartedAt returns the StartedAt field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetStartedAt() (res CommandsGetStartedAtRetType) { res, _ = o.GetStartedAtOk() return @@ -378,22 +455,26 @@ func (o *Commands) GetStartedAt() (res CommandsGetStartedAtRetType) { // GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetStartedAtOk() (ret CommandsGetStartedAtRetType, ok bool) { return getCommandsGetStartedAtAttributeTypeOk(o.StartedAt) } // HasStartedAt returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) HasStartedAt() bool { _, ok := o.GetStartedAtOk() return ok } // SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) SetStartedAt(v CommandsGetStartedAtRetType) { setCommandsGetStartedAtAttributeType(&o.StartedAt, v) } // GetStatus returns the Status field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetStatus() (res CommandsGetStatusRetType) { res, _ = o.GetStatusOk() return @@ -401,21 +482,25 @@ func (o *Commands) GetStatus() (res CommandsGetStatusRetType) { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) GetStatusOk() (ret CommandsGetStatusRetType, ok bool) { return getCommandsGetStatusAttributeTypeOk(o.Status) } // HasStatus returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) HasStatus() bool { _, ok := o.GetStatusOk() return ok } // SetStatus gets a reference to the given string and assigns it to the Status field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Commands) SetStatus(v CommandsGetStatusRetType) { setCommandsGetStatusAttributeType(&o.Status, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o Commands) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCommandsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok { @@ -439,37 +524,45 @@ func (o Commands) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCommands struct { value *Commands isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommands) Get() *Commands { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommands) Set(val *Commands) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommands) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommands) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCommands(val *Commands) *NullableCommands { return &NullableCommands{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCommands) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCommands) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_create_command_payload.go b/services/runcommand/model_create_command_payload.go index 1e209be83..902bd872c 100644 --- a/services/runcommand/model_create_command_payload.go +++ b/services/runcommand/model_create_command_payload.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &CreateCommandPayload{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayloadGetCommandTemplateNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(arg CreateCommandPayloadGetCommandTemplateNameAttributeType) (ret CreateCommandPayloadGetCommandTemplateNameRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(arg CreateComm return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCommandPayloadGetCommandTemplateNameAttributeType(arg *CreateCommandPayloadGetCommandTemplateNameAttributeType, val CreateCommandPayloadGetCommandTemplateNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayloadGetCommandTemplateNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayloadGetCommandTemplateNameRetType = string /* @@ -43,10 +50,16 @@ type CreateCommandPayloadGetCommandTemplateNameRetType = string */ // isContainer +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayloadGetParametersAttributeType = *map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayloadGetParametersArgType = map[string]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayloadGetParametersRetType = map[string]string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateCommandPayloadGetParametersAttributeTypeOk(arg CreateCommandPayloadGetParametersAttributeType) (ret CreateCommandPayloadGetParametersRetType, ok bool) { if arg == nil { return ret, false @@ -54,23 +67,27 @@ func getCreateCommandPayloadGetParametersAttributeTypeOk(arg CreateCommandPayloa return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateCommandPayloadGetParametersAttributeType(arg *CreateCommandPayloadGetParametersAttributeType, val CreateCommandPayloadGetParametersRetType) { *arg = &val } // CreateCommandPayload struct for CreateCommandPayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateCommandPayload struct { // REQUIRED CommandTemplateName CreateCommandPayloadGetCommandTemplateNameAttributeType `json:"commandTemplateName" required:"true"` Parameters CreateCommandPayloadGetParametersAttributeType `json:"parameters,omitempty"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateCommandPayload(commandTemplateName CreateCommandPayloadGetCommandTemplateNameArgType) *CreateCommandPayload { this := CreateCommandPayload{} setCreateCommandPayloadGetCommandTemplateNameAttributeType(&this.CommandTemplateName, commandTemplateName) @@ -80,12 +97,14 @@ func NewCreateCommandPayload(commandTemplateName CreateCommandPayloadGetCommandT // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateCommandPayloadWithDefaults() *CreateCommandPayload { this := CreateCommandPayload{} return &this } // GetCommandTemplateName returns the CommandTemplateName field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCommandPayload) GetCommandTemplateName() (ret CreateCommandPayloadGetCommandTemplateNameRetType) { ret, _ = o.GetCommandTemplateNameOk() return ret @@ -93,16 +112,19 @@ func (o *CreateCommandPayload) GetCommandTemplateName() (ret CreateCommandPayloa // GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCommandPayload) GetCommandTemplateNameOk() (ret CreateCommandPayloadGetCommandTemplateNameRetType, ok bool) { return getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName) } // SetCommandTemplateName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCommandPayload) SetCommandTemplateName(v CreateCommandPayloadGetCommandTemplateNameRetType) { setCreateCommandPayloadGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v) } // GetParameters returns the Parameters field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCommandPayload) GetParameters() (res CreateCommandPayloadGetParametersRetType) { res, _ = o.GetParametersOk() return @@ -110,21 +132,25 @@ func (o *CreateCommandPayload) GetParameters() (res CreateCommandPayloadGetParam // GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCommandPayload) GetParametersOk() (ret CreateCommandPayloadGetParametersRetType, ok bool) { return getCreateCommandPayloadGetParametersAttributeTypeOk(o.Parameters) } // HasParameters returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *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. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateCommandPayload) SetParameters(v CreateCommandPayloadGetParametersRetType) { setCreateCommandPayloadGetParametersAttributeType(&o.Parameters, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok { @@ -136,37 +162,45 @@ func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCreateCommandPayload struct { value *CreateCommandPayload isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateCommandPayload) Get() *CreateCommandPayload { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateCommandPayload) Set(val *CreateCommandPayload) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateCommandPayload) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateCommandPayload) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCreateCommandPayload(val *CreateCommandPayload) *NullableCreateCommandPayload { return &NullableCreateCommandPayload{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateCommandPayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateCommandPayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_error_response.go b/services/runcommand/model_error_response.go index 2cc342b19..5e6255e4e 100644 --- a/services/runcommand/model_error_response.go +++ b/services/runcommand/model_error_response.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &ErrorResponse{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponseGetMessageAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getErrorResponseGetMessageAttributeTypeOk(arg ErrorResponseGetMessageAttributeType) (ret ErrorResponseGetMessageRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getErrorResponseGetMessageAttributeTypeOk(arg ErrorResponseGetMessageAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setErrorResponseGetMessageAttributeType(arg *ErrorResponseGetMessageAttributeType, val ErrorResponseGetMessageRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponseGetMessageArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponseGetMessageRetType = string /* @@ -43,8 +50,10 @@ type ErrorResponseGetMessageRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponseGetStatusAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getErrorResponseGetStatusAttributeTypeOk(arg ErrorResponseGetStatusAttributeType) (ret ErrorResponseGetStatusRetType, ok bool) { if arg == nil { return ret, false @@ -52,14 +61,19 @@ func getErrorResponseGetStatusAttributeTypeOk(arg ErrorResponseGetStatusAttribut return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setErrorResponseGetStatusAttributeType(arg *ErrorResponseGetStatusAttributeType, val ErrorResponseGetStatusRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponseGetStatusArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponseGetStatusRetType = string // ErrorResponse struct for ErrorResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ErrorResponse struct { // Details about the error // REQUIRED @@ -69,12 +83,14 @@ type ErrorResponse struct { Status ErrorResponseGetStatusAttributeType `json:"status" required:"true"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewErrorResponse(message ErrorResponseGetMessageArgType, status ErrorResponseGetStatusArgType) *ErrorResponse { this := ErrorResponse{} setErrorResponseGetMessageAttributeType(&this.Message, message) @@ -85,12 +101,14 @@ func NewErrorResponse(message ErrorResponseGetMessageArgType, status ErrorRespon // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewErrorResponseWithDefaults() *ErrorResponse { this := ErrorResponse{} return &this } // GetMessage returns the Message field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ErrorResponse) GetMessage() (ret ErrorResponseGetMessageRetType) { ret, _ = o.GetMessageOk() return ret @@ -98,16 +116,19 @@ func (o *ErrorResponse) GetMessage() (ret ErrorResponseGetMessageRetType) { // GetMessageOk returns a tuple with the Message field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ErrorResponse) GetMessageOk() (ret ErrorResponseGetMessageRetType, ok bool) { return getErrorResponseGetMessageAttributeTypeOk(o.Message) } // SetMessage sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ErrorResponse) SetMessage(v ErrorResponseGetMessageRetType) { setErrorResponseGetMessageAttributeType(&o.Message, v) } // GetStatus returns the Status field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ErrorResponse) GetStatus() (ret ErrorResponseGetStatusRetType) { ret, _ = o.GetStatusOk() return ret @@ -115,15 +136,18 @@ func (o *ErrorResponse) GetStatus() (ret ErrorResponseGetStatusRetType) { // GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ErrorResponse) GetStatusOk() (ret ErrorResponseGetStatusRetType, ok bool) { return getErrorResponseGetStatusAttributeTypeOk(o.Status) } // SetStatus sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ErrorResponse) SetStatus(v ErrorResponseGetStatusRetType) { setErrorResponseGetStatusAttributeType(&o.Status, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o ErrorResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getErrorResponseGetMessageAttributeTypeOk(o.Message); ok { @@ -135,37 +159,45 @@ func (o ErrorResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableErrorResponse struct { value *ErrorResponse isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableErrorResponse) Get() *ErrorResponse { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableErrorResponse) Set(val *ErrorResponse) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableErrorResponse) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableErrorResponse) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { return &NullableErrorResponse{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_field.go b/services/runcommand/model_field.go index f00bcb096..ce8a411d9 100644 --- a/services/runcommand/model_field.go +++ b/services/runcommand/model_field.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &Field{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetDefaultAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldGetDefaultAttributeTypeOk(arg FieldGetDefaultAttributeType) (ret FieldGetDefaultRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getFieldGetDefaultAttributeTypeOk(arg FieldGetDefaultAttributeType) (ret Fi return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldGetDefaultAttributeType(arg *FieldGetDefaultAttributeType, val FieldGetDefaultRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetDefaultArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetDefaultRetType = string /* @@ -43,8 +50,10 @@ type FieldGetDefaultRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldGetDescriptionAttributeTypeOk(arg FieldGetDescriptionAttributeType) (ret FieldGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -52,11 +61,15 @@ func getFieldGetDescriptionAttributeTypeOk(arg FieldGetDescriptionAttributeType) return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldGetDescriptionAttributeType(arg *FieldGetDescriptionAttributeType, val FieldGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetDescriptionRetType = string /* @@ -64,10 +77,16 @@ type FieldGetDescriptionRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetMaxLenAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetMaxLenArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetMaxLenRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldGetMaxLenAttributeTypeOk(arg FieldGetMaxLenAttributeType) (ret FieldGetMaxLenRetType, ok bool) { if arg == nil { return ret, false @@ -75,6 +94,7 @@ func getFieldGetMaxLenAttributeTypeOk(arg FieldGetMaxLenAttributeType) (ret Fiel return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldGetMaxLenAttributeType(arg *FieldGetMaxLenAttributeType, val FieldGetMaxLenRetType) { *arg = &val } @@ -84,10 +104,16 @@ func setFieldGetMaxLenAttributeType(arg *FieldGetMaxLenAttributeType, val FieldG */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetMinLenAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetMinLenArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetMinLenRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldGetMinLenAttributeTypeOk(arg FieldGetMinLenAttributeType) (ret FieldGetMinLenRetType, ok bool) { if arg == nil { return ret, false @@ -95,6 +121,7 @@ func getFieldGetMinLenAttributeTypeOk(arg FieldGetMinLenAttributeType) (ret Fiel return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldGetMinLenAttributeType(arg *FieldGetMinLenAttributeType, val FieldGetMinLenRetType) { *arg = &val } @@ -104,10 +131,16 @@ func setFieldGetMinLenAttributeType(arg *FieldGetMinLenAttributeType, val FieldG */ // isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldgetReadOnlyAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldgetReadOnlyArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldgetReadOnlyRetType = bool +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldgetReadOnlyAttributeTypeOk(arg FieldgetReadOnlyAttributeType) (ret FieldgetReadOnlyRetType, ok bool) { if arg == nil { return ret, false @@ -115,6 +148,7 @@ func getFieldgetReadOnlyAttributeTypeOk(arg FieldgetReadOnlyAttributeType) (ret return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldgetReadOnlyAttributeType(arg *FieldgetReadOnlyAttributeType, val FieldgetReadOnlyRetType) { *arg = &val } @@ -124,8 +158,10 @@ func setFieldgetReadOnlyAttributeType(arg *FieldgetReadOnlyAttributeType, val Fi */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetTitleAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldGetTitleAttributeTypeOk(arg FieldGetTitleAttributeType) (ret FieldGetTitleRetType, ok bool) { if arg == nil { return ret, false @@ -133,11 +169,15 @@ func getFieldGetTitleAttributeTypeOk(arg FieldGetTitleAttributeType) (ret FieldG return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldGetTitleAttributeType(arg *FieldGetTitleAttributeType, val FieldGetTitleRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetTitleArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetTitleRetType = string /* @@ -145,8 +185,10 @@ type FieldGetTitleRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetTypeAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getFieldGetTypeAttributeTypeOk(arg FieldGetTypeAttributeType) (ret FieldGetTypeRetType, ok bool) { if arg == nil { return ret, false @@ -154,14 +196,19 @@ func getFieldGetTypeAttributeTypeOk(arg FieldGetTypeAttributeType) (ret FieldGet return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setFieldGetTypeAttributeType(arg *FieldGetTypeAttributeType, val FieldGetTypeRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type FieldGetTypeRetType = string // Field struct for Field +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type Field struct { Default FieldGetDefaultAttributeType `json:"default,omitempty"` Description FieldGetDescriptionAttributeType `json:"description,omitempty"` @@ -178,6 +225,7 @@ type Field struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewField() *Field { this := Field{} return &this @@ -186,12 +234,14 @@ func NewField() *Field { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewFieldWithDefaults() *Field { this := Field{} return &this } // GetDefault returns the Default field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetDefault() (res FieldGetDefaultRetType) { res, _ = o.GetDefaultOk() return @@ -199,22 +249,26 @@ func (o *Field) GetDefault() (res FieldGetDefaultRetType) { // GetDefaultOk returns a tuple with the Default field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetDefaultOk() (ret FieldGetDefaultRetType, ok bool) { return getFieldGetDefaultAttributeTypeOk(o.Default) } // HasDefault returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasDefault() bool { _, ok := o.GetDefaultOk() return ok } // SetDefault gets a reference to the given string and assigns it to the Default field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetDefault(v FieldGetDefaultRetType) { setFieldGetDefaultAttributeType(&o.Default, v) } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetDescription() (res FieldGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -222,22 +276,26 @@ func (o *Field) GetDescription() (res FieldGetDescriptionRetType) { // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetDescriptionOk() (ret FieldGetDescriptionRetType, ok bool) { return getFieldGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetDescription(v FieldGetDescriptionRetType) { setFieldGetDescriptionAttributeType(&o.Description, v) } // GetMaxLen returns the MaxLen field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetMaxLen() (res FieldGetMaxLenRetType) { res, _ = o.GetMaxLenOk() return @@ -245,22 +303,26 @@ func (o *Field) GetMaxLen() (res FieldGetMaxLenRetType) { // GetMaxLenOk returns a tuple with the MaxLen field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetMaxLenOk() (ret FieldGetMaxLenRetType, ok bool) { return getFieldGetMaxLenAttributeTypeOk(o.MaxLen) } // HasMaxLen returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasMaxLen() bool { _, ok := o.GetMaxLenOk() return ok } // SetMaxLen gets a reference to the given int64 and assigns it to the MaxLen field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetMaxLen(v FieldGetMaxLenRetType) { setFieldGetMaxLenAttributeType(&o.MaxLen, v) } // GetMinLen returns the MinLen field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetMinLen() (res FieldGetMinLenRetType) { res, _ = o.GetMinLenOk() return @@ -268,22 +330,26 @@ func (o *Field) GetMinLen() (res FieldGetMinLenRetType) { // GetMinLenOk returns a tuple with the MinLen field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetMinLenOk() (ret FieldGetMinLenRetType, ok bool) { return getFieldGetMinLenAttributeTypeOk(o.MinLen) } // HasMinLen returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasMinLen() bool { _, ok := o.GetMinLenOk() return ok } // SetMinLen gets a reference to the given int64 and assigns it to the MinLen field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetMinLen(v FieldGetMinLenRetType) { setFieldGetMinLenAttributeType(&o.MinLen, v) } // GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetReadOnly() (res FieldgetReadOnlyRetType) { res, _ = o.GetReadOnlyOk() return @@ -291,22 +357,26 @@ func (o *Field) GetReadOnly() (res FieldgetReadOnlyRetType) { // GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetReadOnlyOk() (ret FieldgetReadOnlyRetType, ok bool) { return getFieldgetReadOnlyAttributeTypeOk(o.ReadOnly) } // HasReadOnly returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasReadOnly() bool { _, ok := o.GetReadOnlyOk() return ok } // SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetReadOnly(v FieldgetReadOnlyRetType) { setFieldgetReadOnlyAttributeType(&o.ReadOnly, v) } // GetTitle returns the Title field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetTitle() (res FieldGetTitleRetType) { res, _ = o.GetTitleOk() return @@ -314,22 +384,26 @@ func (o *Field) GetTitle() (res FieldGetTitleRetType) { // GetTitleOk returns a tuple with the Title field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetTitleOk() (ret FieldGetTitleRetType, ok bool) { return getFieldGetTitleAttributeTypeOk(o.Title) } // HasTitle returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasTitle() bool { _, ok := o.GetTitleOk() return ok } // SetTitle gets a reference to the given string and assigns it to the Title field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetTitle(v FieldGetTitleRetType) { setFieldGetTitleAttributeType(&o.Title, v) } // GetType returns the Type field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetType() (res FieldGetTypeRetType) { res, _ = o.GetTypeOk() return @@ -337,21 +411,25 @@ func (o *Field) GetType() (res FieldGetTypeRetType) { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) GetTypeOk() (ret FieldGetTypeRetType, ok bool) { return getFieldGetTypeAttributeTypeOk(o.Type) } // HasType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) HasType() bool { _, ok := o.GetTypeOk() return ok } // SetType gets a reference to the given string and assigns it to the Type field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Field) SetType(v FieldGetTypeRetType) { setFieldGetTypeAttributeType(&o.Type, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o Field) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getFieldGetDefaultAttributeTypeOk(o.Default); ok { @@ -378,37 +456,45 @@ func (o Field) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableField struct { value *Field isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableField) Get() *Field { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableField) Set(val *Field) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableField) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableField) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableField(val *Field) *NullableField { return &NullableField{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableField) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableField) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_get_commands_response.go b/services/runcommand/model_get_commands_response.go index 77d5ccb8a..60a7dbb66 100644 --- a/services/runcommand/model_get_commands_response.go +++ b/services/runcommand/model_get_commands_response.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &GetCommandsResponse{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCommandsResponseGetItemsAttributeType = *[]Commands + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCommandsResponseGetItemsArgType = []Commands + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCommandsResponseGetItemsRetType = []Commands +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getGetCommandsResponseGetItemsAttributeTypeOk(arg GetCommandsResponseGetItemsAttributeType) (ret GetCommandsResponseGetItemsRetType, ok bool) { if arg == nil { return ret, false @@ -33,11 +40,13 @@ func getGetCommandsResponseGetItemsAttributeTypeOk(arg GetCommandsResponseGetIte return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setGetCommandsResponseGetItemsAttributeType(arg *GetCommandsResponseGetItemsAttributeType, val GetCommandsResponseGetItemsRetType) { *arg = &val } // GetCommandsResponse struct for GetCommandsResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetCommandsResponse struct { Items GetCommandsResponseGetItemsAttributeType `json:"items,omitempty"` } @@ -46,6 +55,7 @@ type GetCommandsResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewGetCommandsResponse() *GetCommandsResponse { this := GetCommandsResponse{} return &this @@ -54,12 +64,14 @@ func NewGetCommandsResponse() *GetCommandsResponse { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewGetCommandsResponseWithDefaults() *GetCommandsResponse { this := GetCommandsResponse{} return &this } // GetItems returns the Items field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCommandsResponse) GetItems() (res GetCommandsResponseGetItemsRetType) { res, _ = o.GetItemsOk() return @@ -67,21 +79,25 @@ func (o *GetCommandsResponse) GetItems() (res GetCommandsResponseGetItemsRetType // GetItemsOk returns a tuple with the Items field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCommandsResponse) GetItemsOk() (ret GetCommandsResponseGetItemsRetType, ok bool) { return getGetCommandsResponseGetItemsAttributeTypeOk(o.Items) } // HasItems returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCommandsResponse) HasItems() bool { _, ok := o.GetItemsOk() return ok } // SetItems gets a reference to the given []Commands and assigns it to the Items field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *GetCommandsResponse) SetItems(v GetCommandsResponseGetItemsRetType) { setGetCommandsResponseGetItemsAttributeType(&o.Items, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getGetCommandsResponseGetItemsAttributeTypeOk(o.Items); ok { @@ -90,37 +106,45 @@ func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableGetCommandsResponse struct { value *GetCommandsResponse isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGetCommandsResponse) Get() *GetCommandsResponse { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGetCommandsResponse) Set(val *GetCommandsResponse) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGetCommandsResponse) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGetCommandsResponse) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableGetCommandsResponse(val *GetCommandsResponse) *NullableGetCommandsResponse { return &NullableGetCommandsResponse{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableGetCommandsResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableGetCommandsResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_new_command_response.go b/services/runcommand/model_new_command_response.go index 6ac4958bd..0d8ef5c87 100644 --- a/services/runcommand/model_new_command_response.go +++ b/services/runcommand/model_new_command_response.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &NewCommandResponse{} */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NewCommandResponseGetIdAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NewCommandResponseGetIdArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NewCommandResponseGetIdRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getNewCommandResponseGetIdAttributeTypeOk(arg NewCommandResponseGetIdAttributeType) (ret NewCommandResponseGetIdRetType, ok bool) { if arg == nil { return ret, false @@ -33,11 +40,13 @@ func getNewCommandResponseGetIdAttributeTypeOk(arg NewCommandResponseGetIdAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setNewCommandResponseGetIdAttributeType(arg *NewCommandResponseGetIdAttributeType, val NewCommandResponseGetIdRetType) { *arg = &val } // NewCommandResponse struct for NewCommandResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NewCommandResponse struct { // Can be cast to int32 without loss of precision. Id NewCommandResponseGetIdAttributeType `json:"id,omitempty"` @@ -47,6 +56,7 @@ type NewCommandResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNewCommandResponse() *NewCommandResponse { this := NewCommandResponse{} return &this @@ -55,12 +65,14 @@ func NewNewCommandResponse() *NewCommandResponse { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNewCommandResponseWithDefaults() *NewCommandResponse { this := NewCommandResponse{} return &this } // GetId returns the Id field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *NewCommandResponse) GetId() (res NewCommandResponseGetIdRetType) { res, _ = o.GetIdOk() return @@ -68,21 +80,25 @@ func (o *NewCommandResponse) GetId() (res NewCommandResponseGetIdRetType) { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *NewCommandResponse) GetIdOk() (ret NewCommandResponseGetIdRetType, ok bool) { return getNewCommandResponseGetIdAttributeTypeOk(o.Id) } // HasId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *NewCommandResponse) HasId() bool { _, ok := o.GetIdOk() return ok } // SetId gets a reference to the given int64 and assigns it to the Id field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *NewCommandResponse) SetId(v NewCommandResponseGetIdRetType) { setNewCommandResponseGetIdAttributeType(&o.Id, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getNewCommandResponseGetIdAttributeTypeOk(o.Id); ok { @@ -91,37 +107,45 @@ func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableNewCommandResponse struct { value *NewCommandResponse isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableNewCommandResponse) Get() *NewCommandResponse { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableNewCommandResponse) Set(val *NewCommandResponse) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableNewCommandResponse) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableNewCommandResponse) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableNewCommandResponse(val *NewCommandResponse) *NullableNewCommandResponse { return &NullableNewCommandResponse{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableNewCommandResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableNewCommandResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_parameters_schema.go b/services/runcommand/model_parameters_schema.go index 4709b939e..88277e847 100644 --- a/services/runcommand/model_parameters_schema.go +++ b/services/runcommand/model_parameters_schema.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &ParametersSchema{} */ // isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ParametersSchemaGetPropertiesAttributeType = *Properties + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ParametersSchemaGetPropertiesArgType = Properties + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ParametersSchemaGetPropertiesRetType = Properties +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getParametersSchemaGetPropertiesAttributeTypeOk(arg ParametersSchemaGetPropertiesAttributeType) (ret ParametersSchemaGetPropertiesRetType, ok bool) { if arg == nil { return ret, false @@ -33,11 +40,13 @@ func getParametersSchemaGetPropertiesAttributeTypeOk(arg ParametersSchemaGetProp return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setParametersSchemaGetPropertiesAttributeType(arg *ParametersSchemaGetPropertiesAttributeType, val ParametersSchemaGetPropertiesRetType) { *arg = &val } // ParametersSchema struct for ParametersSchema +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ParametersSchema struct { Properties ParametersSchemaGetPropertiesAttributeType `json:"properties,omitempty"` } @@ -46,6 +55,7 @@ type ParametersSchema struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewParametersSchema() *ParametersSchema { this := ParametersSchema{} return &this @@ -54,12 +64,14 @@ func NewParametersSchema() *ParametersSchema { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewParametersSchemaWithDefaults() *ParametersSchema { this := ParametersSchema{} return &this } // GetProperties returns the Properties field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ParametersSchema) GetProperties() (res ParametersSchemaGetPropertiesRetType) { res, _ = o.GetPropertiesOk() return @@ -67,21 +79,25 @@ func (o *ParametersSchema) GetProperties() (res ParametersSchemaGetPropertiesRet // GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ParametersSchema) GetPropertiesOk() (ret ParametersSchemaGetPropertiesRetType, ok bool) { return getParametersSchemaGetPropertiesAttributeTypeOk(o.Properties) } // HasProperties returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ParametersSchema) HasProperties() bool { _, ok := o.GetPropertiesOk() return ok } // SetProperties gets a reference to the given Properties and assigns it to the Properties field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *ParametersSchema) SetProperties(v ParametersSchemaGetPropertiesRetType) { setParametersSchemaGetPropertiesAttributeType(&o.Properties, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o ParametersSchema) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getParametersSchemaGetPropertiesAttributeTypeOk(o.Properties); ok { @@ -90,37 +106,45 @@ func (o ParametersSchema) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableParametersSchema struct { value *ParametersSchema isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableParametersSchema) Get() *ParametersSchema { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableParametersSchema) Set(val *ParametersSchema) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableParametersSchema) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableParametersSchema) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableParametersSchema(val *ParametersSchema) *NullableParametersSchema { return &NullableParametersSchema{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableParametersSchema) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableParametersSchema) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/model_properties.go b/services/runcommand/model_properties.go index c31e0375e..1aee0dcda 100644 --- a/services/runcommand/model_properties.go +++ b/services/runcommand/model_properties.go @@ -8,6 +8,7 @@ API version: 2.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package runcommand import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &Properties{} */ // isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetConfirmPasswordAttributeType = *Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetConfirmPasswordArgType = Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetConfirmPasswordRetType = Field +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getPropertiesGetConfirmPasswordAttributeTypeOk(arg PropertiesGetConfirmPasswordAttributeType) (ret PropertiesGetConfirmPasswordRetType, ok bool) { if arg == nil { return ret, false @@ -33,6 +40,7 @@ func getPropertiesGetConfirmPasswordAttributeTypeOk(arg PropertiesGetConfirmPass return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setPropertiesGetConfirmPasswordAttributeType(arg *PropertiesGetConfirmPasswordAttributeType, val PropertiesGetConfirmPasswordRetType) { *arg = &val } @@ -42,10 +50,16 @@ func setPropertiesGetConfirmPasswordAttributeType(arg *PropertiesGetConfirmPassw */ // isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetPasswordAttributeType = *Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetPasswordArgType = Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetPasswordRetType = Field +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getPropertiesGetPasswordAttributeTypeOk(arg PropertiesGetPasswordAttributeType) (ret PropertiesGetPasswordRetType, ok bool) { if arg == nil { return ret, false @@ -53,6 +67,7 @@ func getPropertiesGetPasswordAttributeTypeOk(arg PropertiesGetPasswordAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setPropertiesGetPasswordAttributeType(arg *PropertiesGetPasswordAttributeType, val PropertiesGetPasswordRetType) { *arg = &val } @@ -62,10 +77,16 @@ func setPropertiesGetPasswordAttributeType(arg *PropertiesGetPasswordAttributeTy */ // isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetScriptAttributeType = *Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetScriptArgType = Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetScriptRetType = Field +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getPropertiesGetScriptAttributeTypeOk(arg PropertiesGetScriptAttributeType) (ret PropertiesGetScriptRetType, ok bool) { if arg == nil { return ret, false @@ -73,6 +94,7 @@ func getPropertiesGetScriptAttributeTypeOk(arg PropertiesGetScriptAttributeType) return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setPropertiesGetScriptAttributeType(arg *PropertiesGetScriptAttributeType, val PropertiesGetScriptRetType) { *arg = &val } @@ -82,10 +104,16 @@ func setPropertiesGetScriptAttributeType(arg *PropertiesGetScriptAttributeType, */ // isModel +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetUsernameAttributeType = *Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetUsernameArgType = Field + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetUsernameRetType = Field +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getPropertiesGetUsernameAttributeTypeOk(arg PropertiesGetUsernameAttributeType) (ret PropertiesGetUsernameRetType, ok bool) { if arg == nil { return ret, false @@ -93,6 +121,7 @@ func getPropertiesGetUsernameAttributeTypeOk(arg PropertiesGetUsernameAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setPropertiesGetUsernameAttributeType(arg *PropertiesGetUsernameAttributeType, val PropertiesGetUsernameRetType) { *arg = &val } @@ -102,10 +131,16 @@ func setPropertiesGetUsernameAttributeType(arg *PropertiesGetUsernameAttributeTy */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetRequiredAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetRequiredArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetRequiredRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getPropertiesGetRequiredAttributeTypeOk(arg PropertiesGetRequiredAttributeType) (ret PropertiesGetRequiredRetType, ok bool) { if arg == nil { return ret, false @@ -113,6 +148,7 @@ func getPropertiesGetRequiredAttributeTypeOk(arg PropertiesGetRequiredAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setPropertiesGetRequiredAttributeType(arg *PropertiesGetRequiredAttributeType, val PropertiesGetRequiredRetType) { *arg = &val } @@ -122,8 +158,10 @@ func setPropertiesGetRequiredAttributeType(arg *PropertiesGetRequiredAttributeTy */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetTypeAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getPropertiesGetTypeAttributeTypeOk(arg PropertiesGetTypeAttributeType) (ret PropertiesGetTypeRetType, ok bool) { if arg == nil { return ret, false @@ -131,14 +169,19 @@ func getPropertiesGetTypeAttributeTypeOk(arg PropertiesGetTypeAttributeType) (re return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setPropertiesGetTypeAttributeType(arg *PropertiesGetTypeAttributeType, val PropertiesGetTypeRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type PropertiesGetTypeRetType = string // Properties struct for Properties +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type Properties struct { ConfirmPassword PropertiesGetConfirmPasswordAttributeType `json:"ConfirmPassword,omitempty"` Password PropertiesGetPasswordAttributeType `json:"Password,omitempty"` @@ -152,6 +195,7 @@ type Properties struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewProperties() *Properties { this := Properties{} return &this @@ -160,12 +204,14 @@ func NewProperties() *Properties { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewPropertiesWithDefaults() *Properties { this := Properties{} return &this } // GetConfirmPassword returns the ConfirmPassword field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetConfirmPassword() (res PropertiesGetConfirmPasswordRetType) { res, _ = o.GetConfirmPasswordOk() return @@ -173,22 +219,26 @@ func (o *Properties) GetConfirmPassword() (res PropertiesGetConfirmPasswordRetTy // GetConfirmPasswordOk returns a tuple with the ConfirmPassword field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetConfirmPasswordOk() (ret PropertiesGetConfirmPasswordRetType, ok bool) { return getPropertiesGetConfirmPasswordAttributeTypeOk(o.ConfirmPassword) } // HasConfirmPassword returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) HasConfirmPassword() bool { _, ok := o.GetConfirmPasswordOk() return ok } // SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) SetConfirmPassword(v PropertiesGetConfirmPasswordRetType) { setPropertiesGetConfirmPasswordAttributeType(&o.ConfirmPassword, v) } // GetPassword returns the Password field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetPassword() (res PropertiesGetPasswordRetType) { res, _ = o.GetPasswordOk() return @@ -196,22 +246,26 @@ func (o *Properties) GetPassword() (res PropertiesGetPasswordRetType) { // GetPasswordOk returns a tuple with the Password field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetPasswordOk() (ret PropertiesGetPasswordRetType, ok bool) { return getPropertiesGetPasswordAttributeTypeOk(o.Password) } // HasPassword returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) HasPassword() bool { _, ok := o.GetPasswordOk() return ok } // SetPassword gets a reference to the given Field and assigns it to the Password field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) SetPassword(v PropertiesGetPasswordRetType) { setPropertiesGetPasswordAttributeType(&o.Password, v) } // GetScript returns the Script field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetScript() (res PropertiesGetScriptRetType) { res, _ = o.GetScriptOk() return @@ -219,22 +273,26 @@ func (o *Properties) GetScript() (res PropertiesGetScriptRetType) { // GetScriptOk returns a tuple with the Script field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetScriptOk() (ret PropertiesGetScriptRetType, ok bool) { return getPropertiesGetScriptAttributeTypeOk(o.Script) } // HasScript returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) HasScript() bool { _, ok := o.GetScriptOk() return ok } // SetScript gets a reference to the given Field and assigns it to the Script field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) SetScript(v PropertiesGetScriptRetType) { setPropertiesGetScriptAttributeType(&o.Script, v) } // GetUsername returns the Username field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetUsername() (res PropertiesGetUsernameRetType) { res, _ = o.GetUsernameOk() return @@ -242,22 +300,26 @@ func (o *Properties) GetUsername() (res PropertiesGetUsernameRetType) { // GetUsernameOk returns a tuple with the Username field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetUsernameOk() (ret PropertiesGetUsernameRetType, ok bool) { return getPropertiesGetUsernameAttributeTypeOk(o.Username) } // HasUsername returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) HasUsername() bool { _, ok := o.GetUsernameOk() return ok } // SetUsername gets a reference to the given Field and assigns it to the Username field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) SetUsername(v PropertiesGetUsernameRetType) { setPropertiesGetUsernameAttributeType(&o.Username, v) } // GetRequired returns the Required field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetRequired() (res PropertiesGetRequiredRetType) { res, _ = o.GetRequiredOk() return @@ -265,22 +327,26 @@ func (o *Properties) GetRequired() (res PropertiesGetRequiredRetType) { // GetRequiredOk returns a tuple with the Required field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetRequiredOk() (ret PropertiesGetRequiredRetType, ok bool) { return getPropertiesGetRequiredAttributeTypeOk(o.Required) } // HasRequired returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) HasRequired() bool { _, ok := o.GetRequiredOk() return ok } // SetRequired gets a reference to the given []string and assigns it to the Required field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) SetRequired(v PropertiesGetRequiredRetType) { setPropertiesGetRequiredAttributeType(&o.Required, v) } // GetType returns the Type field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetType() (res PropertiesGetTypeRetType) { res, _ = o.GetTypeOk() return @@ -288,21 +354,25 @@ func (o *Properties) GetType() (res PropertiesGetTypeRetType) { // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) GetTypeOk() (ret PropertiesGetTypeRetType, ok bool) { return getPropertiesGetTypeAttributeTypeOk(o.Type) } // HasType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) HasType() bool { _, ok := o.GetTypeOk() return ok } // SetType gets a reference to the given string and assigns it to the Type field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *Properties) SetType(v PropertiesGetTypeRetType) { setPropertiesGetTypeAttributeType(&o.Type, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o Properties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getPropertiesGetConfirmPasswordAttributeTypeOk(o.ConfirmPassword); ok { @@ -326,37 +396,45 @@ func (o Properties) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableProperties struct { value *Properties isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableProperties) Get() *Properties { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableProperties) Set(val *Properties) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableProperties) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableProperties) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableProperties(val *Properties) *NullableProperties { return &NullableProperties{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableProperties) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableProperties) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/runcommand/oas_commit b/services/runcommand/oas_commit index 064e1081f..853627d06 100644 --- a/services/runcommand/oas_commit +++ b/services/runcommand/oas_commit @@ -1 +1 @@ -cfcfc32bc1ae335acecd7bf7ffb60354fdc565ab +335aa32af4d6c0d2a036b8567773da2f051f7efb diff --git a/services/runcommand/utils.go b/services/runcommand/utils.go index aa45f6c15..427d247ad 100644 --- a/services/runcommand/utils.go +++ b/services/runcommand/utils.go @@ -18,341 +18,419 @@ import ( ) // PtrBool is a helper routine that returns a pointer to given boolean value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrBool(v bool) *bool { return &v } // PtrInt is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt(v int) *int { return &v } // PtrInt32 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt32(v int32) *int32 { return &v } // PtrInt64 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt64(v int64) *int64 { return &v } // PtrFloat32 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrFloat32(v float32) *float32 { return &v } // PtrFloat64 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrFloat64(v float64) *float64 { return &v } // PtrString is a helper routine that returns a pointer to given string value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrString(v string) *string { return &v } // PtrTime is helper routine that returns a pointer to given Time value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrTime(v time.Time) *time.Time { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableValue[T any] struct { value *T isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableValue[T]) Get() *T { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableValue[T]) Set(val *T) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableValue[T]) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableValue[T]) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableBool struct { value *bool isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) Get() *bool { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) Set(val *bool) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableBool(val *bool) *NullableBool { return &NullableBool{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt struct { value *int isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) Get() *int { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) Set(val *int) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt(val *int) *NullableInt { return &NullableInt{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt32 struct { value *int32 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) Get() *int32 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) Set(val *int32) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt32(val *int32) *NullableInt32 { return &NullableInt32{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt64 struct { value *int64 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) Get() *int64 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) Set(val *int64) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt64(val *int64) *NullableInt64 { return &NullableInt64{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableFloat32 struct { value *float32 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) Get() *float32 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) Set(val *float32) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableFloat32(val *float32) *NullableFloat32 { return &NullableFloat32{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableFloat64 struct { value *float64 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) Get() *float64 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) Set(val *float64) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableFloat64(val *float64) *NullableFloat64 { return &NullableFloat64{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableString struct { value *string isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) Get() *string { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) Set(val *string) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableString(val *string) *NullableString { return &NullableString{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableTime struct { value *time.Time isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) Get() *time.Time { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) Set(val *time.Time) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableTime(val *time.Time) *NullableTime { return &NullableTime{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) MarshalJSON() ([]byte, error) { return v.value.MarshalJSON() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } // IsNil checks if an input is nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func IsNil(i interface{}) bool { if i == nil { return true @@ -369,13 +447,16 @@ func IsNil(i interface{}) bool { return false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type MappedNullable interface { ToMap() (map[string]interface{}, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // randString returns a random string with a specified length. It panics if n <= 0. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func randString(n int) string { b := make([]byte, n) for i := range b { diff --git a/services/runcommand/v1api/api_default.go b/services/runcommand/v1api/api_default.go new file mode 100644 index 000000000..5352a98de --- /dev/null +++ b/services/runcommand/v1api/api_default.go @@ -0,0 +1,886 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + 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 + @return ApiCreateCommandRequest + */ + CreateCommand(ctx context.Context, projectId string, serverId string) ApiCreateCommandRequest + + // CreateCommandExecute executes the request + // @return NewCommandResponse + CreateCommandExecute(r ApiCreateCommandRequest) (*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 serverId Server ID of the machine + @param commandId ID of the command + @return ApiGetCommandRequest + */ + GetCommand(ctx context.Context, projectId string, serverId string, commandId string) ApiGetCommandRequest + + // GetCommandExecute executes the request + // @return CommandDetails + GetCommandExecute(r ApiGetCommandRequest) (*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 + @return ApiGetCommandTemplateRequest + */ + GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string) ApiGetCommandTemplateRequest + + // GetCommandTemplateExecute executes the request + // @return CommandTemplateSchema + GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*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 + // @return CommandTemplateResponse + ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*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 + @return ApiListCommandsRequest + */ + ListCommands(ctx context.Context, projectId string, serverId string) ApiListCommandsRequest + + // ListCommandsExecute executes the request + // @return GetCommandsResponse + ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + createCommandPayload *CreateCommandPayload +} + +// Command to post +func (r ApiCreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest { + r.createCommandPayload = &createCommandPayload + return r +} + +func (r ApiCreateCommandRequest) Execute() (*NewCommandResponse, error) { + return r.ApiService.CreateCommandExecute(r) +} + +/* +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 + @return ApiCreateCommandRequest +*/ +func (a *DefaultAPIService) CreateCommand(ctx context.Context, projectId string, serverId string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// Execute executes the request +// +// @return NewCommandResponse +func (a *DefaultAPIService) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NewCommandResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/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) + + 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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + commandId string +} + +func (r ApiGetCommandRequest) Execute() (*CommandDetails, error) { + return r.ApiService.GetCommandExecute(r) +} + +/* +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 serverId Server ID of the machine + @param commandId ID of the command + @return ApiGetCommandRequest +*/ +func (a *DefaultAPIService) GetCommand(ctx context.Context, projectId string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandId: commandId, + } +} + +// Execute executes the request +// +// @return CommandDetails +func (a *DefaultAPIService) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandDetails + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/servers/{serverId}/commands/{commandId}" + 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, "{"+"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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandTemplateRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + commandTemplateName string +} + +func (r ApiGetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { + return r.ApiService.GetCommandTemplateExecute(r) +} + +/* +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 + @return ApiGetCommandTemplateRequest +*/ +func (a *DefaultAPIService) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + } +} + +// Execute executes the request +// +// @return CommandTemplateSchema +func (a *DefaultAPIService) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateSchema + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCommandTemplate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/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) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandTemplatesRequest struct { + ctx context.Context + ApiService DefaultAPI + osType *string +} + +// The type of the Operating System (windows or linux). If not provided will return data for all OS types. +func (r ApiListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest { + r.osType = &osType + return r +} + +func (r ApiListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) { + return r.ApiService.ListCommandTemplatesExecute(r) +} + +/* +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 *DefaultAPIService) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CommandTemplateResponse +func (a *DefaultAPIService) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCommandTemplates") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/command-templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.osType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "osType", r.osType, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string +} + +func (r ApiListCommandsRequest) Execute() (*GetCommandsResponse, error) { + return r.ApiService.ListCommandsExecute(r) +} + +/* +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 + @return ApiListCommandsRequest +*/ +func (a *DefaultAPIService) ListCommands(ctx context.Context, projectId string, serverId string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// Execute executes the request +// +// @return GetCommandsResponse +func (a *DefaultAPIService) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCommandsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCommands") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/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) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/runcommand/v1api/api_default_mock.go b/services/runcommand/v1api/api_default_mock.go new file mode 100644 index 000000000..23110e130 --- /dev/null +++ b/services/runcommand/v1api/api_default_mock.go @@ -0,0 +1,129 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateCommandExecuteMock can be populated to implement the behavior of the CreateCommandExecute function of this mock + CreateCommandExecuteMock *func(r ApiCreateCommandRequest) (*NewCommandResponse, error) + // GetCommandExecuteMock can be populated to implement the behavior of the GetCommandExecute function of this mock + GetCommandExecuteMock *func(r ApiGetCommandRequest) (*CommandDetails, error) + // GetCommandTemplateExecuteMock can be populated to implement the behavior of the GetCommandTemplateExecute function of this mock + GetCommandTemplateExecuteMock *func(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) + // ListCommandTemplatesExecuteMock can be populated to implement the behavior of the ListCommandTemplatesExecute function of this mock + ListCommandTemplatesExecuteMock *func(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) + // ListCommandsExecuteMock can be populated to implement the behavior of the ListCommandsExecute function of this mock + ListCommandsExecuteMock *func(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +func (a DefaultAPIServiceMock) CreateCommand(ctx context.Context, projectId string, serverId string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// CreateCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + if a.CreateCommandExecuteMock == nil { + var localVarReturnValue *NewCommandResponse + return localVarReturnValue, nil + } + + return (*a.CreateCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommand(ctx context.Context, projectId string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandId: commandId, + } +} + +// GetCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + if a.GetCommandExecuteMock == nil { + var localVarReturnValue *CommandDetails + return localVarReturnValue, nil + } + + return (*a.GetCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + } +} + +// GetCommandTemplateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandTemplateExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + if a.GetCommandTemplateExecuteMock == nil { + var localVarReturnValue *CommandTemplateSchema + return localVarReturnValue, nil + } + + return (*a.GetCommandTemplateExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// ListCommandTemplatesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandTemplatesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + if a.ListCommandTemplatesExecuteMock == nil { + var localVarReturnValue *CommandTemplateResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandTemplatesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommands(ctx context.Context, projectId string, serverId string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// ListCommandsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + if a.ListCommandsExecuteMock == nil { + var localVarReturnValue *GetCommandsResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandsExecuteMock)(r) +} diff --git a/services/runcommand/v1api/client.go b/services/runcommand/v1api/client.go new file mode 100644 index 000000000..8eaf3dce6 --- /dev/null +++ b/services/runcommand/v1api/client.go @@ -0,0 +1,659 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Run Commands Service API API v1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/runcommand/v1api/configuration.go b/services/runcommand/v1api/configuration.go new file mode 100644 index 000000000..ff62dd8a7 --- /dev/null +++ b/services/runcommand/v1api/configuration.go @@ -0,0 +1,41 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +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/runcommand", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://run-command.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/runcommand/v1api/model_command_details.go b/services/runcommand/v1api/model_command_details.go new file mode 100644 index 000000000..77591c3f2 --- /dev/null +++ b/services/runcommand/v1api/model_command_details.go @@ -0,0 +1,413 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CommandDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandDetails{} + +// CommandDetails struct for CommandDetails +type CommandDetails struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + ExitCode *int32 `json:"exitCode,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + Output *string `json:"output,omitempty"` + Script *string `json:"script,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *CommandDetails) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *CommandDetails) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *CommandDetails) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetExitCode returns the ExitCode field value if set, zero value otherwise. +func (o *CommandDetails) GetExitCode() int32 { + if o == nil || IsNil(o.ExitCode) { + var ret int32 + return ret + } + return *o.ExitCode +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.ExitCode) { + return nil, false + } + return o.ExitCode, true +} + +// HasExitCode returns a boolean if a field has been set. +func (o *CommandDetails) HasExitCode() bool { + if o != nil && !IsNil(o.ExitCode) { + return true + } + + return false +} + +// SetExitCode gets a reference to the given int32 and assigns it to the ExitCode field. +func (o *CommandDetails) SetExitCode(v int32) { + o.ExitCode = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *CommandDetails) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CommandDetails) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CommandDetails) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *CommandDetails) SetId(v int32) { + o.Id = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *CommandDetails) GetOutput() string { + if o == nil || IsNil(o.Output) { + var ret string + return ret + } + return *o.Output +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *CommandDetails) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *CommandDetails) SetOutput(v string) { + o.Output = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *CommandDetails) GetScript() string { + if o == nil || IsNil(o.Script) { + var ret string + return ret + } + return *o.Script +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *CommandDetails) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given string and assigns it to the Script field. +func (o *CommandDetails) SetScript(v string) { + o.Script = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *CommandDetails) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CommandDetails) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CommandDetails) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CommandDetails) SetStatus(v string) { + o.Status = &v +} + +func (o CommandDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.ExitCode) { + toSerialize["exitCode"] = o.ExitCode + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.Script) { + toSerialize["script"] = o.Script + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v1api/model_command_template.go b/services/runcommand/v1api/model_command_template.go new file mode 100644 index 000000000..dd65874b4 --- /dev/null +++ b/services/runcommand/v1api/model_command_template.go @@ -0,0 +1,197 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CommandTemplate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplate{} + +// CommandTemplate struct for CommandTemplate +type CommandTemplate struct { + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplate) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplate) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplate) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplate) SetOsType(v []string) { + o.OsType = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplate) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplate) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplate) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v1api/model_command_template_response.go b/services/runcommand/v1api/model_command_template_response.go new file mode 100644 index 000000000..11f08a172 --- /dev/null +++ b/services/runcommand/v1api/model_command_template_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CommandTemplateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateResponse{} + +// CommandTemplateResponse struct for CommandTemplateResponse +type CommandTemplateResponse struct { + Items []CommandTemplate `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() []CommandTemplate { + if o == nil || IsNil(o.Items) { + var ret []CommandTemplate + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateResponse) GetItemsOk() ([]CommandTemplate, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *CommandTemplateResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field. +func (o *CommandTemplateResponse) SetItems(v []CommandTemplate) { + o.Items = v +} + +func (o CommandTemplateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v1api/model_command_template_schema.go b/services/runcommand/v1api/model_command_template_schema.go new file mode 100644 index 000000000..2f4ca1948 --- /dev/null +++ b/services/runcommand/v1api/model_command_template_schema.go @@ -0,0 +1,269 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the CommandTemplateSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateSchema{} + +// CommandTemplateSchema struct for CommandTemplateSchema +type CommandTemplateSchema struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + ParameterSchema *ParametersSchema `json:"parameterSchema,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CommandTemplateSchema) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplateSchema) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplateSchema) SetOsType(v []string) { + o.OsType = v +} + +// GetParameterSchema returns the ParameterSchema field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetParameterSchema() ParametersSchema { + if o == nil || IsNil(o.ParameterSchema) { + var ret ParametersSchema + return ret + } + return *o.ParameterSchema +} + +// 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() (*ParametersSchema, bool) { + if o == nil || IsNil(o.ParameterSchema) { + return nil, false + } + return o.ParameterSchema, true +} + +// HasParameterSchema returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasParameterSchema() bool { + if o != nil && !IsNil(o.ParameterSchema) { + return true + } + + return false +} + +// SetParameterSchema gets a reference to the given ParametersSchema and assigns it to the ParameterSchema field. +func (o *CommandTemplateSchema) SetParameterSchema(v ParametersSchema) { + o.ParameterSchema = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplateSchema) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplateSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.ParameterSchema) { + toSerialize["parameterSchema"] = o.ParameterSchema + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v1api/model_commands.go b/services/runcommand/v1api/model_commands.go new file mode 100644 index 000000000..8799957ec --- /dev/null +++ b/services/runcommand/v1api/model_commands.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the Commands type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Commands{} + +// Commands struct for Commands +type Commands struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *Commands) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *Commands) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *Commands) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *Commands) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *Commands) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *Commands) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Commands) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Commands) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *Commands) SetId(v int32) { + o.Id = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *Commands) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *Commands) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *Commands) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Commands) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Commands) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Commands) SetStatus(v string) { + o.Status = &v +} + +func (o Commands) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Commands) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v1api/model_create_command_payload.go b/services/runcommand/v1api/model_create_command_payload.go new file mode 100644 index 000000000..c74703c8f --- /dev/null +++ b/services/runcommand/v1api/model_create_command_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateCommandPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCommandPayload{} + +// CreateCommandPayload struct for CreateCommandPayload +type CreateCommandPayload struct { + CommandTemplateName string `json:"commandTemplateName"` + Parameters *map[string]string `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 string) *CreateCommandPayload { + this := CreateCommandPayload{} + 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() string { + if o == nil { + var ret string + return ret + } + + return o.CommandTemplateName +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value +// and a boolean to check if the value has been set. +func (o *CreateCommandPayload) GetCommandTemplateNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CommandTemplateName, true +} + +// SetCommandTemplateName sets field value +func (o *CreateCommandPayload) SetCommandTemplateName(v string) { + o.CommandTemplateName = v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *CreateCommandPayload) GetParameters() map[string]string { + if o == nil || IsNil(o.Parameters) { + var ret map[string]string + return ret + } + return *o.Parameters +} + +// 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() (*map[string]string, bool) { + if o == nil || IsNil(o.Parameters) { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *CreateCommandPayload) HasParameters() bool { + if o != nil && !IsNil(o.Parameters) { + return true + } + + return false +} + +// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field. +func (o *CreateCommandPayload) SetParameters(v map[string]string) { + o.Parameters = &v +} + +func (o CreateCommandPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["commandTemplateName"] = o.CommandTemplateName + if !IsNil(o.Parameters) { + toSerialize["parameters"] = o.Parameters + } + return toSerialize, nil +} + +func (o *CreateCommandPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "commandTemplateName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateCommandPayload := _CreateCommandPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateCommandPayload) + + if err != nil { + return err + } + + *o = CreateCommandPayload(varCreateCommandPayload) + + return err +} + +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) +} diff --git a/services/runcommand/v1api/model_error_response.go b/services/runcommand/v1api/model_error_response.go new file mode 100644 index 000000000..bda1fd49f --- /dev/null +++ b/services/runcommand/v1api/model_error_response.go @@ -0,0 +1,187 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Details about the error + Message string `json:"message"` + // The string representation of the http status code (i.e. Not Found, Bad Request, etc) + Status string `json:"status"` +} + +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 string, status string) *ErrorResponse { + this := ErrorResponse{} + this.Message = message + 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() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v string) { + o.Status = v +} + +func (o ErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *ErrorResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorResponse := _ErrorResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + return err +} + +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) +} diff --git a/services/runcommand/v1api/model_field.go b/services/runcommand/v1api/model_field.go new file mode 100644 index 000000000..b8d3c355e --- /dev/null +++ b/services/runcommand/v1api/model_field.go @@ -0,0 +1,341 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the Field type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Field{} + +// Field struct for Field +type Field struct { + Default *string `json:"default,omitempty"` + Description *string `json:"description,omitempty"` + MaxLen *int32 `json:"maxLen,omitempty"` + MinLen *int32 `json:"minLen,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `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() string { + if o == nil || IsNil(o.Default) { + var ret string + return ret + } + return *o.Default +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *Field) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given string and assigns it to the Default field. +func (o *Field) SetDefault(v string) { + o.Default = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Field) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Field) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Field) SetDescription(v string) { + o.Description = &v +} + +// GetMaxLen returns the MaxLen field value if set, zero value otherwise. +func (o *Field) GetMaxLen() int32 { + if o == nil || IsNil(o.MaxLen) { + var ret int32 + return ret + } + return *o.MaxLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MaxLen) { + return nil, false + } + return o.MaxLen, true +} + +// HasMaxLen returns a boolean if a field has been set. +func (o *Field) HasMaxLen() bool { + if o != nil && !IsNil(o.MaxLen) { + return true + } + + return false +} + +// SetMaxLen gets a reference to the given int32 and assigns it to the MaxLen field. +func (o *Field) SetMaxLen(v int32) { + o.MaxLen = &v +} + +// GetMinLen returns the MinLen field value if set, zero value otherwise. +func (o *Field) GetMinLen() int32 { + if o == nil || IsNil(o.MinLen) { + var ret int32 + return ret + } + return *o.MinLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MinLen) { + return nil, false + } + return o.MinLen, true +} + +// HasMinLen returns a boolean if a field has been set. +func (o *Field) HasMinLen() bool { + if o != nil && !IsNil(o.MinLen) { + return true + } + + return false +} + +// SetMinLen gets a reference to the given int32 and assigns it to the MinLen field. +func (o *Field) SetMinLen(v int32) { + o.MinLen = &v +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *Field) GetReadOnly() bool { + if o == nil || IsNil(o.ReadOnly) { + var ret bool + return ret + } + return *o.ReadOnly +} + +// 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() (*bool, bool) { + if o == nil || IsNil(o.ReadOnly) { + return nil, false + } + return o.ReadOnly, true +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *Field) HasReadOnly() bool { + if o != nil && !IsNil(o.ReadOnly) { + return true + } + + return false +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *Field) SetReadOnly(v bool) { + o.ReadOnly = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *Field) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *Field) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *Field) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Field) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Field) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Field) SetType(v string) { + o.Type = &v +} + +func (o Field) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Field) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.MaxLen) { + toSerialize["maxLen"] = o.MaxLen + } + if !IsNil(o.MinLen) { + toSerialize["minLen"] = o.MinLen + } + if !IsNil(o.ReadOnly) { + toSerialize["readOnly"] = o.ReadOnly + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v1api/model_get_commands_response.go b/services/runcommand/v1api/model_get_commands_response.go new file mode 100644 index 000000000..ffff2bd26 --- /dev/null +++ b/services/runcommand/v1api/model_get_commands_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the GetCommandsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCommandsResponse{} + +// GetCommandsResponse struct for GetCommandsResponse +type GetCommandsResponse struct { + Items []Commands `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() []Commands { + if o == nil || IsNil(o.Items) { + var ret []Commands + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCommandsResponse) GetItemsOk() ([]Commands, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *GetCommandsResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Commands and assigns it to the Items field. +func (o *GetCommandsResponse) SetItems(v []Commands) { + o.Items = v +} + +func (o GetCommandsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v1api/model_new_command_response.go b/services/runcommand/v1api/model_new_command_response.go new file mode 100644 index 000000000..3e2107d4f --- /dev/null +++ b/services/runcommand/v1api/model_new_command_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the NewCommandResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewCommandResponse{} + +// NewCommandResponse struct for NewCommandResponse +type NewCommandResponse struct { + Id *int32 `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() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NewCommandResponse) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NewCommandResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *NewCommandResponse) SetId(v int32) { + o.Id = &v +} + +func (o NewCommandResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + 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) +} diff --git a/services/runcommand/v1api/model_parameters_schema.go b/services/runcommand/v1api/model_parameters_schema.go new file mode 100644 index 000000000..3a5fd5c54 --- /dev/null +++ b/services/runcommand/v1api/model_parameters_schema.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the ParametersSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ParametersSchema{} + +// ParametersSchema struct for ParametersSchema +type ParametersSchema struct { + Properties *Properties `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() Properties { + if o == nil || IsNil(o.Properties) { + var ret Properties + return ret + } + return *o.Properties +} + +// 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() (*Properties, bool) { + if o == nil || IsNil(o.Properties) { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *ParametersSchema) HasProperties() bool { + if o != nil && !IsNil(o.Properties) { + return true + } + + return false +} + +// SetProperties gets a reference to the given Properties and assigns it to the Properties field. +func (o *ParametersSchema) SetProperties(v Properties) { + o.Properties = &v +} + +func (o ParametersSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ParametersSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Properties) { + toSerialize["properties"] = o.Properties + } + 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) +} diff --git a/services/runcommand/v1api/model_properties.go b/services/runcommand/v1api/model_properties.go new file mode 100644 index 000000000..e3b084739 --- /dev/null +++ b/services/runcommand/v1api/model_properties.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the Properties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Properties{} + +// Properties struct for Properties +type Properties struct { + ConfirmPassword *Field `json:"ConfirmPassword,omitempty"` + Password *Field `json:"Password,omitempty"` + Script *Field `json:"Script,omitempty"` + Username *Field `json:"Username,omitempty"` + Required []string `json:"required,omitempty"` + Type *string `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() Field { + if o == nil || IsNil(o.ConfirmPassword) { + var ret Field + return ret + } + return *o.ConfirmPassword +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.ConfirmPassword) { + return nil, false + } + return o.ConfirmPassword, true +} + +// HasConfirmPassword returns a boolean if a field has been set. +func (o *Properties) HasConfirmPassword() bool { + if o != nil && !IsNil(o.ConfirmPassword) { + return true + } + + return false +} + +// SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field. +func (o *Properties) SetConfirmPassword(v Field) { + o.ConfirmPassword = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Properties) GetPassword() Field { + if o == nil || IsNil(o.Password) { + var ret Field + return ret + } + return *o.Password +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *Properties) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given Field and assigns it to the Password field. +func (o *Properties) SetPassword(v Field) { + o.Password = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *Properties) GetScript() Field { + if o == nil || IsNil(o.Script) { + var ret Field + return ret + } + return *o.Script +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *Properties) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given Field and assigns it to the Script field. +func (o *Properties) SetScript(v Field) { + o.Script = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Properties) GetUsername() Field { + if o == nil || IsNil(o.Username) { + var ret Field + return ret + } + return *o.Username +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *Properties) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given Field and assigns it to the Username field. +func (o *Properties) SetUsername(v Field) { + o.Username = &v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *Properties) GetRequired() []string { + if o == nil || IsNil(o.Required) { + var ret []string + return ret + } + return o.Required +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.Required) { + return nil, false + } + return o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *Properties) HasRequired() bool { + if o != nil && !IsNil(o.Required) { + return true + } + + return false +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *Properties) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Properties) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Properties) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Properties) SetType(v string) { + o.Type = &v +} + +func (o Properties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Properties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ConfirmPassword) { + toSerialize["ConfirmPassword"] = o.ConfirmPassword + } + if !IsNil(o.Password) { + toSerialize["Password"] = o.Password + } + if !IsNil(o.Script) { + toSerialize["Script"] = o.Script + } + if !IsNil(o.Username) { + toSerialize["Username"] = o.Username + } + if !IsNil(o.Required) { + toSerialize["required"] = o.Required + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v1api/response.go b/services/runcommand/v1api/response.go new file mode 100644 index 000000000..9759a8181 --- /dev/null +++ b/services/runcommand/v1api/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/runcommand/v1api/utils.go b/services/runcommand/v1api/utils.go new file mode 100644 index 000000000..44b3909eb --- /dev/null +++ b/services/runcommand/v1api/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/services/runcommand/v1betaapi/api_default.go b/services/runcommand/v1betaapi/api_default.go new file mode 100644 index 000000000..c4184ca7c --- /dev/null +++ b/services/runcommand/v1betaapi/api_default.go @@ -0,0 +1,886 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1betaapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + 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 + @return ApiCreateCommandRequest + */ + CreateCommand(ctx context.Context, projectId string, serverId string) ApiCreateCommandRequest + + // CreateCommandExecute executes the request + // @return NewCommandResponse + CreateCommandExecute(r ApiCreateCommandRequest) (*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 serverId Server ID of the machine + @param commandId ID of the command + @return ApiGetCommandRequest + */ + GetCommand(ctx context.Context, projectId string, serverId string, commandId string) ApiGetCommandRequest + + // GetCommandExecute executes the request + // @return CommandDetails + GetCommandExecute(r ApiGetCommandRequest) (*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 + @return ApiGetCommandTemplateRequest + */ + GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string) ApiGetCommandTemplateRequest + + // GetCommandTemplateExecute executes the request + // @return CommandTemplateSchema + GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*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 + // @return CommandTemplateResponse + ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*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 + @return ApiListCommandsRequest + */ + ListCommands(ctx context.Context, projectId string, serverId string) ApiListCommandsRequest + + // ListCommandsExecute executes the request + // @return GetCommandsResponse + ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + createCommandPayload *CreateCommandPayload +} + +// Command to post +func (r ApiCreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest { + r.createCommandPayload = &createCommandPayload + return r +} + +func (r ApiCreateCommandRequest) Execute() (*NewCommandResponse, error) { + return r.ApiService.CreateCommandExecute(r) +} + +/* +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 + @return ApiCreateCommandRequest +*/ +func (a *DefaultAPIService) CreateCommand(ctx context.Context, projectId string, serverId string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// Execute executes the request +// +// @return NewCommandResponse +func (a *DefaultAPIService) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NewCommandResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/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) + + 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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + commandId string +} + +func (r ApiGetCommandRequest) Execute() (*CommandDetails, error) { + return r.ApiService.GetCommandExecute(r) +} + +/* +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 serverId Server ID of the machine + @param commandId ID of the command + @return ApiGetCommandRequest +*/ +func (a *DefaultAPIService) GetCommand(ctx context.Context, projectId string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandId: commandId, + } +} + +// Execute executes the request +// +// @return CommandDetails +func (a *DefaultAPIService) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandDetails + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/servers/{serverId}/commands/{commandId}" + 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, "{"+"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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandTemplateRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + commandTemplateName string +} + +func (r ApiGetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { + return r.ApiService.GetCommandTemplateExecute(r) +} + +/* +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 + @return ApiGetCommandTemplateRequest +*/ +func (a *DefaultAPIService) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + } +} + +// Execute executes the request +// +// @return CommandTemplateSchema +func (a *DefaultAPIService) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateSchema + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCommandTemplate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/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) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandTemplatesRequest struct { + ctx context.Context + ApiService DefaultAPI + osType *string +} + +// The type of the Operating System (windows or linux). If not provided will return data for all OS types. +func (r ApiListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest { + r.osType = &osType + return r +} + +func (r ApiListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) { + return r.ApiService.ListCommandTemplatesExecute(r) +} + +/* +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 *DefaultAPIService) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CommandTemplateResponse +func (a *DefaultAPIService) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCommandTemplates") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/command-templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.osType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "osType", r.osType, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string +} + +func (r ApiListCommandsRequest) Execute() (*GetCommandsResponse, error) { + return r.ApiService.ListCommandsExecute(r) +} + +/* +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 + @return ApiListCommandsRequest +*/ +func (a *DefaultAPIService) ListCommands(ctx context.Context, projectId string, serverId string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// Execute executes the request +// +// @return GetCommandsResponse +func (a *DefaultAPIService) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCommandsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCommands") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/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) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/runcommand/v1betaapi/api_default_mock.go b/services/runcommand/v1betaapi/api_default_mock.go new file mode 100644 index 000000000..a54a35b81 --- /dev/null +++ b/services/runcommand/v1betaapi/api_default_mock.go @@ -0,0 +1,129 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateCommandExecuteMock can be populated to implement the behavior of the CreateCommandExecute function of this mock + CreateCommandExecuteMock *func(r ApiCreateCommandRequest) (*NewCommandResponse, error) + // GetCommandExecuteMock can be populated to implement the behavior of the GetCommandExecute function of this mock + GetCommandExecuteMock *func(r ApiGetCommandRequest) (*CommandDetails, error) + // GetCommandTemplateExecuteMock can be populated to implement the behavior of the GetCommandTemplateExecute function of this mock + GetCommandTemplateExecuteMock *func(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) + // ListCommandTemplatesExecuteMock can be populated to implement the behavior of the ListCommandTemplatesExecute function of this mock + ListCommandTemplatesExecuteMock *func(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) + // ListCommandsExecuteMock can be populated to implement the behavior of the ListCommandsExecute function of this mock + ListCommandsExecuteMock *func(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +func (a DefaultAPIServiceMock) CreateCommand(ctx context.Context, projectId string, serverId string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// CreateCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + if a.CreateCommandExecuteMock == nil { + var localVarReturnValue *NewCommandResponse + return localVarReturnValue, nil + } + + return (*a.CreateCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommand(ctx context.Context, projectId string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandId: commandId, + } +} + +// GetCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + if a.GetCommandExecuteMock == nil { + var localVarReturnValue *CommandDetails + return localVarReturnValue, nil + } + + return (*a.GetCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + } +} + +// GetCommandTemplateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandTemplateExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + if a.GetCommandTemplateExecuteMock == nil { + var localVarReturnValue *CommandTemplateSchema + return localVarReturnValue, nil + } + + return (*a.GetCommandTemplateExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// ListCommandTemplatesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandTemplatesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + if a.ListCommandTemplatesExecuteMock == nil { + var localVarReturnValue *CommandTemplateResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandTemplatesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommands(ctx context.Context, projectId string, serverId string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + } +} + +// ListCommandsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + if a.ListCommandsExecuteMock == nil { + var localVarReturnValue *GetCommandsResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandsExecuteMock)(r) +} diff --git a/services/runcommand/v1betaapi/client.go b/services/runcommand/v1betaapi/client.go new file mode 100644 index 000000000..0a39d7f2e --- /dev/null +++ b/services/runcommand/v1betaapi/client.go @@ -0,0 +1,659 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1betaapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Run Commands Service API API v1beta.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/runcommand/v1betaapi/configuration.go b/services/runcommand/v1betaapi/configuration.go new file mode 100644 index 000000000..729195989 --- /dev/null +++ b/services/runcommand/v1betaapi/configuration.go @@ -0,0 +1,41 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1betaapi + +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/runcommand", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://run-command.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/runcommand/v1betaapi/model_command_details.go b/services/runcommand/v1betaapi/model_command_details.go new file mode 100644 index 000000000..02dd54084 --- /dev/null +++ b/services/runcommand/v1betaapi/model_command_details.go @@ -0,0 +1,413 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the CommandDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandDetails{} + +// CommandDetails struct for CommandDetails +type CommandDetails struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + ExitCode *int32 `json:"exitCode,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + Output *string `json:"output,omitempty"` + Script *string `json:"script,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *CommandDetails) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *CommandDetails) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *CommandDetails) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetExitCode returns the ExitCode field value if set, zero value otherwise. +func (o *CommandDetails) GetExitCode() int32 { + if o == nil || IsNil(o.ExitCode) { + var ret int32 + return ret + } + return *o.ExitCode +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.ExitCode) { + return nil, false + } + return o.ExitCode, true +} + +// HasExitCode returns a boolean if a field has been set. +func (o *CommandDetails) HasExitCode() bool { + if o != nil && !IsNil(o.ExitCode) { + return true + } + + return false +} + +// SetExitCode gets a reference to the given int32 and assigns it to the ExitCode field. +func (o *CommandDetails) SetExitCode(v int32) { + o.ExitCode = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *CommandDetails) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CommandDetails) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CommandDetails) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *CommandDetails) SetId(v int32) { + o.Id = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *CommandDetails) GetOutput() string { + if o == nil || IsNil(o.Output) { + var ret string + return ret + } + return *o.Output +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *CommandDetails) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *CommandDetails) SetOutput(v string) { + o.Output = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *CommandDetails) GetScript() string { + if o == nil || IsNil(o.Script) { + var ret string + return ret + } + return *o.Script +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *CommandDetails) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given string and assigns it to the Script field. +func (o *CommandDetails) SetScript(v string) { + o.Script = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *CommandDetails) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CommandDetails) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CommandDetails) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CommandDetails) SetStatus(v string) { + o.Status = &v +} + +func (o CommandDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.ExitCode) { + toSerialize["exitCode"] = o.ExitCode + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.Script) { + toSerialize["script"] = o.Script + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_command_template.go b/services/runcommand/v1betaapi/model_command_template.go new file mode 100644 index 000000000..e7e8aceff --- /dev/null +++ b/services/runcommand/v1betaapi/model_command_template.go @@ -0,0 +1,197 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the CommandTemplate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplate{} + +// CommandTemplate struct for CommandTemplate +type CommandTemplate struct { + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplate) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplate) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplate) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplate) SetOsType(v []string) { + o.OsType = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplate) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplate) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplate) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_command_template_response.go b/services/runcommand/v1betaapi/model_command_template_response.go new file mode 100644 index 000000000..620f977c1 --- /dev/null +++ b/services/runcommand/v1betaapi/model_command_template_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the CommandTemplateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateResponse{} + +// CommandTemplateResponse struct for CommandTemplateResponse +type CommandTemplateResponse struct { + Items []CommandTemplate `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() []CommandTemplate { + if o == nil || IsNil(o.Items) { + var ret []CommandTemplate + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateResponse) GetItemsOk() ([]CommandTemplate, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *CommandTemplateResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field. +func (o *CommandTemplateResponse) SetItems(v []CommandTemplate) { + o.Items = v +} + +func (o CommandTemplateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_command_template_schema.go b/services/runcommand/v1betaapi/model_command_template_schema.go new file mode 100644 index 000000000..f956078d7 --- /dev/null +++ b/services/runcommand/v1betaapi/model_command_template_schema.go @@ -0,0 +1,269 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the CommandTemplateSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateSchema{} + +// CommandTemplateSchema struct for CommandTemplateSchema +type CommandTemplateSchema struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + ParameterSchema *ParametersSchema `json:"parameterSchema,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CommandTemplateSchema) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplateSchema) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplateSchema) SetOsType(v []string) { + o.OsType = v +} + +// GetParameterSchema returns the ParameterSchema field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetParameterSchema() ParametersSchema { + if o == nil || IsNil(o.ParameterSchema) { + var ret ParametersSchema + return ret + } + return *o.ParameterSchema +} + +// 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() (*ParametersSchema, bool) { + if o == nil || IsNil(o.ParameterSchema) { + return nil, false + } + return o.ParameterSchema, true +} + +// HasParameterSchema returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasParameterSchema() bool { + if o != nil && !IsNil(o.ParameterSchema) { + return true + } + + return false +} + +// SetParameterSchema gets a reference to the given ParametersSchema and assigns it to the ParameterSchema field. +func (o *CommandTemplateSchema) SetParameterSchema(v ParametersSchema) { + o.ParameterSchema = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplateSchema) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplateSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.ParameterSchema) { + toSerialize["parameterSchema"] = o.ParameterSchema + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_commands.go b/services/runcommand/v1betaapi/model_commands.go new file mode 100644 index 000000000..5f47a9cd6 --- /dev/null +++ b/services/runcommand/v1betaapi/model_commands.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the Commands type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Commands{} + +// Commands struct for Commands +type Commands struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *Commands) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *Commands) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *Commands) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *Commands) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *Commands) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *Commands) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Commands) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Commands) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *Commands) SetId(v int32) { + o.Id = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *Commands) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *Commands) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *Commands) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Commands) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Commands) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Commands) SetStatus(v string) { + o.Status = &v +} + +func (o Commands) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Commands) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_create_command_payload.go b/services/runcommand/v1betaapi/model_create_command_payload.go new file mode 100644 index 000000000..e31cab67d --- /dev/null +++ b/services/runcommand/v1betaapi/model_create_command_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateCommandPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCommandPayload{} + +// CreateCommandPayload struct for CreateCommandPayload +type CreateCommandPayload struct { + CommandTemplateName string `json:"commandTemplateName"` + Parameters *map[string]string `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 string) *CreateCommandPayload { + this := CreateCommandPayload{} + 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() string { + if o == nil { + var ret string + return ret + } + + return o.CommandTemplateName +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value +// and a boolean to check if the value has been set. +func (o *CreateCommandPayload) GetCommandTemplateNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CommandTemplateName, true +} + +// SetCommandTemplateName sets field value +func (o *CreateCommandPayload) SetCommandTemplateName(v string) { + o.CommandTemplateName = v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *CreateCommandPayload) GetParameters() map[string]string { + if o == nil || IsNil(o.Parameters) { + var ret map[string]string + return ret + } + return *o.Parameters +} + +// 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() (*map[string]string, bool) { + if o == nil || IsNil(o.Parameters) { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *CreateCommandPayload) HasParameters() bool { + if o != nil && !IsNil(o.Parameters) { + return true + } + + return false +} + +// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field. +func (o *CreateCommandPayload) SetParameters(v map[string]string) { + o.Parameters = &v +} + +func (o CreateCommandPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["commandTemplateName"] = o.CommandTemplateName + if !IsNil(o.Parameters) { + toSerialize["parameters"] = o.Parameters + } + return toSerialize, nil +} + +func (o *CreateCommandPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "commandTemplateName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateCommandPayload := _CreateCommandPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateCommandPayload) + + if err != nil { + return err + } + + *o = CreateCommandPayload(varCreateCommandPayload) + + return err +} + +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) +} diff --git a/services/runcommand/v1betaapi/model_error_response.go b/services/runcommand/v1betaapi/model_error_response.go new file mode 100644 index 000000000..9873d568a --- /dev/null +++ b/services/runcommand/v1betaapi/model_error_response.go @@ -0,0 +1,187 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Details about the error + Message string `json:"message"` + // The string representation of the http status code (i.e. Not Found, Bad Request, etc) + Status string `json:"status"` +} + +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 string, status string) *ErrorResponse { + this := ErrorResponse{} + this.Message = message + 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() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v string) { + o.Status = v +} + +func (o ErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *ErrorResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorResponse := _ErrorResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + return err +} + +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) +} diff --git a/services/runcommand/v1betaapi/model_field.go b/services/runcommand/v1betaapi/model_field.go new file mode 100644 index 000000000..ef79161ca --- /dev/null +++ b/services/runcommand/v1betaapi/model_field.go @@ -0,0 +1,341 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the Field type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Field{} + +// Field struct for Field +type Field struct { + Default *string `json:"default,omitempty"` + Description *string `json:"description,omitempty"` + MaxLen *int32 `json:"maxLen,omitempty"` + MinLen *int32 `json:"minLen,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `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() string { + if o == nil || IsNil(o.Default) { + var ret string + return ret + } + return *o.Default +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *Field) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given string and assigns it to the Default field. +func (o *Field) SetDefault(v string) { + o.Default = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Field) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Field) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Field) SetDescription(v string) { + o.Description = &v +} + +// GetMaxLen returns the MaxLen field value if set, zero value otherwise. +func (o *Field) GetMaxLen() int32 { + if o == nil || IsNil(o.MaxLen) { + var ret int32 + return ret + } + return *o.MaxLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MaxLen) { + return nil, false + } + return o.MaxLen, true +} + +// HasMaxLen returns a boolean if a field has been set. +func (o *Field) HasMaxLen() bool { + if o != nil && !IsNil(o.MaxLen) { + return true + } + + return false +} + +// SetMaxLen gets a reference to the given int32 and assigns it to the MaxLen field. +func (o *Field) SetMaxLen(v int32) { + o.MaxLen = &v +} + +// GetMinLen returns the MinLen field value if set, zero value otherwise. +func (o *Field) GetMinLen() int32 { + if o == nil || IsNil(o.MinLen) { + var ret int32 + return ret + } + return *o.MinLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MinLen) { + return nil, false + } + return o.MinLen, true +} + +// HasMinLen returns a boolean if a field has been set. +func (o *Field) HasMinLen() bool { + if o != nil && !IsNil(o.MinLen) { + return true + } + + return false +} + +// SetMinLen gets a reference to the given int32 and assigns it to the MinLen field. +func (o *Field) SetMinLen(v int32) { + o.MinLen = &v +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *Field) GetReadOnly() bool { + if o == nil || IsNil(o.ReadOnly) { + var ret bool + return ret + } + return *o.ReadOnly +} + +// 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() (*bool, bool) { + if o == nil || IsNil(o.ReadOnly) { + return nil, false + } + return o.ReadOnly, true +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *Field) HasReadOnly() bool { + if o != nil && !IsNil(o.ReadOnly) { + return true + } + + return false +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *Field) SetReadOnly(v bool) { + o.ReadOnly = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *Field) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *Field) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *Field) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Field) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Field) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Field) SetType(v string) { + o.Type = &v +} + +func (o Field) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Field) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.MaxLen) { + toSerialize["maxLen"] = o.MaxLen + } + if !IsNil(o.MinLen) { + toSerialize["minLen"] = o.MinLen + } + if !IsNil(o.ReadOnly) { + toSerialize["readOnly"] = o.ReadOnly + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_get_commands_response.go b/services/runcommand/v1betaapi/model_get_commands_response.go new file mode 100644 index 000000000..d7f57af85 --- /dev/null +++ b/services/runcommand/v1betaapi/model_get_commands_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the GetCommandsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCommandsResponse{} + +// GetCommandsResponse struct for GetCommandsResponse +type GetCommandsResponse struct { + Items []Commands `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() []Commands { + if o == nil || IsNil(o.Items) { + var ret []Commands + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCommandsResponse) GetItemsOk() ([]Commands, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *GetCommandsResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Commands and assigns it to the Items field. +func (o *GetCommandsResponse) SetItems(v []Commands) { + o.Items = v +} + +func (o GetCommandsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_new_command_response.go b/services/runcommand/v1betaapi/model_new_command_response.go new file mode 100644 index 000000000..3e2c65825 --- /dev/null +++ b/services/runcommand/v1betaapi/model_new_command_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the NewCommandResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewCommandResponse{} + +// NewCommandResponse struct for NewCommandResponse +type NewCommandResponse struct { + Id *int32 `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() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NewCommandResponse) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NewCommandResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *NewCommandResponse) SetId(v int32) { + o.Id = &v +} + +func (o NewCommandResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_parameters_schema.go b/services/runcommand/v1betaapi/model_parameters_schema.go new file mode 100644 index 000000000..32b454326 --- /dev/null +++ b/services/runcommand/v1betaapi/model_parameters_schema.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the ParametersSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ParametersSchema{} + +// ParametersSchema struct for ParametersSchema +type ParametersSchema struct { + Properties *Properties `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() Properties { + if o == nil || IsNil(o.Properties) { + var ret Properties + return ret + } + return *o.Properties +} + +// 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() (*Properties, bool) { + if o == nil || IsNil(o.Properties) { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *ParametersSchema) HasProperties() bool { + if o != nil && !IsNil(o.Properties) { + return true + } + + return false +} + +// SetProperties gets a reference to the given Properties and assigns it to the Properties field. +func (o *ParametersSchema) SetProperties(v Properties) { + o.Properties = &v +} + +func (o ParametersSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ParametersSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Properties) { + toSerialize["properties"] = o.Properties + } + 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) +} diff --git a/services/runcommand/v1betaapi/model_properties.go b/services/runcommand/v1betaapi/model_properties.go new file mode 100644 index 000000000..c39dff621 --- /dev/null +++ b/services/runcommand/v1betaapi/model_properties.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the Properties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Properties{} + +// Properties struct for Properties +type Properties struct { + ConfirmPassword *Field `json:"ConfirmPassword,omitempty"` + Password *Field `json:"Password,omitempty"` + Script *Field `json:"Script,omitempty"` + Username *Field `json:"Username,omitempty"` + Required []string `json:"required,omitempty"` + Type *string `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() Field { + if o == nil || IsNil(o.ConfirmPassword) { + var ret Field + return ret + } + return *o.ConfirmPassword +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.ConfirmPassword) { + return nil, false + } + return o.ConfirmPassword, true +} + +// HasConfirmPassword returns a boolean if a field has been set. +func (o *Properties) HasConfirmPassword() bool { + if o != nil && !IsNil(o.ConfirmPassword) { + return true + } + + return false +} + +// SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field. +func (o *Properties) SetConfirmPassword(v Field) { + o.ConfirmPassword = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Properties) GetPassword() Field { + if o == nil || IsNil(o.Password) { + var ret Field + return ret + } + return *o.Password +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *Properties) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given Field and assigns it to the Password field. +func (o *Properties) SetPassword(v Field) { + o.Password = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *Properties) GetScript() Field { + if o == nil || IsNil(o.Script) { + var ret Field + return ret + } + return *o.Script +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *Properties) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given Field and assigns it to the Script field. +func (o *Properties) SetScript(v Field) { + o.Script = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Properties) GetUsername() Field { + if o == nil || IsNil(o.Username) { + var ret Field + return ret + } + return *o.Username +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *Properties) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given Field and assigns it to the Username field. +func (o *Properties) SetUsername(v Field) { + o.Username = &v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *Properties) GetRequired() []string { + if o == nil || IsNil(o.Required) { + var ret []string + return ret + } + return o.Required +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.Required) { + return nil, false + } + return o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *Properties) HasRequired() bool { + if o != nil && !IsNil(o.Required) { + return true + } + + return false +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *Properties) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Properties) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Properties) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Properties) SetType(v string) { + o.Type = &v +} + +func (o Properties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Properties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ConfirmPassword) { + toSerialize["ConfirmPassword"] = o.ConfirmPassword + } + if !IsNil(o.Password) { + toSerialize["Password"] = o.Password + } + if !IsNil(o.Script) { + toSerialize["Script"] = o.Script + } + if !IsNil(o.Username) { + toSerialize["Username"] = o.Username + } + if !IsNil(o.Required) { + toSerialize["required"] = o.Required + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v1betaapi/response.go b/services/runcommand/v1betaapi/response.go new file mode 100644 index 000000000..4fd604705 --- /dev/null +++ b/services/runcommand/v1betaapi/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/runcommand/v1betaapi/utils.go b/services/runcommand/v1betaapi/utils.go new file mode 100644 index 000000000..487838390 --- /dev/null +++ b/services/runcommand/v1betaapi/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 1beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/services/runcommand/v2api/api_default.go b/services/runcommand/v2api/api_default.go new file mode 100644 index 000000000..c3df42ec6 --- /dev/null +++ b/services/runcommand/v2api/api_default.go @@ -0,0 +1,906 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2api + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + 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 + // @return NewCommandResponse + CreateCommandExecute(r ApiCreateCommandRequest) (*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 + // @return CommandDetails + GetCommandExecute(r ApiGetCommandRequest) (*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 + // @return CommandTemplateSchema + GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*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 + // @return CommandTemplateResponse + ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*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 + // @return GetCommandsResponse + ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + region string + createCommandPayload *CreateCommandPayload +} + +// Command to post +func (r ApiCreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest { + r.createCommandPayload = &createCommandPayload + return r +} + +func (r ApiCreateCommandRequest) Execute() (*NewCommandResponse, error) { + return r.ApiService.CreateCommandExecute(r) +} + +/* +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 *DefaultAPIService) CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// Execute executes the request +// +// @return NewCommandResponse +func (a *DefaultAPIService) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NewCommandResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + serverId string + commandId string +} + +func (r ApiGetCommandRequest) Execute() (*CommandDetails, error) { + return r.ApiService.GetCommandExecute(r) +} + +/* +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 *DefaultAPIService) GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + commandId: commandId, + } +} + +// Execute executes the request +// +// @return CommandDetails +func (a *DefaultAPIService) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandDetails + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandTemplateRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + commandTemplateName string + region string +} + +func (r ApiGetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { + return r.ApiService.GetCommandTemplateExecute(r) +} + +/* +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 *DefaultAPIService) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + region: region, + } +} + +// Execute executes the request +// +// @return CommandTemplateSchema +func (a *DefaultAPIService) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateSchema + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCommandTemplate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandTemplatesRequest struct { + ctx context.Context + ApiService DefaultAPI + osType *string +} + +// The type of the Operating System (windows or linux). If not provided will return data for all OS types. +func (r ApiListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest { + r.osType = &osType + return r +} + +func (r ApiListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) { + return r.ApiService.ListCommandTemplatesExecute(r) +} + +/* +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 *DefaultAPIService) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CommandTemplateResponse +func (a *DefaultAPIService) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCommandTemplates") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/command-templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.osType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "osType", r.osType, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + region string +} + +func (r ApiListCommandsRequest) Execute() (*GetCommandsResponse, error) { + return r.ApiService.ListCommandsExecute(r) +} + +/* +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 *DefaultAPIService) ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// Execute executes the request +// +// @return GetCommandsResponse +func (a *DefaultAPIService) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCommandsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListCommands") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/runcommand/v2api/api_default_mock.go b/services/runcommand/v2api/api_default_mock.go new file mode 100644 index 000000000..f4dc70b27 --- /dev/null +++ b/services/runcommand/v2api/api_default_mock.go @@ -0,0 +1,133 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateCommandExecuteMock can be populated to implement the behavior of the CreateCommandExecute function of this mock + CreateCommandExecuteMock *func(r ApiCreateCommandRequest) (*NewCommandResponse, error) + // GetCommandExecuteMock can be populated to implement the behavior of the GetCommandExecute function of this mock + GetCommandExecuteMock *func(r ApiGetCommandRequest) (*CommandDetails, error) + // GetCommandTemplateExecuteMock can be populated to implement the behavior of the GetCommandTemplateExecute function of this mock + GetCommandTemplateExecuteMock *func(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) + // ListCommandTemplatesExecuteMock can be populated to implement the behavior of the ListCommandTemplatesExecute function of this mock + ListCommandTemplatesExecuteMock *func(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) + // ListCommandsExecuteMock can be populated to implement the behavior of the ListCommandsExecute function of this mock + ListCommandsExecuteMock *func(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +func (a DefaultAPIServiceMock) CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// CreateCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + if a.CreateCommandExecuteMock == nil { + var localVarReturnValue *NewCommandResponse + return localVarReturnValue, nil + } + + return (*a.CreateCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + commandId: commandId, + } +} + +// GetCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + if a.GetCommandExecuteMock == nil { + var localVarReturnValue *CommandDetails + return localVarReturnValue, nil + } + + return (*a.GetCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + region: region, + } +} + +// GetCommandTemplateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandTemplateExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + if a.GetCommandTemplateExecuteMock == nil { + var localVarReturnValue *CommandTemplateSchema + return localVarReturnValue, nil + } + + return (*a.GetCommandTemplateExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// ListCommandTemplatesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandTemplatesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + if a.ListCommandTemplatesExecuteMock == nil { + var localVarReturnValue *CommandTemplateResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandTemplatesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// ListCommandsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + if a.ListCommandsExecuteMock == nil { + var localVarReturnValue *GetCommandsResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandsExecuteMock)(r) +} diff --git a/services/runcommand/v2api/client.go b/services/runcommand/v2api/client.go new file mode 100644 index 000000000..7dcf47bb7 --- /dev/null +++ b/services/runcommand/v2api/client.go @@ -0,0 +1,659 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2api + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Run Commands Service API API v2.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/runcommand/v2api/configuration.go b/services/runcommand/v2api/configuration.go new file mode 100644 index 000000000..de40a3508 --- /dev/null +++ b/services/runcommand/v2api/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2api + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/runcommand", + 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 +} diff --git a/services/runcommand/v2api/model_command_details.go b/services/runcommand/v2api/model_command_details.go new file mode 100644 index 000000000..74719fd33 --- /dev/null +++ b/services/runcommand/v2api/model_command_details.go @@ -0,0 +1,413 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the CommandDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandDetails{} + +// CommandDetails struct for CommandDetails +type CommandDetails struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + ExitCode *int32 `json:"exitCode,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + Output *string `json:"output,omitempty"` + Script *string `json:"script,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *CommandDetails) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *CommandDetails) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *CommandDetails) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetExitCode returns the ExitCode field value if set, zero value otherwise. +func (o *CommandDetails) GetExitCode() int32 { + if o == nil || IsNil(o.ExitCode) { + var ret int32 + return ret + } + return *o.ExitCode +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.ExitCode) { + return nil, false + } + return o.ExitCode, true +} + +// HasExitCode returns a boolean if a field has been set. +func (o *CommandDetails) HasExitCode() bool { + if o != nil && !IsNil(o.ExitCode) { + return true + } + + return false +} + +// SetExitCode gets a reference to the given int32 and assigns it to the ExitCode field. +func (o *CommandDetails) SetExitCode(v int32) { + o.ExitCode = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *CommandDetails) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CommandDetails) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CommandDetails) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *CommandDetails) SetId(v int32) { + o.Id = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *CommandDetails) GetOutput() string { + if o == nil || IsNil(o.Output) { + var ret string + return ret + } + return *o.Output +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *CommandDetails) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *CommandDetails) SetOutput(v string) { + o.Output = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *CommandDetails) GetScript() string { + if o == nil || IsNil(o.Script) { + var ret string + return ret + } + return *o.Script +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *CommandDetails) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given string and assigns it to the Script field. +func (o *CommandDetails) SetScript(v string) { + o.Script = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *CommandDetails) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CommandDetails) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CommandDetails) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CommandDetails) SetStatus(v string) { + o.Status = &v +} + +func (o CommandDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.ExitCode) { + toSerialize["exitCode"] = o.ExitCode + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.Script) { + toSerialize["script"] = o.Script + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v2api/model_command_template.go b/services/runcommand/v2api/model_command_template.go new file mode 100644 index 000000000..022766345 --- /dev/null +++ b/services/runcommand/v2api/model_command_template.go @@ -0,0 +1,197 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the CommandTemplate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplate{} + +// CommandTemplate struct for CommandTemplate +type CommandTemplate struct { + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplate) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplate) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplate) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplate) SetOsType(v []string) { + o.OsType = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplate) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplate) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplate) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v2api/model_command_template_response.go b/services/runcommand/v2api/model_command_template_response.go new file mode 100644 index 000000000..330ff47f6 --- /dev/null +++ b/services/runcommand/v2api/model_command_template_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the CommandTemplateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateResponse{} + +// CommandTemplateResponse struct for CommandTemplateResponse +type CommandTemplateResponse struct { + Items []CommandTemplate `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() []CommandTemplate { + if o == nil || IsNil(o.Items) { + var ret []CommandTemplate + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateResponse) GetItemsOk() ([]CommandTemplate, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *CommandTemplateResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field. +func (o *CommandTemplateResponse) SetItems(v []CommandTemplate) { + o.Items = v +} + +func (o CommandTemplateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v2api/model_command_template_schema.go b/services/runcommand/v2api/model_command_template_schema.go new file mode 100644 index 000000000..f9930ff37 --- /dev/null +++ b/services/runcommand/v2api/model_command_template_schema.go @@ -0,0 +1,269 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the CommandTemplateSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateSchema{} + +// CommandTemplateSchema struct for CommandTemplateSchema +type CommandTemplateSchema struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + ParametersSchema *ParametersSchema `json:"parametersSchema,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CommandTemplateSchema) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplateSchema) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplateSchema) SetOsType(v []string) { + o.OsType = v +} + +// GetParametersSchema returns the ParametersSchema field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetParametersSchema() ParametersSchema { + if o == nil || IsNil(o.ParametersSchema) { + var ret ParametersSchema + return ret + } + return *o.ParametersSchema +} + +// GetParametersSchemaOk returns a tuple with the ParametersSchema field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetParametersSchemaOk() (*ParametersSchema, bool) { + if o == nil || IsNil(o.ParametersSchema) { + return nil, false + } + return o.ParametersSchema, true +} + +// HasParametersSchema returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasParametersSchema() bool { + if o != nil && !IsNil(o.ParametersSchema) { + return true + } + + return false +} + +// SetParametersSchema gets a reference to the given ParametersSchema and assigns it to the ParametersSchema field. +func (o *CommandTemplateSchema) SetParametersSchema(v ParametersSchema) { + o.ParametersSchema = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplateSchema) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplateSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.ParametersSchema) { + toSerialize["parametersSchema"] = o.ParametersSchema + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v2api/model_commands.go b/services/runcommand/v2api/model_commands.go new file mode 100644 index 000000000..d955246a5 --- /dev/null +++ b/services/runcommand/v2api/model_commands.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the Commands type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Commands{} + +// Commands struct for Commands +type Commands struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *Commands) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *Commands) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *Commands) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *Commands) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *Commands) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *Commands) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Commands) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Commands) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *Commands) SetId(v int32) { + o.Id = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *Commands) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *Commands) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *Commands) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Commands) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Commands) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Commands) SetStatus(v string) { + o.Status = &v +} + +func (o Commands) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Commands) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v2api/model_create_command_payload.go b/services/runcommand/v2api/model_create_command_payload.go new file mode 100644 index 000000000..e922f9ef9 --- /dev/null +++ b/services/runcommand/v2api/model_create_command_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateCommandPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCommandPayload{} + +// CreateCommandPayload struct for CreateCommandPayload +type CreateCommandPayload struct { + CommandTemplateName string `json:"commandTemplateName"` + Parameters *map[string]string `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 string) *CreateCommandPayload { + this := CreateCommandPayload{} + 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() string { + if o == nil { + var ret string + return ret + } + + return o.CommandTemplateName +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value +// and a boolean to check if the value has been set. +func (o *CreateCommandPayload) GetCommandTemplateNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CommandTemplateName, true +} + +// SetCommandTemplateName sets field value +func (o *CreateCommandPayload) SetCommandTemplateName(v string) { + o.CommandTemplateName = v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *CreateCommandPayload) GetParameters() map[string]string { + if o == nil || IsNil(o.Parameters) { + var ret map[string]string + return ret + } + return *o.Parameters +} + +// 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() (*map[string]string, bool) { + if o == nil || IsNil(o.Parameters) { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *CreateCommandPayload) HasParameters() bool { + if o != nil && !IsNil(o.Parameters) { + return true + } + + return false +} + +// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field. +func (o *CreateCommandPayload) SetParameters(v map[string]string) { + o.Parameters = &v +} + +func (o CreateCommandPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["commandTemplateName"] = o.CommandTemplateName + if !IsNil(o.Parameters) { + toSerialize["parameters"] = o.Parameters + } + return toSerialize, nil +} + +func (o *CreateCommandPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "commandTemplateName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateCommandPayload := _CreateCommandPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateCommandPayload) + + if err != nil { + return err + } + + *o = CreateCommandPayload(varCreateCommandPayload) + + return err +} + +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) +} diff --git a/services/runcommand/v2api/model_error_response.go b/services/runcommand/v2api/model_error_response.go new file mode 100644 index 000000000..4fc9fbc8b --- /dev/null +++ b/services/runcommand/v2api/model_error_response.go @@ -0,0 +1,187 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Details about the error + Message string `json:"message"` + // The string representation of the http status code (i.e. Not Found, Bad Request, etc) + Status string `json:"status"` +} + +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 string, status string) *ErrorResponse { + this := ErrorResponse{} + this.Message = message + 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() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v string) { + o.Status = v +} + +func (o ErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *ErrorResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorResponse := _ErrorResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + return err +} + +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) +} diff --git a/services/runcommand/v2api/model_field.go b/services/runcommand/v2api/model_field.go new file mode 100644 index 000000000..162cb8cc3 --- /dev/null +++ b/services/runcommand/v2api/model_field.go @@ -0,0 +1,341 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the Field type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Field{} + +// Field struct for Field +type Field struct { + Default *string `json:"default,omitempty"` + Description *string `json:"description,omitempty"` + MaxLen *int32 `json:"maxLen,omitempty"` + MinLen *int32 `json:"minLen,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `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() string { + if o == nil || IsNil(o.Default) { + var ret string + return ret + } + return *o.Default +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *Field) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given string and assigns it to the Default field. +func (o *Field) SetDefault(v string) { + o.Default = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Field) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Field) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Field) SetDescription(v string) { + o.Description = &v +} + +// GetMaxLen returns the MaxLen field value if set, zero value otherwise. +func (o *Field) GetMaxLen() int32 { + if o == nil || IsNil(o.MaxLen) { + var ret int32 + return ret + } + return *o.MaxLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MaxLen) { + return nil, false + } + return o.MaxLen, true +} + +// HasMaxLen returns a boolean if a field has been set. +func (o *Field) HasMaxLen() bool { + if o != nil && !IsNil(o.MaxLen) { + return true + } + + return false +} + +// SetMaxLen gets a reference to the given int32 and assigns it to the MaxLen field. +func (o *Field) SetMaxLen(v int32) { + o.MaxLen = &v +} + +// GetMinLen returns the MinLen field value if set, zero value otherwise. +func (o *Field) GetMinLen() int32 { + if o == nil || IsNil(o.MinLen) { + var ret int32 + return ret + } + return *o.MinLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MinLen) { + return nil, false + } + return o.MinLen, true +} + +// HasMinLen returns a boolean if a field has been set. +func (o *Field) HasMinLen() bool { + if o != nil && !IsNil(o.MinLen) { + return true + } + + return false +} + +// SetMinLen gets a reference to the given int32 and assigns it to the MinLen field. +func (o *Field) SetMinLen(v int32) { + o.MinLen = &v +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *Field) GetReadOnly() bool { + if o == nil || IsNil(o.ReadOnly) { + var ret bool + return ret + } + return *o.ReadOnly +} + +// 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() (*bool, bool) { + if o == nil || IsNil(o.ReadOnly) { + return nil, false + } + return o.ReadOnly, true +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *Field) HasReadOnly() bool { + if o != nil && !IsNil(o.ReadOnly) { + return true + } + + return false +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *Field) SetReadOnly(v bool) { + o.ReadOnly = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *Field) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *Field) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *Field) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Field) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Field) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Field) SetType(v string) { + o.Type = &v +} + +func (o Field) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Field) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.MaxLen) { + toSerialize["maxLen"] = o.MaxLen + } + if !IsNil(o.MinLen) { + toSerialize["minLen"] = o.MinLen + } + if !IsNil(o.ReadOnly) { + toSerialize["readOnly"] = o.ReadOnly + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v2api/model_get_commands_response.go b/services/runcommand/v2api/model_get_commands_response.go new file mode 100644 index 000000000..086b0b0d2 --- /dev/null +++ b/services/runcommand/v2api/model_get_commands_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the GetCommandsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCommandsResponse{} + +// GetCommandsResponse struct for GetCommandsResponse +type GetCommandsResponse struct { + Items []Commands `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() []Commands { + if o == nil || IsNil(o.Items) { + var ret []Commands + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCommandsResponse) GetItemsOk() ([]Commands, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *GetCommandsResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Commands and assigns it to the Items field. +func (o *GetCommandsResponse) SetItems(v []Commands) { + o.Items = v +} + +func (o GetCommandsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v2api/model_new_command_response.go b/services/runcommand/v2api/model_new_command_response.go new file mode 100644 index 000000000..b23d61d1a --- /dev/null +++ b/services/runcommand/v2api/model_new_command_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the NewCommandResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewCommandResponse{} + +// NewCommandResponse struct for NewCommandResponse +type NewCommandResponse struct { + Id *int32 `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() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NewCommandResponse) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NewCommandResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *NewCommandResponse) SetId(v int32) { + o.Id = &v +} + +func (o NewCommandResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + 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) +} diff --git a/services/runcommand/v2api/model_parameters_schema.go b/services/runcommand/v2api/model_parameters_schema.go new file mode 100644 index 000000000..9b34256b0 --- /dev/null +++ b/services/runcommand/v2api/model_parameters_schema.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the ParametersSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ParametersSchema{} + +// ParametersSchema struct for ParametersSchema +type ParametersSchema struct { + Properties *Properties `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() Properties { + if o == nil || IsNil(o.Properties) { + var ret Properties + return ret + } + return *o.Properties +} + +// 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() (*Properties, bool) { + if o == nil || IsNil(o.Properties) { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *ParametersSchema) HasProperties() bool { + if o != nil && !IsNil(o.Properties) { + return true + } + + return false +} + +// SetProperties gets a reference to the given Properties and assigns it to the Properties field. +func (o *ParametersSchema) SetProperties(v Properties) { + o.Properties = &v +} + +func (o ParametersSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ParametersSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Properties) { + toSerialize["properties"] = o.Properties + } + 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) +} diff --git a/services/runcommand/v2api/model_properties.go b/services/runcommand/v2api/model_properties.go new file mode 100644 index 000000000..26f1c93ad --- /dev/null +++ b/services/runcommand/v2api/model_properties.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" +) + +// checks if the Properties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Properties{} + +// Properties struct for Properties +type Properties struct { + ConfirmPassword *Field `json:"ConfirmPassword,omitempty"` + Password *Field `json:"Password,omitempty"` + Script *Field `json:"Script,omitempty"` + Username *Field `json:"Username,omitempty"` + Required []string `json:"required,omitempty"` + Type *string `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() Field { + if o == nil || IsNil(o.ConfirmPassword) { + var ret Field + return ret + } + return *o.ConfirmPassword +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.ConfirmPassword) { + return nil, false + } + return o.ConfirmPassword, true +} + +// HasConfirmPassword returns a boolean if a field has been set. +func (o *Properties) HasConfirmPassword() bool { + if o != nil && !IsNil(o.ConfirmPassword) { + return true + } + + return false +} + +// SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field. +func (o *Properties) SetConfirmPassword(v Field) { + o.ConfirmPassword = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Properties) GetPassword() Field { + if o == nil || IsNil(o.Password) { + var ret Field + return ret + } + return *o.Password +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *Properties) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given Field and assigns it to the Password field. +func (o *Properties) SetPassword(v Field) { + o.Password = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *Properties) GetScript() Field { + if o == nil || IsNil(o.Script) { + var ret Field + return ret + } + return *o.Script +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *Properties) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given Field and assigns it to the Script field. +func (o *Properties) SetScript(v Field) { + o.Script = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Properties) GetUsername() Field { + if o == nil || IsNil(o.Username) { + var ret Field + return ret + } + return *o.Username +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *Properties) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given Field and assigns it to the Username field. +func (o *Properties) SetUsername(v Field) { + o.Username = &v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *Properties) GetRequired() []string { + if o == nil || IsNil(o.Required) { + var ret []string + return ret + } + return o.Required +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.Required) { + return nil, false + } + return o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *Properties) HasRequired() bool { + if o != nil && !IsNil(o.Required) { + return true + } + + return false +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *Properties) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Properties) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Properties) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Properties) SetType(v string) { + o.Type = &v +} + +func (o Properties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Properties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ConfirmPassword) { + toSerialize["ConfirmPassword"] = o.ConfirmPassword + } + if !IsNil(o.Password) { + toSerialize["Password"] = o.Password + } + if !IsNil(o.Script) { + toSerialize["Script"] = o.Script + } + if !IsNil(o.Username) { + toSerialize["Username"] = o.Username + } + if !IsNil(o.Required) { + toSerialize["required"] = o.Required + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v2api/response.go b/services/runcommand/v2api/response.go new file mode 100644 index 000000000..010bf2c56 --- /dev/null +++ b/services/runcommand/v2api/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/runcommand/v2api/utils.go b/services/runcommand/v2api/utils.go new file mode 100644 index 000000000..9ab4d6543 --- /dev/null +++ b/services/runcommand/v2api/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/services/runcommand/v2betaapi/api_default.go b/services/runcommand/v2betaapi/api_default.go new file mode 100644 index 000000000..20507ef7f --- /dev/null +++ b/services/runcommand/v2betaapi/api_default.go @@ -0,0 +1,906 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2betaapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + 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 + // @return NewCommandResponse + CreateCommandExecute(r ApiCreateCommandRequest) (*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 + // @return CommandDetails + GetCommandExecute(r ApiGetCommandRequest) (*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 + // @return CommandTemplateSchema + GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*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 + // @return CommandTemplateResponse + ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*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 + // @return GetCommandsResponse + ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + region string + createCommandPayload *CreateCommandPayload +} + +// Command to post +func (r ApiCreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest { + r.createCommandPayload = &createCommandPayload + return r +} + +func (r ApiCreateCommandRequest) Execute() (*NewCommandResponse, error) { + return r.ApiService.CreateCommandExecute(r) +} + +/* +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 *DefaultAPIService) CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// Execute executes the request +// +// @return NewCommandResponse +func (a *DefaultAPIService) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NewCommandResponse + ) + + localBasePath, err := a.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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + serverId string + commandId string +} + +func (r ApiGetCommandRequest) Execute() (*CommandDetails, error) { + return r.ApiService.GetCommandExecute(r) +} + +/* +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 *DefaultAPIService) GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + commandId: commandId, + } +} + +// Execute executes the request +// +// @return CommandDetails +func (a *DefaultAPIService) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandDetails + ) + + localBasePath, err := a.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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCommandTemplateRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + commandTemplateName string + region string +} + +func (r ApiGetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { + return r.ApiService.GetCommandTemplateExecute(r) +} + +/* +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 *DefaultAPIService) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + region: region, + } +} + +// Execute executes the request +// +// @return CommandTemplateSchema +func (a *DefaultAPIService) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateSchema + ) + + localBasePath, err := a.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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandTemplatesRequest struct { + ctx context.Context + ApiService DefaultAPI + osType *string +} + +// The type of the Operating System (windows or linux). If not provided will return data for all OS types. +func (r ApiListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest { + r.osType = &osType + return r +} + +func (r ApiListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) { + return r.ApiService.ListCommandTemplatesExecute(r) +} + +/* +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 *DefaultAPIService) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CommandTemplateResponse +func (a *DefaultAPIService) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateResponse + ) + + localBasePath, err := a.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, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListCommandsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + serverId string + region string +} + +func (r ApiListCommandsRequest) Execute() (*GetCommandsResponse, error) { + return r.ApiService.ListCommandsExecute(r) +} + +/* +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 *DefaultAPIService) ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// Execute executes the request +// +// @return GetCommandsResponse +func (a *DefaultAPIService) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCommandsResponse + ) + + localBasePath, err := a.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 := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} diff --git a/services/runcommand/v2betaapi/api_default_mock.go b/services/runcommand/v2betaapi/api_default_mock.go new file mode 100644 index 000000000..048173505 --- /dev/null +++ b/services/runcommand/v2betaapi/api_default_mock.go @@ -0,0 +1,133 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "context" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateCommandExecuteMock can be populated to implement the behavior of the CreateCommandExecute function of this mock + CreateCommandExecuteMock *func(r ApiCreateCommandRequest) (*NewCommandResponse, error) + // GetCommandExecuteMock can be populated to implement the behavior of the GetCommandExecute function of this mock + GetCommandExecuteMock *func(r ApiGetCommandRequest) (*CommandDetails, error) + // GetCommandTemplateExecuteMock can be populated to implement the behavior of the GetCommandTemplateExecute function of this mock + GetCommandTemplateExecuteMock *func(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) + // ListCommandTemplatesExecuteMock can be populated to implement the behavior of the ListCommandTemplatesExecute function of this mock + ListCommandTemplatesExecuteMock *func(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) + // ListCommandsExecuteMock can be populated to implement the behavior of the ListCommandsExecute function of this mock + ListCommandsExecuteMock *func(r ApiListCommandsRequest) (*GetCommandsResponse, error) +} + +func (a DefaultAPIServiceMock) CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest { + return ApiCreateCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// CreateCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateCommandExecute(r ApiCreateCommandRequest) (*NewCommandResponse, error) { + if a.CreateCommandExecuteMock == nil { + var localVarReturnValue *NewCommandResponse + return localVarReturnValue, nil + } + + return (*a.CreateCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest { + return ApiGetCommandRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + commandId: commandId, + } +} + +// GetCommandExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandExecute(r ApiGetCommandRequest) (*CommandDetails, error) { + if a.GetCommandExecuteMock == nil { + var localVarReturnValue *CommandDetails + return localVarReturnValue, nil + } + + return (*a.GetCommandExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest { + return ApiGetCommandTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + region: region, + } +} + +// GetCommandTemplateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCommandTemplateExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCommandTemplateExecute(r ApiGetCommandTemplateRequest) (*CommandTemplateSchema, error) { + if a.GetCommandTemplateExecuteMock == nil { + var localVarReturnValue *CommandTemplateSchema + return localVarReturnValue, nil + } + + return (*a.GetCommandTemplateExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ApiListCommandTemplatesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// ListCommandTemplatesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandTemplatesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandTemplatesExecute(r ApiListCommandTemplatesRequest) (*CommandTemplateResponse, error) { + if a.ListCommandTemplatesExecuteMock == nil { + var localVarReturnValue *CommandTemplateResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandTemplatesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest { + return ApiListCommandsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +// ListCommandsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListCommandsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListCommandsExecute(r ApiListCommandsRequest) (*GetCommandsResponse, error) { + if a.ListCommandsExecuteMock == nil { + var localVarReturnValue *GetCommandsResponse + return localVarReturnValue, nil + } + + return (*a.ListCommandsExecuteMock)(r) +} diff --git a/services/runcommand/v2betaapi/client.go b/services/runcommand/v2betaapi/client.go new file mode 100644 index 000000000..7b380e3a6 --- /dev/null +++ b/services/runcommand/v2betaapi/client.go @@ -0,0 +1,659 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2betaapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT 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. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/runcommand/v2betaapi/configuration.go b/services/runcommand/v2betaapi/configuration.go new file mode 100644 index 000000000..9b244bf55 --- /dev/null +++ b/services/runcommand/v2betaapi/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v2betaapi + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/runcommand", + 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 +} diff --git a/services/runcommand/v2betaapi/model_command_details.go b/services/runcommand/v2betaapi/model_command_details.go new file mode 100644 index 000000000..94d1c2314 --- /dev/null +++ b/services/runcommand/v2betaapi/model_command_details.go @@ -0,0 +1,413 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the CommandDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandDetails{} + +// CommandDetails struct for CommandDetails +type CommandDetails struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + ExitCode *int32 `json:"exitCode,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + Output *string `json:"output,omitempty"` + Script *string `json:"script,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *CommandDetails) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *CommandDetails) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *CommandDetails) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetExitCode returns the ExitCode field value if set, zero value otherwise. +func (o *CommandDetails) GetExitCode() int32 { + if o == nil || IsNil(o.ExitCode) { + var ret int32 + return ret + } + return *o.ExitCode +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.ExitCode) { + return nil, false + } + return o.ExitCode, true +} + +// HasExitCode returns a boolean if a field has been set. +func (o *CommandDetails) HasExitCode() bool { + if o != nil && !IsNil(o.ExitCode) { + return true + } + + return false +} + +// SetExitCode gets a reference to the given int32 and assigns it to the ExitCode field. +func (o *CommandDetails) SetExitCode(v int32) { + o.ExitCode = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *CommandDetails) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CommandDetails) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CommandDetails) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *CommandDetails) SetId(v int32) { + o.Id = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *CommandDetails) GetOutput() string { + if o == nil || IsNil(o.Output) { + var ret string + return ret + } + return *o.Output +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *CommandDetails) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *CommandDetails) SetOutput(v string) { + o.Output = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *CommandDetails) GetScript() string { + if o == nil || IsNil(o.Script) { + var ret string + return ret + } + return *o.Script +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *CommandDetails) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given string and assigns it to the Script field. +func (o *CommandDetails) SetScript(v string) { + o.Script = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *CommandDetails) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CommandDetails) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *CommandDetails) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CommandDetails) SetStatus(v string) { + o.Status = &v +} + +func (o CommandDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.ExitCode) { + toSerialize["exitCode"] = o.ExitCode + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.Script) { + toSerialize["script"] = o.Script + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_command_template.go b/services/runcommand/v2betaapi/model_command_template.go new file mode 100644 index 000000000..b8a7b80ce --- /dev/null +++ b/services/runcommand/v2betaapi/model_command_template.go @@ -0,0 +1,197 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the CommandTemplate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplate{} + +// CommandTemplate struct for CommandTemplate +type CommandTemplate struct { + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplate) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplate) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplate) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplate) SetOsType(v []string) { + o.OsType = v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplate) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplate) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplate) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_command_template_response.go b/services/runcommand/v2betaapi/model_command_template_response.go new file mode 100644 index 000000000..280fe9b9f --- /dev/null +++ b/services/runcommand/v2betaapi/model_command_template_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the CommandTemplateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateResponse{} + +// CommandTemplateResponse struct for CommandTemplateResponse +type CommandTemplateResponse struct { + Items []CommandTemplate `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() []CommandTemplate { + if o == nil || IsNil(o.Items) { + var ret []CommandTemplate + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateResponse) GetItemsOk() ([]CommandTemplate, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *CommandTemplateResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field. +func (o *CommandTemplateResponse) SetItems(v []CommandTemplate) { + o.Items = v +} + +func (o CommandTemplateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_command_template_schema.go b/services/runcommand/v2betaapi/model_command_template_schema.go new file mode 100644 index 000000000..bb1e589c5 --- /dev/null +++ b/services/runcommand/v2betaapi/model_command_template_schema.go @@ -0,0 +1,269 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the CommandTemplateSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateSchema{} + +// CommandTemplateSchema struct for CommandTemplateSchema +type CommandTemplateSchema struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + OsType []string `json:"osType,omitempty"` + ParameterSchema *ParametersSchema `json:"parameterSchema,omitempty"` + Title *string `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() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CommandTemplateSchema) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplateSchema) SetName(v string) { + o.Name = &v +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetOsType() []string { + if o == nil || IsNil(o.OsType) { + var ret []string + return ret + } + return o.OsType +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.OsType) { + return nil, false + } + return o.OsType, true +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasOsType() bool { + if o != nil && !IsNil(o.OsType) { + return true + } + + return false +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplateSchema) SetOsType(v []string) { + o.OsType = v +} + +// GetParameterSchema returns the ParameterSchema field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetParameterSchema() ParametersSchema { + if o == nil || IsNil(o.ParameterSchema) { + var ret ParametersSchema + return ret + } + return *o.ParameterSchema +} + +// 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() (*ParametersSchema, bool) { + if o == nil || IsNil(o.ParameterSchema) { + return nil, false + } + return o.ParameterSchema, true +} + +// HasParameterSchema returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasParameterSchema() bool { + if o != nil && !IsNil(o.ParameterSchema) { + return true + } + + return false +} + +// SetParameterSchema gets a reference to the given ParametersSchema and assigns it to the ParameterSchema field. +func (o *CommandTemplateSchema) SetParameterSchema(v ParametersSchema) { + o.ParameterSchema = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplateSchema) SetTitle(v string) { + o.Title = &v +} + +func (o CommandTemplateSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.OsType) { + toSerialize["osType"] = o.OsType + } + if !IsNil(o.ParameterSchema) { + toSerialize["parameterSchema"] = o.ParameterSchema + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_commands.go b/services/runcommand/v2betaapi/model_commands.go new file mode 100644 index 000000000..31b8038ad --- /dev/null +++ b/services/runcommand/v2betaapi/model_commands.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the Commands type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Commands{} + +// Commands struct for Commands +type Commands struct { + CommandTemplateName *string `json:"commandTemplateName,omitempty"` + CommandTemplateTitle *string `json:"commandTemplateTitle,omitempty"` + FinishedAt *string `json:"finishedAt,omitempty"` + Id *int32 `json:"id,omitempty"` + StartedAt *string `json:"startedAt,omitempty"` + Status *string `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() string { + if o == nil || IsNil(o.CommandTemplateName) { + var ret string + return ret + } + return *o.CommandTemplateName +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateName) { + return nil, false + } + return o.CommandTemplateName, true +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateName() bool { + if o != nil && !IsNil(o.CommandTemplateName) { + return true + } + + return false +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *Commands) SetCommandTemplateName(v string) { + o.CommandTemplateName = &v +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *Commands) GetCommandTemplateTitle() string { + if o == nil || IsNil(o.CommandTemplateTitle) { + var ret string + return ret + } + return *o.CommandTemplateTitle +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.CommandTemplateTitle) { + return nil, false + } + return o.CommandTemplateTitle, true +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateTitle() bool { + if o != nil && !IsNil(o.CommandTemplateTitle) { + return true + } + + return false +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *Commands) SetCommandTemplateTitle(v string) { + o.CommandTemplateTitle = &v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *Commands) GetFinishedAt() string { + if o == nil || IsNil(o.FinishedAt) { + var ret string + return ret + } + return *o.FinishedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *Commands) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *Commands) SetFinishedAt(v string) { + o.FinishedAt = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Commands) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Commands) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *Commands) SetId(v int32) { + o.Id = &v +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *Commands) GetStartedAt() string { + if o == nil || IsNil(o.StartedAt) { + var ret string + return ret + } + return *o.StartedAt +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.StartedAt) { + return nil, false + } + return o.StartedAt, true +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *Commands) HasStartedAt() bool { + if o != nil && !IsNil(o.StartedAt) { + return true + } + + return false +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *Commands) SetStartedAt(v string) { + o.StartedAt = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Commands) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Commands) HasStatus() bool { + if o != nil && !IsNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Commands) SetStatus(v string) { + o.Status = &v +} + +func (o Commands) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Commands) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CommandTemplateName) { + toSerialize["commandTemplateName"] = o.CommandTemplateName + } + if !IsNil(o.CommandTemplateTitle) { + toSerialize["commandTemplateTitle"] = o.CommandTemplateTitle + } + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.StartedAt) { + toSerialize["startedAt"] = o.StartedAt + } + if !IsNil(o.Status) { + toSerialize["status"] = o.Status + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_create_command_payload.go b/services/runcommand/v2betaapi/model_create_command_payload.go new file mode 100644 index 000000000..6b92f0a34 --- /dev/null +++ b/services/runcommand/v2betaapi/model_create_command_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateCommandPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCommandPayload{} + +// CreateCommandPayload struct for CreateCommandPayload +type CreateCommandPayload struct { + CommandTemplateName string `json:"commandTemplateName"` + Parameters *map[string]string `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 string) *CreateCommandPayload { + this := CreateCommandPayload{} + 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() string { + if o == nil { + var ret string + return ret + } + + return o.CommandTemplateName +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value +// and a boolean to check if the value has been set. +func (o *CreateCommandPayload) GetCommandTemplateNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CommandTemplateName, true +} + +// SetCommandTemplateName sets field value +func (o *CreateCommandPayload) SetCommandTemplateName(v string) { + o.CommandTemplateName = v +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *CreateCommandPayload) GetParameters() map[string]string { + if o == nil || IsNil(o.Parameters) { + var ret map[string]string + return ret + } + return *o.Parameters +} + +// 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() (*map[string]string, bool) { + if o == nil || IsNil(o.Parameters) { + return nil, false + } + return o.Parameters, true +} + +// HasParameters returns a boolean if a field has been set. +func (o *CreateCommandPayload) HasParameters() bool { + if o != nil && !IsNil(o.Parameters) { + return true + } + + return false +} + +// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field. +func (o *CreateCommandPayload) SetParameters(v map[string]string) { + o.Parameters = &v +} + +func (o CreateCommandPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["commandTemplateName"] = o.CommandTemplateName + if !IsNil(o.Parameters) { + toSerialize["parameters"] = o.Parameters + } + return toSerialize, nil +} + +func (o *CreateCommandPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "commandTemplateName", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateCommandPayload := _CreateCommandPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateCommandPayload) + + if err != nil { + return err + } + + *o = CreateCommandPayload(varCreateCommandPayload) + + return err +} + +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) +} diff --git a/services/runcommand/v2betaapi/model_error_response.go b/services/runcommand/v2betaapi/model_error_response.go new file mode 100644 index 000000000..7a821b2a2 --- /dev/null +++ b/services/runcommand/v2betaapi/model_error_response.go @@ -0,0 +1,187 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Details about the error + Message string `json:"message"` + // The string representation of the http status code (i.e. Not Found, Bad Request, etc) + Status string `json:"status"` +} + +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 string, status string) *ErrorResponse { + this := ErrorResponse{} + this.Message = message + 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() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v string) { + o.Status = v +} + +func (o ErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *ErrorResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorResponse := _ErrorResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + return err +} + +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) +} diff --git a/services/runcommand/v2betaapi/model_field.go b/services/runcommand/v2betaapi/model_field.go new file mode 100644 index 000000000..a229428a8 --- /dev/null +++ b/services/runcommand/v2betaapi/model_field.go @@ -0,0 +1,341 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the Field type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Field{} + +// Field struct for Field +type Field struct { + Default *string `json:"default,omitempty"` + Description *string `json:"description,omitempty"` + MaxLen *int32 `json:"maxLen,omitempty"` + MinLen *int32 `json:"minLen,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `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() string { + if o == nil || IsNil(o.Default) { + var ret string + return ret + } + return *o.Default +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *Field) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given string and assigns it to the Default field. +func (o *Field) SetDefault(v string) { + o.Default = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Field) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Field) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Field) SetDescription(v string) { + o.Description = &v +} + +// GetMaxLen returns the MaxLen field value if set, zero value otherwise. +func (o *Field) GetMaxLen() int32 { + if o == nil || IsNil(o.MaxLen) { + var ret int32 + return ret + } + return *o.MaxLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MaxLen) { + return nil, false + } + return o.MaxLen, true +} + +// HasMaxLen returns a boolean if a field has been set. +func (o *Field) HasMaxLen() bool { + if o != nil && !IsNil(o.MaxLen) { + return true + } + + return false +} + +// SetMaxLen gets a reference to the given int32 and assigns it to the MaxLen field. +func (o *Field) SetMaxLen(v int32) { + o.MaxLen = &v +} + +// GetMinLen returns the MinLen field value if set, zero value otherwise. +func (o *Field) GetMinLen() int32 { + if o == nil || IsNil(o.MinLen) { + var ret int32 + return ret + } + return *o.MinLen +} + +// 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() (*int32, bool) { + if o == nil || IsNil(o.MinLen) { + return nil, false + } + return o.MinLen, true +} + +// HasMinLen returns a boolean if a field has been set. +func (o *Field) HasMinLen() bool { + if o != nil && !IsNil(o.MinLen) { + return true + } + + return false +} + +// SetMinLen gets a reference to the given int32 and assigns it to the MinLen field. +func (o *Field) SetMinLen(v int32) { + o.MinLen = &v +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *Field) GetReadOnly() bool { + if o == nil || IsNil(o.ReadOnly) { + var ret bool + return ret + } + return *o.ReadOnly +} + +// 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() (*bool, bool) { + if o == nil || IsNil(o.ReadOnly) { + return nil, false + } + return o.ReadOnly, true +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *Field) HasReadOnly() bool { + if o != nil && !IsNil(o.ReadOnly) { + return true + } + + return false +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *Field) SetReadOnly(v bool) { + o.ReadOnly = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *Field) GetTitle() string { + if o == nil || IsNil(o.Title) { + var ret string + return ret + } + return *o.Title +} + +// 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() (*string, bool) { + if o == nil || IsNil(o.Title) { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *Field) HasTitle() bool { + if o != nil && !IsNil(o.Title) { + return true + } + + return false +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *Field) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Field) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Field) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Field) SetType(v string) { + o.Type = &v +} + +func (o Field) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Field) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.MaxLen) { + toSerialize["maxLen"] = o.MaxLen + } + if !IsNil(o.MinLen) { + toSerialize["minLen"] = o.MinLen + } + if !IsNil(o.ReadOnly) { + toSerialize["readOnly"] = o.ReadOnly + } + if !IsNil(o.Title) { + toSerialize["title"] = o.Title + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_get_commands_response.go b/services/runcommand/v2betaapi/model_get_commands_response.go new file mode 100644 index 000000000..83ed90a64 --- /dev/null +++ b/services/runcommand/v2betaapi/model_get_commands_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the GetCommandsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCommandsResponse{} + +// GetCommandsResponse struct for GetCommandsResponse +type GetCommandsResponse struct { + Items []Commands `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() []Commands { + if o == nil || IsNil(o.Items) { + var ret []Commands + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCommandsResponse) GetItemsOk() ([]Commands, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *GetCommandsResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Commands and assigns it to the Items field. +func (o *GetCommandsResponse) SetItems(v []Commands) { + o.Items = v +} + +func (o GetCommandsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_new_command_response.go b/services/runcommand/v2betaapi/model_new_command_response.go new file mode 100644 index 000000000..bf6900367 --- /dev/null +++ b/services/runcommand/v2betaapi/model_new_command_response.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the NewCommandResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewCommandResponse{} + +// NewCommandResponse struct for NewCommandResponse +type NewCommandResponse struct { + Id *int32 `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() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NewCommandResponse) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *NewCommandResponse) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *NewCommandResponse) SetId(v int32) { + o.Id = &v +} + +func (o NewCommandResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_parameters_schema.go b/services/runcommand/v2betaapi/model_parameters_schema.go new file mode 100644 index 000000000..a6a1e0f24 --- /dev/null +++ b/services/runcommand/v2betaapi/model_parameters_schema.go @@ -0,0 +1,125 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the ParametersSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ParametersSchema{} + +// ParametersSchema struct for ParametersSchema +type ParametersSchema struct { + Properties *Properties `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() Properties { + if o == nil || IsNil(o.Properties) { + var ret Properties + return ret + } + return *o.Properties +} + +// 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() (*Properties, bool) { + if o == nil || IsNil(o.Properties) { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *ParametersSchema) HasProperties() bool { + if o != nil && !IsNil(o.Properties) { + return true + } + + return false +} + +// SetProperties gets a reference to the given Properties and assigns it to the Properties field. +func (o *ParametersSchema) SetProperties(v Properties) { + o.Properties = &v +} + +func (o ParametersSchema) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ParametersSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Properties) { + toSerialize["properties"] = o.Properties + } + 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) +} diff --git a/services/runcommand/v2betaapi/model_properties.go b/services/runcommand/v2betaapi/model_properties.go new file mode 100644 index 000000000..f80c58efc --- /dev/null +++ b/services/runcommand/v2betaapi/model_properties.go @@ -0,0 +1,305 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "encoding/json" +) + +// checks if the Properties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Properties{} + +// Properties struct for Properties +type Properties struct { + ConfirmPassword *Field `json:"ConfirmPassword,omitempty"` + Password *Field `json:"Password,omitempty"` + Script *Field `json:"Script,omitempty"` + Username *Field `json:"Username,omitempty"` + Required []string `json:"required,omitempty"` + Type *string `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() Field { + if o == nil || IsNil(o.ConfirmPassword) { + var ret Field + return ret + } + return *o.ConfirmPassword +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.ConfirmPassword) { + return nil, false + } + return o.ConfirmPassword, true +} + +// HasConfirmPassword returns a boolean if a field has been set. +func (o *Properties) HasConfirmPassword() bool { + if o != nil && !IsNil(o.ConfirmPassword) { + return true + } + + return false +} + +// SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field. +func (o *Properties) SetConfirmPassword(v Field) { + o.ConfirmPassword = &v +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Properties) GetPassword() Field { + if o == nil || IsNil(o.Password) { + var ret Field + return ret + } + return *o.Password +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Password) { + return nil, false + } + return o.Password, true +} + +// HasPassword returns a boolean if a field has been set. +func (o *Properties) HasPassword() bool { + if o != nil && !IsNil(o.Password) { + return true + } + + return false +} + +// SetPassword gets a reference to the given Field and assigns it to the Password field. +func (o *Properties) SetPassword(v Field) { + o.Password = &v +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *Properties) GetScript() Field { + if o == nil || IsNil(o.Script) { + var ret Field + return ret + } + return *o.Script +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Script) { + return nil, false + } + return o.Script, true +} + +// HasScript returns a boolean if a field has been set. +func (o *Properties) HasScript() bool { + if o != nil && !IsNil(o.Script) { + return true + } + + return false +} + +// SetScript gets a reference to the given Field and assigns it to the Script field. +func (o *Properties) SetScript(v Field) { + o.Script = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Properties) GetUsername() Field { + if o == nil || IsNil(o.Username) { + var ret Field + return ret + } + return *o.Username +} + +// 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() (*Field, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *Properties) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given Field and assigns it to the Username field. +func (o *Properties) SetUsername(v Field) { + o.Username = &v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *Properties) GetRequired() []string { + if o == nil || IsNil(o.Required) { + var ret []string + return ret + } + return o.Required +} + +// 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() ([]string, bool) { + if o == nil || IsNil(o.Required) { + return nil, false + } + return o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *Properties) HasRequired() bool { + if o != nil && !IsNil(o.Required) { + return true + } + + return false +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *Properties) SetRequired(v []string) { + o.Required = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Properties) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Properties) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Properties) SetType(v string) { + o.Type = &v +} + +func (o Properties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Properties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ConfirmPassword) { + toSerialize["ConfirmPassword"] = o.ConfirmPassword + } + if !IsNil(o.Password) { + toSerialize["Password"] = o.Password + } + if !IsNil(o.Script) { + toSerialize["Script"] = o.Script + } + if !IsNil(o.Username) { + toSerialize["Username"] = o.Username + } + if !IsNil(o.Required) { + toSerialize["required"] = o.Required + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + 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) +} diff --git a/services/runcommand/v2betaapi/response.go b/services/runcommand/v2betaapi/response.go new file mode 100644 index 000000000..5f00d25f3 --- /dev/null +++ b/services/runcommand/v2betaapi/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/runcommand/v2betaapi/utils.go b/services/runcommand/v2betaapi/utils.go new file mode 100644 index 000000000..7b78211eb --- /dev/null +++ b/services/runcommand/v2betaapi/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +Contact: support@stackit.de +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2betaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +}