From 6c01c8548455f113a952ef4a28792ac2f6cca9d7 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 10 Jul 2026 14:21:39 +0000 Subject: [PATCH] Generate automation --- go.work | 1 + services/automation/LICENSE.md | 201 ++ services/automation/go.mod | 10 + services/automation/go.sum | 8 + services/automation/oas_commit | 1 + services/automation/package.go | 1 + services/automation/v1betaapi/api_default.go | 1934 +++++++++++++++++ .../automation/v1betaapi/api_default_mock.go | 241 ++ services/automation/v1betaapi/client.go | 659 ++++++ .../automation/v1betaapi/configuration.go | 38 + .../model_automation_schedule_trigger.go | 168 ++ .../v1betaapi/model_automation_triggers.go | 154 ++ .../model_create_snapshots_result.go | 204 ++ .../model_create_volume_automation_payload.go | 315 +++ .../v1betaapi/model_error_info_detail.go | 262 +++ .../v1betaapi/model_error_response.go | 167 ++ .../v1betaapi/model_error_response_content.go | 262 +++ .../model_error_response_content_details.go | 186 ++ .../v1betaapi/model_event_create_response.go | 167 ++ .../v1betaapi/model_generic_input.go | 167 ++ .../v1betaapi/model_get_volume_ids_result.go | 204 ++ .../model_get_volume_template_response.go | 329 +++ .../v1betaapi/model_help_error_detail.go | 225 ++ .../v1betaapi/model_list_automations_item.go | 374 ++++ .../model_list_automations_response.go | 205 ++ .../v1betaapi/model_list_executions_item.go | 263 +++ .../model_list_executions_item_status.go | 120 + .../model_list_executions_response.go | 205 ++ .../model_list_templates_response.go | 205 ++ .../model_localized_message_error_detail.go | 225 ++ ...artial_update_volume_automation_payload.go | 265 +++ .../automation/v1betaapi/model_schedule.go | 191 ++ .../v1betaapi/model_schedule_details.go | 228 ++ .../v1betaapi/model_schedule_patch_request.go | 228 ++ .../v1betaapi/model_schedule_request.go | 233 ++ .../model_snapshot_retention_policy.go | 154 ++ .../model_snapshot_retention_policy_count.go | 196 ++ ...el_snapshot_retention_policy_count_kind.go | 112 + ..._snapshot_retention_policy_indefinitely.go | 167 ++ ...shot_retention_policy_indefinitely_kind.go | 112 + .../automation/v1betaapi/model_template.go | 255 +++ .../v1betaapi/model_volume_automation.go | 448 ++++ .../model_volume_automation_input.go | 154 ++ .../model_volume_execution_automation.go | 419 ++++ .../model_volume_execution_details.go | 204 ++ .../model_volume_execution_output.go | 154 ++ .../model_volume_execution_output_step.go | 270 +++ ...del_volume_execution_output_step_status.go | 118 + .../model_volume_execution_response.go | 300 +++ .../model_volume_execution_response_status.go | 120 + .../v1betaapi/model_volume_output.go | 154 ++ .../v1betaapi/model_volume_output_step.go | 204 ++ .../model_volume_output_step_result.go | 154 ++ ..._volume_recovery_point_management_input.go | 311 +++ .../model_volume_template_automation_input.go | 167 ++ ...l_volume_template_automation_input_kind.go | 112 + services/automation/v1betaapi/response.go | 48 + services/automation/v1betaapi/utils.go | 362 +++ 58 files changed, 13341 insertions(+) create mode 100644 services/automation/LICENSE.md create mode 100644 services/automation/go.mod create mode 100644 services/automation/go.sum create mode 100644 services/automation/oas_commit create mode 100644 services/automation/package.go create mode 100644 services/automation/v1betaapi/api_default.go create mode 100644 services/automation/v1betaapi/api_default_mock.go create mode 100644 services/automation/v1betaapi/client.go create mode 100644 services/automation/v1betaapi/configuration.go create mode 100644 services/automation/v1betaapi/model_automation_schedule_trigger.go create mode 100644 services/automation/v1betaapi/model_automation_triggers.go create mode 100644 services/automation/v1betaapi/model_create_snapshots_result.go create mode 100644 services/automation/v1betaapi/model_create_volume_automation_payload.go create mode 100644 services/automation/v1betaapi/model_error_info_detail.go create mode 100644 services/automation/v1betaapi/model_error_response.go create mode 100644 services/automation/v1betaapi/model_error_response_content.go create mode 100644 services/automation/v1betaapi/model_error_response_content_details.go create mode 100644 services/automation/v1betaapi/model_event_create_response.go create mode 100644 services/automation/v1betaapi/model_generic_input.go create mode 100644 services/automation/v1betaapi/model_get_volume_ids_result.go create mode 100644 services/automation/v1betaapi/model_get_volume_template_response.go create mode 100644 services/automation/v1betaapi/model_help_error_detail.go create mode 100644 services/automation/v1betaapi/model_list_automations_item.go create mode 100644 services/automation/v1betaapi/model_list_automations_response.go create mode 100644 services/automation/v1betaapi/model_list_executions_item.go create mode 100644 services/automation/v1betaapi/model_list_executions_item_status.go create mode 100644 services/automation/v1betaapi/model_list_executions_response.go create mode 100644 services/automation/v1betaapi/model_list_templates_response.go create mode 100644 services/automation/v1betaapi/model_localized_message_error_detail.go create mode 100644 services/automation/v1betaapi/model_partial_update_volume_automation_payload.go create mode 100644 services/automation/v1betaapi/model_schedule.go create mode 100644 services/automation/v1betaapi/model_schedule_details.go create mode 100644 services/automation/v1betaapi/model_schedule_patch_request.go create mode 100644 services/automation/v1betaapi/model_schedule_request.go create mode 100644 services/automation/v1betaapi/model_snapshot_retention_policy.go create mode 100644 services/automation/v1betaapi/model_snapshot_retention_policy_count.go create mode 100644 services/automation/v1betaapi/model_snapshot_retention_policy_count_kind.go create mode 100644 services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely.go create mode 100644 services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely_kind.go create mode 100644 services/automation/v1betaapi/model_template.go create mode 100644 services/automation/v1betaapi/model_volume_automation.go create mode 100644 services/automation/v1betaapi/model_volume_automation_input.go create mode 100644 services/automation/v1betaapi/model_volume_execution_automation.go create mode 100644 services/automation/v1betaapi/model_volume_execution_details.go create mode 100644 services/automation/v1betaapi/model_volume_execution_output.go create mode 100644 services/automation/v1betaapi/model_volume_execution_output_step.go create mode 100644 services/automation/v1betaapi/model_volume_execution_output_step_status.go create mode 100644 services/automation/v1betaapi/model_volume_execution_response.go create mode 100644 services/automation/v1betaapi/model_volume_execution_response_status.go create mode 100644 services/automation/v1betaapi/model_volume_output.go create mode 100644 services/automation/v1betaapi/model_volume_output_step.go create mode 100644 services/automation/v1betaapi/model_volume_output_step_result.go create mode 100644 services/automation/v1betaapi/model_volume_recovery_point_management_input.go create mode 100644 services/automation/v1betaapi/model_volume_template_automation_input.go create mode 100644 services/automation/v1betaapi/model_volume_template_automation_input_kind.go create mode 100644 services/automation/v1betaapi/response.go create mode 100644 services/automation/v1betaapi/utils.go diff --git a/go.work b/go.work index 7c0013e6d..047b2e01a 100644 --- a/go.work +++ b/go.work @@ -45,6 +45,7 @@ use ( ./services/archiving ./services/auditlog ./services/authorization + ./services/automation ./services/cdn ./services/certificates ./services/cost diff --git a/services/automation/LICENSE.md b/services/automation/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/automation/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/services/automation/go.mod b/services/automation/go.mod new file mode 100644 index 000000000..36269fc79 --- /dev/null +++ b/services/automation/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/automation + +go 1.25 + +require github.com/stackitcloud/stackit-sdk-go/core v0.26.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/automation/go.sum b/services/automation/go.sum new file mode 100644 index 000000000..3712a0c87 --- /dev/null +++ b/services/automation/go.sum @@ -0,0 +1,8 @@ +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +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.26.0 h1:jQEb9gkehfp6VCP6TcYk7BI10cz4l0KM2L6hqYBH2QA= +github.com/stackitcloud/stackit-sdk-go/core v0.26.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/automation/oas_commit b/services/automation/oas_commit new file mode 100644 index 000000000..7432e1eed --- /dev/null +++ b/services/automation/oas_commit @@ -0,0 +1 @@ +d7306ee5d2400a8571c390a29df8ffd02428182f diff --git a/services/automation/package.go b/services/automation/package.go new file mode 100644 index 000000000..075d4da06 --- /dev/null +++ b/services/automation/package.go @@ -0,0 +1 @@ +package automation diff --git a/services/automation/v1betaapi/api_default.go b/services/automation/v1betaapi/api_default.go new file mode 100644 index 000000000..74b1a09b1 --- /dev/null +++ b/services/automation/v1betaapi/api_default.go @@ -0,0 +1,1934 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 { + + /* + CreateVolumeAutomation Create volume automation + + Creates a new volume automation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @return ApiCreateVolumeAutomationRequest + */ + CreateVolumeAutomation(ctx context.Context, projectId string, region string) ApiCreateVolumeAutomationRequest + + // CreateVolumeAutomationExecute executes the request + // @return VolumeAutomation + CreateVolumeAutomationExecute(r ApiCreateVolumeAutomationRequest) (*VolumeAutomation, error) + + /* + CreateVolumeExecution Create volume automation executions + + Creates a new execution for a specific volume automation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiCreateVolumeExecutionRequest + */ + CreateVolumeExecution(ctx context.Context, projectId string, region string, automationId string) ApiCreateVolumeExecutionRequest + + // CreateVolumeExecutionExecute executes the request + // @return VolumeExecutionResponse + CreateVolumeExecutionExecute(r ApiCreateVolumeExecutionRequest) (*VolumeExecutionResponse, error) + + /* + DeleteVolumeAutomation Delete volume automation + + Deletes a specific volume automation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiDeleteVolumeAutomationRequest + */ + DeleteVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiDeleteVolumeAutomationRequest + + // DeleteVolumeAutomationExecute executes the request + DeleteVolumeAutomationExecute(r ApiDeleteVolumeAutomationRequest) error + + /* + GetVolumeAutomation Get volume automation + + Retrieves a specific volume automation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiGetVolumeAutomationRequest + */ + GetVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiGetVolumeAutomationRequest + + // GetVolumeAutomationExecute executes the request + // @return VolumeAutomation + GetVolumeAutomationExecute(r ApiGetVolumeAutomationRequest) (*VolumeAutomation, error) + + /* + GetVolumeExecution Get volume automation execution details + + Get details for a specific volume automation execution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @param executionId execution Id + @return ApiGetVolumeExecutionRequest + */ + GetVolumeExecution(ctx context.Context, projectId string, region string, automationId string, executionId string) ApiGetVolumeExecutionRequest + + // GetVolumeExecutionExecute executes the request + // @return VolumeExecutionResponse + GetVolumeExecutionExecute(r ApiGetVolumeExecutionRequest) (*VolumeExecutionResponse, error) + + /* + GetVolumeTemplate Get volume template + + Retrieve detailed information about a volume template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param templateId templateId Id + @return ApiGetVolumeTemplateRequest + */ + GetVolumeTemplate(ctx context.Context, projectId string, region string, templateId string) ApiGetVolumeTemplateRequest + + // GetVolumeTemplateExecute executes the request + // @return GetVolumeTemplateResponse + GetVolumeTemplateExecute(r ApiGetVolumeTemplateRequest) (*GetVolumeTemplateResponse, error) + + /* + ListVolumeAutomations List volume automations + + Retrieves a list of volume automations. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @return ApiListVolumeAutomationsRequest + */ + ListVolumeAutomations(ctx context.Context, projectId string, region string) ApiListVolumeAutomationsRequest + + // ListVolumeAutomationsExecute executes the request + // @return ListAutomationsResponse + ListVolumeAutomationsExecute(r ApiListVolumeAutomationsRequest) (*ListAutomationsResponse, error) + + /* + ListVolumeExecutions List volume automation executions + + Get a list of all executions for a specific volume automation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiListVolumeExecutionsRequest + */ + ListVolumeExecutions(ctx context.Context, projectId string, region string, automationId string) ApiListVolumeExecutionsRequest + + // ListVolumeExecutionsExecute executes the request + // @return ListExecutionsResponse + ListVolumeExecutionsExecute(r ApiListVolumeExecutionsRequest) (*ListExecutionsResponse, error) + + /* + ListVolumeTemplates List volume templates + + Lists all volume templates for the specified service + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @return ApiListVolumeTemplatesRequest + */ + ListVolumeTemplates(ctx context.Context, projectId string, region string) ApiListVolumeTemplatesRequest + + // ListVolumeTemplatesExecute executes the request + // @return ListTemplatesResponse + ListVolumeTemplatesExecute(r ApiListVolumeTemplatesRequest) (*ListTemplatesResponse, error) + + /* + PartialUpdateVolumeAutomation Patch volume automation + + Partially updates a specific volume automation. Specify the fields to update in the `updateMask` query parameter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiPartialUpdateVolumeAutomationRequest + */ + PartialUpdateVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiPartialUpdateVolumeAutomationRequest + + // PartialUpdateVolumeAutomationExecute executes the request + // @return VolumeAutomation + PartialUpdateVolumeAutomationExecute(r ApiPartialUpdateVolumeAutomationRequest) (*VolumeAutomation, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateVolumeAutomationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + createVolumeAutomationPayload *CreateVolumeAutomationPayload +} + +func (r ApiCreateVolumeAutomationRequest) CreateVolumeAutomationPayload(createVolumeAutomationPayload CreateVolumeAutomationPayload) ApiCreateVolumeAutomationRequest { + r.createVolumeAutomationPayload = &createVolumeAutomationPayload + return r +} + +func (r ApiCreateVolumeAutomationRequest) Execute() (*VolumeAutomation, error) { + return r.ApiService.CreateVolumeAutomationExecute(r) +} + +/* +CreateVolumeAutomation Create volume automation + +Creates a new volume automation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @return ApiCreateVolumeAutomationRequest +*/ +func (a *DefaultAPIService) CreateVolumeAutomation(ctx context.Context, projectId string, region string) ApiCreateVolumeAutomationRequest { + return ApiCreateVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return VolumeAutomation +func (a *DefaultAPIService) CreateVolumeAutomationExecute(r ApiCreateVolumeAutomationRequest) (*VolumeAutomation, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAutomation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateVolumeAutomation") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // 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.createVolumeAutomationPayload + 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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiCreateVolumeExecutionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + automationId string +} + +func (r ApiCreateVolumeExecutionRequest) Execute() (*VolumeExecutionResponse, error) { + return r.ApiService.CreateVolumeExecutionExecute(r) +} + +/* +CreateVolumeExecution Create volume automation executions + +Creates a new execution for a specific volume automation + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiCreateVolumeExecutionRequest +*/ +func (a *DefaultAPIService) CreateVolumeExecution(ctx context.Context, projectId string, region string, automationId string) ApiCreateVolumeExecutionRequest { + return ApiCreateVolumeExecutionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// Execute executes the request +// +// @return VolumeExecutionResponse +func (a *DefaultAPIService) CreateVolumeExecutionExecute(r ApiCreateVolumeExecutionRequest) (*VolumeExecutionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeExecutionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateVolumeExecution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/{automationId}/executions" + 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, "{"+"automationId"+"}", url.PathEscape(parameterValueToString(r.automationId, "automationId")), -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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiDeleteVolumeAutomationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + automationId string +} + +func (r ApiDeleteVolumeAutomationRequest) Execute() error { + return r.ApiService.DeleteVolumeAutomationExecute(r) +} + +/* +DeleteVolumeAutomation Delete volume automation + +Deletes a specific volume automation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiDeleteVolumeAutomationRequest +*/ +func (a *DefaultAPIService) DeleteVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiDeleteVolumeAutomationRequest { + return ApiDeleteVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteVolumeAutomationExecute(r ApiDeleteVolumeAutomationRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteVolumeAutomation") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/{automationId}" + 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, "{"+"automationId"+"}", url.PathEscape(parameterValueToString(r.automationId, "automationId")), -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 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 err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return 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 newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return 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 newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return 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 newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetVolumeAutomationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + automationId string +} + +func (r ApiGetVolumeAutomationRequest) Execute() (*VolumeAutomation, error) { + return r.ApiService.GetVolumeAutomationExecute(r) +} + +/* +GetVolumeAutomation Get volume automation + +Retrieves a specific volume automation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiGetVolumeAutomationRequest +*/ +func (a *DefaultAPIService) GetVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiGetVolumeAutomationRequest { + return ApiGetVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// Execute executes the request +// +// @return VolumeAutomation +func (a *DefaultAPIService) GetVolumeAutomationExecute(r ApiGetVolumeAutomationRequest) (*VolumeAutomation, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAutomation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVolumeAutomation") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/{automationId}" + 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, "{"+"automationId"+"}", url.PathEscape(parameterValueToString(r.automationId, "automationId")), -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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiGetVolumeExecutionRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + automationId string + executionId string +} + +func (r ApiGetVolumeExecutionRequest) Execute() (*VolumeExecutionResponse, error) { + return r.ApiService.GetVolumeExecutionExecute(r) +} + +/* +GetVolumeExecution Get volume automation execution details + +Get details for a specific volume automation execution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @param executionId execution Id + @return ApiGetVolumeExecutionRequest +*/ +func (a *DefaultAPIService) GetVolumeExecution(ctx context.Context, projectId string, region string, automationId string, executionId string) ApiGetVolumeExecutionRequest { + return ApiGetVolumeExecutionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + executionId: executionId, + } +} + +// Execute executes the request +// +// @return VolumeExecutionResponse +func (a *DefaultAPIService) GetVolumeExecutionExecute(r ApiGetVolumeExecutionRequest) (*VolumeExecutionResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeExecutionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVolumeExecution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/{automationId}/executions/{executionId}" + 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, "{"+"automationId"+"}", url.PathEscape(parameterValueToString(r.automationId, "automationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"executionId"+"}", url.PathEscape(parameterValueToString(r.executionId, "executionId")), -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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiGetVolumeTemplateRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + templateId string +} + +func (r ApiGetVolumeTemplateRequest) Execute() (*GetVolumeTemplateResponse, error) { + return r.ApiService.GetVolumeTemplateExecute(r) +} + +/* +GetVolumeTemplate Get volume template + +Retrieve detailed information about a volume template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param templateId templateId Id + @return ApiGetVolumeTemplateRequest +*/ +func (a *DefaultAPIService) GetVolumeTemplate(ctx context.Context, projectId string, region string, templateId string) ApiGetVolumeTemplateRequest { + return ApiGetVolumeTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + templateId: templateId, + } +} + +// Execute executes the request +// +// @return GetVolumeTemplateResponse +func (a *DefaultAPIService) GetVolumeTemplateExecute(r ApiGetVolumeTemplateRequest) (*GetVolumeTemplateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetVolumeTemplateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVolumeTemplate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/templates/{templateId}" + 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, "{"+"templateId"+"}", url.PathEscape(parameterValueToString(r.templateId, "templateId")), -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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiListVolumeAutomationsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + pageSize *int32 + pageToken *string +} + +// The maximum number of items to return. If unspecified or set to 0, at most 100 items will be returned. The maximum value is 100; values above 100 will be coerced to 100. +func (r ApiListVolumeAutomationsRequest) PageSize(pageSize int32) ApiListVolumeAutomationsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous list call. Provide this to retrieve the subsequent page. +func (r ApiListVolumeAutomationsRequest) PageToken(pageToken string) ApiListVolumeAutomationsRequest { + r.pageToken = &pageToken + return r +} + +func (r ApiListVolumeAutomationsRequest) Execute() (*ListAutomationsResponse, error) { + return r.ApiService.ListVolumeAutomationsExecute(r) +} + +/* +ListVolumeAutomations List volume automations + +Retrieves a list of volume automations. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @return ApiListVolumeAutomationsRequest +*/ +func (a *DefaultAPIService) ListVolumeAutomations(ctx context.Context, projectId string, region string) ApiListVolumeAutomationsRequest { + return ApiListVolumeAutomationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return ListAutomationsResponse +func (a *DefaultAPIService) ListVolumeAutomationsExecute(r ApiListVolumeAutomationsRequest) (*ListAutomationsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListAutomationsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListVolumeAutomations") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 100 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiListVolumeExecutionsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + automationId string + pageSize *int32 + pageToken *string +} + +// The maximum number of items to return. If unspecified or set to 0, at most 100 items will be returned. The maximum value is 100; values above 100 will be coerced to 100. +func (r ApiListVolumeExecutionsRequest) PageSize(pageSize int32) ApiListVolumeExecutionsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous list call. Provide this to retrieve the subsequent page. +func (r ApiListVolumeExecutionsRequest) PageToken(pageToken string) ApiListVolumeExecutionsRequest { + r.pageToken = &pageToken + return r +} + +func (r ApiListVolumeExecutionsRequest) Execute() (*ListExecutionsResponse, error) { + return r.ApiService.ListVolumeExecutionsExecute(r) +} + +/* +ListVolumeExecutions List volume automation executions + +Get a list of all executions for a specific volume automation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiListVolumeExecutionsRequest +*/ +func (a *DefaultAPIService) ListVolumeExecutions(ctx context.Context, projectId string, region string, automationId string) ApiListVolumeExecutionsRequest { + return ApiListVolumeExecutionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// Execute executes the request +// +// @return ListExecutionsResponse +func (a *DefaultAPIService) ListVolumeExecutionsExecute(r ApiListVolumeExecutionsRequest) (*ListExecutionsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListExecutionsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListVolumeExecutions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/{automationId}/executions" + 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, "{"+"automationId"+"}", url.PathEscape(parameterValueToString(r.automationId, "automationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 100 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiListVolumeTemplatesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + pageSize *int32 + pageToken *string +} + +// The maximum number of items to return. If unspecified or set to 0, at most 100 items will be returned. The maximum value is 100; values above 100 will be coerced to 100. +func (r ApiListVolumeTemplatesRequest) PageSize(pageSize int32) ApiListVolumeTemplatesRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous list call. Provide this to retrieve the subsequent page. +func (r ApiListVolumeTemplatesRequest) PageToken(pageToken string) ApiListVolumeTemplatesRequest { + r.pageToken = &pageToken + return r +} + +func (r ApiListVolumeTemplatesRequest) Execute() (*ListTemplatesResponse, error) { + return r.ApiService.ListVolumeTemplatesExecute(r) +} + +/* +ListVolumeTemplates List volume templates + +Lists all volume templates for the specified service + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @return ApiListVolumeTemplatesRequest +*/ +func (a *DefaultAPIService) ListVolumeTemplates(ctx context.Context, projectId string, region string) ApiListVolumeTemplatesRequest { + return ApiListVolumeTemplatesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return ListTemplatesResponse +func (a *DefaultAPIService) ListVolumeTemplatesExecute(r ApiListVolumeTemplatesRequest) (*ListTemplatesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListTemplatesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListVolumeTemplates") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/templates" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 100 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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 ApiPartialUpdateVolumeAutomationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + automationId string + updateMask *string + partialUpdateVolumeAutomationPayload *PartialUpdateVolumeAutomationPayload +} + +// A comma-separated list of fully qualified names of fields to be updated. Example: \"name,triggers.schedule.rrule\" +func (r ApiPartialUpdateVolumeAutomationRequest) UpdateMask(updateMask string) ApiPartialUpdateVolumeAutomationRequest { + r.updateMask = &updateMask + return r +} + +func (r ApiPartialUpdateVolumeAutomationRequest) PartialUpdateVolumeAutomationPayload(partialUpdateVolumeAutomationPayload PartialUpdateVolumeAutomationPayload) ApiPartialUpdateVolumeAutomationRequest { + r.partialUpdateVolumeAutomationPayload = &partialUpdateVolumeAutomationPayload + return r +} + +func (r ApiPartialUpdateVolumeAutomationRequest) Execute() (*VolumeAutomation, error) { + return r.ApiService.PartialUpdateVolumeAutomationExecute(r) +} + +/* +PartialUpdateVolumeAutomation Patch volume automation + +Partially updates a specific volume automation. Specify the fields to update in the `updateMask` query parameter. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project Id + @param region region + @param automationId automation Id + @return ApiPartialUpdateVolumeAutomationRequest +*/ +func (a *DefaultAPIService) PartialUpdateVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiPartialUpdateVolumeAutomationRequest { + return ApiPartialUpdateVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// Execute executes the request +// +// @return VolumeAutomation +func (a *DefaultAPIService) PartialUpdateVolumeAutomationExecute(r ApiPartialUpdateVolumeAutomationRequest) (*VolumeAutomation, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAutomation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.PartialUpdateVolumeAutomation") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/services/volumes/automations/{automationId}" + 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, "{"+"automationId"+"}", url.PathEscape(parameterValueToString(r.automationId, "automationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateMask == nil { + return localVarReturnValue, reportError("updateMask is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "updateMask", r.updateMask, "form", "") + // 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.partialUpdateVolumeAutomationPayload + 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 + } + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + 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 + } + + 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/automation/v1betaapi/api_default_mock.go b/services/automation/v1betaapi/api_default_mock.go new file mode 100644 index 000000000..153a98703 --- /dev/null +++ b/services/automation/v1betaapi/api_default_mock.go @@ -0,0 +1,241 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 { + // CreateVolumeAutomationExecuteMock can be populated to implement the behavior of the CreateVolumeAutomationExecute function of this mock + CreateVolumeAutomationExecuteMock *func(r ApiCreateVolumeAutomationRequest) (*VolumeAutomation, error) + // CreateVolumeExecutionExecuteMock can be populated to implement the behavior of the CreateVolumeExecutionExecute function of this mock + CreateVolumeExecutionExecuteMock *func(r ApiCreateVolumeExecutionRequest) (*VolumeExecutionResponse, error) + // DeleteVolumeAutomationExecuteMock can be populated to implement the behavior of the DeleteVolumeAutomationExecute function of this mock + DeleteVolumeAutomationExecuteMock *func(r ApiDeleteVolumeAutomationRequest) error + // GetVolumeAutomationExecuteMock can be populated to implement the behavior of the GetVolumeAutomationExecute function of this mock + GetVolumeAutomationExecuteMock *func(r ApiGetVolumeAutomationRequest) (*VolumeAutomation, error) + // GetVolumeExecutionExecuteMock can be populated to implement the behavior of the GetVolumeExecutionExecute function of this mock + GetVolumeExecutionExecuteMock *func(r ApiGetVolumeExecutionRequest) (*VolumeExecutionResponse, error) + // GetVolumeTemplateExecuteMock can be populated to implement the behavior of the GetVolumeTemplateExecute function of this mock + GetVolumeTemplateExecuteMock *func(r ApiGetVolumeTemplateRequest) (*GetVolumeTemplateResponse, error) + // ListVolumeAutomationsExecuteMock can be populated to implement the behavior of the ListVolumeAutomationsExecute function of this mock + ListVolumeAutomationsExecuteMock *func(r ApiListVolumeAutomationsRequest) (*ListAutomationsResponse, error) + // ListVolumeExecutionsExecuteMock can be populated to implement the behavior of the ListVolumeExecutionsExecute function of this mock + ListVolumeExecutionsExecuteMock *func(r ApiListVolumeExecutionsRequest) (*ListExecutionsResponse, error) + // ListVolumeTemplatesExecuteMock can be populated to implement the behavior of the ListVolumeTemplatesExecute function of this mock + ListVolumeTemplatesExecuteMock *func(r ApiListVolumeTemplatesRequest) (*ListTemplatesResponse, error) + // PartialUpdateVolumeAutomationExecuteMock can be populated to implement the behavior of the PartialUpdateVolumeAutomationExecute function of this mock + PartialUpdateVolumeAutomationExecuteMock *func(r ApiPartialUpdateVolumeAutomationRequest) (*VolumeAutomation, error) +} + +func (a DefaultAPIServiceMock) CreateVolumeAutomation(ctx context.Context, projectId string, region string) ApiCreateVolumeAutomationRequest { + return ApiCreateVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// CreateVolumeAutomationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateVolumeAutomationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateVolumeAutomationExecute(r ApiCreateVolumeAutomationRequest) (*VolumeAutomation, error) { + if a.CreateVolumeAutomationExecuteMock == nil { + var localVarReturnValue *VolumeAutomation + return localVarReturnValue, nil + } + + return (*a.CreateVolumeAutomationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateVolumeExecution(ctx context.Context, projectId string, region string, automationId string) ApiCreateVolumeExecutionRequest { + return ApiCreateVolumeExecutionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// CreateVolumeExecutionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateVolumeExecutionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateVolumeExecutionExecute(r ApiCreateVolumeExecutionRequest) (*VolumeExecutionResponse, error) { + if a.CreateVolumeExecutionExecuteMock == nil { + var localVarReturnValue *VolumeExecutionResponse + return localVarReturnValue, nil + } + + return (*a.CreateVolumeExecutionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiDeleteVolumeAutomationRequest { + return ApiDeleteVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// DeleteVolumeAutomationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteVolumeAutomationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteVolumeAutomationExecute(r ApiDeleteVolumeAutomationRequest) error { + if a.DeleteVolumeAutomationExecuteMock == nil { + return nil + } + + return (*a.DeleteVolumeAutomationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiGetVolumeAutomationRequest { + return ApiGetVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// GetVolumeAutomationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVolumeAutomationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetVolumeAutomationExecute(r ApiGetVolumeAutomationRequest) (*VolumeAutomation, error) { + if a.GetVolumeAutomationExecuteMock == nil { + var localVarReturnValue *VolumeAutomation + return localVarReturnValue, nil + } + + return (*a.GetVolumeAutomationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetVolumeExecution(ctx context.Context, projectId string, region string, automationId string, executionId string) ApiGetVolumeExecutionRequest { + return ApiGetVolumeExecutionRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + executionId: executionId, + } +} + +// GetVolumeExecutionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVolumeExecutionExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetVolumeExecutionExecute(r ApiGetVolumeExecutionRequest) (*VolumeExecutionResponse, error) { + if a.GetVolumeExecutionExecuteMock == nil { + var localVarReturnValue *VolumeExecutionResponse + return localVarReturnValue, nil + } + + return (*a.GetVolumeExecutionExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetVolumeTemplate(ctx context.Context, projectId string, region string, templateId string) ApiGetVolumeTemplateRequest { + return ApiGetVolumeTemplateRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + templateId: templateId, + } +} + +// GetVolumeTemplateExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVolumeTemplateExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetVolumeTemplateExecute(r ApiGetVolumeTemplateRequest) (*GetVolumeTemplateResponse, error) { + if a.GetVolumeTemplateExecuteMock == nil { + var localVarReturnValue *GetVolumeTemplateResponse + return localVarReturnValue, nil + } + + return (*a.GetVolumeTemplateExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListVolumeAutomations(ctx context.Context, projectId string, region string) ApiListVolumeAutomationsRequest { + return ApiListVolumeAutomationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// ListVolumeAutomationsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListVolumeAutomationsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListVolumeAutomationsExecute(r ApiListVolumeAutomationsRequest) (*ListAutomationsResponse, error) { + if a.ListVolumeAutomationsExecuteMock == nil { + var localVarReturnValue *ListAutomationsResponse + return localVarReturnValue, nil + } + + return (*a.ListVolumeAutomationsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListVolumeExecutions(ctx context.Context, projectId string, region string, automationId string) ApiListVolumeExecutionsRequest { + return ApiListVolumeExecutionsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// ListVolumeExecutionsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListVolumeExecutionsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListVolumeExecutionsExecute(r ApiListVolumeExecutionsRequest) (*ListExecutionsResponse, error) { + if a.ListVolumeExecutionsExecuteMock == nil { + var localVarReturnValue *ListExecutionsResponse + return localVarReturnValue, nil + } + + return (*a.ListVolumeExecutionsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListVolumeTemplates(ctx context.Context, projectId string, region string) ApiListVolumeTemplatesRequest { + return ApiListVolumeTemplatesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// ListVolumeTemplatesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListVolumeTemplatesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListVolumeTemplatesExecute(r ApiListVolumeTemplatesRequest) (*ListTemplatesResponse, error) { + if a.ListVolumeTemplatesExecuteMock == nil { + var localVarReturnValue *ListTemplatesResponse + return localVarReturnValue, nil + } + + return (*a.ListVolumeTemplatesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) PartialUpdateVolumeAutomation(ctx context.Context, projectId string, region string, automationId string) ApiPartialUpdateVolumeAutomationRequest { + return ApiPartialUpdateVolumeAutomationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + automationId: automationId, + } +} + +// PartialUpdateVolumeAutomationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the PartialUpdateVolumeAutomationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) PartialUpdateVolumeAutomationExecute(r ApiPartialUpdateVolumeAutomationRequest) (*VolumeAutomation, error) { + if a.PartialUpdateVolumeAutomationExecuteMock == nil { + var localVarReturnValue *VolumeAutomation + return localVarReturnValue, nil + } + + return (*a.PartialUpdateVolumeAutomationExecuteMock)(r) +} diff --git a/services/automation/v1betaapi/client.go b/services/automation/v1betaapi/client.go new file mode 100644 index 000000000..8b5871a25 --- /dev/null +++ b/services/automation/v1betaapi/client.go @@ -0,0 +1,659 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 Automation 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/automation/v1betaapi/configuration.go b/services/automation/v1betaapi/configuration.go new file mode 100644 index 000000000..c47797f81 --- /dev/null +++ b/services/automation/v1betaapi/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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/automation", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://automation-service.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/automation/v1betaapi/model_automation_schedule_trigger.go b/services/automation/v1betaapi/model_automation_schedule_trigger.go new file mode 100644 index 000000000..215857a10 --- /dev/null +++ b/services/automation/v1betaapi/model_automation_schedule_trigger.go @@ -0,0 +1,168 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the AutomationScheduleTrigger type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AutomationScheduleTrigger{} + +// AutomationScheduleTrigger struct for AutomationScheduleTrigger +type AutomationScheduleTrigger struct { + // An rrule (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates + Rrule string `json:"rrule"` + AdditionalProperties map[string]interface{} +} + +type _AutomationScheduleTrigger AutomationScheduleTrigger + +// NewAutomationScheduleTrigger instantiates a new AutomationScheduleTrigger 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 NewAutomationScheduleTrigger(rrule string) *AutomationScheduleTrigger { + this := AutomationScheduleTrigger{} + this.Rrule = rrule + return &this +} + +// NewAutomationScheduleTriggerWithDefaults instantiates a new AutomationScheduleTrigger 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 NewAutomationScheduleTriggerWithDefaults() *AutomationScheduleTrigger { + this := AutomationScheduleTrigger{} + return &this +} + +// GetRrule returns the Rrule field value +func (o *AutomationScheduleTrigger) GetRrule() string { + if o == nil { + var ret string + return ret + } + + return o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value +// and a boolean to check if the value has been set. +func (o *AutomationScheduleTrigger) GetRruleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Rrule, true +} + +// SetRrule sets field value +func (o *AutomationScheduleTrigger) SetRrule(v string) { + o.Rrule = v +} + +func (o AutomationScheduleTrigger) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AutomationScheduleTrigger) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["rrule"] = o.Rrule + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AutomationScheduleTrigger) 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{ + "rrule", + } + + 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) + } + } + + varAutomationScheduleTrigger := _AutomationScheduleTrigger{} + + err = json.Unmarshal(data, &varAutomationScheduleTrigger) + + if err != nil { + return err + } + + *o = AutomationScheduleTrigger(varAutomationScheduleTrigger) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rrule") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAutomationScheduleTrigger struct { + value *AutomationScheduleTrigger + isSet bool +} + +func (v NullableAutomationScheduleTrigger) Get() *AutomationScheduleTrigger { + return v.value +} + +func (v *NullableAutomationScheduleTrigger) Set(val *AutomationScheduleTrigger) { + v.value = val + v.isSet = true +} + +func (v NullableAutomationScheduleTrigger) IsSet() bool { + return v.isSet +} + +func (v *NullableAutomationScheduleTrigger) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAutomationScheduleTrigger(val *AutomationScheduleTrigger) *NullableAutomationScheduleTrigger { + return &NullableAutomationScheduleTrigger{value: val, isSet: true} +} + +func (v NullableAutomationScheduleTrigger) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAutomationScheduleTrigger) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_automation_triggers.go b/services/automation/v1betaapi/model_automation_triggers.go new file mode 100644 index 000000000..81872cabf --- /dev/null +++ b/services/automation/v1betaapi/model_automation_triggers.go @@ -0,0 +1,154 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 AutomationTriggers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AutomationTriggers{} + +// AutomationTriggers struct for AutomationTriggers +type AutomationTriggers struct { + Schedule *AutomationScheduleTrigger `json:"schedule,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AutomationTriggers AutomationTriggers + +// NewAutomationTriggers instantiates a new AutomationTriggers 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 NewAutomationTriggers() *AutomationTriggers { + this := AutomationTriggers{} + return &this +} + +// NewAutomationTriggersWithDefaults instantiates a new AutomationTriggers 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 NewAutomationTriggersWithDefaults() *AutomationTriggers { + this := AutomationTriggers{} + return &this +} + +// GetSchedule returns the Schedule field value if set, zero value otherwise. +func (o *AutomationTriggers) GetSchedule() AutomationScheduleTrigger { + if o == nil || IsNil(o.Schedule) { + var ret AutomationScheduleTrigger + return ret + } + return *o.Schedule +} + +// GetScheduleOk returns a tuple with the Schedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutomationTriggers) GetScheduleOk() (*AutomationScheduleTrigger, bool) { + if o == nil || IsNil(o.Schedule) { + return nil, false + } + return o.Schedule, true +} + +// HasSchedule returns a boolean if a field has been set. +func (o *AutomationTriggers) HasSchedule() bool { + if o != nil && !IsNil(o.Schedule) { + return true + } + + return false +} + +// SetSchedule gets a reference to the given AutomationScheduleTrigger and assigns it to the Schedule field. +func (o *AutomationTriggers) SetSchedule(v AutomationScheduleTrigger) { + o.Schedule = &v +} + +func (o AutomationTriggers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AutomationTriggers) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Schedule) { + toSerialize["schedule"] = o.Schedule + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AutomationTriggers) UnmarshalJSON(data []byte) (err error) { + varAutomationTriggers := _AutomationTriggers{} + + err = json.Unmarshal(data, &varAutomationTriggers) + + if err != nil { + return err + } + + *o = AutomationTriggers(varAutomationTriggers) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "schedule") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAutomationTriggers struct { + value *AutomationTriggers + isSet bool +} + +func (v NullableAutomationTriggers) Get() *AutomationTriggers { + return v.value +} + +func (v *NullableAutomationTriggers) Set(val *AutomationTriggers) { + v.value = val + v.isSet = true +} + +func (v NullableAutomationTriggers) IsSet() bool { + return v.isSet +} + +func (v *NullableAutomationTriggers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAutomationTriggers(val *AutomationTriggers) *NullableAutomationTriggers { + return &NullableAutomationTriggers{value: val, isSet: true} +} + +func (v NullableAutomationTriggers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAutomationTriggers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_create_snapshots_result.go b/services/automation/v1betaapi/model_create_snapshots_result.go new file mode 100644 index 000000000..28b35ca00 --- /dev/null +++ b/services/automation/v1betaapi/model_create_snapshots_result.go @@ -0,0 +1,204 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the CreateSnapshotsResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSnapshotsResult{} + +// CreateSnapshotsResult struct for CreateSnapshotsResult +type CreateSnapshotsResult struct { + CreatedSnapshotIDs []string `json:"createdSnapshotIDs,omitempty"` + Kind string `json:"kind"` + AdditionalProperties map[string]interface{} +} + +type _CreateSnapshotsResult CreateSnapshotsResult + +// NewCreateSnapshotsResult instantiates a new CreateSnapshotsResult 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 NewCreateSnapshotsResult(kind string) *CreateSnapshotsResult { + this := CreateSnapshotsResult{} + this.Kind = kind + return &this +} + +// NewCreateSnapshotsResultWithDefaults instantiates a new CreateSnapshotsResult 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 NewCreateSnapshotsResultWithDefaults() *CreateSnapshotsResult { + this := CreateSnapshotsResult{} + return &this +} + +// GetCreatedSnapshotIDs returns the CreatedSnapshotIDs field value if set, zero value otherwise. +func (o *CreateSnapshotsResult) GetCreatedSnapshotIDs() []string { + if o == nil || IsNil(o.CreatedSnapshotIDs) { + var ret []string + return ret + } + return o.CreatedSnapshotIDs +} + +// GetCreatedSnapshotIDsOk returns a tuple with the CreatedSnapshotIDs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotsResult) GetCreatedSnapshotIDsOk() ([]string, bool) { + if o == nil || IsNil(o.CreatedSnapshotIDs) { + return nil, false + } + return o.CreatedSnapshotIDs, true +} + +// HasCreatedSnapshotIDs returns a boolean if a field has been set. +func (o *CreateSnapshotsResult) HasCreatedSnapshotIDs() bool { + if o != nil && !IsNil(o.CreatedSnapshotIDs) { + return true + } + + return false +} + +// SetCreatedSnapshotIDs gets a reference to the given []string and assigns it to the CreatedSnapshotIDs field. +func (o *CreateSnapshotsResult) SetCreatedSnapshotIDs(v []string) { + o.CreatedSnapshotIDs = v +} + +// GetKind returns the Kind field value +func (o *CreateSnapshotsResult) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *CreateSnapshotsResult) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *CreateSnapshotsResult) SetKind(v string) { + o.Kind = v +} + +func (o CreateSnapshotsResult) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSnapshotsResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CreatedSnapshotIDs) { + toSerialize["createdSnapshotIDs"] = o.CreatedSnapshotIDs + } + toSerialize["kind"] = o.Kind + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateSnapshotsResult) 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{ + "kind", + } + + 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) + } + } + + varCreateSnapshotsResult := _CreateSnapshotsResult{} + + err = json.Unmarshal(data, &varCreateSnapshotsResult) + + if err != nil { + return err + } + + *o = CreateSnapshotsResult(varCreateSnapshotsResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createdSnapshotIDs") + delete(additionalProperties, "kind") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateSnapshotsResult struct { + value *CreateSnapshotsResult + isSet bool +} + +func (v NullableCreateSnapshotsResult) Get() *CreateSnapshotsResult { + return v.value +} + +func (v *NullableCreateSnapshotsResult) Set(val *CreateSnapshotsResult) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSnapshotsResult) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSnapshotsResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSnapshotsResult(val *CreateSnapshotsResult) *NullableCreateSnapshotsResult { + return &NullableCreateSnapshotsResult{value: val, isSet: true} +} + +func (v NullableCreateSnapshotsResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSnapshotsResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_create_volume_automation_payload.go b/services/automation/v1betaapi/model_create_volume_automation_payload.go new file mode 100644 index 000000000..57420e016 --- /dev/null +++ b/services/automation/v1betaapi/model_create_volume_automation_payload.go @@ -0,0 +1,315 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the CreateVolumeAutomationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumeAutomationPayload{} + +// CreateVolumeAutomationPayload struct for CreateVolumeAutomationPayload +type CreateVolumeAutomationPayload struct { + Description *string `json:"description,omitempty"` + Input *VolumeAutomationInput `json:"input,omitempty"` + Name *string `json:"name,omitempty"` + TemplateId string `json:"templateId"` + Triggers *AutomationTriggers `json:"triggers,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateVolumeAutomationPayload CreateVolumeAutomationPayload + +// NewCreateVolumeAutomationPayload instantiates a new CreateVolumeAutomationPayload 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 NewCreateVolumeAutomationPayload(templateId string) *CreateVolumeAutomationPayload { + this := CreateVolumeAutomationPayload{} + this.TemplateId = templateId + return &this +} + +// NewCreateVolumeAutomationPayloadWithDefaults instantiates a new CreateVolumeAutomationPayload 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 NewCreateVolumeAutomationPayloadWithDefaults() *CreateVolumeAutomationPayload { + this := CreateVolumeAutomationPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateVolumeAutomationPayload) 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 *CreateVolumeAutomationPayload) 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 *CreateVolumeAutomationPayload) 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 *CreateVolumeAutomationPayload) SetDescription(v string) { + o.Description = &v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *CreateVolumeAutomationPayload) GetInput() VolumeAutomationInput { + if o == nil || IsNil(o.Input) { + var ret VolumeAutomationInput + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumeAutomationPayload) GetInputOk() (*VolumeAutomationInput, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *CreateVolumeAutomationPayload) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given VolumeAutomationInput and assigns it to the Input field. +func (o *CreateVolumeAutomationPayload) SetInput(v VolumeAutomationInput) { + o.Input = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateVolumeAutomationPayload) 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 *CreateVolumeAutomationPayload) 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 *CreateVolumeAutomationPayload) 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 *CreateVolumeAutomationPayload) SetName(v string) { + o.Name = &v +} + +// GetTemplateId returns the TemplateId field value +func (o *CreateVolumeAutomationPayload) GetTemplateId() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value +// and a boolean to check if the value has been set. +func (o *CreateVolumeAutomationPayload) GetTemplateIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateId, true +} + +// SetTemplateId sets field value +func (o *CreateVolumeAutomationPayload) SetTemplateId(v string) { + o.TemplateId = v +} + +// GetTriggers returns the Triggers field value if set, zero value otherwise. +func (o *CreateVolumeAutomationPayload) GetTriggers() AutomationTriggers { + if o == nil || IsNil(o.Triggers) { + var ret AutomationTriggers + return ret + } + return *o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumeAutomationPayload) GetTriggersOk() (*AutomationTriggers, bool) { + if o == nil || IsNil(o.Triggers) { + return nil, false + } + return o.Triggers, true +} + +// HasTriggers returns a boolean if a field has been set. +func (o *CreateVolumeAutomationPayload) HasTriggers() bool { + if o != nil && !IsNil(o.Triggers) { + return true + } + + return false +} + +// SetTriggers gets a reference to the given AutomationTriggers and assigns it to the Triggers field. +func (o *CreateVolumeAutomationPayload) SetTriggers(v AutomationTriggers) { + o.Triggers = &v +} + +func (o CreateVolumeAutomationPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateVolumeAutomationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["templateId"] = o.TemplateId + if !IsNil(o.Triggers) { + toSerialize["triggers"] = o.Triggers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateVolumeAutomationPayload) 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{ + "templateId", + } + + 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) + } + } + + varCreateVolumeAutomationPayload := _CreateVolumeAutomationPayload{} + + err = json.Unmarshal(data, &varCreateVolumeAutomationPayload) + + if err != nil { + return err + } + + *o = CreateVolumeAutomationPayload(varCreateVolumeAutomationPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "input") + delete(additionalProperties, "name") + delete(additionalProperties, "templateId") + delete(additionalProperties, "triggers") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateVolumeAutomationPayload struct { + value *CreateVolumeAutomationPayload + isSet bool +} + +func (v NullableCreateVolumeAutomationPayload) Get() *CreateVolumeAutomationPayload { + return v.value +} + +func (v *NullableCreateVolumeAutomationPayload) Set(val *CreateVolumeAutomationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumeAutomationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumeAutomationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumeAutomationPayload(val *CreateVolumeAutomationPayload) *NullableCreateVolumeAutomationPayload { + return &NullableCreateVolumeAutomationPayload{value: val, isSet: true} +} + +func (v NullableCreateVolumeAutomationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumeAutomationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_error_info_detail.go b/services/automation/v1betaapi/model_error_info_detail.go new file mode 100644 index 000000000..ae00fb46f --- /dev/null +++ b/services/automation/v1betaapi/model_error_info_detail.go @@ -0,0 +1,262 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ErrorInfoDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorInfoDetail{} + +// ErrorInfoDetail struct for ErrorInfoDetail +type ErrorInfoDetail struct { + Type string `json:"@type"` + Domain string `json:"domain"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Reason string `json:"reason"` + AdditionalProperties map[string]interface{} +} + +type _ErrorInfoDetail ErrorInfoDetail + +// NewErrorInfoDetail instantiates a new ErrorInfoDetail 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 NewErrorInfoDetail(types string, domain string, reason string) *ErrorInfoDetail { + this := ErrorInfoDetail{} + this.Type = types + this.Domain = domain + this.Reason = reason + return &this +} + +// NewErrorInfoDetailWithDefaults instantiates a new ErrorInfoDetail 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 NewErrorInfoDetailWithDefaults() *ErrorInfoDetail { + this := ErrorInfoDetail{} + return &this +} + +// GetType returns the Type field value +func (o *ErrorInfoDetail) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ErrorInfoDetail) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ErrorInfoDetail) SetType(v string) { + o.Type = v +} + +// GetDomain returns the Domain field value +func (o *ErrorInfoDetail) GetDomain() string { + if o == nil { + var ret string + return ret + } + + return o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +func (o *ErrorInfoDetail) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Domain, true +} + +// SetDomain sets field value +func (o *ErrorInfoDetail) SetDomain(v string) { + o.Domain = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *ErrorInfoDetail) GetMetadata() map[string]interface{} { + if o == nil || IsNil(o.Metadata) { + var ret map[string]interface{} + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorInfoDetail) GetMetadataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Metadata) { + return map[string]interface{}{}, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *ErrorInfoDetail) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *ErrorInfoDetail) SetMetadata(v map[string]interface{}) { + o.Metadata = v +} + +// GetReason returns the Reason field value +func (o *ErrorInfoDetail) GetReason() string { + if o == nil { + var ret string + return ret + } + + return o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value +// and a boolean to check if the value has been set. +func (o *ErrorInfoDetail) GetReasonOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Reason, true +} + +// SetReason sets field value +func (o *ErrorInfoDetail) SetReason(v string) { + o.Reason = v +} + +func (o ErrorInfoDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorInfoDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["@type"] = o.Type + toSerialize["domain"] = o.Domain + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + toSerialize["reason"] = o.Reason + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ErrorInfoDetail) 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{ + "@type", + "domain", + "reason", + } + + 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) + } + } + + varErrorInfoDetail := _ErrorInfoDetail{} + + err = json.Unmarshal(data, &varErrorInfoDetail) + + if err != nil { + return err + } + + *o = ErrorInfoDetail(varErrorInfoDetail) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "@type") + delete(additionalProperties, "domain") + delete(additionalProperties, "metadata") + delete(additionalProperties, "reason") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableErrorInfoDetail struct { + value *ErrorInfoDetail + isSet bool +} + +func (v NullableErrorInfoDetail) Get() *ErrorInfoDetail { + return v.value +} + +func (v *NullableErrorInfoDetail) Set(val *ErrorInfoDetail) { + v.value = val + v.isSet = true +} + +func (v NullableErrorInfoDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorInfoDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorInfoDetail(val *ErrorInfoDetail) *NullableErrorInfoDetail { + return &NullableErrorInfoDetail{value: val, isSet: true} +} + +func (v NullableErrorInfoDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorInfoDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_error_response.go b/services/automation/v1betaapi/model_error_response.go new file mode 100644 index 000000000..05c3210af --- /dev/null +++ b/services/automation/v1betaapi/model_error_response.go @@ -0,0 +1,167 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + Error ErrorResponseContent `json:"error"` + AdditionalProperties map[string]interface{} +} + +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(error_ ErrorResponseContent) *ErrorResponse { + this := ErrorResponse{} + this.Error = error_ + 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 +} + +// GetError returns the Error field value +func (o *ErrorResponse) GetError() ErrorResponseContent { + if o == nil { + var ret ErrorResponseContent + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetErrorOk() (*ErrorResponseContent, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *ErrorResponse) SetError(v ErrorResponseContent) { + o.Error = 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["error"] = o.Error + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + 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{ + "error", + } + + 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{} + + err = json.Unmarshal(data, &varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + o.AdditionalProperties = additionalProperties + } + + 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/automation/v1betaapi/model_error_response_content.go b/services/automation/v1betaapi/model_error_response_content.go new file mode 100644 index 000000000..415b6adde --- /dev/null +++ b/services/automation/v1betaapi/model_error_response_content.go @@ -0,0 +1,262 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ErrorResponseContent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponseContent{} + +// ErrorResponseContent struct for ErrorResponseContent +type ErrorResponseContent struct { + Code int32 `json:"code"` + Details []ErrorResponseContentDetails `json:"details,omitempty"` + Message string `json:"message"` + Status string `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _ErrorResponseContent ErrorResponseContent + +// NewErrorResponseContent instantiates a new ErrorResponseContent 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 NewErrorResponseContent(code int32, message string, status string) *ErrorResponseContent { + this := ErrorResponseContent{} + this.Code = code + this.Message = message + this.Status = status + return &this +} + +// NewErrorResponseContentWithDefaults instantiates a new ErrorResponseContent 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 NewErrorResponseContentWithDefaults() *ErrorResponseContent { + this := ErrorResponseContent{} + return &this +} + +// GetCode returns the Code field value +func (o *ErrorResponseContent) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *ErrorResponseContent) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *ErrorResponseContent) SetCode(v int32) { + o.Code = v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *ErrorResponseContent) GetDetails() []ErrorResponseContentDetails { + if o == nil || IsNil(o.Details) { + var ret []ErrorResponseContentDetails + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResponseContent) GetDetailsOk() ([]ErrorResponseContentDetails, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *ErrorResponseContent) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given []ErrorResponseContentDetails and assigns it to the Details field. +func (o *ErrorResponseContent) SetDetails(v []ErrorResponseContentDetails) { + o.Details = v +} + +// GetMessage returns the Message field value +func (o *ErrorResponseContent) 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 *ErrorResponseContent) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponseContent) SetMessage(v string) { + o.Message = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponseContent) 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 *ErrorResponseContent) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponseContent) SetStatus(v string) { + o.Status = v +} + +func (o ErrorResponseContent) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponseContent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + toSerialize["message"] = o.Message + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ErrorResponseContent) 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{ + "code", + "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) + } + } + + varErrorResponseContent := _ErrorResponseContent{} + + err = json.Unmarshal(data, &varErrorResponseContent) + + if err != nil { + return err + } + + *o = ErrorResponseContent(varErrorResponseContent) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "details") + delete(additionalProperties, "message") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableErrorResponseContent struct { + value *ErrorResponseContent + isSet bool +} + +func (v NullableErrorResponseContent) Get() *ErrorResponseContent { + return v.value +} + +func (v *NullableErrorResponseContent) Set(val *ErrorResponseContent) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponseContent) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponseContent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponseContent(val *ErrorResponseContent) *NullableErrorResponseContent { + return &NullableErrorResponseContent{value: val, isSet: true} +} + +func (v NullableErrorResponseContent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponseContent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_error_response_content_details.go b/services/automation/v1betaapi/model_error_response_content_details.go new file mode 100644 index 000000000..b01dd74af --- /dev/null +++ b/services/automation/v1betaapi/model_error_response_content_details.go @@ -0,0 +1,186 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// ErrorResponseContentDetails - struct for ErrorResponseContentDetails +type ErrorResponseContentDetails struct { + ErrorInfoDetail *ErrorInfoDetail + HelpErrorDetail *HelpErrorDetail + LocalizedMessageErrorDetail *LocalizedMessageErrorDetail +} + +// ErrorInfoDetailAsErrorResponseContentDetails is a convenience function that returns ErrorInfoDetail wrapped in ErrorResponseContentDetails +func ErrorInfoDetailAsErrorResponseContentDetails(v *ErrorInfoDetail) ErrorResponseContentDetails { + return ErrorResponseContentDetails{ + ErrorInfoDetail: v, + } +} + +// HelpErrorDetailAsErrorResponseContentDetails is a convenience function that returns HelpErrorDetail wrapped in ErrorResponseContentDetails +func HelpErrorDetailAsErrorResponseContentDetails(v *HelpErrorDetail) ErrorResponseContentDetails { + return ErrorResponseContentDetails{ + HelpErrorDetail: v, + } +} + +// LocalizedMessageErrorDetailAsErrorResponseContentDetails is a convenience function that returns LocalizedMessageErrorDetail wrapped in ErrorResponseContentDetails +func LocalizedMessageErrorDetailAsErrorResponseContentDetails(v *LocalizedMessageErrorDetail) ErrorResponseContentDetails { + return ErrorResponseContentDetails{ + LocalizedMessageErrorDetail: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ErrorResponseContentDetails) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'ErrorInfo' + if jsonDict["@type"] == "ErrorInfo" { + // try to unmarshal JSON data into ErrorInfoDetail + err = json.Unmarshal(data, &dst.ErrorInfoDetail) + if err == nil { + return nil // data stored in dst.ErrorInfoDetail, return on the first match + } else { + dst.ErrorInfoDetail = nil + return fmt.Errorf("failed to unmarshal ErrorResponseContentDetails as ErrorInfoDetail: %s", err.Error()) + } + } + + // check if the discriminator value is 'Help' + if jsonDict["@type"] == "Help" { + // try to unmarshal JSON data into HelpErrorDetail + err = json.Unmarshal(data, &dst.HelpErrorDetail) + if err == nil { + return nil // data stored in dst.HelpErrorDetail, return on the first match + } else { + dst.HelpErrorDetail = nil + return fmt.Errorf("failed to unmarshal ErrorResponseContentDetails as HelpErrorDetail: %s", err.Error()) + } + } + + // check if the discriminator value is 'LocalizedMessage' + if jsonDict["@type"] == "LocalizedMessage" { + // try to unmarshal JSON data into LocalizedMessageErrorDetail + err = json.Unmarshal(data, &dst.LocalizedMessageErrorDetail) + if err == nil { + return nil // data stored in dst.LocalizedMessageErrorDetail, return on the first match + } else { + dst.LocalizedMessageErrorDetail = nil + return fmt.Errorf("failed to unmarshal ErrorResponseContentDetails as LocalizedMessageErrorDetail: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ErrorResponseContentDetails) MarshalJSON() ([]byte, error) { + if src.ErrorInfoDetail != nil { + return json.Marshal(&src.ErrorInfoDetail) + } + + if src.HelpErrorDetail != nil { + return json.Marshal(&src.HelpErrorDetail) + } + + if src.LocalizedMessageErrorDetail != nil { + return json.Marshal(&src.LocalizedMessageErrorDetail) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *ErrorResponseContentDetails) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.ErrorInfoDetail != nil { + return obj.ErrorInfoDetail + } + + if obj.HelpErrorDetail != nil { + return obj.HelpErrorDetail + } + + if obj.LocalizedMessageErrorDetail != nil { + return obj.LocalizedMessageErrorDetail + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj ErrorResponseContentDetails) GetActualInstanceValue() interface{} { + if obj.ErrorInfoDetail != nil { + return *obj.ErrorInfoDetail + } + + if obj.HelpErrorDetail != nil { + return *obj.HelpErrorDetail + } + + if obj.LocalizedMessageErrorDetail != nil { + return *obj.LocalizedMessageErrorDetail + } + + // all schemas are nil + return nil +} + +type NullableErrorResponseContentDetails struct { + value *ErrorResponseContentDetails + isSet bool +} + +func (v NullableErrorResponseContentDetails) Get() *ErrorResponseContentDetails { + return v.value +} + +func (v *NullableErrorResponseContentDetails) Set(val *ErrorResponseContentDetails) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponseContentDetails) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponseContentDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponseContentDetails(val *ErrorResponseContentDetails) *NullableErrorResponseContentDetails { + return &NullableErrorResponseContentDetails{value: val, isSet: true} +} + +func (v NullableErrorResponseContentDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponseContentDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_event_create_response.go b/services/automation/v1betaapi/model_event_create_response.go new file mode 100644 index 000000000..fcbbd8458 --- /dev/null +++ b/services/automation/v1betaapi/model_event_create_response.go @@ -0,0 +1,167 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the EventCreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EventCreateResponse{} + +// EventCreateResponse struct for EventCreateResponse +type EventCreateResponse struct { + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _EventCreateResponse EventCreateResponse + +// NewEventCreateResponse instantiates a new EventCreateResponse 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 NewEventCreateResponse(id string) *EventCreateResponse { + this := EventCreateResponse{} + this.Id = id + return &this +} + +// NewEventCreateResponseWithDefaults instantiates a new EventCreateResponse 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 NewEventCreateResponseWithDefaults() *EventCreateResponse { + this := EventCreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *EventCreateResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *EventCreateResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *EventCreateResponse) SetId(v string) { + o.Id = v +} + +func (o EventCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EventCreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *EventCreateResponse) 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{ + "id", + } + + 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) + } + } + + varEventCreateResponse := _EventCreateResponse{} + + err = json.Unmarshal(data, &varEventCreateResponse) + + if err != nil { + return err + } + + *o = EventCreateResponse(varEventCreateResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEventCreateResponse struct { + value *EventCreateResponse + isSet bool +} + +func (v NullableEventCreateResponse) Get() *EventCreateResponse { + return v.value +} + +func (v *NullableEventCreateResponse) Set(val *EventCreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEventCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEventCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEventCreateResponse(val *EventCreateResponse) *NullableEventCreateResponse { + return &NullableEventCreateResponse{value: val, isSet: true} +} + +func (v NullableEventCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEventCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_generic_input.go b/services/automation/v1betaapi/model_generic_input.go new file mode 100644 index 000000000..bbb55bc06 --- /dev/null +++ b/services/automation/v1betaapi/model_generic_input.go @@ -0,0 +1,167 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the GenericInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericInput{} + +// GenericInput struct for GenericInput +type GenericInput struct { + Kind string `json:"kind"` + AdditionalProperties map[string]interface{} +} + +type _GenericInput GenericInput + +// NewGenericInput instantiates a new GenericInput 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 NewGenericInput(kind string) *GenericInput { + this := GenericInput{} + this.Kind = kind + return &this +} + +// NewGenericInputWithDefaults instantiates a new GenericInput 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 NewGenericInputWithDefaults() *GenericInput { + this := GenericInput{} + return &this +} + +// GetKind returns the Kind field value +func (o *GenericInput) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *GenericInput) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *GenericInput) SetKind(v string) { + o.Kind = v +} + +func (o GenericInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GenericInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kind"] = o.Kind + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GenericInput) 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{ + "kind", + } + + 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) + } + } + + varGenericInput := _GenericInput{} + + err = json.Unmarshal(data, &varGenericInput) + + if err != nil { + return err + } + + *o = GenericInput(varGenericInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "kind") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGenericInput struct { + value *GenericInput + isSet bool +} + +func (v NullableGenericInput) Get() *GenericInput { + return v.value +} + +func (v *NullableGenericInput) Set(val *GenericInput) { + v.value = val + v.isSet = true +} + +func (v NullableGenericInput) IsSet() bool { + return v.isSet +} + +func (v *NullableGenericInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGenericInput(val *GenericInput) *NullableGenericInput { + return &NullableGenericInput{value: val, isSet: true} +} + +func (v NullableGenericInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGenericInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_get_volume_ids_result.go b/services/automation/v1betaapi/model_get_volume_ids_result.go new file mode 100644 index 000000000..810bc00b2 --- /dev/null +++ b/services/automation/v1betaapi/model_get_volume_ids_result.go @@ -0,0 +1,204 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the GetVolumeIDsResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetVolumeIDsResult{} + +// GetVolumeIDsResult struct for GetVolumeIDsResult +type GetVolumeIDsResult struct { + Kind string `json:"kind"` + VolumeIDs []string `json:"volumeIDs,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetVolumeIDsResult GetVolumeIDsResult + +// NewGetVolumeIDsResult instantiates a new GetVolumeIDsResult 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 NewGetVolumeIDsResult(kind string) *GetVolumeIDsResult { + this := GetVolumeIDsResult{} + this.Kind = kind + return &this +} + +// NewGetVolumeIDsResultWithDefaults instantiates a new GetVolumeIDsResult 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 NewGetVolumeIDsResultWithDefaults() *GetVolumeIDsResult { + this := GetVolumeIDsResult{} + return &this +} + +// GetKind returns the Kind field value +func (o *GetVolumeIDsResult) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *GetVolumeIDsResult) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *GetVolumeIDsResult) SetKind(v string) { + o.Kind = v +} + +// GetVolumeIDs returns the VolumeIDs field value if set, zero value otherwise. +func (o *GetVolumeIDsResult) GetVolumeIDs() []string { + if o == nil || IsNil(o.VolumeIDs) { + var ret []string + return ret + } + return o.VolumeIDs +} + +// GetVolumeIDsOk returns a tuple with the VolumeIDs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetVolumeIDsResult) GetVolumeIDsOk() ([]string, bool) { + if o == nil || IsNil(o.VolumeIDs) { + return nil, false + } + return o.VolumeIDs, true +} + +// HasVolumeIDs returns a boolean if a field has been set. +func (o *GetVolumeIDsResult) HasVolumeIDs() bool { + if o != nil && !IsNil(o.VolumeIDs) { + return true + } + + return false +} + +// SetVolumeIDs gets a reference to the given []string and assigns it to the VolumeIDs field. +func (o *GetVolumeIDsResult) SetVolumeIDs(v []string) { + o.VolumeIDs = v +} + +func (o GetVolumeIDsResult) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetVolumeIDsResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kind"] = o.Kind + if !IsNil(o.VolumeIDs) { + toSerialize["volumeIDs"] = o.VolumeIDs + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetVolumeIDsResult) 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{ + "kind", + } + + 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) + } + } + + varGetVolumeIDsResult := _GetVolumeIDsResult{} + + err = json.Unmarshal(data, &varGetVolumeIDsResult) + + if err != nil { + return err + } + + *o = GetVolumeIDsResult(varGetVolumeIDsResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "kind") + delete(additionalProperties, "volumeIDs") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetVolumeIDsResult struct { + value *GetVolumeIDsResult + isSet bool +} + +func (v NullableGetVolumeIDsResult) Get() *GetVolumeIDsResult { + return v.value +} + +func (v *NullableGetVolumeIDsResult) Set(val *GetVolumeIDsResult) { + v.value = val + v.isSet = true +} + +func (v NullableGetVolumeIDsResult) IsSet() bool { + return v.isSet +} + +func (v *NullableGetVolumeIDsResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetVolumeIDsResult(val *GetVolumeIDsResult) *NullableGetVolumeIDsResult { + return &NullableGetVolumeIDsResult{value: val, isSet: true} +} + +func (v NullableGetVolumeIDsResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetVolumeIDsResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_get_volume_template_response.go b/services/automation/v1betaapi/model_get_volume_template_response.go new file mode 100644 index 000000000..c1da348cc --- /dev/null +++ b/services/automation/v1betaapi/model_get_volume_template_response.go @@ -0,0 +1,329 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the GetVolumeTemplateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetVolumeTemplateResponse{} + +// GetVolumeTemplateResponse struct for GetVolumeTemplateResponse +type GetVolumeTemplateResponse struct { + CreateTime time.Time `json:"createTime"` + Description string `json:"description"` + Id string `json:"id"` + Input *VolumeTemplateAutomationInput `json:"input,omitempty"` + Name string `json:"name"` + Output *VolumeOutput `json:"output,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GetVolumeTemplateResponse GetVolumeTemplateResponse + +// NewGetVolumeTemplateResponse instantiates a new GetVolumeTemplateResponse 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 NewGetVolumeTemplateResponse(createTime time.Time, description string, id string, name string) *GetVolumeTemplateResponse { + this := GetVolumeTemplateResponse{} + this.CreateTime = createTime + this.Description = description + this.Id = id + this.Name = name + return &this +} + +// NewGetVolumeTemplateResponseWithDefaults instantiates a new GetVolumeTemplateResponse 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 NewGetVolumeTemplateResponseWithDefaults() *GetVolumeTemplateResponse { + this := GetVolumeTemplateResponse{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *GetVolumeTemplateResponse) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *GetVolumeTemplateResponse) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *GetVolumeTemplateResponse) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetDescription returns the Description field value +func (o *GetVolumeTemplateResponse) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *GetVolumeTemplateResponse) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *GetVolumeTemplateResponse) SetDescription(v string) { + o.Description = v +} + +// GetId returns the Id field value +func (o *GetVolumeTemplateResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *GetVolumeTemplateResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *GetVolumeTemplateResponse) SetId(v string) { + o.Id = v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *GetVolumeTemplateResponse) GetInput() VolumeTemplateAutomationInput { + if o == nil || IsNil(o.Input) { + var ret VolumeTemplateAutomationInput + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetVolumeTemplateResponse) GetInputOk() (*VolumeTemplateAutomationInput, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *GetVolumeTemplateResponse) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given VolumeTemplateAutomationInput and assigns it to the Input field. +func (o *GetVolumeTemplateResponse) SetInput(v VolumeTemplateAutomationInput) { + o.Input = &v +} + +// GetName returns the Name field value +func (o *GetVolumeTemplateResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetVolumeTemplateResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetVolumeTemplateResponse) SetName(v string) { + o.Name = v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *GetVolumeTemplateResponse) GetOutput() VolumeOutput { + if o == nil || IsNil(o.Output) { + var ret VolumeOutput + 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 *GetVolumeTemplateResponse) GetOutputOk() (*VolumeOutput, 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 *GetVolumeTemplateResponse) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given VolumeOutput and assigns it to the Output field. +func (o *GetVolumeTemplateResponse) SetOutput(v VolumeOutput) { + o.Output = &v +} + +func (o GetVolumeTemplateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetVolumeTemplateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["createTime"] = o.CreateTime + toSerialize["description"] = o.Description + toSerialize["id"] = o.Id + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + toSerialize["name"] = o.Name + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetVolumeTemplateResponse) 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{ + "createTime", + "description", + "id", + "name", + } + + 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) + } + } + + varGetVolumeTemplateResponse := _GetVolumeTemplateResponse{} + + err = json.Unmarshal(data, &varGetVolumeTemplateResponse) + + if err != nil { + return err + } + + *o = GetVolumeTemplateResponse(varGetVolumeTemplateResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createTime") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "input") + delete(additionalProperties, "name") + delete(additionalProperties, "output") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetVolumeTemplateResponse struct { + value *GetVolumeTemplateResponse + isSet bool +} + +func (v NullableGetVolumeTemplateResponse) Get() *GetVolumeTemplateResponse { + return v.value +} + +func (v *NullableGetVolumeTemplateResponse) Set(val *GetVolumeTemplateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetVolumeTemplateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetVolumeTemplateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetVolumeTemplateResponse(val *GetVolumeTemplateResponse) *NullableGetVolumeTemplateResponse { + return &NullableGetVolumeTemplateResponse{value: val, isSet: true} +} + +func (v NullableGetVolumeTemplateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetVolumeTemplateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_help_error_detail.go b/services/automation/v1betaapi/model_help_error_detail.go new file mode 100644 index 000000000..557754f05 --- /dev/null +++ b/services/automation/v1betaapi/model_help_error_detail.go @@ -0,0 +1,225 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the HelpErrorDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HelpErrorDetail{} + +// HelpErrorDetail struct for HelpErrorDetail +type HelpErrorDetail struct { + Type string `json:"@type"` + Description string `json:"description"` + Url string `json:"url"` + AdditionalProperties map[string]interface{} +} + +type _HelpErrorDetail HelpErrorDetail + +// NewHelpErrorDetail instantiates a new HelpErrorDetail 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 NewHelpErrorDetail(types string, description string, url string) *HelpErrorDetail { + this := HelpErrorDetail{} + this.Type = types + this.Description = description + this.Url = url + return &this +} + +// NewHelpErrorDetailWithDefaults instantiates a new HelpErrorDetail 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 NewHelpErrorDetailWithDefaults() *HelpErrorDetail { + this := HelpErrorDetail{} + return &this +} + +// GetType returns the Type field value +func (o *HelpErrorDetail) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *HelpErrorDetail) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *HelpErrorDetail) SetType(v string) { + o.Type = v +} + +// GetDescription returns the Description field value +func (o *HelpErrorDetail) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *HelpErrorDetail) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *HelpErrorDetail) SetDescription(v string) { + o.Description = v +} + +// GetUrl returns the Url field value +func (o *HelpErrorDetail) GetUrl() string { + if o == nil { + var ret string + return ret + } + + return o.Url +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *HelpErrorDetail) GetUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Url, true +} + +// SetUrl sets field value +func (o *HelpErrorDetail) SetUrl(v string) { + o.Url = v +} + +func (o HelpErrorDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HelpErrorDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["@type"] = o.Type + toSerialize["description"] = o.Description + toSerialize["url"] = o.Url + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *HelpErrorDetail) 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{ + "@type", + "description", + "url", + } + + 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) + } + } + + varHelpErrorDetail := _HelpErrorDetail{} + + err = json.Unmarshal(data, &varHelpErrorDetail) + + if err != nil { + return err + } + + *o = HelpErrorDetail(varHelpErrorDetail) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "@type") + delete(additionalProperties, "description") + delete(additionalProperties, "url") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableHelpErrorDetail struct { + value *HelpErrorDetail + isSet bool +} + +func (v NullableHelpErrorDetail) Get() *HelpErrorDetail { + return v.value +} + +func (v *NullableHelpErrorDetail) Set(val *HelpErrorDetail) { + v.value = val + v.isSet = true +} + +func (v NullableHelpErrorDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableHelpErrorDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHelpErrorDetail(val *HelpErrorDetail) *NullableHelpErrorDetail { + return &NullableHelpErrorDetail{value: val, isSet: true} +} + +func (v NullableHelpErrorDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHelpErrorDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_list_automations_item.go b/services/automation/v1betaapi/model_list_automations_item.go new file mode 100644 index 000000000..6177f0bcc --- /dev/null +++ b/services/automation/v1betaapi/model_list_automations_item.go @@ -0,0 +1,374 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the ListAutomationsItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListAutomationsItem{} + +// ListAutomationsItem struct for ListAutomationsItem +type ListAutomationsItem struct { + CreateTime time.Time `json:"createTime"` + Description *string `json:"description,omitempty"` + Id string `json:"id"` + Name *string `json:"name,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + Triggers *AutomationTriggers `json:"triggers,omitempty"` + UpdateTime time.Time `json:"updateTime"` + AdditionalProperties map[string]interface{} +} + +type _ListAutomationsItem ListAutomationsItem + +// NewListAutomationsItem instantiates a new ListAutomationsItem 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 NewListAutomationsItem(createTime time.Time, id string, updateTime time.Time) *ListAutomationsItem { + this := ListAutomationsItem{} + this.CreateTime = createTime + this.Id = id + this.UpdateTime = updateTime + return &this +} + +// NewListAutomationsItemWithDefaults instantiates a new ListAutomationsItem 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 NewListAutomationsItemWithDefaults() *ListAutomationsItem { + this := ListAutomationsItem{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *ListAutomationsItem) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *ListAutomationsItem) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *ListAutomationsItem) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *ListAutomationsItem) 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 *ListAutomationsItem) 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 *ListAutomationsItem) 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 *ListAutomationsItem) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value +func (o *ListAutomationsItem) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ListAutomationsItem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ListAutomationsItem) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ListAutomationsItem) 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 *ListAutomationsItem) 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 *ListAutomationsItem) 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 *ListAutomationsItem) SetName(v string) { + o.Name = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *ListAutomationsItem) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAutomationsItem) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *ListAutomationsItem) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *ListAutomationsItem) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetTriggers returns the Triggers field value if set, zero value otherwise. +func (o *ListAutomationsItem) GetTriggers() AutomationTriggers { + if o == nil || IsNil(o.Triggers) { + var ret AutomationTriggers + return ret + } + return *o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAutomationsItem) GetTriggersOk() (*AutomationTriggers, bool) { + if o == nil || IsNil(o.Triggers) { + return nil, false + } + return o.Triggers, true +} + +// HasTriggers returns a boolean if a field has been set. +func (o *ListAutomationsItem) HasTriggers() bool { + if o != nil && !IsNil(o.Triggers) { + return true + } + + return false +} + +// SetTriggers gets a reference to the given AutomationTriggers and assigns it to the Triggers field. +func (o *ListAutomationsItem) SetTriggers(v AutomationTriggers) { + o.Triggers = &v +} + +// GetUpdateTime returns the UpdateTime field value +func (o *ListAutomationsItem) GetUpdateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdateTime +} + +// GetUpdateTimeOk returns a tuple with the UpdateTime field value +// and a boolean to check if the value has been set. +func (o *ListAutomationsItem) GetUpdateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdateTime, true +} + +// SetUpdateTime sets field value +func (o *ListAutomationsItem) SetUpdateTime(v time.Time) { + o.UpdateTime = v +} + +func (o ListAutomationsItem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListAutomationsItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["createTime"] = o.CreateTime + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["id"] = o.Id + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + if !IsNil(o.Triggers) { + toSerialize["triggers"] = o.Triggers + } + toSerialize["updateTime"] = o.UpdateTime + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListAutomationsItem) 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{ + "createTime", + "id", + "updateTime", + } + + 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) + } + } + + varListAutomationsItem := _ListAutomationsItem{} + + err = json.Unmarshal(data, &varListAutomationsItem) + + if err != nil { + return err + } + + *o = ListAutomationsItem(varListAutomationsItem) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createTime") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "templateId") + delete(additionalProperties, "triggers") + delete(additionalProperties, "updateTime") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListAutomationsItem struct { + value *ListAutomationsItem + isSet bool +} + +func (v NullableListAutomationsItem) Get() *ListAutomationsItem { + return v.value +} + +func (v *NullableListAutomationsItem) Set(val *ListAutomationsItem) { + v.value = val + v.isSet = true +} + +func (v NullableListAutomationsItem) IsSet() bool { + return v.isSet +} + +func (v *NullableListAutomationsItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListAutomationsItem(val *ListAutomationsItem) *NullableListAutomationsItem { + return &NullableListAutomationsItem{value: val, isSet: true} +} + +func (v NullableListAutomationsItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListAutomationsItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_list_automations_response.go b/services/automation/v1betaapi/model_list_automations_response.go new file mode 100644 index 000000000..a6ae089a9 --- /dev/null +++ b/services/automation/v1betaapi/model_list_automations_response.go @@ -0,0 +1,205 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ListAutomationsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListAutomationsResponse{} + +// ListAutomationsResponse struct for ListAutomationsResponse +type ListAutomationsResponse struct { + Items []ListAutomationsItem `json:"items"` + // A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListAutomationsResponse ListAutomationsResponse + +// NewListAutomationsResponse instantiates a new ListAutomationsResponse 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 NewListAutomationsResponse(items []ListAutomationsItem) *ListAutomationsResponse { + this := ListAutomationsResponse{} + this.Items = items + return &this +} + +// NewListAutomationsResponseWithDefaults instantiates a new ListAutomationsResponse 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 NewListAutomationsResponseWithDefaults() *ListAutomationsResponse { + this := ListAutomationsResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ListAutomationsResponse) GetItems() []ListAutomationsItem { + if o == nil { + var ret []ListAutomationsItem + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListAutomationsResponse) GetItemsOk() ([]ListAutomationsItem, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListAutomationsResponse) SetItems(v []ListAutomationsItem) { + o.Items = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListAutomationsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAutomationsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListAutomationsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListAutomationsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListAutomationsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListAutomationsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListAutomationsResponse) 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{ + "items", + } + + 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) + } + } + + varListAutomationsResponse := _ListAutomationsResponse{} + + err = json.Unmarshal(data, &varListAutomationsResponse) + + if err != nil { + return err + } + + *o = ListAutomationsResponse(varListAutomationsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListAutomationsResponse struct { + value *ListAutomationsResponse + isSet bool +} + +func (v NullableListAutomationsResponse) Get() *ListAutomationsResponse { + return v.value +} + +func (v *NullableListAutomationsResponse) Set(val *ListAutomationsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListAutomationsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListAutomationsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListAutomationsResponse(val *ListAutomationsResponse) *NullableListAutomationsResponse { + return &NullableListAutomationsResponse{value: val, isSet: true} +} + +func (v NullableListAutomationsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListAutomationsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_list_executions_item.go b/services/automation/v1betaapi/model_list_executions_item.go new file mode 100644 index 000000000..f722fa820 --- /dev/null +++ b/services/automation/v1betaapi/model_list_executions_item.go @@ -0,0 +1,263 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the ListExecutionsItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListExecutionsItem{} + +// ListExecutionsItem struct for ListExecutionsItem +type ListExecutionsItem struct { + CreateTime time.Time `json:"createTime"` + EndTime *time.Time `json:"endTime,omitempty"` + Id string `json:"id"` + Status ListExecutionsItemStatus `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _ListExecutionsItem ListExecutionsItem + +// NewListExecutionsItem instantiates a new ListExecutionsItem 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 NewListExecutionsItem(createTime time.Time, id string, status ListExecutionsItemStatus) *ListExecutionsItem { + this := ListExecutionsItem{} + this.CreateTime = createTime + this.Id = id + this.Status = status + return &this +} + +// NewListExecutionsItemWithDefaults instantiates a new ListExecutionsItem 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 NewListExecutionsItemWithDefaults() *ListExecutionsItem { + this := ListExecutionsItem{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *ListExecutionsItem) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *ListExecutionsItem) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *ListExecutionsItem) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetEndTime returns the EndTime field value if set, zero value otherwise. +func (o *ListExecutionsItem) GetEndTime() time.Time { + if o == nil || IsNil(o.EndTime) { + var ret time.Time + return ret + } + return *o.EndTime +} + +// GetEndTimeOk returns a tuple with the EndTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListExecutionsItem) GetEndTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.EndTime) { + return nil, false + } + return o.EndTime, true +} + +// HasEndTime returns a boolean if a field has been set. +func (o *ListExecutionsItem) HasEndTime() bool { + if o != nil && !IsNil(o.EndTime) { + return true + } + + return false +} + +// SetEndTime gets a reference to the given time.Time and assigns it to the EndTime field. +func (o *ListExecutionsItem) SetEndTime(v time.Time) { + o.EndTime = &v +} + +// GetId returns the Id field value +func (o *ListExecutionsItem) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ListExecutionsItem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ListExecutionsItem) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *ListExecutionsItem) GetStatus() ListExecutionsItemStatus { + if o == nil { + var ret ListExecutionsItemStatus + 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 *ListExecutionsItem) GetStatusOk() (*ListExecutionsItemStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ListExecutionsItem) SetStatus(v ListExecutionsItemStatus) { + o.Status = v +} + +func (o ListExecutionsItem) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListExecutionsItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["createTime"] = o.CreateTime + if !IsNil(o.EndTime) { + toSerialize["endTime"] = o.EndTime + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListExecutionsItem) 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{ + "createTime", + "id", + "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) + } + } + + varListExecutionsItem := _ListExecutionsItem{} + + err = json.Unmarshal(data, &varListExecutionsItem) + + if err != nil { + return err + } + + *o = ListExecutionsItem(varListExecutionsItem) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createTime") + delete(additionalProperties, "endTime") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListExecutionsItem struct { + value *ListExecutionsItem + isSet bool +} + +func (v NullableListExecutionsItem) Get() *ListExecutionsItem { + return v.value +} + +func (v *NullableListExecutionsItem) Set(val *ListExecutionsItem) { + v.value = val + v.isSet = true +} + +func (v NullableListExecutionsItem) IsSet() bool { + return v.isSet +} + +func (v *NullableListExecutionsItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListExecutionsItem(val *ListExecutionsItem) *NullableListExecutionsItem { + return &NullableListExecutionsItem{value: val, isSet: true} +} + +func (v NullableListExecutionsItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListExecutionsItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_list_executions_item_status.go b/services/automation/v1betaapi/model_list_executions_item_status.go new file mode 100644 index 000000000..f2d4b9d2d --- /dev/null +++ b/services/automation/v1betaapi/model_list_executions_item_status.go @@ -0,0 +1,120 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// ListExecutionsItemStatus the model 'ListExecutionsItemStatus' +type ListExecutionsItemStatus string + +// List of ListExecutionsItem_status +const ( + LISTEXECUTIONSITEMSTATUS_PENDING ListExecutionsItemStatus = "PENDING" + LISTEXECUTIONSITEMSTATUS_RUNNING ListExecutionsItemStatus = "RUNNING" + LISTEXECUTIONSITEMSTATUS_COMPLETED ListExecutionsItemStatus = "COMPLETED" + LISTEXECUTIONSITEMSTATUS_FAILED ListExecutionsItemStatus = "FAILED" + LISTEXECUTIONSITEMSTATUS_TERMINATED ListExecutionsItemStatus = "TERMINATED" + LISTEXECUTIONSITEMSTATUS_UNKNOWN_DEFAULT_OPEN_API ListExecutionsItemStatus = "unknown_default_open_api" +) + +// All allowed values of ListExecutionsItemStatus enum +var AllowedListExecutionsItemStatusEnumValues = []ListExecutionsItemStatus{ + "PENDING", + "RUNNING", + "COMPLETED", + "FAILED", + "TERMINATED", + "unknown_default_open_api", +} + +func (v *ListExecutionsItemStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ListExecutionsItemStatus(value) + for _, existing := range AllowedListExecutionsItemStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = LISTEXECUTIONSITEMSTATUS_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewListExecutionsItemStatusFromValue returns a pointer to a valid ListExecutionsItemStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListExecutionsItemStatusFromValue(v string) (*ListExecutionsItemStatus, error) { + ev := ListExecutionsItemStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListExecutionsItemStatus: valid values are %v", v, AllowedListExecutionsItemStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListExecutionsItemStatus) IsValid() bool { + for _, existing := range AllowedListExecutionsItemStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ListExecutionsItem_status value +func (v ListExecutionsItemStatus) Ptr() *ListExecutionsItemStatus { + return &v +} + +type NullableListExecutionsItemStatus struct { + value *ListExecutionsItemStatus + isSet bool +} + +func (v NullableListExecutionsItemStatus) Get() *ListExecutionsItemStatus { + return v.value +} + +func (v *NullableListExecutionsItemStatus) Set(val *ListExecutionsItemStatus) { + v.value = val + v.isSet = true +} + +func (v NullableListExecutionsItemStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableListExecutionsItemStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListExecutionsItemStatus(val *ListExecutionsItemStatus) *NullableListExecutionsItemStatus { + return &NullableListExecutionsItemStatus{value: val, isSet: true} +} + +func (v NullableListExecutionsItemStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListExecutionsItemStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_list_executions_response.go b/services/automation/v1betaapi/model_list_executions_response.go new file mode 100644 index 000000000..400991985 --- /dev/null +++ b/services/automation/v1betaapi/model_list_executions_response.go @@ -0,0 +1,205 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ListExecutionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListExecutionsResponse{} + +// ListExecutionsResponse struct for ListExecutionsResponse +type ListExecutionsResponse struct { + Items []ListExecutionsItem `json:"items"` + // A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListExecutionsResponse ListExecutionsResponse + +// NewListExecutionsResponse instantiates a new ListExecutionsResponse 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 NewListExecutionsResponse(items []ListExecutionsItem) *ListExecutionsResponse { + this := ListExecutionsResponse{} + this.Items = items + return &this +} + +// NewListExecutionsResponseWithDefaults instantiates a new ListExecutionsResponse 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 NewListExecutionsResponseWithDefaults() *ListExecutionsResponse { + this := ListExecutionsResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ListExecutionsResponse) GetItems() []ListExecutionsItem { + if o == nil { + var ret []ListExecutionsItem + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListExecutionsResponse) GetItemsOk() ([]ListExecutionsItem, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListExecutionsResponse) SetItems(v []ListExecutionsItem) { + o.Items = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListExecutionsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListExecutionsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListExecutionsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListExecutionsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListExecutionsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListExecutionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListExecutionsResponse) 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{ + "items", + } + + 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) + } + } + + varListExecutionsResponse := _ListExecutionsResponse{} + + err = json.Unmarshal(data, &varListExecutionsResponse) + + if err != nil { + return err + } + + *o = ListExecutionsResponse(varListExecutionsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListExecutionsResponse struct { + value *ListExecutionsResponse + isSet bool +} + +func (v NullableListExecutionsResponse) Get() *ListExecutionsResponse { + return v.value +} + +func (v *NullableListExecutionsResponse) Set(val *ListExecutionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListExecutionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListExecutionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListExecutionsResponse(val *ListExecutionsResponse) *NullableListExecutionsResponse { + return &NullableListExecutionsResponse{value: val, isSet: true} +} + +func (v NullableListExecutionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListExecutionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_list_templates_response.go b/services/automation/v1betaapi/model_list_templates_response.go new file mode 100644 index 000000000..9a07df470 --- /dev/null +++ b/services/automation/v1betaapi/model_list_templates_response.go @@ -0,0 +1,205 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ListTemplatesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListTemplatesResponse{} + +// ListTemplatesResponse struct for ListTemplatesResponse +type ListTemplatesResponse struct { + Items []Template `json:"items"` + // A token that can be sent as `pageToken` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListTemplatesResponse ListTemplatesResponse + +// NewListTemplatesResponse instantiates a new ListTemplatesResponse 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 NewListTemplatesResponse(items []Template) *ListTemplatesResponse { + this := ListTemplatesResponse{} + this.Items = items + return &this +} + +// NewListTemplatesResponseWithDefaults instantiates a new ListTemplatesResponse 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 NewListTemplatesResponseWithDefaults() *ListTemplatesResponse { + this := ListTemplatesResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ListTemplatesResponse) GetItems() []Template { + if o == nil { + var ret []Template + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListTemplatesResponse) GetItemsOk() ([]Template, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListTemplatesResponse) SetItems(v []Template) { + o.Items = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListTemplatesResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListTemplatesResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListTemplatesResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListTemplatesResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListTemplatesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListTemplatesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListTemplatesResponse) 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{ + "items", + } + + 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) + } + } + + varListTemplatesResponse := _ListTemplatesResponse{} + + err = json.Unmarshal(data, &varListTemplatesResponse) + + if err != nil { + return err + } + + *o = ListTemplatesResponse(varListTemplatesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "items") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListTemplatesResponse struct { + value *ListTemplatesResponse + isSet bool +} + +func (v NullableListTemplatesResponse) Get() *ListTemplatesResponse { + return v.value +} + +func (v *NullableListTemplatesResponse) Set(val *ListTemplatesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListTemplatesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListTemplatesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListTemplatesResponse(val *ListTemplatesResponse) *NullableListTemplatesResponse { + return &NullableListTemplatesResponse{value: val, isSet: true} +} + +func (v NullableListTemplatesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListTemplatesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_localized_message_error_detail.go b/services/automation/v1betaapi/model_localized_message_error_detail.go new file mode 100644 index 000000000..b00861ef5 --- /dev/null +++ b/services/automation/v1betaapi/model_localized_message_error_detail.go @@ -0,0 +1,225 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the LocalizedMessageErrorDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LocalizedMessageErrorDetail{} + +// LocalizedMessageErrorDetail struct for LocalizedMessageErrorDetail +type LocalizedMessageErrorDetail struct { + Type string `json:"@type"` + Locale string `json:"locale"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _LocalizedMessageErrorDetail LocalizedMessageErrorDetail + +// NewLocalizedMessageErrorDetail instantiates a new LocalizedMessageErrorDetail 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 NewLocalizedMessageErrorDetail(types string, locale string, message string) *LocalizedMessageErrorDetail { + this := LocalizedMessageErrorDetail{} + this.Type = types + this.Locale = locale + this.Message = message + return &this +} + +// NewLocalizedMessageErrorDetailWithDefaults instantiates a new LocalizedMessageErrorDetail 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 NewLocalizedMessageErrorDetailWithDefaults() *LocalizedMessageErrorDetail { + this := LocalizedMessageErrorDetail{} + return &this +} + +// GetType returns the Type field value +func (o *LocalizedMessageErrorDetail) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LocalizedMessageErrorDetail) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *LocalizedMessageErrorDetail) SetType(v string) { + o.Type = v +} + +// GetLocale returns the Locale field value +func (o *LocalizedMessageErrorDetail) GetLocale() string { + if o == nil { + var ret string + return ret + } + + return o.Locale +} + +// GetLocaleOk returns a tuple with the Locale field value +// and a boolean to check if the value has been set. +func (o *LocalizedMessageErrorDetail) GetLocaleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Locale, true +} + +// SetLocale sets field value +func (o *LocalizedMessageErrorDetail) SetLocale(v string) { + o.Locale = v +} + +// GetMessage returns the Message field value +func (o *LocalizedMessageErrorDetail) 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 *LocalizedMessageErrorDetail) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *LocalizedMessageErrorDetail) SetMessage(v string) { + o.Message = v +} + +func (o LocalizedMessageErrorDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LocalizedMessageErrorDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["@type"] = o.Type + toSerialize["locale"] = o.Locale + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *LocalizedMessageErrorDetail) 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{ + "@type", + "locale", + "message", + } + + 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) + } + } + + varLocalizedMessageErrorDetail := _LocalizedMessageErrorDetail{} + + err = json.Unmarshal(data, &varLocalizedMessageErrorDetail) + + if err != nil { + return err + } + + *o = LocalizedMessageErrorDetail(varLocalizedMessageErrorDetail) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "@type") + delete(additionalProperties, "locale") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableLocalizedMessageErrorDetail struct { + value *LocalizedMessageErrorDetail + isSet bool +} + +func (v NullableLocalizedMessageErrorDetail) Get() *LocalizedMessageErrorDetail { + return v.value +} + +func (v *NullableLocalizedMessageErrorDetail) Set(val *LocalizedMessageErrorDetail) { + v.value = val + v.isSet = true +} + +func (v NullableLocalizedMessageErrorDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableLocalizedMessageErrorDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLocalizedMessageErrorDetail(val *LocalizedMessageErrorDetail) *NullableLocalizedMessageErrorDetail { + return &NullableLocalizedMessageErrorDetail{value: val, isSet: true} +} + +func (v NullableLocalizedMessageErrorDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLocalizedMessageErrorDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_partial_update_volume_automation_payload.go b/services/automation/v1betaapi/model_partial_update_volume_automation_payload.go new file mode 100644 index 000000000..ace58c3b8 --- /dev/null +++ b/services/automation/v1betaapi/model_partial_update_volume_automation_payload.go @@ -0,0 +1,265 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 PartialUpdateVolumeAutomationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateVolumeAutomationPayload{} + +// PartialUpdateVolumeAutomationPayload struct for PartialUpdateVolumeAutomationPayload +type PartialUpdateVolumeAutomationPayload struct { + Description *string `json:"description,omitempty"` + Input *VolumeAutomationInput `json:"input,omitempty"` + Name *string `json:"name,omitempty"` + Triggers *AutomationTriggers `json:"triggers,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PartialUpdateVolumeAutomationPayload PartialUpdateVolumeAutomationPayload + +// NewPartialUpdateVolumeAutomationPayload instantiates a new PartialUpdateVolumeAutomationPayload 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 NewPartialUpdateVolumeAutomationPayload() *PartialUpdateVolumeAutomationPayload { + this := PartialUpdateVolumeAutomationPayload{} + return &this +} + +// NewPartialUpdateVolumeAutomationPayloadWithDefaults instantiates a new PartialUpdateVolumeAutomationPayload 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 NewPartialUpdateVolumeAutomationPayloadWithDefaults() *PartialUpdateVolumeAutomationPayload { + this := PartialUpdateVolumeAutomationPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PartialUpdateVolumeAutomationPayload) 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 *PartialUpdateVolumeAutomationPayload) 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 *PartialUpdateVolumeAutomationPayload) 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 *PartialUpdateVolumeAutomationPayload) SetDescription(v string) { + o.Description = &v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *PartialUpdateVolumeAutomationPayload) GetInput() VolumeAutomationInput { + if o == nil || IsNil(o.Input) { + var ret VolumeAutomationInput + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateVolumeAutomationPayload) GetInputOk() (*VolumeAutomationInput, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *PartialUpdateVolumeAutomationPayload) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given VolumeAutomationInput and assigns it to the Input field. +func (o *PartialUpdateVolumeAutomationPayload) SetInput(v VolumeAutomationInput) { + o.Input = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateVolumeAutomationPayload) 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 *PartialUpdateVolumeAutomationPayload) 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 *PartialUpdateVolumeAutomationPayload) 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 *PartialUpdateVolumeAutomationPayload) SetName(v string) { + o.Name = &v +} + +// GetTriggers returns the Triggers field value if set, zero value otherwise. +func (o *PartialUpdateVolumeAutomationPayload) GetTriggers() AutomationTriggers { + if o == nil || IsNil(o.Triggers) { + var ret AutomationTriggers + return ret + } + return *o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateVolumeAutomationPayload) GetTriggersOk() (*AutomationTriggers, bool) { + if o == nil || IsNil(o.Triggers) { + return nil, false + } + return o.Triggers, true +} + +// HasTriggers returns a boolean if a field has been set. +func (o *PartialUpdateVolumeAutomationPayload) HasTriggers() bool { + if o != nil && !IsNil(o.Triggers) { + return true + } + + return false +} + +// SetTriggers gets a reference to the given AutomationTriggers and assigns it to the Triggers field. +func (o *PartialUpdateVolumeAutomationPayload) SetTriggers(v AutomationTriggers) { + o.Triggers = &v +} + +func (o PartialUpdateVolumeAutomationPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PartialUpdateVolumeAutomationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Triggers) { + toSerialize["triggers"] = o.Triggers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PartialUpdateVolumeAutomationPayload) UnmarshalJSON(data []byte) (err error) { + varPartialUpdateVolumeAutomationPayload := _PartialUpdateVolumeAutomationPayload{} + + err = json.Unmarshal(data, &varPartialUpdateVolumeAutomationPayload) + + if err != nil { + return err + } + + *o = PartialUpdateVolumeAutomationPayload(varPartialUpdateVolumeAutomationPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "input") + delete(additionalProperties, "name") + delete(additionalProperties, "triggers") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePartialUpdateVolumeAutomationPayload struct { + value *PartialUpdateVolumeAutomationPayload + isSet bool +} + +func (v NullablePartialUpdateVolumeAutomationPayload) Get() *PartialUpdateVolumeAutomationPayload { + return v.value +} + +func (v *NullablePartialUpdateVolumeAutomationPayload) Set(val *PartialUpdateVolumeAutomationPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateVolumeAutomationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateVolumeAutomationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateVolumeAutomationPayload(val *PartialUpdateVolumeAutomationPayload) *NullablePartialUpdateVolumeAutomationPayload { + return &NullablePartialUpdateVolumeAutomationPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateVolumeAutomationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateVolumeAutomationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_schedule.go b/services/automation/v1betaapi/model_schedule.go new file mode 100644 index 000000000..7373adde7 --- /dev/null +++ b/services/automation/v1betaapi/model_schedule.go @@ -0,0 +1,191 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 Schedule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Schedule{} + +// Schedule struct for Schedule +type Schedule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Schedule Schedule + +// NewSchedule instantiates a new Schedule 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 NewSchedule() *Schedule { + this := Schedule{} + return &this +} + +// NewScheduleWithDefaults instantiates a new Schedule 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 NewScheduleWithDefaults() *Schedule { + this := Schedule{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Schedule) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Schedule) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Schedule) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Schedule) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Schedule) 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 *Schedule) 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 *Schedule) 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 *Schedule) SetName(v string) { + o.Name = &v +} + +func (o Schedule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Schedule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Schedule) UnmarshalJSON(data []byte) (err error) { + varSchedule := _Schedule{} + + err = json.Unmarshal(data, &varSchedule) + + if err != nil { + return err + } + + *o = Schedule(varSchedule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSchedule struct { + value *Schedule + isSet bool +} + +func (v NullableSchedule) Get() *Schedule { + return v.value +} + +func (v *NullableSchedule) Set(val *Schedule) { + v.value = val + v.isSet = true +} + +func (v NullableSchedule) IsSet() bool { + return v.isSet +} + +func (v *NullableSchedule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSchedule(val *Schedule) *NullableSchedule { + return &NullableSchedule{value: val, isSet: true} +} + +func (v NullableSchedule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSchedule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_schedule_details.go b/services/automation/v1betaapi/model_schedule_details.go new file mode 100644 index 000000000..546fc11c9 --- /dev/null +++ b/services/automation/v1betaapi/model_schedule_details.go @@ -0,0 +1,228 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 ScheduleDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ScheduleDetails{} + +// ScheduleDetails struct for ScheduleDetails +type ScheduleDetails struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + WorkflowConfig map[string]interface{} `json:"workflowConfig,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ScheduleDetails ScheduleDetails + +// NewScheduleDetails instantiates a new ScheduleDetails 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 NewScheduleDetails() *ScheduleDetails { + this := ScheduleDetails{} + return &this +} + +// NewScheduleDetailsWithDefaults instantiates a new ScheduleDetails 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 NewScheduleDetailsWithDefaults() *ScheduleDetails { + this := ScheduleDetails{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ScheduleDetails) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScheduleDetails) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ScheduleDetails) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ScheduleDetails) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ScheduleDetails) 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 *ScheduleDetails) 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 *ScheduleDetails) 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 *ScheduleDetails) SetName(v string) { + o.Name = &v +} + +// GetWorkflowConfig returns the WorkflowConfig field value if set, zero value otherwise. +func (o *ScheduleDetails) GetWorkflowConfig() map[string]interface{} { + if o == nil || IsNil(o.WorkflowConfig) { + var ret map[string]interface{} + return ret + } + return o.WorkflowConfig +} + +// GetWorkflowConfigOk returns a tuple with the WorkflowConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScheduleDetails) GetWorkflowConfigOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.WorkflowConfig) { + return map[string]interface{}{}, false + } + return o.WorkflowConfig, true +} + +// HasWorkflowConfig returns a boolean if a field has been set. +func (o *ScheduleDetails) HasWorkflowConfig() bool { + if o != nil && !IsNil(o.WorkflowConfig) { + return true + } + + return false +} + +// SetWorkflowConfig gets a reference to the given map[string]interface{} and assigns it to the WorkflowConfig field. +func (o *ScheduleDetails) SetWorkflowConfig(v map[string]interface{}) { + o.WorkflowConfig = v +} + +func (o ScheduleDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ScheduleDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.WorkflowConfig) { + toSerialize["workflowConfig"] = o.WorkflowConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ScheduleDetails) UnmarshalJSON(data []byte) (err error) { + varScheduleDetails := _ScheduleDetails{} + + err = json.Unmarshal(data, &varScheduleDetails) + + if err != nil { + return err + } + + *o = ScheduleDetails(varScheduleDetails) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "workflowConfig") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableScheduleDetails struct { + value *ScheduleDetails + isSet bool +} + +func (v NullableScheduleDetails) Get() *ScheduleDetails { + return v.value +} + +func (v *NullableScheduleDetails) Set(val *ScheduleDetails) { + v.value = val + v.isSet = true +} + +func (v NullableScheduleDetails) IsSet() bool { + return v.isSet +} + +func (v *NullableScheduleDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScheduleDetails(val *ScheduleDetails) *NullableScheduleDetails { + return &NullableScheduleDetails{value: val, isSet: true} +} + +func (v NullableScheduleDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScheduleDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_schedule_patch_request.go b/services/automation/v1betaapi/model_schedule_patch_request.go new file mode 100644 index 000000000..102eaf56f --- /dev/null +++ b/services/automation/v1betaapi/model_schedule_patch_request.go @@ -0,0 +1,228 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 SchedulePatchRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SchedulePatchRequest{} + +// SchedulePatchRequest struct for SchedulePatchRequest +type SchedulePatchRequest struct { + Name *string `json:"name,omitempty"` + Rrule *string `json:"rrule,omitempty"` + WorkflowConfig map[string]interface{} `json:"workflowConfig,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _SchedulePatchRequest SchedulePatchRequest + +// NewSchedulePatchRequest instantiates a new SchedulePatchRequest 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 NewSchedulePatchRequest() *SchedulePatchRequest { + this := SchedulePatchRequest{} + return &this +} + +// NewSchedulePatchRequestWithDefaults instantiates a new SchedulePatchRequest 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 NewSchedulePatchRequestWithDefaults() *SchedulePatchRequest { + this := SchedulePatchRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SchedulePatchRequest) 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 *SchedulePatchRequest) 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 *SchedulePatchRequest) 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 *SchedulePatchRequest) SetName(v string) { + o.Name = &v +} + +// GetRrule returns the Rrule field value if set, zero value otherwise. +func (o *SchedulePatchRequest) GetRrule() string { + if o == nil || IsNil(o.Rrule) { + var ret string + return ret + } + return *o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SchedulePatchRequest) GetRruleOk() (*string, bool) { + if o == nil || IsNil(o.Rrule) { + return nil, false + } + return o.Rrule, true +} + +// HasRrule returns a boolean if a field has been set. +func (o *SchedulePatchRequest) HasRrule() bool { + if o != nil && !IsNil(o.Rrule) { + return true + } + + return false +} + +// SetRrule gets a reference to the given string and assigns it to the Rrule field. +func (o *SchedulePatchRequest) SetRrule(v string) { + o.Rrule = &v +} + +// GetWorkflowConfig returns the WorkflowConfig field value if set, zero value otherwise. +func (o *SchedulePatchRequest) GetWorkflowConfig() map[string]interface{} { + if o == nil || IsNil(o.WorkflowConfig) { + var ret map[string]interface{} + return ret + } + return o.WorkflowConfig +} + +// GetWorkflowConfigOk returns a tuple with the WorkflowConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SchedulePatchRequest) GetWorkflowConfigOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.WorkflowConfig) { + return map[string]interface{}{}, false + } + return o.WorkflowConfig, true +} + +// HasWorkflowConfig returns a boolean if a field has been set. +func (o *SchedulePatchRequest) HasWorkflowConfig() bool { + if o != nil && !IsNil(o.WorkflowConfig) { + return true + } + + return false +} + +// SetWorkflowConfig gets a reference to the given map[string]interface{} and assigns it to the WorkflowConfig field. +func (o *SchedulePatchRequest) SetWorkflowConfig(v map[string]interface{}) { + o.WorkflowConfig = v +} + +func (o SchedulePatchRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SchedulePatchRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Rrule) { + toSerialize["rrule"] = o.Rrule + } + if !IsNil(o.WorkflowConfig) { + toSerialize["workflowConfig"] = o.WorkflowConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SchedulePatchRequest) UnmarshalJSON(data []byte) (err error) { + varSchedulePatchRequest := _SchedulePatchRequest{} + + err = json.Unmarshal(data, &varSchedulePatchRequest) + + if err != nil { + return err + } + + *o = SchedulePatchRequest(varSchedulePatchRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "rrule") + delete(additionalProperties, "workflowConfig") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSchedulePatchRequest struct { + value *SchedulePatchRequest + isSet bool +} + +func (v NullableSchedulePatchRequest) Get() *SchedulePatchRequest { + return v.value +} + +func (v *NullableSchedulePatchRequest) Set(val *SchedulePatchRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSchedulePatchRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSchedulePatchRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSchedulePatchRequest(val *SchedulePatchRequest) *NullableSchedulePatchRequest { + return &NullableSchedulePatchRequest{value: val, isSet: true} +} + +func (v NullableSchedulePatchRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSchedulePatchRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_schedule_request.go b/services/automation/v1betaapi/model_schedule_request.go new file mode 100644 index 000000000..ca45215e4 --- /dev/null +++ b/services/automation/v1betaapi/model_schedule_request.go @@ -0,0 +1,233 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the ScheduleRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ScheduleRequest{} + +// ScheduleRequest struct for ScheduleRequest +type ScheduleRequest struct { + Name string `json:"name"` + Rrule string `json:"rrule"` + WorkflowConfig map[string]interface{} `json:"workflowConfig,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ScheduleRequest ScheduleRequest + +// NewScheduleRequest instantiates a new ScheduleRequest 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 NewScheduleRequest(name string, rrule string) *ScheduleRequest { + this := ScheduleRequest{} + this.Name = name + this.Rrule = rrule + return &this +} + +// NewScheduleRequestWithDefaults instantiates a new ScheduleRequest 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 NewScheduleRequestWithDefaults() *ScheduleRequest { + this := ScheduleRequest{} + return &this +} + +// GetName returns the Name field value +func (o *ScheduleRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ScheduleRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ScheduleRequest) SetName(v string) { + o.Name = v +} + +// GetRrule returns the Rrule field value +func (o *ScheduleRequest) GetRrule() string { + if o == nil { + var ret string + return ret + } + + return o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value +// and a boolean to check if the value has been set. +func (o *ScheduleRequest) GetRruleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Rrule, true +} + +// SetRrule sets field value +func (o *ScheduleRequest) SetRrule(v string) { + o.Rrule = v +} + +// GetWorkflowConfig returns the WorkflowConfig field value if set, zero value otherwise. +func (o *ScheduleRequest) GetWorkflowConfig() map[string]interface{} { + if o == nil || IsNil(o.WorkflowConfig) { + var ret map[string]interface{} + return ret + } + return o.WorkflowConfig +} + +// GetWorkflowConfigOk returns a tuple with the WorkflowConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ScheduleRequest) GetWorkflowConfigOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.WorkflowConfig) { + return map[string]interface{}{}, false + } + return o.WorkflowConfig, true +} + +// HasWorkflowConfig returns a boolean if a field has been set. +func (o *ScheduleRequest) HasWorkflowConfig() bool { + if o != nil && !IsNil(o.WorkflowConfig) { + return true + } + + return false +} + +// SetWorkflowConfig gets a reference to the given map[string]interface{} and assigns it to the WorkflowConfig field. +func (o *ScheduleRequest) SetWorkflowConfig(v map[string]interface{}) { + o.WorkflowConfig = v +} + +func (o ScheduleRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ScheduleRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["rrule"] = o.Rrule + if !IsNil(o.WorkflowConfig) { + toSerialize["workflowConfig"] = o.WorkflowConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ScheduleRequest) 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{ + "name", + "rrule", + } + + 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) + } + } + + varScheduleRequest := _ScheduleRequest{} + + err = json.Unmarshal(data, &varScheduleRequest) + + if err != nil { + return err + } + + *o = ScheduleRequest(varScheduleRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "rrule") + delete(additionalProperties, "workflowConfig") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableScheduleRequest struct { + value *ScheduleRequest + isSet bool +} + +func (v NullableScheduleRequest) Get() *ScheduleRequest { + return v.value +} + +func (v *NullableScheduleRequest) Set(val *ScheduleRequest) { + v.value = val + v.isSet = true +} + +func (v NullableScheduleRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableScheduleRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableScheduleRequest(val *ScheduleRequest) *NullableScheduleRequest { + return &NullableScheduleRequest{value: val, isSet: true} +} + +func (v NullableScheduleRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableScheduleRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_snapshot_retention_policy.go b/services/automation/v1betaapi/model_snapshot_retention_policy.go new file mode 100644 index 000000000..375776920 --- /dev/null +++ b/services/automation/v1betaapi/model_snapshot_retention_policy.go @@ -0,0 +1,154 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// SnapshotRetentionPolicy - struct for SnapshotRetentionPolicy +type SnapshotRetentionPolicy struct { + SnapshotRetentionPolicyCount *SnapshotRetentionPolicyCount + SnapshotRetentionPolicyIndefinitely *SnapshotRetentionPolicyIndefinitely +} + +// SnapshotRetentionPolicyCountAsSnapshotRetentionPolicy is a convenience function that returns SnapshotRetentionPolicyCount wrapped in SnapshotRetentionPolicy +func SnapshotRetentionPolicyCountAsSnapshotRetentionPolicy(v *SnapshotRetentionPolicyCount) SnapshotRetentionPolicy { + return SnapshotRetentionPolicy{ + SnapshotRetentionPolicyCount: v, + } +} + +// SnapshotRetentionPolicyIndefinitelyAsSnapshotRetentionPolicy is a convenience function that returns SnapshotRetentionPolicyIndefinitely wrapped in SnapshotRetentionPolicy +func SnapshotRetentionPolicyIndefinitelyAsSnapshotRetentionPolicy(v *SnapshotRetentionPolicyIndefinitely) SnapshotRetentionPolicy { + return SnapshotRetentionPolicy{ + SnapshotRetentionPolicyIndefinitely: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *SnapshotRetentionPolicy) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'count' + if jsonDict["kind"] == "count" { + // try to unmarshal JSON data into SnapshotRetentionPolicyCount + err = json.Unmarshal(data, &dst.SnapshotRetentionPolicyCount) + if err == nil { + return nil // data stored in dst.SnapshotRetentionPolicyCount, return on the first match + } else { + dst.SnapshotRetentionPolicyCount = nil + return fmt.Errorf("failed to unmarshal SnapshotRetentionPolicy as SnapshotRetentionPolicyCount: %s", err.Error()) + } + } + + // check if the discriminator value is 'indefinitely' + if jsonDict["kind"] == "indefinitely" { + // try to unmarshal JSON data into SnapshotRetentionPolicyIndefinitely + err = json.Unmarshal(data, &dst.SnapshotRetentionPolicyIndefinitely) + if err == nil { + return nil // data stored in dst.SnapshotRetentionPolicyIndefinitely, return on the first match + } else { + dst.SnapshotRetentionPolicyIndefinitely = nil + return fmt.Errorf("failed to unmarshal SnapshotRetentionPolicy as SnapshotRetentionPolicyIndefinitely: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src SnapshotRetentionPolicy) MarshalJSON() ([]byte, error) { + if src.SnapshotRetentionPolicyCount != nil { + return json.Marshal(&src.SnapshotRetentionPolicyCount) + } + + if src.SnapshotRetentionPolicyIndefinitely != nil { + return json.Marshal(&src.SnapshotRetentionPolicyIndefinitely) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *SnapshotRetentionPolicy) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.SnapshotRetentionPolicyCount != nil { + return obj.SnapshotRetentionPolicyCount + } + + if obj.SnapshotRetentionPolicyIndefinitely != nil { + return obj.SnapshotRetentionPolicyIndefinitely + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj SnapshotRetentionPolicy) GetActualInstanceValue() interface{} { + if obj.SnapshotRetentionPolicyCount != nil { + return *obj.SnapshotRetentionPolicyCount + } + + if obj.SnapshotRetentionPolicyIndefinitely != nil { + return *obj.SnapshotRetentionPolicyIndefinitely + } + + // all schemas are nil + return nil +} + +type NullableSnapshotRetentionPolicy struct { + value *SnapshotRetentionPolicy + isSet bool +} + +func (v NullableSnapshotRetentionPolicy) Get() *SnapshotRetentionPolicy { + return v.value +} + +func (v *NullableSnapshotRetentionPolicy) Set(val *SnapshotRetentionPolicy) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotRetentionPolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotRetentionPolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotRetentionPolicy(val *SnapshotRetentionPolicy) *NullableSnapshotRetentionPolicy { + return &NullableSnapshotRetentionPolicy{value: val, isSet: true} +} + +func (v NullableSnapshotRetentionPolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotRetentionPolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_snapshot_retention_policy_count.go b/services/automation/v1betaapi/model_snapshot_retention_policy_count.go new file mode 100644 index 000000000..8beb2b91a --- /dev/null +++ b/services/automation/v1betaapi/model_snapshot_retention_policy_count.go @@ -0,0 +1,196 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the SnapshotRetentionPolicyCount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotRetentionPolicyCount{} + +// SnapshotRetentionPolicyCount struct for SnapshotRetentionPolicyCount +type SnapshotRetentionPolicyCount struct { + Kind SnapshotRetentionPolicyCountKind `json:"kind"` + Value int32 `json:"value"` + AdditionalProperties map[string]interface{} +} + +type _SnapshotRetentionPolicyCount SnapshotRetentionPolicyCount + +// NewSnapshotRetentionPolicyCount instantiates a new SnapshotRetentionPolicyCount 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 NewSnapshotRetentionPolicyCount(kind SnapshotRetentionPolicyCountKind, value int32) *SnapshotRetentionPolicyCount { + this := SnapshotRetentionPolicyCount{} + this.Kind = kind + this.Value = value + return &this +} + +// NewSnapshotRetentionPolicyCountWithDefaults instantiates a new SnapshotRetentionPolicyCount 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 NewSnapshotRetentionPolicyCountWithDefaults() *SnapshotRetentionPolicyCount { + this := SnapshotRetentionPolicyCount{} + return &this +} + +// GetKind returns the Kind field value +func (o *SnapshotRetentionPolicyCount) GetKind() SnapshotRetentionPolicyCountKind { + if o == nil { + var ret SnapshotRetentionPolicyCountKind + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *SnapshotRetentionPolicyCount) GetKindOk() (*SnapshotRetentionPolicyCountKind, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *SnapshotRetentionPolicyCount) SetKind(v SnapshotRetentionPolicyCountKind) { + o.Kind = v +} + +// GetValue returns the Value field value +func (o *SnapshotRetentionPolicyCount) GetValue() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *SnapshotRetentionPolicyCount) GetValueOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *SnapshotRetentionPolicyCount) SetValue(v int32) { + o.Value = v +} + +func (o SnapshotRetentionPolicyCount) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SnapshotRetentionPolicyCount) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kind"] = o.Kind + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SnapshotRetentionPolicyCount) 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{ + "kind", + "value", + } + + 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) + } + } + + varSnapshotRetentionPolicyCount := _SnapshotRetentionPolicyCount{} + + err = json.Unmarshal(data, &varSnapshotRetentionPolicyCount) + + if err != nil { + return err + } + + *o = SnapshotRetentionPolicyCount(varSnapshotRetentionPolicyCount) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "kind") + delete(additionalProperties, "value") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSnapshotRetentionPolicyCount struct { + value *SnapshotRetentionPolicyCount + isSet bool +} + +func (v NullableSnapshotRetentionPolicyCount) Get() *SnapshotRetentionPolicyCount { + return v.value +} + +func (v *NullableSnapshotRetentionPolicyCount) Set(val *SnapshotRetentionPolicyCount) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotRetentionPolicyCount) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotRetentionPolicyCount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotRetentionPolicyCount(val *SnapshotRetentionPolicyCount) *NullableSnapshotRetentionPolicyCount { + return &NullableSnapshotRetentionPolicyCount{value: val, isSet: true} +} + +func (v NullableSnapshotRetentionPolicyCount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotRetentionPolicyCount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_snapshot_retention_policy_count_kind.go b/services/automation/v1betaapi/model_snapshot_retention_policy_count_kind.go new file mode 100644 index 000000000..0f89223d5 --- /dev/null +++ b/services/automation/v1betaapi/model_snapshot_retention_policy_count_kind.go @@ -0,0 +1,112 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// SnapshotRetentionPolicyCountKind the model 'SnapshotRetentionPolicyCountKind' +type SnapshotRetentionPolicyCountKind string + +// List of SnapshotRetentionPolicyCount_kind +const ( + SNAPSHOTRETENTIONPOLICYCOUNTKIND_COUNT SnapshotRetentionPolicyCountKind = "count" + SNAPSHOTRETENTIONPOLICYCOUNTKIND_UNKNOWN_DEFAULT_OPEN_API SnapshotRetentionPolicyCountKind = "unknown_default_open_api" +) + +// All allowed values of SnapshotRetentionPolicyCountKind enum +var AllowedSnapshotRetentionPolicyCountKindEnumValues = []SnapshotRetentionPolicyCountKind{ + "count", + "unknown_default_open_api", +} + +func (v *SnapshotRetentionPolicyCountKind) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SnapshotRetentionPolicyCountKind(value) + for _, existing := range AllowedSnapshotRetentionPolicyCountKindEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = SNAPSHOTRETENTIONPOLICYCOUNTKIND_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewSnapshotRetentionPolicyCountKindFromValue returns a pointer to a valid SnapshotRetentionPolicyCountKind +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSnapshotRetentionPolicyCountKindFromValue(v string) (*SnapshotRetentionPolicyCountKind, error) { + ev := SnapshotRetentionPolicyCountKind(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SnapshotRetentionPolicyCountKind: valid values are %v", v, AllowedSnapshotRetentionPolicyCountKindEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SnapshotRetentionPolicyCountKind) IsValid() bool { + for _, existing := range AllowedSnapshotRetentionPolicyCountKindEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SnapshotRetentionPolicyCount_kind value +func (v SnapshotRetentionPolicyCountKind) Ptr() *SnapshotRetentionPolicyCountKind { + return &v +} + +type NullableSnapshotRetentionPolicyCountKind struct { + value *SnapshotRetentionPolicyCountKind + isSet bool +} + +func (v NullableSnapshotRetentionPolicyCountKind) Get() *SnapshotRetentionPolicyCountKind { + return v.value +} + +func (v *NullableSnapshotRetentionPolicyCountKind) Set(val *SnapshotRetentionPolicyCountKind) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotRetentionPolicyCountKind) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotRetentionPolicyCountKind) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotRetentionPolicyCountKind(val *SnapshotRetentionPolicyCountKind) *NullableSnapshotRetentionPolicyCountKind { + return &NullableSnapshotRetentionPolicyCountKind{value: val, isSet: true} +} + +func (v NullableSnapshotRetentionPolicyCountKind) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotRetentionPolicyCountKind) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely.go b/services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely.go new file mode 100644 index 000000000..8dac8b450 --- /dev/null +++ b/services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely.go @@ -0,0 +1,167 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the SnapshotRetentionPolicyIndefinitely type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotRetentionPolicyIndefinitely{} + +// SnapshotRetentionPolicyIndefinitely struct for SnapshotRetentionPolicyIndefinitely +type SnapshotRetentionPolicyIndefinitely struct { + Kind SnapshotRetentionPolicyIndefinitelyKind `json:"kind"` + AdditionalProperties map[string]interface{} +} + +type _SnapshotRetentionPolicyIndefinitely SnapshotRetentionPolicyIndefinitely + +// NewSnapshotRetentionPolicyIndefinitely instantiates a new SnapshotRetentionPolicyIndefinitely 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 NewSnapshotRetentionPolicyIndefinitely(kind SnapshotRetentionPolicyIndefinitelyKind) *SnapshotRetentionPolicyIndefinitely { + this := SnapshotRetentionPolicyIndefinitely{} + this.Kind = kind + return &this +} + +// NewSnapshotRetentionPolicyIndefinitelyWithDefaults instantiates a new SnapshotRetentionPolicyIndefinitely 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 NewSnapshotRetentionPolicyIndefinitelyWithDefaults() *SnapshotRetentionPolicyIndefinitely { + this := SnapshotRetentionPolicyIndefinitely{} + return &this +} + +// GetKind returns the Kind field value +func (o *SnapshotRetentionPolicyIndefinitely) GetKind() SnapshotRetentionPolicyIndefinitelyKind { + if o == nil { + var ret SnapshotRetentionPolicyIndefinitelyKind + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *SnapshotRetentionPolicyIndefinitely) GetKindOk() (*SnapshotRetentionPolicyIndefinitelyKind, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *SnapshotRetentionPolicyIndefinitely) SetKind(v SnapshotRetentionPolicyIndefinitelyKind) { + o.Kind = v +} + +func (o SnapshotRetentionPolicyIndefinitely) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SnapshotRetentionPolicyIndefinitely) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kind"] = o.Kind + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *SnapshotRetentionPolicyIndefinitely) 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{ + "kind", + } + + 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) + } + } + + varSnapshotRetentionPolicyIndefinitely := _SnapshotRetentionPolicyIndefinitely{} + + err = json.Unmarshal(data, &varSnapshotRetentionPolicyIndefinitely) + + if err != nil { + return err + } + + *o = SnapshotRetentionPolicyIndefinitely(varSnapshotRetentionPolicyIndefinitely) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "kind") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSnapshotRetentionPolicyIndefinitely struct { + value *SnapshotRetentionPolicyIndefinitely + isSet bool +} + +func (v NullableSnapshotRetentionPolicyIndefinitely) Get() *SnapshotRetentionPolicyIndefinitely { + return v.value +} + +func (v *NullableSnapshotRetentionPolicyIndefinitely) Set(val *SnapshotRetentionPolicyIndefinitely) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotRetentionPolicyIndefinitely) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotRetentionPolicyIndefinitely) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotRetentionPolicyIndefinitely(val *SnapshotRetentionPolicyIndefinitely) *NullableSnapshotRetentionPolicyIndefinitely { + return &NullableSnapshotRetentionPolicyIndefinitely{value: val, isSet: true} +} + +func (v NullableSnapshotRetentionPolicyIndefinitely) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotRetentionPolicyIndefinitely) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely_kind.go b/services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely_kind.go new file mode 100644 index 000000000..735e696a8 --- /dev/null +++ b/services/automation/v1betaapi/model_snapshot_retention_policy_indefinitely_kind.go @@ -0,0 +1,112 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// SnapshotRetentionPolicyIndefinitelyKind the model 'SnapshotRetentionPolicyIndefinitelyKind' +type SnapshotRetentionPolicyIndefinitelyKind string + +// List of SnapshotRetentionPolicyIndefinitely_kind +const ( + SNAPSHOTRETENTIONPOLICYINDEFINITELYKIND_INDEFINITELY SnapshotRetentionPolicyIndefinitelyKind = "indefinitely" + SNAPSHOTRETENTIONPOLICYINDEFINITELYKIND_UNKNOWN_DEFAULT_OPEN_API SnapshotRetentionPolicyIndefinitelyKind = "unknown_default_open_api" +) + +// All allowed values of SnapshotRetentionPolicyIndefinitelyKind enum +var AllowedSnapshotRetentionPolicyIndefinitelyKindEnumValues = []SnapshotRetentionPolicyIndefinitelyKind{ + "indefinitely", + "unknown_default_open_api", +} + +func (v *SnapshotRetentionPolicyIndefinitelyKind) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SnapshotRetentionPolicyIndefinitelyKind(value) + for _, existing := range AllowedSnapshotRetentionPolicyIndefinitelyKindEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = SNAPSHOTRETENTIONPOLICYINDEFINITELYKIND_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewSnapshotRetentionPolicyIndefinitelyKindFromValue returns a pointer to a valid SnapshotRetentionPolicyIndefinitelyKind +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSnapshotRetentionPolicyIndefinitelyKindFromValue(v string) (*SnapshotRetentionPolicyIndefinitelyKind, error) { + ev := SnapshotRetentionPolicyIndefinitelyKind(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SnapshotRetentionPolicyIndefinitelyKind: valid values are %v", v, AllowedSnapshotRetentionPolicyIndefinitelyKindEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SnapshotRetentionPolicyIndefinitelyKind) IsValid() bool { + for _, existing := range AllowedSnapshotRetentionPolicyIndefinitelyKindEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SnapshotRetentionPolicyIndefinitely_kind value +func (v SnapshotRetentionPolicyIndefinitelyKind) Ptr() *SnapshotRetentionPolicyIndefinitelyKind { + return &v +} + +type NullableSnapshotRetentionPolicyIndefinitelyKind struct { + value *SnapshotRetentionPolicyIndefinitelyKind + isSet bool +} + +func (v NullableSnapshotRetentionPolicyIndefinitelyKind) Get() *SnapshotRetentionPolicyIndefinitelyKind { + return v.value +} + +func (v *NullableSnapshotRetentionPolicyIndefinitelyKind) Set(val *SnapshotRetentionPolicyIndefinitelyKind) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotRetentionPolicyIndefinitelyKind) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotRetentionPolicyIndefinitelyKind) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotRetentionPolicyIndefinitelyKind(val *SnapshotRetentionPolicyIndefinitelyKind) *NullableSnapshotRetentionPolicyIndefinitelyKind { + return &NullableSnapshotRetentionPolicyIndefinitelyKind{value: val, isSet: true} +} + +func (v NullableSnapshotRetentionPolicyIndefinitelyKind) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotRetentionPolicyIndefinitelyKind) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_template.go b/services/automation/v1betaapi/model_template.go new file mode 100644 index 000000000..130474dd0 --- /dev/null +++ b/services/automation/v1betaapi/model_template.go @@ -0,0 +1,255 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the Template type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Template{} + +// Template struct for Template +type Template struct { + CreateTime time.Time `json:"createTime"` + Description string `json:"description"` + Id string `json:"id"` + Name string `json:"name"` + AdditionalProperties map[string]interface{} +} + +type _Template Template + +// NewTemplate instantiates a new Template 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 NewTemplate(createTime time.Time, description string, id string, name string) *Template { + this := Template{} + this.CreateTime = createTime + this.Description = description + this.Id = id + this.Name = name + return &this +} + +// NewTemplateWithDefaults instantiates a new Template 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 NewTemplateWithDefaults() *Template { + this := Template{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *Template) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *Template) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *Template) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetDescription returns the Description field value +func (o *Template) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *Template) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *Template) SetDescription(v string) { + o.Description = v +} + +// GetId returns the Id field value +func (o *Template) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Template) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Template) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Template) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Template) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Template) SetName(v string) { + o.Name = v +} + +func (o Template) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Template) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["createTime"] = o.CreateTime + toSerialize["description"] = o.Description + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Template) 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{ + "createTime", + "description", + "id", + "name", + } + + 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) + } + } + + varTemplate := _Template{} + + err = json.Unmarshal(data, &varTemplate) + + if err != nil { + return err + } + + *o = Template(varTemplate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createTime") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTemplate struct { + value *Template + isSet bool +} + +func (v NullableTemplate) Get() *Template { + return v.value +} + +func (v *NullableTemplate) Set(val *Template) { + v.value = val + v.isSet = true +} + +func (v NullableTemplate) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplate(val *Template) *NullableTemplate { + return &NullableTemplate{value: val, isSet: true} +} + +func (v NullableTemplate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_automation.go b/services/automation/v1betaapi/model_volume_automation.go new file mode 100644 index 000000000..1c2dc1468 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_automation.go @@ -0,0 +1,448 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the VolumeAutomation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAutomation{} + +// VolumeAutomation struct for VolumeAutomation +type VolumeAutomation struct { + CreateTime time.Time `json:"createTime"` + Description *string `json:"description,omitempty"` + Id string `json:"id"` + Input *VolumeAutomationInput `json:"input,omitempty"` + Name *string `json:"name,omitempty"` + Output *VolumeOutput `json:"output,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + Triggers *AutomationTriggers `json:"triggers,omitempty"` + UpdateTime time.Time `json:"updateTime"` + AdditionalProperties map[string]interface{} +} + +type _VolumeAutomation VolumeAutomation + +// NewVolumeAutomation instantiates a new VolumeAutomation 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 NewVolumeAutomation(createTime time.Time, id string, updateTime time.Time) *VolumeAutomation { + this := VolumeAutomation{} + this.CreateTime = createTime + this.Id = id + this.UpdateTime = updateTime + return &this +} + +// NewVolumeAutomationWithDefaults instantiates a new VolumeAutomation 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 NewVolumeAutomationWithDefaults() *VolumeAutomation { + this := VolumeAutomation{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *VolumeAutomation) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *VolumeAutomation) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *VolumeAutomation) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VolumeAutomation) 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 *VolumeAutomation) 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 *VolumeAutomation) 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 *VolumeAutomation) SetDescription(v string) { + o.Description = &v +} + +// GetId returns the Id field value +func (o *VolumeAutomation) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *VolumeAutomation) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *VolumeAutomation) SetId(v string) { + o.Id = v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *VolumeAutomation) GetInput() VolumeAutomationInput { + if o == nil || IsNil(o.Input) { + var ret VolumeAutomationInput + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAutomation) GetInputOk() (*VolumeAutomationInput, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *VolumeAutomation) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given VolumeAutomationInput and assigns it to the Input field. +func (o *VolumeAutomation) SetInput(v VolumeAutomationInput) { + o.Input = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VolumeAutomation) 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 *VolumeAutomation) 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 *VolumeAutomation) 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 *VolumeAutomation) SetName(v string) { + o.Name = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *VolumeAutomation) GetOutput() VolumeOutput { + if o == nil || IsNil(o.Output) { + var ret VolumeOutput + 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 *VolumeAutomation) GetOutputOk() (*VolumeOutput, 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 *VolumeAutomation) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given VolumeOutput and assigns it to the Output field. +func (o *VolumeAutomation) SetOutput(v VolumeOutput) { + o.Output = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *VolumeAutomation) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAutomation) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *VolumeAutomation) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *VolumeAutomation) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetTriggers returns the Triggers field value if set, zero value otherwise. +func (o *VolumeAutomation) GetTriggers() AutomationTriggers { + if o == nil || IsNil(o.Triggers) { + var ret AutomationTriggers + return ret + } + return *o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAutomation) GetTriggersOk() (*AutomationTriggers, bool) { + if o == nil || IsNil(o.Triggers) { + return nil, false + } + return o.Triggers, true +} + +// HasTriggers returns a boolean if a field has been set. +func (o *VolumeAutomation) HasTriggers() bool { + if o != nil && !IsNil(o.Triggers) { + return true + } + + return false +} + +// SetTriggers gets a reference to the given AutomationTriggers and assigns it to the Triggers field. +func (o *VolumeAutomation) SetTriggers(v AutomationTriggers) { + o.Triggers = &v +} + +// GetUpdateTime returns the UpdateTime field value +func (o *VolumeAutomation) GetUpdateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdateTime +} + +// GetUpdateTimeOk returns a tuple with the UpdateTime field value +// and a boolean to check if the value has been set. +func (o *VolumeAutomation) GetUpdateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdateTime, true +} + +// SetUpdateTime sets field value +func (o *VolumeAutomation) SetUpdateTime(v time.Time) { + o.UpdateTime = v +} + +func (o VolumeAutomation) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeAutomation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["createTime"] = o.CreateTime + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["id"] = o.Id + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + if !IsNil(o.Triggers) { + toSerialize["triggers"] = o.Triggers + } + toSerialize["updateTime"] = o.UpdateTime + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeAutomation) 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{ + "createTime", + "id", + "updateTime", + } + + 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) + } + } + + varVolumeAutomation := _VolumeAutomation{} + + err = json.Unmarshal(data, &varVolumeAutomation) + + if err != nil { + return err + } + + *o = VolumeAutomation(varVolumeAutomation) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createTime") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "input") + delete(additionalProperties, "name") + delete(additionalProperties, "output") + delete(additionalProperties, "templateId") + delete(additionalProperties, "triggers") + delete(additionalProperties, "updateTime") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeAutomation struct { + value *VolumeAutomation + isSet bool +} + +func (v NullableVolumeAutomation) Get() *VolumeAutomation { + return v.value +} + +func (v *NullableVolumeAutomation) Set(val *VolumeAutomation) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAutomation) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAutomation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAutomation(val *VolumeAutomation) *NullableVolumeAutomation { + return &NullableVolumeAutomation{value: val, isSet: true} +} + +func (v NullableVolumeAutomation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAutomation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_automation_input.go b/services/automation/v1betaapi/model_volume_automation_input.go new file mode 100644 index 000000000..682ea2d02 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_automation_input.go @@ -0,0 +1,154 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// VolumeAutomationInput - struct for VolumeAutomationInput +type VolumeAutomationInput struct { + GenericInput *GenericInput + VolumeRecoveryPointManagementInput *VolumeRecoveryPointManagementInput +} + +// GenericInputAsVolumeAutomationInput is a convenience function that returns GenericInput wrapped in VolumeAutomationInput +func GenericInputAsVolumeAutomationInput(v *GenericInput) VolumeAutomationInput { + return VolumeAutomationInput{ + GenericInput: v, + } +} + +// VolumeRecoveryPointManagementInputAsVolumeAutomationInput is a convenience function that returns VolumeRecoveryPointManagementInput wrapped in VolumeAutomationInput +func VolumeRecoveryPointManagementInputAsVolumeAutomationInput(v *VolumeRecoveryPointManagementInput) VolumeAutomationInput { + return VolumeAutomationInput{ + VolumeRecoveryPointManagementInput: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *VolumeAutomationInput) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'Generic' + if jsonDict["kind"] == "Generic" { + // try to unmarshal JSON data into GenericInput + err = json.Unmarshal(data, &dst.GenericInput) + if err == nil { + return nil // data stored in dst.GenericInput, return on the first match + } else { + dst.GenericInput = nil + return fmt.Errorf("failed to unmarshal VolumeAutomationInput as GenericInput: %s", err.Error()) + } + } + + // check if the discriminator value is 'VolumeRecoveryPointManagement' + if jsonDict["kind"] == "VolumeRecoveryPointManagement" { + // try to unmarshal JSON data into VolumeRecoveryPointManagementInput + err = json.Unmarshal(data, &dst.VolumeRecoveryPointManagementInput) + if err == nil { + return nil // data stored in dst.VolumeRecoveryPointManagementInput, return on the first match + } else { + dst.VolumeRecoveryPointManagementInput = nil + return fmt.Errorf("failed to unmarshal VolumeAutomationInput as VolumeRecoveryPointManagementInput: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src VolumeAutomationInput) MarshalJSON() ([]byte, error) { + if src.GenericInput != nil { + return json.Marshal(&src.GenericInput) + } + + if src.VolumeRecoveryPointManagementInput != nil { + return json.Marshal(&src.VolumeRecoveryPointManagementInput) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *VolumeAutomationInput) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GenericInput != nil { + return obj.GenericInput + } + + if obj.VolumeRecoveryPointManagementInput != nil { + return obj.VolumeRecoveryPointManagementInput + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj VolumeAutomationInput) GetActualInstanceValue() interface{} { + if obj.GenericInput != nil { + return *obj.GenericInput + } + + if obj.VolumeRecoveryPointManagementInput != nil { + return *obj.VolumeRecoveryPointManagementInput + } + + // all schemas are nil + return nil +} + +type NullableVolumeAutomationInput struct { + value *VolumeAutomationInput + isSet bool +} + +func (v NullableVolumeAutomationInput) Get() *VolumeAutomationInput { + return v.value +} + +func (v *NullableVolumeAutomationInput) Set(val *VolumeAutomationInput) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAutomationInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAutomationInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAutomationInput(val *VolumeAutomationInput) *NullableVolumeAutomationInput { + return &NullableVolumeAutomationInput{value: val, isSet: true} +} + +func (v NullableVolumeAutomationInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAutomationInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_automation.go b/services/automation/v1betaapi/model_volume_execution_automation.go new file mode 100644 index 000000000..65ce0e941 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_automation.go @@ -0,0 +1,419 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the VolumeExecutionAutomation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeExecutionAutomation{} + +// VolumeExecutionAutomation struct for VolumeExecutionAutomation +type VolumeExecutionAutomation struct { + CreateTime time.Time `json:"createTime"` + Description *string `json:"description,omitempty"` + Input *VolumeAutomationInput `json:"input,omitempty"` + Name *string `json:"name,omitempty"` + Output *VolumeExecutionOutput `json:"output,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + Triggers *AutomationTriggers `json:"triggers,omitempty"` + UpdateTime time.Time `json:"updateTime"` + AdditionalProperties map[string]interface{} +} + +type _VolumeExecutionAutomation VolumeExecutionAutomation + +// NewVolumeExecutionAutomation instantiates a new VolumeExecutionAutomation 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 NewVolumeExecutionAutomation(createTime time.Time, updateTime time.Time) *VolumeExecutionAutomation { + this := VolumeExecutionAutomation{} + this.CreateTime = createTime + this.UpdateTime = updateTime + return &this +} + +// NewVolumeExecutionAutomationWithDefaults instantiates a new VolumeExecutionAutomation 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 NewVolumeExecutionAutomationWithDefaults() *VolumeExecutionAutomation { + this := VolumeExecutionAutomation{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *VolumeExecutionAutomation) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *VolumeExecutionAutomation) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *VolumeExecutionAutomation) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VolumeExecutionAutomation) 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 *VolumeExecutionAutomation) 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 *VolumeExecutionAutomation) 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 *VolumeExecutionAutomation) SetDescription(v string) { + o.Description = &v +} + +// GetInput returns the Input field value if set, zero value otherwise. +func (o *VolumeExecutionAutomation) GetInput() VolumeAutomationInput { + if o == nil || IsNil(o.Input) { + var ret VolumeAutomationInput + return ret + } + return *o.Input +} + +// GetInputOk returns a tuple with the Input field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionAutomation) GetInputOk() (*VolumeAutomationInput, bool) { + if o == nil || IsNil(o.Input) { + return nil, false + } + return o.Input, true +} + +// HasInput returns a boolean if a field has been set. +func (o *VolumeExecutionAutomation) HasInput() bool { + if o != nil && !IsNil(o.Input) { + return true + } + + return false +} + +// SetInput gets a reference to the given VolumeAutomationInput and assigns it to the Input field. +func (o *VolumeExecutionAutomation) SetInput(v VolumeAutomationInput) { + o.Input = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VolumeExecutionAutomation) 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 *VolumeExecutionAutomation) 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 *VolumeExecutionAutomation) 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 *VolumeExecutionAutomation) SetName(v string) { + o.Name = &v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *VolumeExecutionAutomation) GetOutput() VolumeExecutionOutput { + if o == nil || IsNil(o.Output) { + var ret VolumeExecutionOutput + 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 *VolumeExecutionAutomation) GetOutputOk() (*VolumeExecutionOutput, 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 *VolumeExecutionAutomation) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given VolumeExecutionOutput and assigns it to the Output field. +func (o *VolumeExecutionAutomation) SetOutput(v VolumeExecutionOutput) { + o.Output = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *VolumeExecutionAutomation) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionAutomation) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *VolumeExecutionAutomation) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *VolumeExecutionAutomation) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetTriggers returns the Triggers field value if set, zero value otherwise. +func (o *VolumeExecutionAutomation) GetTriggers() AutomationTriggers { + if o == nil || IsNil(o.Triggers) { + var ret AutomationTriggers + return ret + } + return *o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionAutomation) GetTriggersOk() (*AutomationTriggers, bool) { + if o == nil || IsNil(o.Triggers) { + return nil, false + } + return o.Triggers, true +} + +// HasTriggers returns a boolean if a field has been set. +func (o *VolumeExecutionAutomation) HasTriggers() bool { + if o != nil && !IsNil(o.Triggers) { + return true + } + + return false +} + +// SetTriggers gets a reference to the given AutomationTriggers and assigns it to the Triggers field. +func (o *VolumeExecutionAutomation) SetTriggers(v AutomationTriggers) { + o.Triggers = &v +} + +// GetUpdateTime returns the UpdateTime field value +func (o *VolumeExecutionAutomation) GetUpdateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdateTime +} + +// GetUpdateTimeOk returns a tuple with the UpdateTime field value +// and a boolean to check if the value has been set. +func (o *VolumeExecutionAutomation) GetUpdateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdateTime, true +} + +// SetUpdateTime sets field value +func (o *VolumeExecutionAutomation) SetUpdateTime(v time.Time) { + o.UpdateTime = v +} + +func (o VolumeExecutionAutomation) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeExecutionAutomation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["createTime"] = o.CreateTime + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Input) { + toSerialize["input"] = o.Input + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + if !IsNil(o.Triggers) { + toSerialize["triggers"] = o.Triggers + } + toSerialize["updateTime"] = o.UpdateTime + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeExecutionAutomation) 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{ + "createTime", + "updateTime", + } + + 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) + } + } + + varVolumeExecutionAutomation := _VolumeExecutionAutomation{} + + err = json.Unmarshal(data, &varVolumeExecutionAutomation) + + if err != nil { + return err + } + + *o = VolumeExecutionAutomation(varVolumeExecutionAutomation) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "createTime") + delete(additionalProperties, "description") + delete(additionalProperties, "input") + delete(additionalProperties, "name") + delete(additionalProperties, "output") + delete(additionalProperties, "templateId") + delete(additionalProperties, "triggers") + delete(additionalProperties, "updateTime") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeExecutionAutomation struct { + value *VolumeExecutionAutomation + isSet bool +} + +func (v NullableVolumeExecutionAutomation) Get() *VolumeExecutionAutomation { + return v.value +} + +func (v *NullableVolumeExecutionAutomation) Set(val *VolumeExecutionAutomation) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionAutomation) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionAutomation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionAutomation(val *VolumeExecutionAutomation) *NullableVolumeExecutionAutomation { + return &NullableVolumeExecutionAutomation{value: val, isSet: true} +} + +func (v NullableVolumeExecutionAutomation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionAutomation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_details.go b/services/automation/v1betaapi/model_volume_execution_details.go new file mode 100644 index 000000000..b6ed8a30e --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_details.go @@ -0,0 +1,204 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the VolumeExecutionDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeExecutionDetails{} + +// VolumeExecutionDetails struct for VolumeExecutionDetails +type VolumeExecutionDetails struct { + Config VolumeAutomation `json:"config"` + Output *VolumeExecutionOutput `json:"output,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VolumeExecutionDetails VolumeExecutionDetails + +// NewVolumeExecutionDetails instantiates a new VolumeExecutionDetails 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 NewVolumeExecutionDetails(config VolumeAutomation) *VolumeExecutionDetails { + this := VolumeExecutionDetails{} + this.Config = config + return &this +} + +// NewVolumeExecutionDetailsWithDefaults instantiates a new VolumeExecutionDetails 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 NewVolumeExecutionDetailsWithDefaults() *VolumeExecutionDetails { + this := VolumeExecutionDetails{} + return &this +} + +// GetConfig returns the Config field value +func (o *VolumeExecutionDetails) GetConfig() VolumeAutomation { + if o == nil { + var ret VolumeAutomation + return ret + } + + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *VolumeExecutionDetails) GetConfigOk() (*VolumeAutomation, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value +func (o *VolumeExecutionDetails) SetConfig(v VolumeAutomation) { + o.Config = v +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *VolumeExecutionDetails) GetOutput() VolumeExecutionOutput { + if o == nil || IsNil(o.Output) { + var ret VolumeExecutionOutput + 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 *VolumeExecutionDetails) GetOutputOk() (*VolumeExecutionOutput, 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 *VolumeExecutionDetails) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given VolumeExecutionOutput and assigns it to the Output field. +func (o *VolumeExecutionDetails) SetOutput(v VolumeExecutionOutput) { + o.Output = &v +} + +func (o VolumeExecutionDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeExecutionDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["config"] = o.Config + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeExecutionDetails) 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{ + "config", + } + + 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) + } + } + + varVolumeExecutionDetails := _VolumeExecutionDetails{} + + err = json.Unmarshal(data, &varVolumeExecutionDetails) + + if err != nil { + return err + } + + *o = VolumeExecutionDetails(varVolumeExecutionDetails) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "config") + delete(additionalProperties, "output") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeExecutionDetails struct { + value *VolumeExecutionDetails + isSet bool +} + +func (v NullableVolumeExecutionDetails) Get() *VolumeExecutionDetails { + return v.value +} + +func (v *NullableVolumeExecutionDetails) Set(val *VolumeExecutionDetails) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionDetails) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionDetails(val *VolumeExecutionDetails) *NullableVolumeExecutionDetails { + return &NullableVolumeExecutionDetails{value: val, isSet: true} +} + +func (v NullableVolumeExecutionDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_output.go b/services/automation/v1betaapi/model_volume_execution_output.go new file mode 100644 index 000000000..04685508e --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_output.go @@ -0,0 +1,154 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 VolumeExecutionOutput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeExecutionOutput{} + +// VolumeExecutionOutput struct for VolumeExecutionOutput +type VolumeExecutionOutput struct { + Steps []VolumeExecutionOutputStep `json:"steps,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VolumeExecutionOutput VolumeExecutionOutput + +// NewVolumeExecutionOutput instantiates a new VolumeExecutionOutput 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 NewVolumeExecutionOutput() *VolumeExecutionOutput { + this := VolumeExecutionOutput{} + return &this +} + +// NewVolumeExecutionOutputWithDefaults instantiates a new VolumeExecutionOutput 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 NewVolumeExecutionOutputWithDefaults() *VolumeExecutionOutput { + this := VolumeExecutionOutput{} + return &this +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *VolumeExecutionOutput) GetSteps() []VolumeExecutionOutputStep { + if o == nil || IsNil(o.Steps) { + var ret []VolumeExecutionOutputStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionOutput) GetStepsOk() ([]VolumeExecutionOutputStep, bool) { + if o == nil || IsNil(o.Steps) { + return nil, false + } + return o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *VolumeExecutionOutput) HasSteps() bool { + if o != nil && !IsNil(o.Steps) { + return true + } + + return false +} + +// SetSteps gets a reference to the given []VolumeExecutionOutputStep and assigns it to the Steps field. +func (o *VolumeExecutionOutput) SetSteps(v []VolumeExecutionOutputStep) { + o.Steps = v +} + +func (o VolumeExecutionOutput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeExecutionOutput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Steps) { + toSerialize["steps"] = o.Steps + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeExecutionOutput) UnmarshalJSON(data []byte) (err error) { + varVolumeExecutionOutput := _VolumeExecutionOutput{} + + err = json.Unmarshal(data, &varVolumeExecutionOutput) + + if err != nil { + return err + } + + *o = VolumeExecutionOutput(varVolumeExecutionOutput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "steps") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeExecutionOutput struct { + value *VolumeExecutionOutput + isSet bool +} + +func (v NullableVolumeExecutionOutput) Get() *VolumeExecutionOutput { + return v.value +} + +func (v *NullableVolumeExecutionOutput) Set(val *VolumeExecutionOutput) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionOutput) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionOutput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionOutput(val *VolumeExecutionOutput) *NullableVolumeExecutionOutput { + return &NullableVolumeExecutionOutput{value: val, isSet: true} +} + +func (v NullableVolumeExecutionOutput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionOutput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_output_step.go b/services/automation/v1betaapi/model_volume_execution_output_step.go new file mode 100644 index 000000000..6e3efbe70 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_output_step.go @@ -0,0 +1,270 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the VolumeExecutionOutputStep type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeExecutionOutputStep{} + +// VolumeExecutionOutputStep struct for VolumeExecutionOutputStep +type VolumeExecutionOutputStep struct { + Message *string `json:"message,omitempty"` + Name string `json:"name"` + Result *VolumeOutputStepResult `json:"result,omitempty"` + Status VolumeExecutionOutputStepStatus `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _VolumeExecutionOutputStep VolumeExecutionOutputStep + +// NewVolumeExecutionOutputStep instantiates a new VolumeExecutionOutputStep 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 NewVolumeExecutionOutputStep(name string, status VolumeExecutionOutputStepStatus) *VolumeExecutionOutputStep { + this := VolumeExecutionOutputStep{} + this.Name = name + this.Status = status + return &this +} + +// NewVolumeExecutionOutputStepWithDefaults instantiates a new VolumeExecutionOutputStep 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 NewVolumeExecutionOutputStepWithDefaults() *VolumeExecutionOutputStep { + this := VolumeExecutionOutputStep{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *VolumeExecutionOutputStep) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionOutputStep) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *VolumeExecutionOutputStep) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *VolumeExecutionOutputStep) SetMessage(v string) { + o.Message = &v +} + +// GetName returns the Name field value +func (o *VolumeExecutionOutputStep) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VolumeExecutionOutputStep) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *VolumeExecutionOutputStep) SetName(v string) { + o.Name = v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *VolumeExecutionOutputStep) GetResult() VolumeOutputStepResult { + if o == nil || IsNil(o.Result) { + var ret VolumeOutputStepResult + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionOutputStep) GetResultOk() (*VolumeOutputStepResult, bool) { + if o == nil || IsNil(o.Result) { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *VolumeExecutionOutputStep) HasResult() bool { + if o != nil && !IsNil(o.Result) { + return true + } + + return false +} + +// SetResult gets a reference to the given VolumeOutputStepResult and assigns it to the Result field. +func (o *VolumeExecutionOutputStep) SetResult(v VolumeOutputStepResult) { + o.Result = &v +} + +// GetStatus returns the Status field value +func (o *VolumeExecutionOutputStep) GetStatus() VolumeExecutionOutputStepStatus { + if o == nil { + var ret VolumeExecutionOutputStepStatus + 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 *VolumeExecutionOutputStep) GetStatusOk() (*VolumeExecutionOutputStepStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *VolumeExecutionOutputStep) SetStatus(v VolumeExecutionOutputStepStatus) { + o.Status = v +} + +func (o VolumeExecutionOutputStep) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeExecutionOutputStep) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + toSerialize["name"] = o.Name + if !IsNil(o.Result) { + toSerialize["result"] = o.Result + } + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeExecutionOutputStep) 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{ + "name", + "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) + } + } + + varVolumeExecutionOutputStep := _VolumeExecutionOutputStep{} + + err = json.Unmarshal(data, &varVolumeExecutionOutputStep) + + if err != nil { + return err + } + + *o = VolumeExecutionOutputStep(varVolumeExecutionOutputStep) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "name") + delete(additionalProperties, "result") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeExecutionOutputStep struct { + value *VolumeExecutionOutputStep + isSet bool +} + +func (v NullableVolumeExecutionOutputStep) Get() *VolumeExecutionOutputStep { + return v.value +} + +func (v *NullableVolumeExecutionOutputStep) Set(val *VolumeExecutionOutputStep) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionOutputStep) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionOutputStep) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionOutputStep(val *VolumeExecutionOutputStep) *NullableVolumeExecutionOutputStep { + return &NullableVolumeExecutionOutputStep{value: val, isSet: true} +} + +func (v NullableVolumeExecutionOutputStep) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionOutputStep) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_output_step_status.go b/services/automation/v1betaapi/model_volume_execution_output_step_status.go new file mode 100644 index 000000000..fb2c88f99 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_output_step_status.go @@ -0,0 +1,118 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// VolumeExecutionOutputStepStatus the model 'VolumeExecutionOutputStepStatus' +type VolumeExecutionOutputStepStatus string + +// List of VolumeExecutionOutputStep_status +const ( + VOLUMEEXECUTIONOUTPUTSTEPSTATUS_PENDING VolumeExecutionOutputStepStatus = "PENDING" + VOLUMEEXECUTIONOUTPUTSTEPSTATUS_RUNNING VolumeExecutionOutputStepStatus = "RUNNING" + VOLUMEEXECUTIONOUTPUTSTEPSTATUS_FAILED VolumeExecutionOutputStepStatus = "FAILED" + VOLUMEEXECUTIONOUTPUTSTEPSTATUS_SUCCESSFUL VolumeExecutionOutputStepStatus = "SUCCESSFUL" + VOLUMEEXECUTIONOUTPUTSTEPSTATUS_UNKNOWN_DEFAULT_OPEN_API VolumeExecutionOutputStepStatus = "unknown_default_open_api" +) + +// All allowed values of VolumeExecutionOutputStepStatus enum +var AllowedVolumeExecutionOutputStepStatusEnumValues = []VolumeExecutionOutputStepStatus{ + "PENDING", + "RUNNING", + "FAILED", + "SUCCESSFUL", + "unknown_default_open_api", +} + +func (v *VolumeExecutionOutputStepStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VolumeExecutionOutputStepStatus(value) + for _, existing := range AllowedVolumeExecutionOutputStepStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = VOLUMEEXECUTIONOUTPUTSTEPSTATUS_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewVolumeExecutionOutputStepStatusFromValue returns a pointer to a valid VolumeExecutionOutputStepStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVolumeExecutionOutputStepStatusFromValue(v string) (*VolumeExecutionOutputStepStatus, error) { + ev := VolumeExecutionOutputStepStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VolumeExecutionOutputStepStatus: valid values are %v", v, AllowedVolumeExecutionOutputStepStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VolumeExecutionOutputStepStatus) IsValid() bool { + for _, existing := range AllowedVolumeExecutionOutputStepStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VolumeExecutionOutputStep_status value +func (v VolumeExecutionOutputStepStatus) Ptr() *VolumeExecutionOutputStepStatus { + return &v +} + +type NullableVolumeExecutionOutputStepStatus struct { + value *VolumeExecutionOutputStepStatus + isSet bool +} + +func (v NullableVolumeExecutionOutputStepStatus) Get() *VolumeExecutionOutputStepStatus { + return v.value +} + +func (v *NullableVolumeExecutionOutputStepStatus) Set(val *VolumeExecutionOutputStepStatus) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionOutputStepStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionOutputStepStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionOutputStepStatus(val *VolumeExecutionOutputStepStatus) *NullableVolumeExecutionOutputStepStatus { + return &NullableVolumeExecutionOutputStepStatus{value: val, isSet: true} +} + +func (v NullableVolumeExecutionOutputStepStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionOutputStepStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_response.go b/services/automation/v1betaapi/model_volume_execution_response.go new file mode 100644 index 000000000..d45cd1239 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_response.go @@ -0,0 +1,300 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" + "time" +) + +// checks if the VolumeExecutionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeExecutionResponse{} + +// VolumeExecutionResponse struct for VolumeExecutionResponse +type VolumeExecutionResponse struct { + Automation *VolumeExecutionDetails `json:"automation,omitempty"` + CreateTime time.Time `json:"createTime"` + EndTime *time.Time `json:"endTime,omitempty"` + Id string `json:"id"` + Status VolumeExecutionResponseStatus `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _VolumeExecutionResponse VolumeExecutionResponse + +// NewVolumeExecutionResponse instantiates a new VolumeExecutionResponse 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 NewVolumeExecutionResponse(createTime time.Time, id string, status VolumeExecutionResponseStatus) *VolumeExecutionResponse { + this := VolumeExecutionResponse{} + this.CreateTime = createTime + this.Id = id + this.Status = status + return &this +} + +// NewVolumeExecutionResponseWithDefaults instantiates a new VolumeExecutionResponse 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 NewVolumeExecutionResponseWithDefaults() *VolumeExecutionResponse { + this := VolumeExecutionResponse{} + return &this +} + +// GetAutomation returns the Automation field value if set, zero value otherwise. +func (o *VolumeExecutionResponse) GetAutomation() VolumeExecutionDetails { + if o == nil || IsNil(o.Automation) { + var ret VolumeExecutionDetails + return ret + } + return *o.Automation +} + +// GetAutomationOk returns a tuple with the Automation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionResponse) GetAutomationOk() (*VolumeExecutionDetails, bool) { + if o == nil || IsNil(o.Automation) { + return nil, false + } + return o.Automation, true +} + +// HasAutomation returns a boolean if a field has been set. +func (o *VolumeExecutionResponse) HasAutomation() bool { + if o != nil && !IsNil(o.Automation) { + return true + } + + return false +} + +// SetAutomation gets a reference to the given VolumeExecutionDetails and assigns it to the Automation field. +func (o *VolumeExecutionResponse) SetAutomation(v VolumeExecutionDetails) { + o.Automation = &v +} + +// GetCreateTime returns the CreateTime field value +func (o *VolumeExecutionResponse) GetCreateTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *VolumeExecutionResponse) GetCreateTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreateTime, true +} + +// SetCreateTime sets field value +func (o *VolumeExecutionResponse) SetCreateTime(v time.Time) { + o.CreateTime = v +} + +// GetEndTime returns the EndTime field value if set, zero value otherwise. +func (o *VolumeExecutionResponse) GetEndTime() time.Time { + if o == nil || IsNil(o.EndTime) { + var ret time.Time + return ret + } + return *o.EndTime +} + +// GetEndTimeOk returns a tuple with the EndTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeExecutionResponse) GetEndTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.EndTime) { + return nil, false + } + return o.EndTime, true +} + +// HasEndTime returns a boolean if a field has been set. +func (o *VolumeExecutionResponse) HasEndTime() bool { + if o != nil && !IsNil(o.EndTime) { + return true + } + + return false +} + +// SetEndTime gets a reference to the given time.Time and assigns it to the EndTime field. +func (o *VolumeExecutionResponse) SetEndTime(v time.Time) { + o.EndTime = &v +} + +// GetId returns the Id field value +func (o *VolumeExecutionResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *VolumeExecutionResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *VolumeExecutionResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *VolumeExecutionResponse) GetStatus() VolumeExecutionResponseStatus { + if o == nil { + var ret VolumeExecutionResponseStatus + 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 *VolumeExecutionResponse) GetStatusOk() (*VolumeExecutionResponseStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *VolumeExecutionResponse) SetStatus(v VolumeExecutionResponseStatus) { + o.Status = v +} + +func (o VolumeExecutionResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeExecutionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Automation) { + toSerialize["automation"] = o.Automation + } + toSerialize["createTime"] = o.CreateTime + if !IsNil(o.EndTime) { + toSerialize["endTime"] = o.EndTime + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeExecutionResponse) 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{ + "createTime", + "id", + "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) + } + } + + varVolumeExecutionResponse := _VolumeExecutionResponse{} + + err = json.Unmarshal(data, &varVolumeExecutionResponse) + + if err != nil { + return err + } + + *o = VolumeExecutionResponse(varVolumeExecutionResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "automation") + delete(additionalProperties, "createTime") + delete(additionalProperties, "endTime") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeExecutionResponse struct { + value *VolumeExecutionResponse + isSet bool +} + +func (v NullableVolumeExecutionResponse) Get() *VolumeExecutionResponse { + return v.value +} + +func (v *NullableVolumeExecutionResponse) Set(val *VolumeExecutionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionResponse(val *VolumeExecutionResponse) *NullableVolumeExecutionResponse { + return &NullableVolumeExecutionResponse{value: val, isSet: true} +} + +func (v NullableVolumeExecutionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_execution_response_status.go b/services/automation/v1betaapi/model_volume_execution_response_status.go new file mode 100644 index 000000000..b36f6edcc --- /dev/null +++ b/services/automation/v1betaapi/model_volume_execution_response_status.go @@ -0,0 +1,120 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// VolumeExecutionResponseStatus the model 'VolumeExecutionResponseStatus' +type VolumeExecutionResponseStatus string + +// List of VolumeExecutionResponse_status +const ( + VOLUMEEXECUTIONRESPONSESTATUS_PENDING VolumeExecutionResponseStatus = "PENDING" + VOLUMEEXECUTIONRESPONSESTATUS_RUNNING VolumeExecutionResponseStatus = "RUNNING" + VOLUMEEXECUTIONRESPONSESTATUS_COMPLETED VolumeExecutionResponseStatus = "COMPLETED" + VOLUMEEXECUTIONRESPONSESTATUS_FAILED VolumeExecutionResponseStatus = "FAILED" + VOLUMEEXECUTIONRESPONSESTATUS_TERMINATED VolumeExecutionResponseStatus = "TERMINATED" + VOLUMEEXECUTIONRESPONSESTATUS_UNKNOWN_DEFAULT_OPEN_API VolumeExecutionResponseStatus = "unknown_default_open_api" +) + +// All allowed values of VolumeExecutionResponseStatus enum +var AllowedVolumeExecutionResponseStatusEnumValues = []VolumeExecutionResponseStatus{ + "PENDING", + "RUNNING", + "COMPLETED", + "FAILED", + "TERMINATED", + "unknown_default_open_api", +} + +func (v *VolumeExecutionResponseStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VolumeExecutionResponseStatus(value) + for _, existing := range AllowedVolumeExecutionResponseStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = VOLUMEEXECUTIONRESPONSESTATUS_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewVolumeExecutionResponseStatusFromValue returns a pointer to a valid VolumeExecutionResponseStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVolumeExecutionResponseStatusFromValue(v string) (*VolumeExecutionResponseStatus, error) { + ev := VolumeExecutionResponseStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VolumeExecutionResponseStatus: valid values are %v", v, AllowedVolumeExecutionResponseStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VolumeExecutionResponseStatus) IsValid() bool { + for _, existing := range AllowedVolumeExecutionResponseStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VolumeExecutionResponse_status value +func (v VolumeExecutionResponseStatus) Ptr() *VolumeExecutionResponseStatus { + return &v +} + +type NullableVolumeExecutionResponseStatus struct { + value *VolumeExecutionResponseStatus + isSet bool +} + +func (v NullableVolumeExecutionResponseStatus) Get() *VolumeExecutionResponseStatus { + return v.value +} + +func (v *NullableVolumeExecutionResponseStatus) Set(val *VolumeExecutionResponseStatus) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeExecutionResponseStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeExecutionResponseStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeExecutionResponseStatus(val *VolumeExecutionResponseStatus) *NullableVolumeExecutionResponseStatus { + return &NullableVolumeExecutionResponseStatus{value: val, isSet: true} +} + +func (v NullableVolumeExecutionResponseStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeExecutionResponseStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_output.go b/services/automation/v1betaapi/model_volume_output.go new file mode 100644 index 000000000..ac8a56f49 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_output.go @@ -0,0 +1,154 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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 VolumeOutput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeOutput{} + +// VolumeOutput struct for VolumeOutput +type VolumeOutput struct { + Steps []VolumeOutputStep `json:"steps,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VolumeOutput VolumeOutput + +// NewVolumeOutput instantiates a new VolumeOutput 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 NewVolumeOutput() *VolumeOutput { + this := VolumeOutput{} + return &this +} + +// NewVolumeOutputWithDefaults instantiates a new VolumeOutput 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 NewVolumeOutputWithDefaults() *VolumeOutput { + this := VolumeOutput{} + return &this +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *VolumeOutput) GetSteps() []VolumeOutputStep { + if o == nil || IsNil(o.Steps) { + var ret []VolumeOutputStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeOutput) GetStepsOk() ([]VolumeOutputStep, bool) { + if o == nil || IsNil(o.Steps) { + return nil, false + } + return o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *VolumeOutput) HasSteps() bool { + if o != nil && !IsNil(o.Steps) { + return true + } + + return false +} + +// SetSteps gets a reference to the given []VolumeOutputStep and assigns it to the Steps field. +func (o *VolumeOutput) SetSteps(v []VolumeOutputStep) { + o.Steps = v +} + +func (o VolumeOutput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeOutput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Steps) { + toSerialize["steps"] = o.Steps + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeOutput) UnmarshalJSON(data []byte) (err error) { + varVolumeOutput := _VolumeOutput{} + + err = json.Unmarshal(data, &varVolumeOutput) + + if err != nil { + return err + } + + *o = VolumeOutput(varVolumeOutput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "steps") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeOutput struct { + value *VolumeOutput + isSet bool +} + +func (v NullableVolumeOutput) Get() *VolumeOutput { + return v.value +} + +func (v *NullableVolumeOutput) Set(val *VolumeOutput) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeOutput) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeOutput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeOutput(val *VolumeOutput) *NullableVolumeOutput { + return &NullableVolumeOutput{value: val, isSet: true} +} + +func (v NullableVolumeOutput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeOutput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_output_step.go b/services/automation/v1betaapi/model_volume_output_step.go new file mode 100644 index 000000000..8487bc904 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_output_step.go @@ -0,0 +1,204 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the VolumeOutputStep type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeOutputStep{} + +// VolumeOutputStep struct for VolumeOutputStep +type VolumeOutputStep struct { + Name string `json:"name"` + Result *VolumeOutputStepResult `json:"result,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VolumeOutputStep VolumeOutputStep + +// NewVolumeOutputStep instantiates a new VolumeOutputStep 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 NewVolumeOutputStep(name string) *VolumeOutputStep { + this := VolumeOutputStep{} + this.Name = name + return &this +} + +// NewVolumeOutputStepWithDefaults instantiates a new VolumeOutputStep 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 NewVolumeOutputStepWithDefaults() *VolumeOutputStep { + this := VolumeOutputStep{} + return &this +} + +// GetName returns the Name field value +func (o *VolumeOutputStep) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VolumeOutputStep) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *VolumeOutputStep) SetName(v string) { + o.Name = v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *VolumeOutputStep) GetResult() VolumeOutputStepResult { + if o == nil || IsNil(o.Result) { + var ret VolumeOutputStepResult + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeOutputStep) GetResultOk() (*VolumeOutputStepResult, bool) { + if o == nil || IsNil(o.Result) { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *VolumeOutputStep) HasResult() bool { + if o != nil && !IsNil(o.Result) { + return true + } + + return false +} + +// SetResult gets a reference to the given VolumeOutputStepResult and assigns it to the Result field. +func (o *VolumeOutputStep) SetResult(v VolumeOutputStepResult) { + o.Result = &v +} + +func (o VolumeOutputStep) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeOutputStep) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Result) { + toSerialize["result"] = o.Result + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeOutputStep) 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{ + "name", + } + + 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) + } + } + + varVolumeOutputStep := _VolumeOutputStep{} + + err = json.Unmarshal(data, &varVolumeOutputStep) + + if err != nil { + return err + } + + *o = VolumeOutputStep(varVolumeOutputStep) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "result") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeOutputStep struct { + value *VolumeOutputStep + isSet bool +} + +func (v NullableVolumeOutputStep) Get() *VolumeOutputStep { + return v.value +} + +func (v *NullableVolumeOutputStep) Set(val *VolumeOutputStep) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeOutputStep) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeOutputStep) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeOutputStep(val *VolumeOutputStep) *NullableVolumeOutputStep { + return &NullableVolumeOutputStep{value: val, isSet: true} +} + +func (v NullableVolumeOutputStep) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeOutputStep) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_output_step_result.go b/services/automation/v1betaapi/model_volume_output_step_result.go new file mode 100644 index 000000000..812d911e7 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_output_step_result.go @@ -0,0 +1,154 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// VolumeOutputStepResult - struct for VolumeOutputStepResult +type VolumeOutputStepResult struct { + CreateSnapshotsResult *CreateSnapshotsResult + GetVolumeIDsResult *GetVolumeIDsResult +} + +// CreateSnapshotsResultAsVolumeOutputStepResult is a convenience function that returns CreateSnapshotsResult wrapped in VolumeOutputStepResult +func CreateSnapshotsResultAsVolumeOutputStepResult(v *CreateSnapshotsResult) VolumeOutputStepResult { + return VolumeOutputStepResult{ + CreateSnapshotsResult: v, + } +} + +// GetVolumeIDsResultAsVolumeOutputStepResult is a convenience function that returns GetVolumeIDsResult wrapped in VolumeOutputStepResult +func GetVolumeIDsResultAsVolumeOutputStepResult(v *GetVolumeIDsResult) VolumeOutputStepResult { + return VolumeOutputStepResult{ + GetVolumeIDsResult: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *VolumeOutputStepResult) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'CreateSnapshotsResult' + if jsonDict["kind"] == "CreateSnapshotsResult" { + // try to unmarshal JSON data into CreateSnapshotsResult + err = json.Unmarshal(data, &dst.CreateSnapshotsResult) + if err == nil { + return nil // data stored in dst.CreateSnapshotsResult, return on the first match + } else { + dst.CreateSnapshotsResult = nil + return fmt.Errorf("failed to unmarshal VolumeOutputStepResult as CreateSnapshotsResult: %s", err.Error()) + } + } + + // check if the discriminator value is 'GetVolumeIDsResult' + if jsonDict["kind"] == "GetVolumeIDsResult" { + // try to unmarshal JSON data into GetVolumeIDsResult + err = json.Unmarshal(data, &dst.GetVolumeIDsResult) + if err == nil { + return nil // data stored in dst.GetVolumeIDsResult, return on the first match + } else { + dst.GetVolumeIDsResult = nil + return fmt.Errorf("failed to unmarshal VolumeOutputStepResult as GetVolumeIDsResult: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src VolumeOutputStepResult) MarshalJSON() ([]byte, error) { + if src.CreateSnapshotsResult != nil { + return json.Marshal(&src.CreateSnapshotsResult) + } + + if src.GetVolumeIDsResult != nil { + return json.Marshal(&src.GetVolumeIDsResult) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *VolumeOutputStepResult) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateSnapshotsResult != nil { + return obj.CreateSnapshotsResult + } + + if obj.GetVolumeIDsResult != nil { + return obj.GetVolumeIDsResult + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj VolumeOutputStepResult) GetActualInstanceValue() interface{} { + if obj.CreateSnapshotsResult != nil { + return *obj.CreateSnapshotsResult + } + + if obj.GetVolumeIDsResult != nil { + return *obj.GetVolumeIDsResult + } + + // all schemas are nil + return nil +} + +type NullableVolumeOutputStepResult struct { + value *VolumeOutputStepResult + isSet bool +} + +func (v NullableVolumeOutputStepResult) Get() *VolumeOutputStepResult { + return v.value +} + +func (v *NullableVolumeOutputStepResult) Set(val *VolumeOutputStepResult) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeOutputStepResult) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeOutputStepResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeOutputStepResult(val *VolumeOutputStepResult) *NullableVolumeOutputStepResult { + return &NullableVolumeOutputStepResult{value: val, isSet: true} +} + +func (v NullableVolumeOutputStepResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeOutputStepResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_recovery_point_management_input.go b/services/automation/v1betaapi/model_volume_recovery_point_management_input.go new file mode 100644 index 000000000..e452c8fcb --- /dev/null +++ b/services/automation/v1betaapi/model_volume_recovery_point_management_input.go @@ -0,0 +1,311 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the VolumeRecoveryPointManagementInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeRecoveryPointManagementInput{} + +// VolumeRecoveryPointManagementInput struct for VolumeRecoveryPointManagementInput +type VolumeRecoveryPointManagementInput struct { + InheritVolumeLabels *bool `json:"inheritVolumeLabels,omitempty"` + Kind string `json:"kind"` + RecoveryPointLabels *map[string]string `json:"recoveryPointLabels,omitempty"` + SnapshotRetentionPolicy SnapshotRetentionPolicy `json:"snapshotRetentionPolicy"` + VolumeLabelSelector *string `json:"volumeLabelSelector,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _VolumeRecoveryPointManagementInput VolumeRecoveryPointManagementInput + +// NewVolumeRecoveryPointManagementInput instantiates a new VolumeRecoveryPointManagementInput 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 NewVolumeRecoveryPointManagementInput(kind string, snapshotRetentionPolicy SnapshotRetentionPolicy) *VolumeRecoveryPointManagementInput { + this := VolumeRecoveryPointManagementInput{} + var inheritVolumeLabels bool = false + this.InheritVolumeLabels = &inheritVolumeLabels + this.Kind = kind + this.SnapshotRetentionPolicy = snapshotRetentionPolicy + return &this +} + +// NewVolumeRecoveryPointManagementInputWithDefaults instantiates a new VolumeRecoveryPointManagementInput 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 NewVolumeRecoveryPointManagementInputWithDefaults() *VolumeRecoveryPointManagementInput { + this := VolumeRecoveryPointManagementInput{} + var inheritVolumeLabels bool = false + this.InheritVolumeLabels = &inheritVolumeLabels + return &this +} + +// GetInheritVolumeLabels returns the InheritVolumeLabels field value if set, zero value otherwise. +func (o *VolumeRecoveryPointManagementInput) GetInheritVolumeLabels() bool { + if o == nil || IsNil(o.InheritVolumeLabels) { + var ret bool + return ret + } + return *o.InheritVolumeLabels +} + +// GetInheritVolumeLabelsOk returns a tuple with the InheritVolumeLabels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeRecoveryPointManagementInput) GetInheritVolumeLabelsOk() (*bool, bool) { + if o == nil || IsNil(o.InheritVolumeLabels) { + return nil, false + } + return o.InheritVolumeLabels, true +} + +// HasInheritVolumeLabels returns a boolean if a field has been set. +func (o *VolumeRecoveryPointManagementInput) HasInheritVolumeLabels() bool { + if o != nil && !IsNil(o.InheritVolumeLabels) { + return true + } + + return false +} + +// SetInheritVolumeLabels gets a reference to the given bool and assigns it to the InheritVolumeLabels field. +func (o *VolumeRecoveryPointManagementInput) SetInheritVolumeLabels(v bool) { + o.InheritVolumeLabels = &v +} + +// GetKind returns the Kind field value +func (o *VolumeRecoveryPointManagementInput) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *VolumeRecoveryPointManagementInput) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *VolumeRecoveryPointManagementInput) SetKind(v string) { + o.Kind = v +} + +// GetRecoveryPointLabels returns the RecoveryPointLabels field value if set, zero value otherwise. +func (o *VolumeRecoveryPointManagementInput) GetRecoveryPointLabels() map[string]string { + if o == nil || IsNil(o.RecoveryPointLabels) { + var ret map[string]string + return ret + } + return *o.RecoveryPointLabels +} + +// GetRecoveryPointLabelsOk returns a tuple with the RecoveryPointLabels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeRecoveryPointManagementInput) GetRecoveryPointLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.RecoveryPointLabels) { + return nil, false + } + return o.RecoveryPointLabels, true +} + +// HasRecoveryPointLabels returns a boolean if a field has been set. +func (o *VolumeRecoveryPointManagementInput) HasRecoveryPointLabels() bool { + if o != nil && !IsNil(o.RecoveryPointLabels) { + return true + } + + return false +} + +// SetRecoveryPointLabels gets a reference to the given map[string]string and assigns it to the RecoveryPointLabels field. +func (o *VolumeRecoveryPointManagementInput) SetRecoveryPointLabels(v map[string]string) { + o.RecoveryPointLabels = &v +} + +// GetSnapshotRetentionPolicy returns the SnapshotRetentionPolicy field value +func (o *VolumeRecoveryPointManagementInput) GetSnapshotRetentionPolicy() SnapshotRetentionPolicy { + if o == nil { + var ret SnapshotRetentionPolicy + return ret + } + + return o.SnapshotRetentionPolicy +} + +// GetSnapshotRetentionPolicyOk returns a tuple with the SnapshotRetentionPolicy field value +// and a boolean to check if the value has been set. +func (o *VolumeRecoveryPointManagementInput) GetSnapshotRetentionPolicyOk() (*SnapshotRetentionPolicy, bool) { + if o == nil { + return nil, false + } + return &o.SnapshotRetentionPolicy, true +} + +// SetSnapshotRetentionPolicy sets field value +func (o *VolumeRecoveryPointManagementInput) SetSnapshotRetentionPolicy(v SnapshotRetentionPolicy) { + o.SnapshotRetentionPolicy = v +} + +// GetVolumeLabelSelector returns the VolumeLabelSelector field value if set, zero value otherwise. +func (o *VolumeRecoveryPointManagementInput) GetVolumeLabelSelector() string { + if o == nil || IsNil(o.VolumeLabelSelector) { + var ret string + return ret + } + return *o.VolumeLabelSelector +} + +// GetVolumeLabelSelectorOk returns a tuple with the VolumeLabelSelector field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeRecoveryPointManagementInput) GetVolumeLabelSelectorOk() (*string, bool) { + if o == nil || IsNil(o.VolumeLabelSelector) { + return nil, false + } + return o.VolumeLabelSelector, true +} + +// HasVolumeLabelSelector returns a boolean if a field has been set. +func (o *VolumeRecoveryPointManagementInput) HasVolumeLabelSelector() bool { + if o != nil && !IsNil(o.VolumeLabelSelector) { + return true + } + + return false +} + +// SetVolumeLabelSelector gets a reference to the given string and assigns it to the VolumeLabelSelector field. +func (o *VolumeRecoveryPointManagementInput) SetVolumeLabelSelector(v string) { + o.VolumeLabelSelector = &v +} + +func (o VolumeRecoveryPointManagementInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeRecoveryPointManagementInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.InheritVolumeLabels) { + toSerialize["inheritVolumeLabels"] = o.InheritVolumeLabels + } + toSerialize["kind"] = o.Kind + if !IsNil(o.RecoveryPointLabels) { + toSerialize["recoveryPointLabels"] = o.RecoveryPointLabels + } + toSerialize["snapshotRetentionPolicy"] = o.SnapshotRetentionPolicy + if !IsNil(o.VolumeLabelSelector) { + toSerialize["volumeLabelSelector"] = o.VolumeLabelSelector + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeRecoveryPointManagementInput) 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{ + "kind", + "snapshotRetentionPolicy", + } + + 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) + } + } + + varVolumeRecoveryPointManagementInput := _VolumeRecoveryPointManagementInput{} + + err = json.Unmarshal(data, &varVolumeRecoveryPointManagementInput) + + if err != nil { + return err + } + + *o = VolumeRecoveryPointManagementInput(varVolumeRecoveryPointManagementInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "inheritVolumeLabels") + delete(additionalProperties, "kind") + delete(additionalProperties, "recoveryPointLabels") + delete(additionalProperties, "snapshotRetentionPolicy") + delete(additionalProperties, "volumeLabelSelector") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeRecoveryPointManagementInput struct { + value *VolumeRecoveryPointManagementInput + isSet bool +} + +func (v NullableVolumeRecoveryPointManagementInput) Get() *VolumeRecoveryPointManagementInput { + return v.value +} + +func (v *NullableVolumeRecoveryPointManagementInput) Set(val *VolumeRecoveryPointManagementInput) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeRecoveryPointManagementInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeRecoveryPointManagementInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeRecoveryPointManagementInput(val *VolumeRecoveryPointManagementInput) *NullableVolumeRecoveryPointManagementInput { + return &NullableVolumeRecoveryPointManagementInput{value: val, isSet: true} +} + +func (v NullableVolumeRecoveryPointManagementInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeRecoveryPointManagementInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_template_automation_input.go b/services/automation/v1betaapi/model_volume_template_automation_input.go new file mode 100644 index 000000000..3c80fb879 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_template_automation_input.go @@ -0,0 +1,167 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// checks if the VolumeTemplateAutomationInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeTemplateAutomationInput{} + +// VolumeTemplateAutomationInput struct for VolumeTemplateAutomationInput +type VolumeTemplateAutomationInput struct { + Kind VolumeTemplateAutomationInputKind `json:"kind"` + AdditionalProperties map[string]interface{} +} + +type _VolumeTemplateAutomationInput VolumeTemplateAutomationInput + +// NewVolumeTemplateAutomationInput instantiates a new VolumeTemplateAutomationInput 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 NewVolumeTemplateAutomationInput(kind VolumeTemplateAutomationInputKind) *VolumeTemplateAutomationInput { + this := VolumeTemplateAutomationInput{} + this.Kind = kind + return &this +} + +// NewVolumeTemplateAutomationInputWithDefaults instantiates a new VolumeTemplateAutomationInput 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 NewVolumeTemplateAutomationInputWithDefaults() *VolumeTemplateAutomationInput { + this := VolumeTemplateAutomationInput{} + return &this +} + +// GetKind returns the Kind field value +func (o *VolumeTemplateAutomationInput) GetKind() VolumeTemplateAutomationInputKind { + if o == nil { + var ret VolumeTemplateAutomationInputKind + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *VolumeTemplateAutomationInput) GetKindOk() (*VolumeTemplateAutomationInputKind, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *VolumeTemplateAutomationInput) SetKind(v VolumeTemplateAutomationInputKind) { + o.Kind = v +} + +func (o VolumeTemplateAutomationInput) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeTemplateAutomationInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kind"] = o.Kind + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *VolumeTemplateAutomationInput) 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{ + "kind", + } + + 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) + } + } + + varVolumeTemplateAutomationInput := _VolumeTemplateAutomationInput{} + + err = json.Unmarshal(data, &varVolumeTemplateAutomationInput) + + if err != nil { + return err + } + + *o = VolumeTemplateAutomationInput(varVolumeTemplateAutomationInput) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "kind") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVolumeTemplateAutomationInput struct { + value *VolumeTemplateAutomationInput + isSet bool +} + +func (v NullableVolumeTemplateAutomationInput) Get() *VolumeTemplateAutomationInput { + return v.value +} + +func (v *NullableVolumeTemplateAutomationInput) Set(val *VolumeTemplateAutomationInput) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeTemplateAutomationInput) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeTemplateAutomationInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeTemplateAutomationInput(val *VolumeTemplateAutomationInput) *NullableVolumeTemplateAutomationInput { + return &NullableVolumeTemplateAutomationInput{value: val, isSet: true} +} + +func (v NullableVolumeTemplateAutomationInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeTemplateAutomationInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/model_volume_template_automation_input_kind.go b/services/automation/v1betaapi/model_volume_template_automation_input_kind.go new file mode 100644 index 000000000..594a354b2 --- /dev/null +++ b/services/automation/v1betaapi/model_volume_template_automation_input_kind.go @@ -0,0 +1,112 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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" + "fmt" +) + +// VolumeTemplateAutomationInputKind the model 'VolumeTemplateAutomationInputKind' +type VolumeTemplateAutomationInputKind string + +// List of VolumeTemplateAutomationInput_kind +const ( + VOLUMETEMPLATEAUTOMATIONINPUTKIND_VOLUME_RECOVERY_POINT_MANAGEMENT VolumeTemplateAutomationInputKind = "VolumeRecoveryPointManagement" + VOLUMETEMPLATEAUTOMATIONINPUTKIND_UNKNOWN_DEFAULT_OPEN_API VolumeTemplateAutomationInputKind = "unknown_default_open_api" +) + +// All allowed values of VolumeTemplateAutomationInputKind enum +var AllowedVolumeTemplateAutomationInputKindEnumValues = []VolumeTemplateAutomationInputKind{ + "VolumeRecoveryPointManagement", + "unknown_default_open_api", +} + +func (v *VolumeTemplateAutomationInputKind) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := VolumeTemplateAutomationInputKind(value) + for _, existing := range AllowedVolumeTemplateAutomationInputKindEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = VOLUMETEMPLATEAUTOMATIONINPUTKIND_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewVolumeTemplateAutomationInputKindFromValue returns a pointer to a valid VolumeTemplateAutomationInputKind +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVolumeTemplateAutomationInputKindFromValue(v string) (*VolumeTemplateAutomationInputKind, error) { + ev := VolumeTemplateAutomationInputKind(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VolumeTemplateAutomationInputKind: valid values are %v", v, AllowedVolumeTemplateAutomationInputKindEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VolumeTemplateAutomationInputKind) IsValid() bool { + for _, existing := range AllowedVolumeTemplateAutomationInputKindEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VolumeTemplateAutomationInput_kind value +func (v VolumeTemplateAutomationInputKind) Ptr() *VolumeTemplateAutomationInputKind { + return &v +} + +type NullableVolumeTemplateAutomationInputKind struct { + value *VolumeTemplateAutomationInputKind + isSet bool +} + +func (v NullableVolumeTemplateAutomationInputKind) Get() *VolumeTemplateAutomationInputKind { + return v.value +} + +func (v *NullableVolumeTemplateAutomationInputKind) Set(val *VolumeTemplateAutomationInputKind) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeTemplateAutomationInputKind) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeTemplateAutomationInputKind) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeTemplateAutomationInputKind(val *VolumeTemplateAutomationInputKind) *NullableVolumeTemplateAutomationInputKind { + return &NullableVolumeTemplateAutomationInputKind{value: val, isSet: true} +} + +func (v NullableVolumeTemplateAutomationInputKind) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeTemplateAutomationInputKind) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/automation/v1betaapi/response.go b/services/automation/v1betaapi/response.go new file mode 100644 index 000000000..e4a4cab9d --- /dev/null +++ b/services/automation/v1betaapi/response.go @@ -0,0 +1,48 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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/automation/v1betaapi/utils.go b/services/automation/v1betaapi/utils.go new file mode 100644 index 000000000..5378f4d40 --- /dev/null +++ b/services/automation/v1betaapi/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT Automation Service API + +API endpoints for automation management . + +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...) +}