From 190952156600775ecfa19cc636a1085728a2cb4d Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 15 Apr 2026 06:49:01 +0000 Subject: [PATCH] Generate telemetryrouter --- go.work | 1 + services/telemetryrouter/LICENSE.md | 201 ++ services/telemetryrouter/go.mod | 10 + services/telemetryrouter/go.sum | 8 + services/telemetryrouter/oas_commit | 1 + services/telemetryrouter/package.go | 1 + .../telemetryrouter/v1betaapi/api_default.go | 2762 +++++++++++++++++ .../v1betaapi/api_default_mock.go | 354 +++ services/telemetryrouter/v1betaapi/client.go | 658 ++++ .../v1betaapi/configuration.go | 37 + .../model_access_token_base_request.go | 254 ++ .../model_access_token_base_response.go | 344 ++ .../v1betaapi/model_config_filter.go | 166 + .../model_config_filter_attributes.go | 253 ++ .../v1betaapi/model_config_filter_level.go | 112 + .../v1betaapi/model_config_filter_matcher.go | 110 + .../model_create_access_token_payload.go | 254 ++ .../model_create_access_token_response.go | 374 +++ .../model_create_destination_payload.go | 234 ++ .../model_create_telemetry_router_payload.go | 242 ++ .../v1betaapi/model_destination_config.go | 277 ++ ...model_destination_config_open_telemetry.go | 242 ++ ...nation_config_open_telemetry_basic_auth.go | 195 ++ .../v1betaapi/model_destination_config_s3.go | 233 ++ .../model_destination_config_s3_access_key.go | 195 ++ .../model_destination_config_type.go | 110 + .../v1betaapi/model_destination_response.go | 355 +++ .../model_get_access_token_response.go | 344 ++ .../model_list_access_tokens_response.go | 204 ++ .../model_list_destinations_response.go | 204 ++ .../model_list_telemetry_routers_response.go | 204 ++ .../v1betaapi/model_response4xx.go | 167 + .../model_telemetry_router_response.go | 363 +++ .../model_update_access_token_payload.go | 212 ++ .../model_update_access_token_response.go | 344 ++ .../model_update_destination_payload.go | 229 ++ .../model_update_telemetry_router_payload.go | 229 ++ .../telemetryrouter/v1betaapi/response.go | 47 + services/telemetryrouter/v1betaapi/utils.go | 361 +++ 39 files changed, 10891 insertions(+) create mode 100644 services/telemetryrouter/LICENSE.md create mode 100644 services/telemetryrouter/go.mod create mode 100644 services/telemetryrouter/go.sum create mode 100644 services/telemetryrouter/oas_commit create mode 100644 services/telemetryrouter/package.go create mode 100644 services/telemetryrouter/v1betaapi/api_default.go create mode 100644 services/telemetryrouter/v1betaapi/api_default_mock.go create mode 100644 services/telemetryrouter/v1betaapi/client.go create mode 100644 services/telemetryrouter/v1betaapi/configuration.go create mode 100644 services/telemetryrouter/v1betaapi/model_access_token_base_request.go create mode 100644 services/telemetryrouter/v1betaapi/model_access_token_base_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_config_filter.go create mode 100644 services/telemetryrouter/v1betaapi/model_config_filter_attributes.go create mode 100644 services/telemetryrouter/v1betaapi/model_config_filter_level.go create mode 100644 services/telemetryrouter/v1betaapi/model_config_filter_matcher.go create mode 100644 services/telemetryrouter/v1betaapi/model_create_access_token_payload.go create mode 100644 services/telemetryrouter/v1betaapi/model_create_access_token_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_create_destination_payload.go create mode 100644 services/telemetryrouter/v1betaapi/model_create_telemetry_router_payload.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_config.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry_basic_auth.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_config_s3.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_config_s3_access_key.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_config_type.go create mode 100644 services/telemetryrouter/v1betaapi/model_destination_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_get_access_token_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_list_access_tokens_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_list_destinations_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_list_telemetry_routers_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_response4xx.go create mode 100644 services/telemetryrouter/v1betaapi/model_telemetry_router_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_update_access_token_payload.go create mode 100644 services/telemetryrouter/v1betaapi/model_update_access_token_response.go create mode 100644 services/telemetryrouter/v1betaapi/model_update_destination_payload.go create mode 100644 services/telemetryrouter/v1betaapi/model_update_telemetry_router_payload.go create mode 100644 services/telemetryrouter/v1betaapi/response.go create mode 100644 services/telemetryrouter/v1betaapi/utils.go diff --git a/go.work b/go.work index 0df93c57e..570ca9e4d 100644 --- a/go.work +++ b/go.work @@ -75,5 +75,6 @@ use ( ./services/ske ./services/sqlserverflex ./services/stackitmarketplace + ./services/telemetryrouter ./services/vpn ) diff --git a/services/telemetryrouter/LICENSE.md b/services/telemetryrouter/LICENSE.md new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/services/telemetryrouter/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/telemetryrouter/go.mod b/services/telemetryrouter/go.mod new file mode 100644 index 000000000..82c2e8001 --- /dev/null +++ b/services/telemetryrouter/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/telemetryrouter + +go 1.25 + +require github.com/stackitcloud/stackit-sdk-go/core v0.25.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/telemetryrouter/go.sum b/services/telemetryrouter/go.sum new file mode 100644 index 000000000..f66cfd445 --- /dev/null +++ b/services/telemetryrouter/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.25.0 h1:ra3VEk684MNoq741g+xbZrKjZzhyztq5liUAwwew4DY= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/telemetryrouter/oas_commit b/services/telemetryrouter/oas_commit new file mode 100644 index 000000000..de39a0856 --- /dev/null +++ b/services/telemetryrouter/oas_commit @@ -0,0 +1 @@ +828314cc225fa390e5b2162029ac60888c3255bb diff --git a/services/telemetryrouter/package.go b/services/telemetryrouter/package.go new file mode 100644 index 000000000..8a598daf0 --- /dev/null +++ b/services/telemetryrouter/package.go @@ -0,0 +1 @@ +package telemetryrouter diff --git a/services/telemetryrouter/v1betaapi/api_default.go b/services/telemetryrouter/v1betaapi/api_default.go new file mode 100644 index 000000000..f5f088e23 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/api_default.go @@ -0,0 +1,2762 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// 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 { + + /* + CreateAccessToken Method for CreateAccessToken + + Create a new access token for the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiCreateAccessTokenRequest + */ + CreateAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiCreateAccessTokenRequest + + // CreateAccessTokenExecute executes the request + // @return CreateAccessTokenResponse + CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*CreateAccessTokenResponse, error) + + /* + CreateDestination Method for CreateDestination + + Creates a new Destination within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiCreateDestinationRequest + */ + CreateDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiCreateDestinationRequest + + // CreateDestinationExecute executes the request + // @return DestinationResponse + CreateDestinationExecute(r ApiCreateDestinationRequest) (*DestinationResponse, error) + + /* + CreateTelemetryRouter Method for CreateTelemetryRouter + + Creates the new Telemetry Router within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateTelemetryRouterRequest + */ + CreateTelemetryRouter(ctx context.Context, projectId string, regionId string) ApiCreateTelemetryRouterRequest + + // CreateTelemetryRouterExecute executes the request + // @return TelemetryRouterResponse + CreateTelemetryRouterExecute(r ApiCreateTelemetryRouterRequest) (*TelemetryRouterResponse, error) + + /* + DeleteAccessToken Method for DeleteAccessToken + + Delete an access token for the given Telemetry Router by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param accessTokenId The Access Token UUID. + @return ApiDeleteAccessTokenRequest + */ + DeleteAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiDeleteAccessTokenRequest + + // DeleteAccessTokenExecute executes the request + DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) error + + /* + DeleteDestination Method for DeleteDestination + + Deletes the given Destination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param destinationId The Destination UUID. + @return ApiDeleteDestinationRequest + */ + DeleteDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiDeleteDestinationRequest + + // DeleteDestinationExecute executes the request + DeleteDestinationExecute(r ApiDeleteDestinationRequest) error + + /* + DeleteTelemetryRouter Method for DeleteTelemetryRouter + + Deletes the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiDeleteTelemetryRouterRequest + */ + DeleteTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiDeleteTelemetryRouterRequest + + // DeleteTelemetryRouterExecute executes the request + DeleteTelemetryRouterExecute(r ApiDeleteTelemetryRouterRequest) error + + /* + GetAccessToken Method for GetAccessToken + + Get an access token for the given Telemetry Router by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param accessTokenId The Access Token UUID. + @return ApiGetAccessTokenRequest + */ + GetAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiGetAccessTokenRequest + + // GetAccessTokenExecute executes the request + // @return GetAccessTokenResponse + GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*GetAccessTokenResponse, error) + + /* + GetDestination Method for GetDestination + + Returns the details for the given destination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param destinationId The Destination UUID. + @return ApiGetDestinationRequest + */ + GetDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiGetDestinationRequest + + // GetDestinationExecute executes the request + // @return DestinationResponse + GetDestinationExecute(r ApiGetDestinationRequest) (*DestinationResponse, error) + + /* + GetTelemetryRouter Method for GetTelemetryRouter + + Returns the details for the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiGetTelemetryRouterRequest + */ + GetTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiGetTelemetryRouterRequest + + // GetTelemetryRouterExecute executes the request + // @return TelemetryRouterResponse + GetTelemetryRouterExecute(r ApiGetTelemetryRouterRequest) (*TelemetryRouterResponse, error) + + /* + ListAccessTokens Method for ListAccessTokens + + Get all access tokens for a telemetry router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiListAccessTokensRequest + */ + ListAccessTokens(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiListAccessTokensRequest + + // ListAccessTokensExecute executes the request + // @return ListAccessTokensResponse + ListAccessTokensExecute(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) + + /* + ListDestinations Method for ListDestinations + + Returns a list of all destinations of a specific Telemetry Router within a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiListDestinationsRequest + */ + ListDestinations(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiListDestinationsRequest + + // ListDestinationsExecute executes the request + // @return ListDestinationsResponse + ListDestinationsExecute(r ApiListDestinationsRequest) (*ListDestinationsResponse, error) + + /* + ListTelemetryRouters Method for ListTelemetryRouters + + Returns a list of all Telemetry Routers within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListTelemetryRoutersRequest + */ + ListTelemetryRouters(ctx context.Context, projectId string, regionId string) ApiListTelemetryRoutersRequest + + // ListTelemetryRoutersExecute executes the request + // @return ListTelemetryRoutersResponse + ListTelemetryRoutersExecute(r ApiListTelemetryRoutersRequest) (*ListTelemetryRoutersResponse, error) + + /* + UpdateAccessToken Method for UpdateAccessToken + + Update an existing access token for the given Telemetry Router by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param accessTokenId The Access Token UUID. + @return ApiUpdateAccessTokenRequest + */ + UpdateAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiUpdateAccessTokenRequest + + // UpdateAccessTokenExecute executes the request + // @return UpdateAccessTokenResponse + UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*UpdateAccessTokenResponse, error) + + /* + UpdateDestination Method for UpdateDestination + + Updates the given destination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param destinationId The Destination UUID. + @return ApiUpdateDestinationRequest + */ + UpdateDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiUpdateDestinationRequest + + // UpdateDestinationExecute executes the request + // @return DestinationResponse + UpdateDestinationExecute(r ApiUpdateDestinationRequest) (*DestinationResponse, error) + + /* + UpdateTelemetryRouter Method for UpdateTelemetryRouter + + Updates the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiUpdateTelemetryRouterRequest + */ + UpdateTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiUpdateTelemetryRouterRequest + + // UpdateTelemetryRouterExecute executes the request + // @return TelemetryRouterResponse + UpdateTelemetryRouterExecute(r ApiUpdateTelemetryRouterRequest) (*TelemetryRouterResponse, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + createAccessTokenPayload *CreateAccessTokenPayload +} + +func (r ApiCreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { + r.createAccessTokenPayload = &createAccessTokenPayload + return r +} + +func (r ApiCreateAccessTokenRequest) Execute() (*CreateAccessTokenResponse, error) { + return r.ApiService.CreateAccessTokenExecute(r) +} + +/* +CreateAccessToken Method for CreateAccessToken + +Create a new access token for the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiCreateAccessTokenRequest +*/ +func (a *DefaultAPIService) CreateAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +// +// @return CreateAccessTokenResponse +func (a *DefaultAPIService) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*CreateAccessTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateAccessTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createAccessTokenPayload == nil { + return localVarReturnValue, reportError("createAccessTokenPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAccessTokenPayload + 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiCreateDestinationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + createDestinationPayload *CreateDestinationPayload +} + +func (r ApiCreateDestinationRequest) CreateDestinationPayload(createDestinationPayload CreateDestinationPayload) ApiCreateDestinationRequest { + r.createDestinationPayload = &createDestinationPayload + return r +} + +func (r ApiCreateDestinationRequest) Execute() (*DestinationResponse, error) { + return r.ApiService.CreateDestinationExecute(r) +} + +/* +CreateDestination Method for CreateDestination + +Creates a new Destination within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiCreateDestinationRequest +*/ +func (a *DefaultAPIService) CreateDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiCreateDestinationRequest { + return ApiCreateDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +// +// @return DestinationResponse +func (a *DefaultAPIService) CreateDestinationExecute(r ApiCreateDestinationRequest) (*DestinationResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DestinationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateDestination") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/destinations" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDestinationPayload == nil { + return localVarReturnValue, reportError("createDestinationPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createDestinationPayload + 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiCreateTelemetryRouterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createTelemetryRouterPayload *CreateTelemetryRouterPayload +} + +func (r ApiCreateTelemetryRouterRequest) CreateTelemetryRouterPayload(createTelemetryRouterPayload CreateTelemetryRouterPayload) ApiCreateTelemetryRouterRequest { + r.createTelemetryRouterPayload = &createTelemetryRouterPayload + return r +} + +func (r ApiCreateTelemetryRouterRequest) Execute() (*TelemetryRouterResponse, error) { + return r.ApiService.CreateTelemetryRouterExecute(r) +} + +/* +CreateTelemetryRouter Method for CreateTelemetryRouter + +Creates the new Telemetry Router within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateTelemetryRouterRequest +*/ +func (a *DefaultAPIService) CreateTelemetryRouter(ctx context.Context, projectId string, regionId string) ApiCreateTelemetryRouterRequest { + return ApiCreateTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return TelemetryRouterResponse +func (a *DefaultAPIService) CreateTelemetryRouterExecute(r ApiCreateTelemetryRouterRequest) (*TelemetryRouterResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TelemetryRouterResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateTelemetryRouter") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createTelemetryRouterPayload == nil { + return localVarReturnValue, reportError("createTelemetryRouterPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createTelemetryRouterPayload + 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiDeleteAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + accessTokenId string +} + +func (r ApiDeleteAccessTokenRequest) Execute() error { + return r.ApiService.DeleteAccessTokenExecute(r) +} + +/* +DeleteAccessToken Method for DeleteAccessToken + +Delete an access token for the given Telemetry Router by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param accessTokenId The Access Token UUID. + @return ApiDeleteAccessTokenRequest +*/ +func (a *DefaultAPIService) DeleteAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + accessTokenId: accessTokenId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAccessToken") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/access-tokens/{accessTokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"accessTokenId"+"}", url.PathEscape(parameterValueToString(r.accessTokenId, "accessTokenId")), -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 Response4xx + 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 newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + 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 newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + 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 newErr + } + return newErr + } + + return nil +} + +type ApiDeleteDestinationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + destinationId string +} + +func (r ApiDeleteDestinationRequest) Execute() error { + return r.ApiService.DeleteDestinationExecute(r) +} + +/* +DeleteDestination Method for DeleteDestination + +Deletes the given Destination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param destinationId The Destination UUID. + @return ApiDeleteDestinationRequest +*/ +func (a *DefaultAPIService) DeleteDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiDeleteDestinationRequest { + return ApiDeleteDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + destinationId: destinationId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteDestinationExecute(r ApiDeleteDestinationRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteDestination") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/destinations/{destinationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"destinationId"+"}", url.PathEscape(parameterValueToString(r.destinationId, "destinationId")), -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 Response4xx + 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 newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + 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 newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + 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 newErr + } + return newErr + } + + return nil +} + +type ApiDeleteTelemetryRouterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + force *bool +} + +// If true, deletes all child resources. If false, the resource remains in a 'deletion state' while child resources exist. +func (r ApiDeleteTelemetryRouterRequest) Force(force bool) ApiDeleteTelemetryRouterRequest { + r.force = &force + return r +} + +func (r ApiDeleteTelemetryRouterRequest) Execute() error { + return r.ApiService.DeleteTelemetryRouterExecute(r) +} + +/* +DeleteTelemetryRouter Method for DeleteTelemetryRouter + +Deletes the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiDeleteTelemetryRouterRequest +*/ +func (a *DefaultAPIService) DeleteTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiDeleteTelemetryRouterRequest { + return ApiDeleteTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteTelemetryRouterExecute(r ApiDeleteTelemetryRouterRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteTelemetryRouter") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.force != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force", r.force, "form", "") + } else { + var defaultValue bool = false + parameterAddToHeaderOrQuery(localVarQueryParams, "force", defaultValue, "form", "") + r.force = &defaultValue + } + // 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 Response4xx + 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 newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + 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 newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + 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 newErr + } + return newErr + } + + return nil +} + +type ApiGetAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + accessTokenId string +} + +func (r ApiGetAccessTokenRequest) Execute() (*GetAccessTokenResponse, error) { + return r.ApiService.GetAccessTokenExecute(r) +} + +/* +GetAccessToken Method for GetAccessToken + +Get an access token for the given Telemetry Router by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param accessTokenId The Access Token UUID. + @return ApiGetAccessTokenRequest +*/ +func (a *DefaultAPIService) GetAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + accessTokenId: accessTokenId, + } +} + +// Execute executes the request +// +// @return GetAccessTokenResponse +func (a *DefaultAPIService) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*GetAccessTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetAccessTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/access-tokens/{accessTokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"accessTokenId"+"}", url.PathEscape(parameterValueToString(r.accessTokenId, "accessTokenId")), -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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiGetDestinationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + destinationId string +} + +func (r ApiGetDestinationRequest) Execute() (*DestinationResponse, error) { + return r.ApiService.GetDestinationExecute(r) +} + +/* +GetDestination Method for GetDestination + +Returns the details for the given destination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param destinationId The Destination UUID. + @return ApiGetDestinationRequest +*/ +func (a *DefaultAPIService) GetDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiGetDestinationRequest { + return ApiGetDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + destinationId: destinationId, + } +} + +// Execute executes the request +// +// @return DestinationResponse +func (a *DefaultAPIService) GetDestinationExecute(r ApiGetDestinationRequest) (*DestinationResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DestinationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetDestination") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/destinations/{destinationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"destinationId"+"}", url.PathEscape(parameterValueToString(r.destinationId, "destinationId")), -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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiGetTelemetryRouterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string +} + +func (r ApiGetTelemetryRouterRequest) Execute() (*TelemetryRouterResponse, error) { + return r.ApiService.GetTelemetryRouterExecute(r) +} + +/* +GetTelemetryRouter Method for GetTelemetryRouter + +Returns the details for the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiGetTelemetryRouterRequest +*/ +func (a *DefaultAPIService) GetTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiGetTelemetryRouterRequest { + return ApiGetTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +// +// @return TelemetryRouterResponse +func (a *DefaultAPIService) GetTelemetryRouterExecute(r ApiGetTelemetryRouterRequest) (*TelemetryRouterResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TelemetryRouterResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetTelemetryRouter") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiListAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. +func (r ApiListAccessTokensRequest) PageToken(pageToken string) ApiListAccessTokensRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return +func (r ApiListAccessTokensRequest) PageSize(pageSize int32) ApiListAccessTokensRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListAccessTokensRequest) Execute() (*ListAccessTokensResponse, error) { + return r.ApiService.ListAccessTokensExecute(r) +} + +/* +ListAccessTokens Method for ListAccessTokens + +Get all access tokens for a telemetry router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiListAccessTokensRequest +*/ +func (a *DefaultAPIService) ListAccessTokens(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +// +// @return ListAccessTokensResponse +func (a *DefaultAPIService) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListAccessTokensResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "form", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + // 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiListDestinationsRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. +func (r ApiListDestinationsRequest) PageToken(pageToken string) ApiListDestinationsRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return +func (r ApiListDestinationsRequest) PageSize(pageSize int32) ApiListDestinationsRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListDestinationsRequest) Execute() (*ListDestinationsResponse, error) { + return r.ApiService.ListDestinationsExecute(r) +} + +/* +ListDestinations Method for ListDestinations + +Returns a list of all destinations of a specific Telemetry Router within a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiListDestinationsRequest +*/ +func (a *DefaultAPIService) ListDestinations(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiListDestinationsRequest { + return ApiListDestinationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +// +// @return ListDestinationsResponse +func (a *DefaultAPIService) ListDestinationsExecute(r ApiListDestinationsRequest) (*ListDestinationsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDestinationsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListDestinations") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/destinations" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "form", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + // 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiListTelemetryRoutersRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. +func (r ApiListTelemetryRoutersRequest) PageToken(pageToken string) ApiListTelemetryRoutersRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return +func (r ApiListTelemetryRoutersRequest) PageSize(pageSize int32) ApiListTelemetryRoutersRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiListTelemetryRoutersRequest) Execute() (*ListTelemetryRoutersResponse, error) { + return r.ApiService.ListTelemetryRoutersExecute(r) +} + +/* +ListTelemetryRouters Method for ListTelemetryRouters + +Returns a list of all Telemetry Routers within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListTelemetryRoutersRequest +*/ +func (a *DefaultAPIService) ListTelemetryRouters(ctx context.Context, projectId string, regionId string) ApiListTelemetryRoutersRequest { + return ApiListTelemetryRoutersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return ListTelemetryRoutersResponse +func (a *DefaultAPIService) ListTelemetryRoutersExecute(r ApiListTelemetryRoutersRequest) (*ListTelemetryRoutersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListTelemetryRoutersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListTelemetryRouters") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "form", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", defaultValue, "form", "") + r.pageSize = &defaultValue + } + // 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiUpdateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + accessTokenId string + updateAccessTokenPayload *UpdateAccessTokenPayload +} + +func (r ApiUpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { + r.updateAccessTokenPayload = &updateAccessTokenPayload + return r +} + +func (r ApiUpdateAccessTokenRequest) Execute() (*UpdateAccessTokenResponse, error) { + return r.ApiService.UpdateAccessTokenExecute(r) +} + +/* +UpdateAccessToken Method for UpdateAccessToken + +Update an existing access token for the given Telemetry Router by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param accessTokenId The Access Token UUID. + @return ApiUpdateAccessTokenRequest +*/ +func (a *DefaultAPIService) UpdateAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + accessTokenId: accessTokenId, + } +} + +// Execute executes the request +// +// @return UpdateAccessTokenResponse +func (a *DefaultAPIService) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*UpdateAccessTokenResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateAccessTokenResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/access-tokens/{accessTokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"accessTokenId"+"}", url.PathEscape(parameterValueToString(r.accessTokenId, "accessTokenId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAccessTokenPayload == nil { + return localVarReturnValue, reportError("updateAccessTokenPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAccessTokenPayload + 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiUpdateDestinationRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + destinationId string + updateDestinationPayload *UpdateDestinationPayload +} + +func (r ApiUpdateDestinationRequest) UpdateDestinationPayload(updateDestinationPayload UpdateDestinationPayload) ApiUpdateDestinationRequest { + r.updateDestinationPayload = &updateDestinationPayload + return r +} + +func (r ApiUpdateDestinationRequest) Execute() (*DestinationResponse, error) { + return r.ApiService.UpdateDestinationExecute(r) +} + +/* +UpdateDestination Method for UpdateDestination + +Updates the given destination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @param destinationId The Destination UUID. + @return ApiUpdateDestinationRequest +*/ +func (a *DefaultAPIService) UpdateDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiUpdateDestinationRequest { + return ApiUpdateDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + destinationId: destinationId, + } +} + +// Execute executes the request +// +// @return DestinationResponse +func (a *DefaultAPIService) UpdateDestinationExecute(r ApiUpdateDestinationRequest) (*DestinationResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DestinationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateDestination") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}/destinations/{destinationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"destinationId"+"}", url.PathEscape(parameterValueToString(r.destinationId, "destinationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDestinationPayload == nil { + return localVarReturnValue, reportError("updateDestinationPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateDestinationPayload + 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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 ApiUpdateTelemetryRouterRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + telemetryRouterId string + updateTelemetryRouterPayload *UpdateTelemetryRouterPayload +} + +func (r ApiUpdateTelemetryRouterRequest) UpdateTelemetryRouterPayload(updateTelemetryRouterPayload UpdateTelemetryRouterPayload) ApiUpdateTelemetryRouterRequest { + r.updateTelemetryRouterPayload = &updateTelemetryRouterPayload + return r +} + +func (r ApiUpdateTelemetryRouterRequest) Execute() (*TelemetryRouterResponse, error) { + return r.ApiService.UpdateTelemetryRouterExecute(r) +} + +/* +UpdateTelemetryRouter Method for UpdateTelemetryRouter + +Updates the given Telemetry Router. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param telemetryRouterId The Telemetry Router UUID. + @return ApiUpdateTelemetryRouterRequest +*/ +func (a *DefaultAPIService) UpdateTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiUpdateTelemetryRouterRequest { + return ApiUpdateTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// Execute executes the request +// +// @return TelemetryRouterResponse +func (a *DefaultAPIService) UpdateTelemetryRouterExecute(r ApiUpdateTelemetryRouterRequest) (*TelemetryRouterResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TelemetryRouterResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateTelemetryRouter") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"telemetryRouterId"+"}", url.PathEscape(parameterValueToString(r.telemetryRouterId, "telemetryRouterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateTelemetryRouterPayload == nil { + return localVarReturnValue, reportError("updateTelemetryRouterPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateTelemetryRouterPayload + 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 Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Response4xx + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + return localVarReturnValue, newErr + } + 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/telemetryrouter/v1betaapi/api_default_mock.go b/services/telemetryrouter/v1betaapi/api_default_mock.go new file mode 100644 index 000000000..aa5c11d5c --- /dev/null +++ b/services/telemetryrouter/v1betaapi/api_default_mock.go @@ -0,0 +1,354 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// 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 { + // CreateAccessTokenExecuteMock can be populated to implement the behavior of the CreateAccessTokenExecute function of this mock + CreateAccessTokenExecuteMock *func(r ApiCreateAccessTokenRequest) (*CreateAccessTokenResponse, error) + // CreateDestinationExecuteMock can be populated to implement the behavior of the CreateDestinationExecute function of this mock + CreateDestinationExecuteMock *func(r ApiCreateDestinationRequest) (*DestinationResponse, error) + // CreateTelemetryRouterExecuteMock can be populated to implement the behavior of the CreateTelemetryRouterExecute function of this mock + CreateTelemetryRouterExecuteMock *func(r ApiCreateTelemetryRouterRequest) (*TelemetryRouterResponse, error) + // DeleteAccessTokenExecuteMock can be populated to implement the behavior of the DeleteAccessTokenExecute function of this mock + DeleteAccessTokenExecuteMock *func(r ApiDeleteAccessTokenRequest) error + // DeleteDestinationExecuteMock can be populated to implement the behavior of the DeleteDestinationExecute function of this mock + DeleteDestinationExecuteMock *func(r ApiDeleteDestinationRequest) error + // DeleteTelemetryRouterExecuteMock can be populated to implement the behavior of the DeleteTelemetryRouterExecute function of this mock + DeleteTelemetryRouterExecuteMock *func(r ApiDeleteTelemetryRouterRequest) error + // GetAccessTokenExecuteMock can be populated to implement the behavior of the GetAccessTokenExecute function of this mock + GetAccessTokenExecuteMock *func(r ApiGetAccessTokenRequest) (*GetAccessTokenResponse, error) + // GetDestinationExecuteMock can be populated to implement the behavior of the GetDestinationExecute function of this mock + GetDestinationExecuteMock *func(r ApiGetDestinationRequest) (*DestinationResponse, error) + // GetTelemetryRouterExecuteMock can be populated to implement the behavior of the GetTelemetryRouterExecute function of this mock + GetTelemetryRouterExecuteMock *func(r ApiGetTelemetryRouterRequest) (*TelemetryRouterResponse, error) + // ListAccessTokensExecuteMock can be populated to implement the behavior of the ListAccessTokensExecute function of this mock + ListAccessTokensExecuteMock *func(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) + // ListDestinationsExecuteMock can be populated to implement the behavior of the ListDestinationsExecute function of this mock + ListDestinationsExecuteMock *func(r ApiListDestinationsRequest) (*ListDestinationsResponse, error) + // ListTelemetryRoutersExecuteMock can be populated to implement the behavior of the ListTelemetryRoutersExecute function of this mock + ListTelemetryRoutersExecuteMock *func(r ApiListTelemetryRoutersRequest) (*ListTelemetryRoutersResponse, error) + // UpdateAccessTokenExecuteMock can be populated to implement the behavior of the UpdateAccessTokenExecute function of this mock + UpdateAccessTokenExecuteMock *func(r ApiUpdateAccessTokenRequest) (*UpdateAccessTokenResponse, error) + // UpdateDestinationExecuteMock can be populated to implement the behavior of the UpdateDestinationExecute function of this mock + UpdateDestinationExecuteMock *func(r ApiUpdateDestinationRequest) (*DestinationResponse, error) + // UpdateTelemetryRouterExecuteMock can be populated to implement the behavior of the UpdateTelemetryRouterExecute function of this mock + UpdateTelemetryRouterExecuteMock *func(r ApiUpdateTelemetryRouterRequest) (*TelemetryRouterResponse, error) +} + +func (a DefaultAPIServiceMock) CreateAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// CreateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*CreateAccessTokenResponse, error) { + if a.CreateAccessTokenExecuteMock == nil { + var localVarReturnValue *CreateAccessTokenResponse + return localVarReturnValue, nil + } + + return (*a.CreateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiCreateDestinationRequest { + return ApiCreateDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// CreateDestinationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateDestinationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateDestinationExecute(r ApiCreateDestinationRequest) (*DestinationResponse, error) { + if a.CreateDestinationExecuteMock == nil { + var localVarReturnValue *DestinationResponse + return localVarReturnValue, nil + } + + return (*a.CreateDestinationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateTelemetryRouter(ctx context.Context, projectId string, regionId string) ApiCreateTelemetryRouterRequest { + return ApiCreateTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateTelemetryRouterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateTelemetryRouterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateTelemetryRouterExecute(r ApiCreateTelemetryRouterRequest) (*TelemetryRouterResponse, error) { + if a.CreateTelemetryRouterExecuteMock == nil { + var localVarReturnValue *TelemetryRouterResponse + return localVarReturnValue, nil + } + + return (*a.CreateTelemetryRouterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + accessTokenId: accessTokenId, + } +} + +// DeleteAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) error { + if a.DeleteAccessTokenExecuteMock == nil { + return nil + } + + return (*a.DeleteAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiDeleteDestinationRequest { + return ApiDeleteDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + destinationId: destinationId, + } +} + +// DeleteDestinationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteDestinationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteDestinationExecute(r ApiDeleteDestinationRequest) error { + if a.DeleteDestinationExecuteMock == nil { + return nil + } + + return (*a.DeleteDestinationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiDeleteTelemetryRouterRequest { + return ApiDeleteTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// DeleteTelemetryRouterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteTelemetryRouterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteTelemetryRouterExecute(r ApiDeleteTelemetryRouterRequest) error { + if a.DeleteTelemetryRouterExecuteMock == nil { + return nil + } + + return (*a.DeleteTelemetryRouterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + accessTokenId: accessTokenId, + } +} + +// GetAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*GetAccessTokenResponse, error) { + if a.GetAccessTokenExecuteMock == nil { + var localVarReturnValue *GetAccessTokenResponse + return localVarReturnValue, nil + } + + return (*a.GetAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiGetDestinationRequest { + return ApiGetDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + destinationId: destinationId, + } +} + +// GetDestinationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetDestinationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetDestinationExecute(r ApiGetDestinationRequest) (*DestinationResponse, error) { + if a.GetDestinationExecuteMock == nil { + var localVarReturnValue *DestinationResponse + return localVarReturnValue, nil + } + + return (*a.GetDestinationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiGetTelemetryRouterRequest { + return ApiGetTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// GetTelemetryRouterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetTelemetryRouterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetTelemetryRouterExecute(r ApiGetTelemetryRouterRequest) (*TelemetryRouterResponse, error) { + if a.GetTelemetryRouterExecuteMock == nil { + var localVarReturnValue *TelemetryRouterResponse + return localVarReturnValue, nil + } + + return (*a.GetTelemetryRouterExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListAccessTokens(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// ListAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) { + if a.ListAccessTokensExecuteMock == nil { + var localVarReturnValue *ListAccessTokensResponse + return localVarReturnValue, nil + } + + return (*a.ListAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListDestinations(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiListDestinationsRequest { + return ApiListDestinationsRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// ListDestinationsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListDestinationsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListDestinationsExecute(r ApiListDestinationsRequest) (*ListDestinationsResponse, error) { + if a.ListDestinationsExecuteMock == nil { + var localVarReturnValue *ListDestinationsResponse + return localVarReturnValue, nil + } + + return (*a.ListDestinationsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListTelemetryRouters(ctx context.Context, projectId string, regionId string) ApiListTelemetryRoutersRequest { + return ApiListTelemetryRoutersRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListTelemetryRoutersExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListTelemetryRoutersExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListTelemetryRoutersExecute(r ApiListTelemetryRoutersRequest) (*ListTelemetryRoutersResponse, error) { + if a.ListTelemetryRoutersExecuteMock == nil { + var localVarReturnValue *ListTelemetryRoutersResponse + return localVarReturnValue, nil + } + + return (*a.ListTelemetryRoutersExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateAccessToken(ctx context.Context, projectId string, regionId string, telemetryRouterId string, accessTokenId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + accessTokenId: accessTokenId, + } +} + +// UpdateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*UpdateAccessTokenResponse, error) { + if a.UpdateAccessTokenExecuteMock == nil { + var localVarReturnValue *UpdateAccessTokenResponse + return localVarReturnValue, nil + } + + return (*a.UpdateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateDestination(ctx context.Context, projectId string, regionId string, telemetryRouterId string, destinationId string) ApiUpdateDestinationRequest { + return ApiUpdateDestinationRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + destinationId: destinationId, + } +} + +// UpdateDestinationExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateDestinationExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateDestinationExecute(r ApiUpdateDestinationRequest) (*DestinationResponse, error) { + if a.UpdateDestinationExecuteMock == nil { + var localVarReturnValue *DestinationResponse + return localVarReturnValue, nil + } + + return (*a.UpdateDestinationExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateTelemetryRouter(ctx context.Context, projectId string, regionId string, telemetryRouterId string) ApiUpdateTelemetryRouterRequest { + return ApiUpdateTelemetryRouterRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + telemetryRouterId: telemetryRouterId, + } +} + +// UpdateTelemetryRouterExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateTelemetryRouterExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateTelemetryRouterExecute(r ApiUpdateTelemetryRouterRequest) (*TelemetryRouterResponse, error) { + if a.UpdateTelemetryRouterExecuteMock == nil { + var localVarReturnValue *TelemetryRouterResponse + return localVarReturnValue, nil + } + + return (*a.UpdateTelemetryRouterExecuteMock)(r) +} diff --git a/services/telemetryrouter/v1betaapi/client.go b/services/telemetryrouter/v1betaapi/client.go new file mode 100644 index 000000000..211adb2a8 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// 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 Telemetry Router API API v1beta.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/telemetryrouter/v1betaapi/configuration.go b/services/telemetryrouter/v1betaapi/configuration.go new file mode 100644 index 000000000..e99eb3ffb --- /dev/null +++ b/services/telemetryrouter/v1betaapi/configuration.go @@ -0,0 +1,37 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// 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/telemetryrouter", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://telemetry-router.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/telemetryrouter/v1betaapi/model_access_token_base_request.go b/services/telemetryrouter/v1betaapi/model_access_token_base_request.go new file mode 100644 index 000000000..382e028b3 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_access_token_base_request.go @@ -0,0 +1,254 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AccessTokenBaseRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenBaseRequest{} + +// AccessTokenBaseRequest struct for AccessTokenBaseRequest +type AccessTokenBaseRequest struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The selected display name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + // The time-to-live (TTL) in days for the access token. If not set, token will not expire. + Ttl NullableInt32 `json:"ttl,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AccessTokenBaseRequest AccessTokenBaseRequest + +// NewAccessTokenBaseRequest instantiates a new AccessTokenBaseRequest 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 NewAccessTokenBaseRequest(displayName string) *AccessTokenBaseRequest { + this := AccessTokenBaseRequest{} + this.DisplayName = displayName + return &this +} + +// NewAccessTokenBaseRequestWithDefaults instantiates a new AccessTokenBaseRequest 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 NewAccessTokenBaseRequestWithDefaults() *AccessTokenBaseRequest { + this := AccessTokenBaseRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessTokenBaseRequest) 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 *AccessTokenBaseRequest) 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 *AccessTokenBaseRequest) 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 *AccessTokenBaseRequest) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessTokenBaseRequest) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessTokenBaseRequest) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *AccessTokenBaseRequest) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetTtl returns the Ttl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AccessTokenBaseRequest) GetTtl() int32 { + if o == nil || IsNil(o.Ttl.Get()) { + var ret int32 + return ret + } + return *o.Ttl.Get() +} + +// GetTtlOk returns a tuple with the Ttl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *AccessTokenBaseRequest) GetTtlOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Ttl.Get(), o.Ttl.IsSet() +} + +// HasTtl returns a boolean if a field has been set. +func (o *AccessTokenBaseRequest) HasTtl() bool { + if o != nil && o.Ttl.IsSet() { + return true + } + + return false +} + +// SetTtl gets a reference to the given NullableInt32 and assigns it to the Ttl field. +func (o *AccessTokenBaseRequest) SetTtl(v int32) { + o.Ttl.Set(&v) +} + +// SetTtlNil sets the value for Ttl to be an explicit nil +func (o *AccessTokenBaseRequest) SetTtlNil() { + o.Ttl.Set(nil) +} + +// UnsetTtl ensures that no value is present for Ttl, not even an explicit nil +func (o *AccessTokenBaseRequest) UnsetTtl() { + o.Ttl.Unset() +} + +func (o AccessTokenBaseRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessTokenBaseRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if o.Ttl.IsSet() { + toSerialize["ttl"] = o.Ttl.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AccessTokenBaseRequest) 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{ + "displayName", + } + + 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) + } + } + + varAccessTokenBaseRequest := _AccessTokenBaseRequest{} + + err = json.Unmarshal(data, &varAccessTokenBaseRequest) + + if err != nil { + return err + } + + *o = AccessTokenBaseRequest(varAccessTokenBaseRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "ttl") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAccessTokenBaseRequest struct { + value *AccessTokenBaseRequest + isSet bool +} + +func (v NullableAccessTokenBaseRequest) Get() *AccessTokenBaseRequest { + return v.value +} + +func (v *NullableAccessTokenBaseRequest) Set(val *AccessTokenBaseRequest) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenBaseRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenBaseRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenBaseRequest(val *AccessTokenBaseRequest) *NullableAccessTokenBaseRequest { + return &NullableAccessTokenBaseRequest{value: val, isSet: true} +} + +func (v NullableAccessTokenBaseRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenBaseRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_access_token_base_response.go b/services/telemetryrouter/v1betaapi/model_access_token_base_response.go new file mode 100644 index 000000000..cb74d1086 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_access_token_base_response.go @@ -0,0 +1,344 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the AccessTokenBaseResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenBaseResponse{} + +// AccessTokenBaseResponse struct for AccessTokenBaseResponse +type AccessTokenBaseResponse struct { + // The user ID of the creator of the access token. + CreatorId string `json:"creatorId"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The selected display name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 ]*$"` + // The date and time until the access token is valid to (inclusively). + ExpirationTime NullableTime `json:"expirationTime,omitempty"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + Status string `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _AccessTokenBaseResponse AccessTokenBaseResponse + +// NewAccessTokenBaseResponse instantiates a new AccessTokenBaseResponse 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 NewAccessTokenBaseResponse(creatorId string, displayName string, id string, status string) *AccessTokenBaseResponse { + this := AccessTokenBaseResponse{} + this.CreatorId = creatorId + this.DisplayName = displayName + this.Id = id + this.Status = status + return &this +} + +// NewAccessTokenBaseResponseWithDefaults instantiates a new AccessTokenBaseResponse 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 NewAccessTokenBaseResponseWithDefaults() *AccessTokenBaseResponse { + this := AccessTokenBaseResponse{} + return &this +} + +// GetCreatorId returns the CreatorId field value +func (o *AccessTokenBaseResponse) GetCreatorId() string { + if o == nil { + var ret string + return ret + } + + return o.CreatorId +} + +// GetCreatorIdOk returns a tuple with the CreatorId field value +// and a boolean to check if the value has been set. +func (o *AccessTokenBaseResponse) GetCreatorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatorId, true +} + +// SetCreatorId sets field value +func (o *AccessTokenBaseResponse) SetCreatorId(v string) { + o.CreatorId = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessTokenBaseResponse) 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 *AccessTokenBaseResponse) 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 *AccessTokenBaseResponse) 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 *AccessTokenBaseResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessTokenBaseResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessTokenBaseResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *AccessTokenBaseResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpirationTime returns the ExpirationTime field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AccessTokenBaseResponse) GetExpirationTime() time.Time { + if o == nil || IsNil(o.ExpirationTime.Get()) { + var ret time.Time + return ret + } + return *o.ExpirationTime.Get() +} + +// GetExpirationTimeOk returns a tuple with the ExpirationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *AccessTokenBaseResponse) GetExpirationTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.ExpirationTime.Get(), o.ExpirationTime.IsSet() +} + +// HasExpirationTime returns a boolean if a field has been set. +func (o *AccessTokenBaseResponse) HasExpirationTime() bool { + if o != nil && o.ExpirationTime.IsSet() { + return true + } + + return false +} + +// SetExpirationTime gets a reference to the given NullableTime and assigns it to the ExpirationTime field. +func (o *AccessTokenBaseResponse) SetExpirationTime(v time.Time) { + o.ExpirationTime.Set(&v) +} + +// SetExpirationTimeNil sets the value for ExpirationTime to be an explicit nil +func (o *AccessTokenBaseResponse) SetExpirationTimeNil() { + o.ExpirationTime.Set(nil) +} + +// UnsetExpirationTime ensures that no value is present for ExpirationTime, not even an explicit nil +func (o *AccessTokenBaseResponse) UnsetExpirationTime() { + o.ExpirationTime.Unset() +} + +// GetId returns the Id field value +func (o *AccessTokenBaseResponse) 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 *AccessTokenBaseResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AccessTokenBaseResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *AccessTokenBaseResponse) 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 *AccessTokenBaseResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *AccessTokenBaseResponse) SetStatus(v string) { + o.Status = v +} + +func (o AccessTokenBaseResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessTokenBaseResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["creatorId"] = o.CreatorId + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if o.ExpirationTime.IsSet() { + toSerialize["expirationTime"] = o.ExpirationTime.Get() + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AccessTokenBaseResponse) 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{ + "creatorId", + "displayName", + "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) + } + } + + varAccessTokenBaseResponse := _AccessTokenBaseResponse{} + + err = json.Unmarshal(data, &varAccessTokenBaseResponse) + + if err != nil { + return err + } + + *o = AccessTokenBaseResponse(varAccessTokenBaseResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "creatorId") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "expirationTime") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAccessTokenBaseResponse struct { + value *AccessTokenBaseResponse + isSet bool +} + +func (v NullableAccessTokenBaseResponse) Get() *AccessTokenBaseResponse { + return v.value +} + +func (v *NullableAccessTokenBaseResponse) Set(val *AccessTokenBaseResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenBaseResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenBaseResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenBaseResponse(val *AccessTokenBaseResponse) *NullableAccessTokenBaseResponse { + return &NullableAccessTokenBaseResponse{value: val, isSet: true} +} + +func (v NullableAccessTokenBaseResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenBaseResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_config_filter.go b/services/telemetryrouter/v1betaapi/model_config_filter.go new file mode 100644 index 000000000..bd47ad156 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_config_filter.go @@ -0,0 +1,166 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ConfigFilter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConfigFilter{} + +// ConfigFilter struct for ConfigFilter +type ConfigFilter struct { + Attributes []ConfigFilterAttributes `json:"attributes"` + AdditionalProperties map[string]interface{} +} + +type _ConfigFilter ConfigFilter + +// NewConfigFilter instantiates a new ConfigFilter 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 NewConfigFilter(attributes []ConfigFilterAttributes) *ConfigFilter { + this := ConfigFilter{} + this.Attributes = attributes + return &this +} + +// NewConfigFilterWithDefaults instantiates a new ConfigFilter 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 NewConfigFilterWithDefaults() *ConfigFilter { + this := ConfigFilter{} + return &this +} + +// GetAttributes returns the Attributes field value +func (o *ConfigFilter) GetAttributes() []ConfigFilterAttributes { + if o == nil { + var ret []ConfigFilterAttributes + return ret + } + + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *ConfigFilter) GetAttributesOk() ([]ConfigFilterAttributes, bool) { + if o == nil { + return nil, false + } + return o.Attributes, true +} + +// SetAttributes sets field value +func (o *ConfigFilter) SetAttributes(v []ConfigFilterAttributes) { + o.Attributes = v +} + +func (o ConfigFilter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConfigFilter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["attributes"] = o.Attributes + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConfigFilter) 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{ + "attributes", + } + + 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) + } + } + + varConfigFilter := _ConfigFilter{} + + err = json.Unmarshal(data, &varConfigFilter) + + if err != nil { + return err + } + + *o = ConfigFilter(varConfigFilter) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "attributes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConfigFilter struct { + value *ConfigFilter + isSet bool +} + +func (v NullableConfigFilter) Get() *ConfigFilter { + return v.value +} + +func (v *NullableConfigFilter) Set(val *ConfigFilter) { + v.value = val + v.isSet = true +} + +func (v NullableConfigFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigFilter(val *ConfigFilter) *NullableConfigFilter { + return &NullableConfigFilter{value: val, isSet: true} +} + +func (v NullableConfigFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_config_filter_attributes.go b/services/telemetryrouter/v1betaapi/model_config_filter_attributes.go new file mode 100644 index 000000000..4b23585ec --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_config_filter_attributes.go @@ -0,0 +1,253 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ConfigFilterAttributes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConfigFilterAttributes{} + +// ConfigFilterAttributes struct for ConfigFilterAttributes +type ConfigFilterAttributes struct { + Key string `json:"key"` + Level ConfigFilterLevel `json:"level"` + Matcher ConfigFilterMatcher `json:"matcher"` + Values []string `json:"values"` + AdditionalProperties map[string]interface{} +} + +type _ConfigFilterAttributes ConfigFilterAttributes + +// NewConfigFilterAttributes instantiates a new ConfigFilterAttributes 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 NewConfigFilterAttributes(key string, level ConfigFilterLevel, matcher ConfigFilterMatcher, values []string) *ConfigFilterAttributes { + this := ConfigFilterAttributes{} + this.Key = key + this.Level = level + this.Matcher = matcher + this.Values = values + return &this +} + +// NewConfigFilterAttributesWithDefaults instantiates a new ConfigFilterAttributes 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 NewConfigFilterAttributesWithDefaults() *ConfigFilterAttributes { + this := ConfigFilterAttributes{} + return &this +} + +// GetKey returns the Key field value +func (o *ConfigFilterAttributes) GetKey() string { + if o == nil { + var ret string + return ret + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *ConfigFilterAttributes) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Key, true +} + +// SetKey sets field value +func (o *ConfigFilterAttributes) SetKey(v string) { + o.Key = v +} + +// GetLevel returns the Level field value +func (o *ConfigFilterAttributes) GetLevel() ConfigFilterLevel { + if o == nil { + var ret ConfigFilterLevel + return ret + } + + return o.Level +} + +// GetLevelOk returns a tuple with the Level field value +// and a boolean to check if the value has been set. +func (o *ConfigFilterAttributes) GetLevelOk() (*ConfigFilterLevel, bool) { + if o == nil { + return nil, false + } + return &o.Level, true +} + +// SetLevel sets field value +func (o *ConfigFilterAttributes) SetLevel(v ConfigFilterLevel) { + o.Level = v +} + +// GetMatcher returns the Matcher field value +func (o *ConfigFilterAttributes) GetMatcher() ConfigFilterMatcher { + if o == nil { + var ret ConfigFilterMatcher + return ret + } + + return o.Matcher +} + +// GetMatcherOk returns a tuple with the Matcher field value +// and a boolean to check if the value has been set. +func (o *ConfigFilterAttributes) GetMatcherOk() (*ConfigFilterMatcher, bool) { + if o == nil { + return nil, false + } + return &o.Matcher, true +} + +// SetMatcher sets field value +func (o *ConfigFilterAttributes) SetMatcher(v ConfigFilterMatcher) { + o.Matcher = v +} + +// GetValues returns the Values field value +func (o *ConfigFilterAttributes) GetValues() []string { + if o == nil { + var ret []string + return ret + } + + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value +// and a boolean to check if the value has been set. +func (o *ConfigFilterAttributes) GetValuesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Values, true +} + +// SetValues sets field value +func (o *ConfigFilterAttributes) SetValues(v []string) { + o.Values = v +} + +func (o ConfigFilterAttributes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConfigFilterAttributes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["key"] = o.Key + toSerialize["level"] = o.Level + toSerialize["matcher"] = o.Matcher + toSerialize["values"] = o.Values + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConfigFilterAttributes) 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{ + "key", + "level", + "matcher", + "values", + } + + 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) + } + } + + varConfigFilterAttributes := _ConfigFilterAttributes{} + + err = json.Unmarshal(data, &varConfigFilterAttributes) + + if err != nil { + return err + } + + *o = ConfigFilterAttributes(varConfigFilterAttributes) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "key") + delete(additionalProperties, "level") + delete(additionalProperties, "matcher") + delete(additionalProperties, "values") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConfigFilterAttributes struct { + value *ConfigFilterAttributes + isSet bool +} + +func (v NullableConfigFilterAttributes) Get() *ConfigFilterAttributes { + return v.value +} + +func (v *NullableConfigFilterAttributes) Set(val *ConfigFilterAttributes) { + v.value = val + v.isSet = true +} + +func (v NullableConfigFilterAttributes) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigFilterAttributes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigFilterAttributes(val *ConfigFilterAttributes) *NullableConfigFilterAttributes { + return &NullableConfigFilterAttributes{value: val, isSet: true} +} + +func (v NullableConfigFilterAttributes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigFilterAttributes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_config_filter_level.go b/services/telemetryrouter/v1betaapi/model_config_filter_level.go new file mode 100644 index 000000000..1091d0102 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_config_filter_level.go @@ -0,0 +1,112 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// ConfigFilterLevel the model 'ConfigFilterLevel' +type ConfigFilterLevel string + +// List of configFilterLevel +const ( + CONFIGFILTERLEVEL_RESOURCE ConfigFilterLevel = "resource" + CONFIGFILTERLEVEL_SCOPE ConfigFilterLevel = "scope" + CONFIGFILTERLEVEL_LOG_RECORD ConfigFilterLevel = "logRecord" +) + +// All allowed values of ConfigFilterLevel enum +var AllowedConfigFilterLevelEnumValues = []ConfigFilterLevel{ + "resource", + "scope", + "logRecord", +} + +func (v *ConfigFilterLevel) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ConfigFilterLevel(value) + for _, existing := range AllowedConfigFilterLevelEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ConfigFilterLevel", value) +} + +// NewConfigFilterLevelFromValue returns a pointer to a valid ConfigFilterLevel +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewConfigFilterLevelFromValue(v string) (*ConfigFilterLevel, error) { + ev := ConfigFilterLevel(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ConfigFilterLevel: valid values are %v", v, AllowedConfigFilterLevelEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ConfigFilterLevel) IsValid() bool { + for _, existing := range AllowedConfigFilterLevelEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to configFilterLevel value +func (v ConfigFilterLevel) Ptr() *ConfigFilterLevel { + return &v +} + +type NullableConfigFilterLevel struct { + value *ConfigFilterLevel + isSet bool +} + +func (v NullableConfigFilterLevel) Get() *ConfigFilterLevel { + return v.value +} + +func (v *NullableConfigFilterLevel) Set(val *ConfigFilterLevel) { + v.value = val + v.isSet = true +} + +func (v NullableConfigFilterLevel) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigFilterLevel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigFilterLevel(val *ConfigFilterLevel) *NullableConfigFilterLevel { + return &NullableConfigFilterLevel{value: val, isSet: true} +} + +func (v NullableConfigFilterLevel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigFilterLevel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_config_filter_matcher.go b/services/telemetryrouter/v1betaapi/model_config_filter_matcher.go new file mode 100644 index 000000000..1bbe46c4e --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_config_filter_matcher.go @@ -0,0 +1,110 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// ConfigFilterMatcher the model 'ConfigFilterMatcher' +type ConfigFilterMatcher string + +// List of configFilterMatcher +const ( + CONFIGFILTERMATCHER_EQUAL ConfigFilterMatcher = "=" + CONFIGFILTERMATCHER_NOT_EQUAL ConfigFilterMatcher = "!=" +) + +// All allowed values of ConfigFilterMatcher enum +var AllowedConfigFilterMatcherEnumValues = []ConfigFilterMatcher{ + "=", + "!=", +} + +func (v *ConfigFilterMatcher) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ConfigFilterMatcher(value) + for _, existing := range AllowedConfigFilterMatcherEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ConfigFilterMatcher", value) +} + +// NewConfigFilterMatcherFromValue returns a pointer to a valid ConfigFilterMatcher +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewConfigFilterMatcherFromValue(v string) (*ConfigFilterMatcher, error) { + ev := ConfigFilterMatcher(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ConfigFilterMatcher: valid values are %v", v, AllowedConfigFilterMatcherEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ConfigFilterMatcher) IsValid() bool { + for _, existing := range AllowedConfigFilterMatcherEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to configFilterMatcher value +func (v ConfigFilterMatcher) Ptr() *ConfigFilterMatcher { + return &v +} + +type NullableConfigFilterMatcher struct { + value *ConfigFilterMatcher + isSet bool +} + +func (v NullableConfigFilterMatcher) Get() *ConfigFilterMatcher { + return v.value +} + +func (v *NullableConfigFilterMatcher) Set(val *ConfigFilterMatcher) { + v.value = val + v.isSet = true +} + +func (v NullableConfigFilterMatcher) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigFilterMatcher) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigFilterMatcher(val *ConfigFilterMatcher) *NullableConfigFilterMatcher { + return &NullableConfigFilterMatcher{value: val, isSet: true} +} + +func (v NullableConfigFilterMatcher) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigFilterMatcher) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_create_access_token_payload.go b/services/telemetryrouter/v1betaapi/model_create_access_token_payload.go new file mode 100644 index 000000000..e64d3f8a9 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_create_access_token_payload.go @@ -0,0 +1,254 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenPayload{} + +// CreateAccessTokenPayload struct for CreateAccessTokenPayload +type CreateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The selected display name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + // The time-to-live (TTL) in days for the access token. If not set, token will not expire. + Ttl NullableInt32 `json:"ttl,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateAccessTokenPayload CreateAccessTokenPayload + +// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName string) *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + this.DisplayName = displayName + return &this +} + +// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) 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 *CreateAccessTokenPayload) 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 *CreateAccessTokenPayload) 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 *CreateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetTtl returns the Ttl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateAccessTokenPayload) GetTtl() int32 { + if o == nil || IsNil(o.Ttl.Get()) { + var ret int32 + return ret + } + return *o.Ttl.Get() +} + +// GetTtlOk returns a tuple with the Ttl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateAccessTokenPayload) GetTtlOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Ttl.Get(), o.Ttl.IsSet() +} + +// HasTtl returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasTtl() bool { + if o != nil && o.Ttl.IsSet() { + return true + } + + return false +} + +// SetTtl gets a reference to the given NullableInt32 and assigns it to the Ttl field. +func (o *CreateAccessTokenPayload) SetTtl(v int32) { + o.Ttl.Set(&v) +} + +// SetTtlNil sets the value for Ttl to be an explicit nil +func (o *CreateAccessTokenPayload) SetTtlNil() { + o.Ttl.Set(nil) +} + +// UnsetTtl ensures that no value is present for Ttl, not even an explicit nil +func (o *CreateAccessTokenPayload) UnsetTtl() { + o.Ttl.Unset() +} + +func (o CreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if o.Ttl.IsSet() { + toSerialize["ttl"] = o.Ttl.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateAccessTokenPayload) 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{ + "displayName", + } + + 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) + } + } + + varCreateAccessTokenPayload := _CreateAccessTokenPayload{} + + err = json.Unmarshal(data, &varCreateAccessTokenPayload) + + if err != nil { + return err + } + + *o = CreateAccessTokenPayload(varCreateAccessTokenPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "ttl") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateAccessTokenPayload struct { + value *CreateAccessTokenPayload + isSet bool +} + +func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { + return v.value +} + +func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { + return &NullableCreateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_create_access_token_response.go b/services/telemetryrouter/v1betaapi/model_create_access_token_response.go new file mode 100644 index 000000000..29868b8b7 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_create_access_token_response.go @@ -0,0 +1,374 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the CreateAccessTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenResponse{} + +// CreateAccessTokenResponse struct for CreateAccessTokenResponse +type CreateAccessTokenResponse struct { + // The user ID of the creator of the access token. + CreatorId string `json:"creatorId"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The selected display name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 ]*$"` + // The date and time until the access token is valid to (inclusively). + ExpirationTime NullableTime `json:"expirationTime,omitempty"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + Status string `json:"status"` + // The generated access token. + AccessToken string `json:"accessToken"` + AdditionalProperties map[string]interface{} +} + +type _CreateAccessTokenResponse CreateAccessTokenResponse + +// NewCreateAccessTokenResponse instantiates a new CreateAccessTokenResponse 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 NewCreateAccessTokenResponse(creatorId string, displayName string, id string, status string, accessToken string) *CreateAccessTokenResponse { + this := CreateAccessTokenResponse{} + this.CreatorId = creatorId + this.DisplayName = displayName + this.Id = id + this.Status = status + this.AccessToken = accessToken + return &this +} + +// NewCreateAccessTokenResponseWithDefaults instantiates a new CreateAccessTokenResponse 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 NewCreateAccessTokenResponseWithDefaults() *CreateAccessTokenResponse { + this := CreateAccessTokenResponse{} + return &this +} + +// GetCreatorId returns the CreatorId field value +func (o *CreateAccessTokenResponse) GetCreatorId() string { + if o == nil { + var ret string + return ret + } + + return o.CreatorId +} + +// GetCreatorIdOk returns a tuple with the CreatorId field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenResponse) GetCreatorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatorId, true +} + +// SetCreatorId sets field value +func (o *CreateAccessTokenResponse) SetCreatorId(v string) { + o.CreatorId = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenResponse) 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 *CreateAccessTokenResponse) 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 *CreateAccessTokenResponse) 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 *CreateAccessTokenResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpirationTime returns the ExpirationTime field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateAccessTokenResponse) GetExpirationTime() time.Time { + if o == nil || IsNil(o.ExpirationTime.Get()) { + var ret time.Time + return ret + } + return *o.ExpirationTime.Get() +} + +// GetExpirationTimeOk returns a tuple with the ExpirationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateAccessTokenResponse) GetExpirationTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.ExpirationTime.Get(), o.ExpirationTime.IsSet() +} + +// HasExpirationTime returns a boolean if a field has been set. +func (o *CreateAccessTokenResponse) HasExpirationTime() bool { + if o != nil && o.ExpirationTime.IsSet() { + return true + } + + return false +} + +// SetExpirationTime gets a reference to the given NullableTime and assigns it to the ExpirationTime field. +func (o *CreateAccessTokenResponse) SetExpirationTime(v time.Time) { + o.ExpirationTime.Set(&v) +} + +// SetExpirationTimeNil sets the value for ExpirationTime to be an explicit nil +func (o *CreateAccessTokenResponse) SetExpirationTimeNil() { + o.ExpirationTime.Set(nil) +} + +// UnsetExpirationTime ensures that no value is present for ExpirationTime, not even an explicit nil +func (o *CreateAccessTokenResponse) UnsetExpirationTime() { + o.ExpirationTime.Unset() +} + +// GetId returns the Id field value +func (o *CreateAccessTokenResponse) 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 *CreateAccessTokenResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreateAccessTokenResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *CreateAccessTokenResponse) 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 *CreateAccessTokenResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *CreateAccessTokenResponse) SetStatus(v string) { + o.Status = v +} + +// GetAccessToken returns the AccessToken field value +func (o *CreateAccessTokenResponse) GetAccessToken() string { + if o == nil { + var ret string + return ret + } + + return o.AccessToken +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenResponse) GetAccessTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessToken, true +} + +// SetAccessToken sets field value +func (o *CreateAccessTokenResponse) SetAccessToken(v string) { + o.AccessToken = v +} + +func (o CreateAccessTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateAccessTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["creatorId"] = o.CreatorId + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if o.ExpirationTime.IsSet() { + toSerialize["expirationTime"] = o.ExpirationTime.Get() + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + toSerialize["accessToken"] = o.AccessToken + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateAccessTokenResponse) 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{ + "creatorId", + "displayName", + "id", + "status", + "accessToken", + } + + 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) + } + } + + varCreateAccessTokenResponse := _CreateAccessTokenResponse{} + + err = json.Unmarshal(data, &varCreateAccessTokenResponse) + + if err != nil { + return err + } + + *o = CreateAccessTokenResponse(varCreateAccessTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "creatorId") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "expirationTime") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + delete(additionalProperties, "accessToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateAccessTokenResponse struct { + value *CreateAccessTokenResponse + isSet bool +} + +func (v NullableCreateAccessTokenResponse) Get() *CreateAccessTokenResponse { + return v.value +} + +func (v *NullableCreateAccessTokenResponse) Set(val *CreateAccessTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenResponse(val *CreateAccessTokenResponse) *NullableCreateAccessTokenResponse { + return &NullableCreateAccessTokenResponse{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_create_destination_payload.go b/services/telemetryrouter/v1betaapi/model_create_destination_payload.go new file mode 100644 index 000000000..08d79c15f --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_create_destination_payload.go @@ -0,0 +1,234 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateDestinationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDestinationPayload{} + +// CreateDestinationPayload struct for CreateDestinationPayload +type CreateDestinationPayload struct { + Config DestinationConfig `json:"config"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + AdditionalProperties map[string]interface{} +} + +type _CreateDestinationPayload CreateDestinationPayload + +// NewCreateDestinationPayload instantiates a new CreateDestinationPayload 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 NewCreateDestinationPayload(config DestinationConfig, displayName string) *CreateDestinationPayload { + this := CreateDestinationPayload{} + this.Config = config + this.DisplayName = displayName + return &this +} + +// NewCreateDestinationPayloadWithDefaults instantiates a new CreateDestinationPayload 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 NewCreateDestinationPayloadWithDefaults() *CreateDestinationPayload { + this := CreateDestinationPayload{} + return &this +} + +// GetConfig returns the Config field value +func (o *CreateDestinationPayload) GetConfig() DestinationConfig { + if o == nil { + var ret DestinationConfig + 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 *CreateDestinationPayload) GetConfigOk() (*DestinationConfig, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value +func (o *CreateDestinationPayload) SetConfig(v DestinationConfig) { + o.Config = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateDestinationPayload) 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 *CreateDestinationPayload) 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 *CreateDestinationPayload) 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 *CreateDestinationPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateDestinationPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateDestinationPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateDestinationPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +func (o CreateDestinationPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateDestinationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["config"] = o.Config + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateDestinationPayload) 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", + "displayName", + } + + 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) + } + } + + varCreateDestinationPayload := _CreateDestinationPayload{} + + err = json.Unmarshal(data, &varCreateDestinationPayload) + + if err != nil { + return err + } + + *o = CreateDestinationPayload(varCreateDestinationPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "config") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateDestinationPayload struct { + value *CreateDestinationPayload + isSet bool +} + +func (v NullableCreateDestinationPayload) Get() *CreateDestinationPayload { + return v.value +} + +func (v *NullableCreateDestinationPayload) Set(val *CreateDestinationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDestinationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDestinationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDestinationPayload(val *CreateDestinationPayload) *NullableCreateDestinationPayload { + return &NullableCreateDestinationPayload{value: val, isSet: true} +} + +func (v NullableCreateDestinationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDestinationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_create_telemetry_router_payload.go b/services/telemetryrouter/v1betaapi/model_create_telemetry_router_payload.go new file mode 100644 index 000000000..10175c60b --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_create_telemetry_router_payload.go @@ -0,0 +1,242 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateTelemetryRouterPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateTelemetryRouterPayload{} + +// CreateTelemetryRouterPayload struct for CreateTelemetryRouterPayload +type CreateTelemetryRouterPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + Filter *ConfigFilter `json:"filter,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateTelemetryRouterPayload CreateTelemetryRouterPayload + +// NewCreateTelemetryRouterPayload instantiates a new CreateTelemetryRouterPayload 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 NewCreateTelemetryRouterPayload(displayName string) *CreateTelemetryRouterPayload { + this := CreateTelemetryRouterPayload{} + this.DisplayName = displayName + return &this +} + +// NewCreateTelemetryRouterPayloadWithDefaults instantiates a new CreateTelemetryRouterPayload 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 NewCreateTelemetryRouterPayloadWithDefaults() *CreateTelemetryRouterPayload { + this := CreateTelemetryRouterPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateTelemetryRouterPayload) 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 *CreateTelemetryRouterPayload) 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 *CreateTelemetryRouterPayload) 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 *CreateTelemetryRouterPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateTelemetryRouterPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateTelemetryRouterPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateTelemetryRouterPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *CreateTelemetryRouterPayload) GetFilter() ConfigFilter { + if o == nil || IsNil(o.Filter) { + var ret ConfigFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTelemetryRouterPayload) GetFilterOk() (*ConfigFilter, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *CreateTelemetryRouterPayload) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given ConfigFilter and assigns it to the Filter field. +func (o *CreateTelemetryRouterPayload) SetFilter(v ConfigFilter) { + o.Filter = &v +} + +func (o CreateTelemetryRouterPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateTelemetryRouterPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateTelemetryRouterPayload) 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{ + "displayName", + } + + 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) + } + } + + varCreateTelemetryRouterPayload := _CreateTelemetryRouterPayload{} + + err = json.Unmarshal(data, &varCreateTelemetryRouterPayload) + + if err != nil { + return err + } + + *o = CreateTelemetryRouterPayload(varCreateTelemetryRouterPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "filter") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateTelemetryRouterPayload struct { + value *CreateTelemetryRouterPayload + isSet bool +} + +func (v NullableCreateTelemetryRouterPayload) Get() *CreateTelemetryRouterPayload { + return v.value +} + +func (v *NullableCreateTelemetryRouterPayload) Set(val *CreateTelemetryRouterPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateTelemetryRouterPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateTelemetryRouterPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateTelemetryRouterPayload(val *CreateTelemetryRouterPayload) *NullableCreateTelemetryRouterPayload { + return &NullableCreateTelemetryRouterPayload{value: val, isSet: true} +} + +func (v NullableCreateTelemetryRouterPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateTelemetryRouterPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_config.go b/services/telemetryrouter/v1betaapi/model_destination_config.go new file mode 100644 index 000000000..e32111d2e --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_config.go @@ -0,0 +1,277 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the DestinationConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationConfig{} + +// DestinationConfig struct for DestinationConfig +type DestinationConfig struct { + ConfigType DestinationConfigType `json:"configType"` + Filter *ConfigFilter `json:"filter,omitempty"` + OpenTelemetry *DestinationConfigOpenTelemetry `json:"openTelemetry,omitempty"` + S3 *DestinationConfigS3 `json:"s3,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DestinationConfig DestinationConfig + +// NewDestinationConfig instantiates a new DestinationConfig 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 NewDestinationConfig(configType DestinationConfigType) *DestinationConfig { + this := DestinationConfig{} + this.ConfigType = configType + return &this +} + +// NewDestinationConfigWithDefaults instantiates a new DestinationConfig 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 NewDestinationConfigWithDefaults() *DestinationConfig { + this := DestinationConfig{} + return &this +} + +// GetConfigType returns the ConfigType field value +func (o *DestinationConfig) GetConfigType() DestinationConfigType { + if o == nil { + var ret DestinationConfigType + return ret + } + + return o.ConfigType +} + +// GetConfigTypeOk returns a tuple with the ConfigType field value +// and a boolean to check if the value has been set. +func (o *DestinationConfig) GetConfigTypeOk() (*DestinationConfigType, bool) { + if o == nil { + return nil, false + } + return &o.ConfigType, true +} + +// SetConfigType sets field value +func (o *DestinationConfig) SetConfigType(v DestinationConfigType) { + o.ConfigType = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *DestinationConfig) GetFilter() ConfigFilter { + if o == nil || IsNil(o.Filter) { + var ret ConfigFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DestinationConfig) GetFilterOk() (*ConfigFilter, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *DestinationConfig) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given ConfigFilter and assigns it to the Filter field. +func (o *DestinationConfig) SetFilter(v ConfigFilter) { + o.Filter = &v +} + +// GetOpenTelemetry returns the OpenTelemetry field value if set, zero value otherwise. +func (o *DestinationConfig) GetOpenTelemetry() DestinationConfigOpenTelemetry { + if o == nil || IsNil(o.OpenTelemetry) { + var ret DestinationConfigOpenTelemetry + return ret + } + return *o.OpenTelemetry +} + +// GetOpenTelemetryOk returns a tuple with the OpenTelemetry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DestinationConfig) GetOpenTelemetryOk() (*DestinationConfigOpenTelemetry, bool) { + if o == nil || IsNil(o.OpenTelemetry) { + return nil, false + } + return o.OpenTelemetry, true +} + +// HasOpenTelemetry returns a boolean if a field has been set. +func (o *DestinationConfig) HasOpenTelemetry() bool { + if o != nil && !IsNil(o.OpenTelemetry) { + return true + } + + return false +} + +// SetOpenTelemetry gets a reference to the given DestinationConfigOpenTelemetry and assigns it to the OpenTelemetry field. +func (o *DestinationConfig) SetOpenTelemetry(v DestinationConfigOpenTelemetry) { + o.OpenTelemetry = &v +} + +// GetS3 returns the S3 field value if set, zero value otherwise. +func (o *DestinationConfig) GetS3() DestinationConfigS3 { + if o == nil || IsNil(o.S3) { + var ret DestinationConfigS3 + return ret + } + return *o.S3 +} + +// GetS3Ok returns a tuple with the S3 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DestinationConfig) GetS3Ok() (*DestinationConfigS3, bool) { + if o == nil || IsNil(o.S3) { + return nil, false + } + return o.S3, true +} + +// HasS3 returns a boolean if a field has been set. +func (o *DestinationConfig) HasS3() bool { + if o != nil && !IsNil(o.S3) { + return true + } + + return false +} + +// SetS3 gets a reference to the given DestinationConfigS3 and assigns it to the S3 field. +func (o *DestinationConfig) SetS3(v DestinationConfigS3) { + o.S3 = &v +} + +func (o DestinationConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DestinationConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["configType"] = o.ConfigType + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + if !IsNil(o.OpenTelemetry) { + toSerialize["openTelemetry"] = o.OpenTelemetry + } + if !IsNil(o.S3) { + toSerialize["s3"] = o.S3 + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DestinationConfig) 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{ + "configType", + } + + 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) + } + } + + varDestinationConfig := _DestinationConfig{} + + err = json.Unmarshal(data, &varDestinationConfig) + + if err != nil { + return err + } + + *o = DestinationConfig(varDestinationConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "configType") + delete(additionalProperties, "filter") + delete(additionalProperties, "openTelemetry") + delete(additionalProperties, "s3") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDestinationConfig struct { + value *DestinationConfig + isSet bool +} + +func (v NullableDestinationConfig) Get() *DestinationConfig { + return v.value +} + +func (v *NullableDestinationConfig) Set(val *DestinationConfig) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationConfig(val *DestinationConfig) *NullableDestinationConfig { + return &NullableDestinationConfig{value: val, isSet: true} +} + +func (v NullableDestinationConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry.go b/services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry.go new file mode 100644 index 000000000..b067ad452 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry.go @@ -0,0 +1,242 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the DestinationConfigOpenTelemetry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationConfigOpenTelemetry{} + +// DestinationConfigOpenTelemetry struct for DestinationConfigOpenTelemetry +type DestinationConfigOpenTelemetry struct { + BasicAuth *DestinationConfigOpenTelemetryBasicAuth `json:"basicAuth,omitempty"` + // A bearer token to authenticate at the OpenTelemetry URI. + BearerToken *string `json:"bearerToken,omitempty"` + // The URI for reaching the resource. + Uri string `json:"uri"` + AdditionalProperties map[string]interface{} +} + +type _DestinationConfigOpenTelemetry DestinationConfigOpenTelemetry + +// NewDestinationConfigOpenTelemetry instantiates a new DestinationConfigOpenTelemetry 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 NewDestinationConfigOpenTelemetry(uri string) *DestinationConfigOpenTelemetry { + this := DestinationConfigOpenTelemetry{} + this.Uri = uri + return &this +} + +// NewDestinationConfigOpenTelemetryWithDefaults instantiates a new DestinationConfigOpenTelemetry 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 NewDestinationConfigOpenTelemetryWithDefaults() *DestinationConfigOpenTelemetry { + this := DestinationConfigOpenTelemetry{} + return &this +} + +// GetBasicAuth returns the BasicAuth field value if set, zero value otherwise. +func (o *DestinationConfigOpenTelemetry) GetBasicAuth() DestinationConfigOpenTelemetryBasicAuth { + if o == nil || IsNil(o.BasicAuth) { + var ret DestinationConfigOpenTelemetryBasicAuth + return ret + } + return *o.BasicAuth +} + +// GetBasicAuthOk returns a tuple with the BasicAuth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DestinationConfigOpenTelemetry) GetBasicAuthOk() (*DestinationConfigOpenTelemetryBasicAuth, bool) { + if o == nil || IsNil(o.BasicAuth) { + return nil, false + } + return o.BasicAuth, true +} + +// HasBasicAuth returns a boolean if a field has been set. +func (o *DestinationConfigOpenTelemetry) HasBasicAuth() bool { + if o != nil && !IsNil(o.BasicAuth) { + return true + } + + return false +} + +// SetBasicAuth gets a reference to the given DestinationConfigOpenTelemetryBasicAuth and assigns it to the BasicAuth field. +func (o *DestinationConfigOpenTelemetry) SetBasicAuth(v DestinationConfigOpenTelemetryBasicAuth) { + o.BasicAuth = &v +} + +// GetBearerToken returns the BearerToken field value if set, zero value otherwise. +func (o *DestinationConfigOpenTelemetry) GetBearerToken() string { + if o == nil || IsNil(o.BearerToken) { + var ret string + return ret + } + return *o.BearerToken +} + +// GetBearerTokenOk returns a tuple with the BearerToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DestinationConfigOpenTelemetry) GetBearerTokenOk() (*string, bool) { + if o == nil || IsNil(o.BearerToken) { + return nil, false + } + return o.BearerToken, true +} + +// HasBearerToken returns a boolean if a field has been set. +func (o *DestinationConfigOpenTelemetry) HasBearerToken() bool { + if o != nil && !IsNil(o.BearerToken) { + return true + } + + return false +} + +// SetBearerToken gets a reference to the given string and assigns it to the BearerToken field. +func (o *DestinationConfigOpenTelemetry) SetBearerToken(v string) { + o.BearerToken = &v +} + +// GetUri returns the Uri field value +func (o *DestinationConfigOpenTelemetry) GetUri() string { + if o == nil { + var ret string + return ret + } + + return o.Uri +} + +// GetUriOk returns a tuple with the Uri field value +// and a boolean to check if the value has been set. +func (o *DestinationConfigOpenTelemetry) GetUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uri, true +} + +// SetUri sets field value +func (o *DestinationConfigOpenTelemetry) SetUri(v string) { + o.Uri = v +} + +func (o DestinationConfigOpenTelemetry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DestinationConfigOpenTelemetry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BasicAuth) { + toSerialize["basicAuth"] = o.BasicAuth + } + if !IsNil(o.BearerToken) { + toSerialize["bearerToken"] = o.BearerToken + } + toSerialize["uri"] = o.Uri + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DestinationConfigOpenTelemetry) 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{ + "uri", + } + + 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) + } + } + + varDestinationConfigOpenTelemetry := _DestinationConfigOpenTelemetry{} + + err = json.Unmarshal(data, &varDestinationConfigOpenTelemetry) + + if err != nil { + return err + } + + *o = DestinationConfigOpenTelemetry(varDestinationConfigOpenTelemetry) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "basicAuth") + delete(additionalProperties, "bearerToken") + delete(additionalProperties, "uri") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDestinationConfigOpenTelemetry struct { + value *DestinationConfigOpenTelemetry + isSet bool +} + +func (v NullableDestinationConfigOpenTelemetry) Get() *DestinationConfigOpenTelemetry { + return v.value +} + +func (v *NullableDestinationConfigOpenTelemetry) Set(val *DestinationConfigOpenTelemetry) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationConfigOpenTelemetry) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationConfigOpenTelemetry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationConfigOpenTelemetry(val *DestinationConfigOpenTelemetry) *NullableDestinationConfigOpenTelemetry { + return &NullableDestinationConfigOpenTelemetry{value: val, isSet: true} +} + +func (v NullableDestinationConfigOpenTelemetry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationConfigOpenTelemetry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry_basic_auth.go b/services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry_basic_auth.go new file mode 100644 index 000000000..0b5358de2 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_config_open_telemetry_basic_auth.go @@ -0,0 +1,195 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the DestinationConfigOpenTelemetryBasicAuth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationConfigOpenTelemetryBasicAuth{} + +// DestinationConfigOpenTelemetryBasicAuth Basic auth to authenticate at the OpenTelemetry URI +type DestinationConfigOpenTelemetryBasicAuth struct { + Password string `json:"password"` + Username string `json:"username"` + AdditionalProperties map[string]interface{} +} + +type _DestinationConfigOpenTelemetryBasicAuth DestinationConfigOpenTelemetryBasicAuth + +// NewDestinationConfigOpenTelemetryBasicAuth instantiates a new DestinationConfigOpenTelemetryBasicAuth 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 NewDestinationConfigOpenTelemetryBasicAuth(password string, username string) *DestinationConfigOpenTelemetryBasicAuth { + this := DestinationConfigOpenTelemetryBasicAuth{} + this.Password = password + this.Username = username + return &this +} + +// NewDestinationConfigOpenTelemetryBasicAuthWithDefaults instantiates a new DestinationConfigOpenTelemetryBasicAuth 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 NewDestinationConfigOpenTelemetryBasicAuthWithDefaults() *DestinationConfigOpenTelemetryBasicAuth { + this := DestinationConfigOpenTelemetryBasicAuth{} + return &this +} + +// GetPassword returns the Password field value +func (o *DestinationConfigOpenTelemetryBasicAuth) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *DestinationConfigOpenTelemetryBasicAuth) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *DestinationConfigOpenTelemetryBasicAuth) SetPassword(v string) { + o.Password = v +} + +// GetUsername returns the Username field value +func (o *DestinationConfigOpenTelemetryBasicAuth) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *DestinationConfigOpenTelemetryBasicAuth) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *DestinationConfigOpenTelemetryBasicAuth) SetUsername(v string) { + o.Username = v +} + +func (o DestinationConfigOpenTelemetryBasicAuth) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DestinationConfigOpenTelemetryBasicAuth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["password"] = o.Password + toSerialize["username"] = o.Username + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DestinationConfigOpenTelemetryBasicAuth) 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{ + "password", + "username", + } + + 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) + } + } + + varDestinationConfigOpenTelemetryBasicAuth := _DestinationConfigOpenTelemetryBasicAuth{} + + err = json.Unmarshal(data, &varDestinationConfigOpenTelemetryBasicAuth) + + if err != nil { + return err + } + + *o = DestinationConfigOpenTelemetryBasicAuth(varDestinationConfigOpenTelemetryBasicAuth) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "password") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDestinationConfigOpenTelemetryBasicAuth struct { + value *DestinationConfigOpenTelemetryBasicAuth + isSet bool +} + +func (v NullableDestinationConfigOpenTelemetryBasicAuth) Get() *DestinationConfigOpenTelemetryBasicAuth { + return v.value +} + +func (v *NullableDestinationConfigOpenTelemetryBasicAuth) Set(val *DestinationConfigOpenTelemetryBasicAuth) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationConfigOpenTelemetryBasicAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationConfigOpenTelemetryBasicAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationConfigOpenTelemetryBasicAuth(val *DestinationConfigOpenTelemetryBasicAuth) *NullableDestinationConfigOpenTelemetryBasicAuth { + return &NullableDestinationConfigOpenTelemetryBasicAuth{value: val, isSet: true} +} + +func (v NullableDestinationConfigOpenTelemetryBasicAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationConfigOpenTelemetryBasicAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_config_s3.go b/services/telemetryrouter/v1betaapi/model_destination_config_s3.go new file mode 100644 index 000000000..3691f8488 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_config_s3.go @@ -0,0 +1,233 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the DestinationConfigS3 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationConfigS3{} + +// DestinationConfigS3 struct for DestinationConfigS3 +type DestinationConfigS3 struct { + AccessKey *DestinationConfigS3AccessKey `json:"accessKey,omitempty"` + Bucket string `json:"bucket"` + // The URI for reaching the resource. + Endpoint string `json:"endpoint"` + AdditionalProperties map[string]interface{} +} + +type _DestinationConfigS3 DestinationConfigS3 + +// NewDestinationConfigS3 instantiates a new DestinationConfigS3 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 NewDestinationConfigS3(bucket string, endpoint string) *DestinationConfigS3 { + this := DestinationConfigS3{} + this.Bucket = bucket + this.Endpoint = endpoint + return &this +} + +// NewDestinationConfigS3WithDefaults instantiates a new DestinationConfigS3 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 NewDestinationConfigS3WithDefaults() *DestinationConfigS3 { + this := DestinationConfigS3{} + return &this +} + +// GetAccessKey returns the AccessKey field value if set, zero value otherwise. +func (o *DestinationConfigS3) GetAccessKey() DestinationConfigS3AccessKey { + if o == nil || IsNil(o.AccessKey) { + var ret DestinationConfigS3AccessKey + return ret + } + return *o.AccessKey +} + +// GetAccessKeyOk returns a tuple with the AccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DestinationConfigS3) GetAccessKeyOk() (*DestinationConfigS3AccessKey, bool) { + if o == nil || IsNil(o.AccessKey) { + return nil, false + } + return o.AccessKey, true +} + +// HasAccessKey returns a boolean if a field has been set. +func (o *DestinationConfigS3) HasAccessKey() bool { + if o != nil && !IsNil(o.AccessKey) { + return true + } + + return false +} + +// SetAccessKey gets a reference to the given DestinationConfigS3AccessKey and assigns it to the AccessKey field. +func (o *DestinationConfigS3) SetAccessKey(v DestinationConfigS3AccessKey) { + o.AccessKey = &v +} + +// GetBucket returns the Bucket field value +func (o *DestinationConfigS3) GetBucket() string { + if o == nil { + var ret string + return ret + } + + return o.Bucket +} + +// GetBucketOk returns a tuple with the Bucket field value +// and a boolean to check if the value has been set. +func (o *DestinationConfigS3) GetBucketOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Bucket, true +} + +// SetBucket sets field value +func (o *DestinationConfigS3) SetBucket(v string) { + o.Bucket = v +} + +// GetEndpoint returns the Endpoint field value +func (o *DestinationConfigS3) GetEndpoint() string { + if o == nil { + var ret string + return ret + } + + return o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value +// and a boolean to check if the value has been set. +func (o *DestinationConfigS3) GetEndpointOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Endpoint, true +} + +// SetEndpoint sets field value +func (o *DestinationConfigS3) SetEndpoint(v string) { + o.Endpoint = v +} + +func (o DestinationConfigS3) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DestinationConfigS3) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessKey) { + toSerialize["accessKey"] = o.AccessKey + } + toSerialize["bucket"] = o.Bucket + toSerialize["endpoint"] = o.Endpoint + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DestinationConfigS3) 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{ + "bucket", + "endpoint", + } + + 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) + } + } + + varDestinationConfigS3 := _DestinationConfigS3{} + + err = json.Unmarshal(data, &varDestinationConfigS3) + + if err != nil { + return err + } + + *o = DestinationConfigS3(varDestinationConfigS3) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "accessKey") + delete(additionalProperties, "bucket") + delete(additionalProperties, "endpoint") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDestinationConfigS3 struct { + value *DestinationConfigS3 + isSet bool +} + +func (v NullableDestinationConfigS3) Get() *DestinationConfigS3 { + return v.value +} + +func (v *NullableDestinationConfigS3) Set(val *DestinationConfigS3) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationConfigS3) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationConfigS3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationConfigS3(val *DestinationConfigS3) *NullableDestinationConfigS3 { + return &NullableDestinationConfigS3{value: val, isSet: true} +} + +func (v NullableDestinationConfigS3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationConfigS3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_config_s3_access_key.go b/services/telemetryrouter/v1betaapi/model_destination_config_s3_access_key.go new file mode 100644 index 000000000..360dcffab --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_config_s3_access_key.go @@ -0,0 +1,195 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the DestinationConfigS3AccessKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationConfigS3AccessKey{} + +// DestinationConfigS3AccessKey The S3 access key +type DestinationConfigS3AccessKey struct { + Id string `json:"id"` + Secret string `json:"secret"` + AdditionalProperties map[string]interface{} +} + +type _DestinationConfigS3AccessKey DestinationConfigS3AccessKey + +// NewDestinationConfigS3AccessKey instantiates a new DestinationConfigS3AccessKey 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 NewDestinationConfigS3AccessKey(id string, secret string) *DestinationConfigS3AccessKey { + this := DestinationConfigS3AccessKey{} + this.Id = id + this.Secret = secret + return &this +} + +// NewDestinationConfigS3AccessKeyWithDefaults instantiates a new DestinationConfigS3AccessKey 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 NewDestinationConfigS3AccessKeyWithDefaults() *DestinationConfigS3AccessKey { + this := DestinationConfigS3AccessKey{} + return &this +} + +// GetId returns the Id field value +func (o *DestinationConfigS3AccessKey) 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 *DestinationConfigS3AccessKey) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DestinationConfigS3AccessKey) SetId(v string) { + o.Id = v +} + +// GetSecret returns the Secret field value +func (o *DestinationConfigS3AccessKey) GetSecret() string { + if o == nil { + var ret string + return ret + } + + return o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value +// and a boolean to check if the value has been set. +func (o *DestinationConfigS3AccessKey) GetSecretOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Secret, true +} + +// SetSecret sets field value +func (o *DestinationConfigS3AccessKey) SetSecret(v string) { + o.Secret = v +} + +func (o DestinationConfigS3AccessKey) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DestinationConfigS3AccessKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["secret"] = o.Secret + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DestinationConfigS3AccessKey) 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", + "secret", + } + + 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) + } + } + + varDestinationConfigS3AccessKey := _DestinationConfigS3AccessKey{} + + err = json.Unmarshal(data, &varDestinationConfigS3AccessKey) + + if err != nil { + return err + } + + *o = DestinationConfigS3AccessKey(varDestinationConfigS3AccessKey) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "secret") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDestinationConfigS3AccessKey struct { + value *DestinationConfigS3AccessKey + isSet bool +} + +func (v NullableDestinationConfigS3AccessKey) Get() *DestinationConfigS3AccessKey { + return v.value +} + +func (v *NullableDestinationConfigS3AccessKey) Set(val *DestinationConfigS3AccessKey) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationConfigS3AccessKey) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationConfigS3AccessKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationConfigS3AccessKey(val *DestinationConfigS3AccessKey) *NullableDestinationConfigS3AccessKey { + return &NullableDestinationConfigS3AccessKey{value: val, isSet: true} +} + +func (v NullableDestinationConfigS3AccessKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationConfigS3AccessKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_config_type.go b/services/telemetryrouter/v1betaapi/model_destination_config_type.go new file mode 100644 index 000000000..dc65d63b8 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_config_type.go @@ -0,0 +1,110 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// DestinationConfigType Type of the destination. +type DestinationConfigType string + +// List of destinationConfigType +const ( + DESTINATIONCONFIGTYPE_OPEN_TELEMETRY DestinationConfigType = "OpenTelemetry" + DESTINATIONCONFIGTYPE_S3 DestinationConfigType = "S3" +) + +// All allowed values of DestinationConfigType enum +var AllowedDestinationConfigTypeEnumValues = []DestinationConfigType{ + "OpenTelemetry", + "S3", +} + +func (v *DestinationConfigType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DestinationConfigType(value) + for _, existing := range AllowedDestinationConfigTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DestinationConfigType", value) +} + +// NewDestinationConfigTypeFromValue returns a pointer to a valid DestinationConfigType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDestinationConfigTypeFromValue(v string) (*DestinationConfigType, error) { + ev := DestinationConfigType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DestinationConfigType: valid values are %v", v, AllowedDestinationConfigTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DestinationConfigType) IsValid() bool { + for _, existing := range AllowedDestinationConfigTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to destinationConfigType value +func (v DestinationConfigType) Ptr() *DestinationConfigType { + return &v +} + +type NullableDestinationConfigType struct { + value *DestinationConfigType + isSet bool +} + +func (v NullableDestinationConfigType) Get() *DestinationConfigType { + return v.value +} + +func (v *NullableDestinationConfigType) Set(val *DestinationConfigType) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationConfigType) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationConfigType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationConfigType(val *DestinationConfigType) *NullableDestinationConfigType { + return &NullableDestinationConfigType{value: val, isSet: true} +} + +func (v NullableDestinationConfigType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationConfigType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_destination_response.go b/services/telemetryrouter/v1betaapi/model_destination_response.go new file mode 100644 index 000000000..14bc021a2 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_destination_response.go @@ -0,0 +1,355 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the DestinationResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationResponse{} + +// DestinationResponse struct for DestinationResponse +type DestinationResponse struct { + Config DestinationConfig `json:"config"` + // The point in time the resource was created. + CreationTime time.Time `json:"creationTime"` + // The credential type for the resource. + CredentialType string `json:"credentialType"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + // A auto generated unique id which identifies the resource. + Id string `json:"id"` + // The current status of the resource. + Status string `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _DestinationResponse DestinationResponse + +// NewDestinationResponse instantiates a new DestinationResponse 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 NewDestinationResponse(config DestinationConfig, creationTime time.Time, credentialType string, displayName string, id string, status string) *DestinationResponse { + this := DestinationResponse{} + this.Config = config + this.CreationTime = creationTime + this.CredentialType = credentialType + this.DisplayName = displayName + this.Id = id + this.Status = status + return &this +} + +// NewDestinationResponseWithDefaults instantiates a new DestinationResponse 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 NewDestinationResponseWithDefaults() *DestinationResponse { + this := DestinationResponse{} + return &this +} + +// GetConfig returns the Config field value +func (o *DestinationResponse) GetConfig() DestinationConfig { + if o == nil { + var ret DestinationConfig + 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 *DestinationResponse) GetConfigOk() (*DestinationConfig, bool) { + if o == nil { + return nil, false + } + return &o.Config, true +} + +// SetConfig sets field value +func (o *DestinationResponse) SetConfig(v DestinationConfig) { + o.Config = v +} + +// GetCreationTime returns the CreationTime field value +func (o *DestinationResponse) GetCreationTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreationTime +} + +// GetCreationTimeOk returns a tuple with the CreationTime field value +// and a boolean to check if the value has been set. +func (o *DestinationResponse) GetCreationTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreationTime, true +} + +// SetCreationTime sets field value +func (o *DestinationResponse) SetCreationTime(v time.Time) { + o.CreationTime = v +} + +// GetCredentialType returns the CredentialType field value +func (o *DestinationResponse) GetCredentialType() string { + if o == nil { + var ret string + return ret + } + + return o.CredentialType +} + +// GetCredentialTypeOk returns a tuple with the CredentialType field value +// and a boolean to check if the value has been set. +func (o *DestinationResponse) GetCredentialTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CredentialType, true +} + +// SetCredentialType sets field value +func (o *DestinationResponse) SetCredentialType(v string) { + o.CredentialType = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DestinationResponse) 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 *DestinationResponse) 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 *DestinationResponse) 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 *DestinationResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *DestinationResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *DestinationResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *DestinationResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value +func (o *DestinationResponse) 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 *DestinationResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DestinationResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *DestinationResponse) 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 *DestinationResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *DestinationResponse) SetStatus(v string) { + o.Status = v +} + +func (o DestinationResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DestinationResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["config"] = o.Config + toSerialize["creationTime"] = o.CreationTime + toSerialize["credentialType"] = o.CredentialType + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DestinationResponse) 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", + "creationTime", + "credentialType", + "displayName", + "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) + } + } + + varDestinationResponse := _DestinationResponse{} + + err = json.Unmarshal(data, &varDestinationResponse) + + if err != nil { + return err + } + + *o = DestinationResponse(varDestinationResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "config") + delete(additionalProperties, "creationTime") + delete(additionalProperties, "credentialType") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDestinationResponse struct { + value *DestinationResponse + isSet bool +} + +func (v NullableDestinationResponse) Get() *DestinationResponse { + return v.value +} + +func (v *NullableDestinationResponse) Set(val *DestinationResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationResponse(val *DestinationResponse) *NullableDestinationResponse { + return &NullableDestinationResponse{value: val, isSet: true} +} + +func (v NullableDestinationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_get_access_token_response.go b/services/telemetryrouter/v1betaapi/model_get_access_token_response.go new file mode 100644 index 000000000..f1fe8c30c --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_get_access_token_response.go @@ -0,0 +1,344 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the GetAccessTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetAccessTokenResponse{} + +// GetAccessTokenResponse struct for GetAccessTokenResponse +type GetAccessTokenResponse struct { + // The user ID of the creator of the access token. + CreatorId string `json:"creatorId"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The selected display name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 ]*$"` + // The date and time until the access token is valid to (inclusively). + ExpirationTime NullableTime `json:"expirationTime,omitempty"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + Status string `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _GetAccessTokenResponse GetAccessTokenResponse + +// NewGetAccessTokenResponse instantiates a new GetAccessTokenResponse 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 NewGetAccessTokenResponse(creatorId string, displayName string, id string, status string) *GetAccessTokenResponse { + this := GetAccessTokenResponse{} + this.CreatorId = creatorId + this.DisplayName = displayName + this.Id = id + this.Status = status + return &this +} + +// NewGetAccessTokenResponseWithDefaults instantiates a new GetAccessTokenResponse 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 NewGetAccessTokenResponseWithDefaults() *GetAccessTokenResponse { + this := GetAccessTokenResponse{} + return &this +} + +// GetCreatorId returns the CreatorId field value +func (o *GetAccessTokenResponse) GetCreatorId() string { + if o == nil { + var ret string + return ret + } + + return o.CreatorId +} + +// GetCreatorIdOk returns a tuple with the CreatorId field value +// and a boolean to check if the value has been set. +func (o *GetAccessTokenResponse) GetCreatorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatorId, true +} + +// SetCreatorId sets field value +func (o *GetAccessTokenResponse) SetCreatorId(v string) { + o.CreatorId = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetAccessTokenResponse) 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 *GetAccessTokenResponse) 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 *GetAccessTokenResponse) 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 *GetAccessTokenResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *GetAccessTokenResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *GetAccessTokenResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *GetAccessTokenResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpirationTime returns the ExpirationTime field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GetAccessTokenResponse) GetExpirationTime() time.Time { + if o == nil || IsNil(o.ExpirationTime.Get()) { + var ret time.Time + return ret + } + return *o.ExpirationTime.Get() +} + +// GetExpirationTimeOk returns a tuple with the ExpirationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetAccessTokenResponse) GetExpirationTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.ExpirationTime.Get(), o.ExpirationTime.IsSet() +} + +// HasExpirationTime returns a boolean if a field has been set. +func (o *GetAccessTokenResponse) HasExpirationTime() bool { + if o != nil && o.ExpirationTime.IsSet() { + return true + } + + return false +} + +// SetExpirationTime gets a reference to the given NullableTime and assigns it to the ExpirationTime field. +func (o *GetAccessTokenResponse) SetExpirationTime(v time.Time) { + o.ExpirationTime.Set(&v) +} + +// SetExpirationTimeNil sets the value for ExpirationTime to be an explicit nil +func (o *GetAccessTokenResponse) SetExpirationTimeNil() { + o.ExpirationTime.Set(nil) +} + +// UnsetExpirationTime ensures that no value is present for ExpirationTime, not even an explicit nil +func (o *GetAccessTokenResponse) UnsetExpirationTime() { + o.ExpirationTime.Unset() +} + +// GetId returns the Id field value +func (o *GetAccessTokenResponse) 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 *GetAccessTokenResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *GetAccessTokenResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *GetAccessTokenResponse) 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 *GetAccessTokenResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *GetAccessTokenResponse) SetStatus(v string) { + o.Status = v +} + +func (o GetAccessTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetAccessTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["creatorId"] = o.CreatorId + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if o.ExpirationTime.IsSet() { + toSerialize["expirationTime"] = o.ExpirationTime.Get() + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetAccessTokenResponse) 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{ + "creatorId", + "displayName", + "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) + } + } + + varGetAccessTokenResponse := _GetAccessTokenResponse{} + + err = json.Unmarshal(data, &varGetAccessTokenResponse) + + if err != nil { + return err + } + + *o = GetAccessTokenResponse(varGetAccessTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "creatorId") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "expirationTime") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetAccessTokenResponse struct { + value *GetAccessTokenResponse + isSet bool +} + +func (v NullableGetAccessTokenResponse) Get() *GetAccessTokenResponse { + return v.value +} + +func (v *NullableGetAccessTokenResponse) Set(val *GetAccessTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetAccessTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetAccessTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetAccessTokenResponse(val *GetAccessTokenResponse) *NullableGetAccessTokenResponse { + return &NullableGetAccessTokenResponse{value: val, isSet: true} +} + +func (v NullableGetAccessTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetAccessTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_list_access_tokens_response.go b/services/telemetryrouter/v1betaapi/model_list_access_tokens_response.go new file mode 100644 index 000000000..e7b9f7c56 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_list_access_tokens_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListAccessTokensResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListAccessTokensResponse{} + +// ListAccessTokensResponse struct for ListAccessTokensResponse +type ListAccessTokensResponse struct { + AccessTokens []GetAccessTokenResponse `json:"accessTokens"` + // A token to retrieve the next page of results. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListAccessTokensResponse ListAccessTokensResponse + +// NewListAccessTokensResponse instantiates a new ListAccessTokensResponse 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 NewListAccessTokensResponse(accessTokens []GetAccessTokenResponse) *ListAccessTokensResponse { + this := ListAccessTokensResponse{} + this.AccessTokens = accessTokens + return &this +} + +// NewListAccessTokensResponseWithDefaults instantiates a new ListAccessTokensResponse 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 NewListAccessTokensResponseWithDefaults() *ListAccessTokensResponse { + this := ListAccessTokensResponse{} + return &this +} + +// GetAccessTokens returns the AccessTokens field value +func (o *ListAccessTokensResponse) GetAccessTokens() []GetAccessTokenResponse { + if o == nil { + var ret []GetAccessTokenResponse + return ret + } + + return o.AccessTokens +} + +// GetAccessTokensOk returns a tuple with the AccessTokens field value +// and a boolean to check if the value has been set. +func (o *ListAccessTokensResponse) GetAccessTokensOk() ([]GetAccessTokenResponse, bool) { + if o == nil { + return nil, false + } + return o.AccessTokens, true +} + +// SetAccessTokens sets field value +func (o *ListAccessTokensResponse) SetAccessTokens(v []GetAccessTokenResponse) { + o.AccessTokens = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListAccessTokensResponse) 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 *ListAccessTokensResponse) 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 *ListAccessTokensResponse) 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 *ListAccessTokensResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListAccessTokensResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListAccessTokensResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accessTokens"] = o.AccessTokens + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListAccessTokensResponse) 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{ + "accessTokens", + } + + 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) + } + } + + varListAccessTokensResponse := _ListAccessTokensResponse{} + + err = json.Unmarshal(data, &varListAccessTokensResponse) + + if err != nil { + return err + } + + *o = ListAccessTokensResponse(varListAccessTokensResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "accessTokens") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListAccessTokensResponse struct { + value *ListAccessTokensResponse + isSet bool +} + +func (v NullableListAccessTokensResponse) Get() *ListAccessTokensResponse { + return v.value +} + +func (v *NullableListAccessTokensResponse) Set(val *ListAccessTokensResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListAccessTokensResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListAccessTokensResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListAccessTokensResponse(val *ListAccessTokensResponse) *NullableListAccessTokensResponse { + return &NullableListAccessTokensResponse{value: val, isSet: true} +} + +func (v NullableListAccessTokensResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListAccessTokensResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_list_destinations_response.go b/services/telemetryrouter/v1betaapi/model_list_destinations_response.go new file mode 100644 index 000000000..51a7a0329 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_list_destinations_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListDestinationsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDestinationsResponse{} + +// ListDestinationsResponse struct for ListDestinationsResponse +type ListDestinationsResponse struct { + Destinations []DestinationResponse `json:"destinations"` + // A token to retrieve the next page of results. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListDestinationsResponse ListDestinationsResponse + +// NewListDestinationsResponse instantiates a new ListDestinationsResponse 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 NewListDestinationsResponse(destinations []DestinationResponse) *ListDestinationsResponse { + this := ListDestinationsResponse{} + this.Destinations = destinations + return &this +} + +// NewListDestinationsResponseWithDefaults instantiates a new ListDestinationsResponse 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 NewListDestinationsResponseWithDefaults() *ListDestinationsResponse { + this := ListDestinationsResponse{} + return &this +} + +// GetDestinations returns the Destinations field value +func (o *ListDestinationsResponse) GetDestinations() []DestinationResponse { + if o == nil { + var ret []DestinationResponse + return ret + } + + return o.Destinations +} + +// GetDestinationsOk returns a tuple with the Destinations field value +// and a boolean to check if the value has been set. +func (o *ListDestinationsResponse) GetDestinationsOk() ([]DestinationResponse, bool) { + if o == nil { + return nil, false + } + return o.Destinations, true +} + +// SetDestinations sets field value +func (o *ListDestinationsResponse) SetDestinations(v []DestinationResponse) { + o.Destinations = v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListDestinationsResponse) 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 *ListDestinationsResponse) 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 *ListDestinationsResponse) 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 *ListDestinationsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o ListDestinationsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDestinationsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["destinations"] = o.Destinations + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListDestinationsResponse) 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{ + "destinations", + } + + 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) + } + } + + varListDestinationsResponse := _ListDestinationsResponse{} + + err = json.Unmarshal(data, &varListDestinationsResponse) + + if err != nil { + return err + } + + *o = ListDestinationsResponse(varListDestinationsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "destinations") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListDestinationsResponse struct { + value *ListDestinationsResponse + isSet bool +} + +func (v NullableListDestinationsResponse) Get() *ListDestinationsResponse { + return v.value +} + +func (v *NullableListDestinationsResponse) Set(val *ListDestinationsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDestinationsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDestinationsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDestinationsResponse(val *ListDestinationsResponse) *NullableListDestinationsResponse { + return &NullableListDestinationsResponse{value: val, isSet: true} +} + +func (v NullableListDestinationsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDestinationsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_list_telemetry_routers_response.go b/services/telemetryrouter/v1betaapi/model_list_telemetry_routers_response.go new file mode 100644 index 000000000..239b9ada6 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_list_telemetry_routers_response.go @@ -0,0 +1,204 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListTelemetryRoutersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListTelemetryRoutersResponse{} + +// ListTelemetryRoutersResponse struct for ListTelemetryRoutersResponse +type ListTelemetryRoutersResponse struct { + // A token to retrieve the next page of results. + NextPageToken *string `json:"nextPageToken,omitempty"` + TelemetryRouters []TelemetryRouterResponse `json:"telemetryRouters"` + AdditionalProperties map[string]interface{} +} + +type _ListTelemetryRoutersResponse ListTelemetryRoutersResponse + +// NewListTelemetryRoutersResponse instantiates a new ListTelemetryRoutersResponse 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 NewListTelemetryRoutersResponse(telemetryRouters []TelemetryRouterResponse) *ListTelemetryRoutersResponse { + this := ListTelemetryRoutersResponse{} + this.TelemetryRouters = telemetryRouters + return &this +} + +// NewListTelemetryRoutersResponseWithDefaults instantiates a new ListTelemetryRoutersResponse 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 NewListTelemetryRoutersResponseWithDefaults() *ListTelemetryRoutersResponse { + this := ListTelemetryRoutersResponse{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListTelemetryRoutersResponse) 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 *ListTelemetryRoutersResponse) 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 *ListTelemetryRoutersResponse) 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 *ListTelemetryRoutersResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +// GetTelemetryRouters returns the TelemetryRouters field value +func (o *ListTelemetryRoutersResponse) GetTelemetryRouters() []TelemetryRouterResponse { + if o == nil { + var ret []TelemetryRouterResponse + return ret + } + + return o.TelemetryRouters +} + +// GetTelemetryRoutersOk returns a tuple with the TelemetryRouters field value +// and a boolean to check if the value has been set. +func (o *ListTelemetryRoutersResponse) GetTelemetryRoutersOk() ([]TelemetryRouterResponse, bool) { + if o == nil { + return nil, false + } + return o.TelemetryRouters, true +} + +// SetTelemetryRouters sets field value +func (o *ListTelemetryRoutersResponse) SetTelemetryRouters(v []TelemetryRouterResponse) { + o.TelemetryRouters = v +} + +func (o ListTelemetryRoutersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListTelemetryRoutersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + toSerialize["telemetryRouters"] = o.TelemetryRouters + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListTelemetryRoutersResponse) 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{ + "telemetryRouters", + } + + 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) + } + } + + varListTelemetryRoutersResponse := _ListTelemetryRoutersResponse{} + + err = json.Unmarshal(data, &varListTelemetryRoutersResponse) + + if err != nil { + return err + } + + *o = ListTelemetryRoutersResponse(varListTelemetryRoutersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nextPageToken") + delete(additionalProperties, "telemetryRouters") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListTelemetryRoutersResponse struct { + value *ListTelemetryRoutersResponse + isSet bool +} + +func (v NullableListTelemetryRoutersResponse) Get() *ListTelemetryRoutersResponse { + return v.value +} + +func (v *NullableListTelemetryRoutersResponse) Set(val *ListTelemetryRoutersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListTelemetryRoutersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListTelemetryRoutersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListTelemetryRoutersResponse(val *ListTelemetryRoutersResponse) *NullableListTelemetryRoutersResponse { + return &NullableListTelemetryRoutersResponse{value: val, isSet: true} +} + +func (v NullableListTelemetryRoutersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListTelemetryRoutersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_response4xx.go b/services/telemetryrouter/v1betaapi/model_response4xx.go new file mode 100644 index 000000000..11bfec341 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_response4xx.go @@ -0,0 +1,167 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Response4xx type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Response4xx{} + +// Response4xx struct for Response4xx +type Response4xx struct { + // A message containing the reason for failure + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _Response4xx Response4xx + +// NewResponse4xx instantiates a new Response4xx 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 NewResponse4xx(message string) *Response4xx { + this := Response4xx{} + this.Message = message + return &this +} + +// NewResponse4xxWithDefaults instantiates a new Response4xx 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 NewResponse4xxWithDefaults() *Response4xx { + this := Response4xx{} + return &this +} + +// GetMessage returns the Message field value +func (o *Response4xx) 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 *Response4xx) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Response4xx) SetMessage(v string) { + o.Message = v +} + +func (o Response4xx) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Response4xx) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Response4xx) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "message", + } + + 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) + } + } + + varResponse4xx := _Response4xx{} + + err = json.Unmarshal(data, &varResponse4xx) + + if err != nil { + return err + } + + *o = Response4xx(varResponse4xx) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableResponse4xx struct { + value *Response4xx + isSet bool +} + +func (v NullableResponse4xx) Get() *Response4xx { + return v.value +} + +func (v *NullableResponse4xx) Set(val *Response4xx) { + v.value = val + v.isSet = true +} + +func (v NullableResponse4xx) IsSet() bool { + return v.isSet +} + +func (v *NullableResponse4xx) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResponse4xx(val *Response4xx) *NullableResponse4xx { + return &NullableResponse4xx{value: val, isSet: true} +} + +func (v NullableResponse4xx) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResponse4xx) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_telemetry_router_response.go b/services/telemetryrouter/v1betaapi/model_telemetry_router_response.go new file mode 100644 index 000000000..759f0023f --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_telemetry_router_response.go @@ -0,0 +1,363 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the TelemetryRouterResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TelemetryRouterResponse{} + +// TelemetryRouterResponse struct for TelemetryRouterResponse +type TelemetryRouterResponse struct { + // The point in time the resource was created. + CreationTime time.Time `json:"creationTime"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + Filter *ConfigFilter `json:"filter,omitempty"` + // A auto generated unique id which identifies the resource. + Id string `json:"id"` + // The current status of the resource. + Status string `json:"status"` + // The URI for reaching the resource. + Uri string `json:"uri"` + AdditionalProperties map[string]interface{} +} + +type _TelemetryRouterResponse TelemetryRouterResponse + +// NewTelemetryRouterResponse instantiates a new TelemetryRouterResponse 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 NewTelemetryRouterResponse(creationTime time.Time, displayName string, id string, status string, uri string) *TelemetryRouterResponse { + this := TelemetryRouterResponse{} + this.CreationTime = creationTime + this.DisplayName = displayName + this.Id = id + this.Status = status + this.Uri = uri + return &this +} + +// NewTelemetryRouterResponseWithDefaults instantiates a new TelemetryRouterResponse 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 NewTelemetryRouterResponseWithDefaults() *TelemetryRouterResponse { + this := TelemetryRouterResponse{} + return &this +} + +// GetCreationTime returns the CreationTime field value +func (o *TelemetryRouterResponse) GetCreationTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreationTime +} + +// GetCreationTimeOk returns a tuple with the CreationTime field value +// and a boolean to check if the value has been set. +func (o *TelemetryRouterResponse) GetCreationTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreationTime, true +} + +// SetCreationTime sets field value +func (o *TelemetryRouterResponse) SetCreationTime(v time.Time) { + o.CreationTime = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *TelemetryRouterResponse) 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 *TelemetryRouterResponse) 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 *TelemetryRouterResponse) 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 *TelemetryRouterResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *TelemetryRouterResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *TelemetryRouterResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *TelemetryRouterResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *TelemetryRouterResponse) GetFilter() ConfigFilter { + if o == nil || IsNil(o.Filter) { + var ret ConfigFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TelemetryRouterResponse) GetFilterOk() (*ConfigFilter, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *TelemetryRouterResponse) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given ConfigFilter and assigns it to the Filter field. +func (o *TelemetryRouterResponse) SetFilter(v ConfigFilter) { + o.Filter = &v +} + +// GetId returns the Id field value +func (o *TelemetryRouterResponse) 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 *TelemetryRouterResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *TelemetryRouterResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *TelemetryRouterResponse) 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 *TelemetryRouterResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *TelemetryRouterResponse) SetStatus(v string) { + o.Status = v +} + +// GetUri returns the Uri field value +func (o *TelemetryRouterResponse) GetUri() string { + if o == nil { + var ret string + return ret + } + + return o.Uri +} + +// GetUriOk returns a tuple with the Uri field value +// and a boolean to check if the value has been set. +func (o *TelemetryRouterResponse) GetUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uri, true +} + +// SetUri sets field value +func (o *TelemetryRouterResponse) SetUri(v string) { + o.Uri = v +} + +func (o TelemetryRouterResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TelemetryRouterResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["creationTime"] = o.CreationTime + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + toSerialize["uri"] = o.Uri + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TelemetryRouterResponse) 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{ + "creationTime", + "displayName", + "id", + "status", + "uri", + } + + 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) + } + } + + varTelemetryRouterResponse := _TelemetryRouterResponse{} + + err = json.Unmarshal(data, &varTelemetryRouterResponse) + + if err != nil { + return err + } + + *o = TelemetryRouterResponse(varTelemetryRouterResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "creationTime") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "filter") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + delete(additionalProperties, "uri") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTelemetryRouterResponse struct { + value *TelemetryRouterResponse + isSet bool +} + +func (v NullableTelemetryRouterResponse) Get() *TelemetryRouterResponse { + return v.value +} + +func (v *NullableTelemetryRouterResponse) Set(val *TelemetryRouterResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTelemetryRouterResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTelemetryRouterResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTelemetryRouterResponse(val *TelemetryRouterResponse) *NullableTelemetryRouterResponse { + return &NullableTelemetryRouterResponse{value: val, isSet: true} +} + +func (v NullableTelemetryRouterResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTelemetryRouterResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_update_access_token_payload.go b/services/telemetryrouter/v1betaapi/model_update_access_token_payload.go new file mode 100644 index 000000000..79f6c59de --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_update_access_token_payload.go @@ -0,0 +1,212 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenPayload{} + +// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +type UpdateAccessTokenPayload struct { + Description NullableString `json:"description,omitempty"` + DisplayName NullableString `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + AdditionalProperties map[string]interface{} +} + +type _UpdateAccessTokenPayload UpdateAccessTokenPayload + +// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description.Get()) { + var ret string + return ret + } + return *o.Description.Get() +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description.Get(), o.Description.IsSet() +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDescription() bool { + if o != nil && o.Description.IsSet() { + return true + } + + return false +} + +// SetDescription gets a reference to the given NullableString and assigns it to the Description field. +func (o *UpdateAccessTokenPayload) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil +func (o *UpdateAccessTokenPayload) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil +func (o *UpdateAccessTokenPayload) UnsetDescription() { + o.Description.Unset() +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateAccessTokenPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName.Get()) { + var ret string + return ret + } + return *o.DisplayName.Get() +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DisplayName.Get(), o.DisplayName.IsSet() +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDisplayName() bool { + if o != nil && o.DisplayName.IsSet() { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given NullableString and assigns it to the DisplayName field. +func (o *UpdateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName.Set(&v) +} + +// SetDisplayNameNil sets the value for DisplayName to be an explicit nil +func (o *UpdateAccessTokenPayload) SetDisplayNameNil() { + o.DisplayName.Set(nil) +} + +// UnsetDisplayName ensures that no value is present for DisplayName, not even an explicit nil +func (o *UpdateAccessTokenPayload) UnsetDisplayName() { + o.DisplayName.Unset() +} + +func (o UpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.DisplayName.IsSet() { + toSerialize["displayName"] = o.DisplayName.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateAccessTokenPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateAccessTokenPayload := _UpdateAccessTokenPayload{} + + err = json.Unmarshal(data, &varUpdateAccessTokenPayload) + + if err != nil { + return err + } + + *o = UpdateAccessTokenPayload(varUpdateAccessTokenPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateAccessTokenPayload struct { + value *UpdateAccessTokenPayload + isSet bool +} + +func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { + return v.value +} + +func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { + return &NullableUpdateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_update_access_token_response.go b/services/telemetryrouter/v1betaapi/model_update_access_token_response.go new file mode 100644 index 000000000..a0ab9c366 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_update_access_token_response.go @@ -0,0 +1,344 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the UpdateAccessTokenResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenResponse{} + +// UpdateAccessTokenResponse struct for UpdateAccessTokenResponse +type UpdateAccessTokenResponse struct { + // The user ID of the creator of the access token. + CreatorId string `json:"creatorId"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The selected display name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 ]*$"` + // The date and time until the access token is valid to (inclusively). + ExpirationTime NullableTime `json:"expirationTime,omitempty"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + Status string `json:"status"` + AdditionalProperties map[string]interface{} +} + +type _UpdateAccessTokenResponse UpdateAccessTokenResponse + +// NewUpdateAccessTokenResponse instantiates a new UpdateAccessTokenResponse 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 NewUpdateAccessTokenResponse(creatorId string, displayName string, id string, status string) *UpdateAccessTokenResponse { + this := UpdateAccessTokenResponse{} + this.CreatorId = creatorId + this.DisplayName = displayName + this.Id = id + this.Status = status + return &this +} + +// NewUpdateAccessTokenResponseWithDefaults instantiates a new UpdateAccessTokenResponse 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 NewUpdateAccessTokenResponseWithDefaults() *UpdateAccessTokenResponse { + this := UpdateAccessTokenResponse{} + return &this +} + +// GetCreatorId returns the CreatorId field value +func (o *UpdateAccessTokenResponse) GetCreatorId() string { + if o == nil { + var ret string + return ret + } + + return o.CreatorId +} + +// GetCreatorIdOk returns a tuple with the CreatorId field value +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenResponse) GetCreatorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatorId, true +} + +// SetCreatorId sets field value +func (o *UpdateAccessTokenResponse) SetCreatorId(v string) { + o.CreatorId = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAccessTokenResponse) 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 *UpdateAccessTokenResponse) 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 *UpdateAccessTokenResponse) 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 *UpdateAccessTokenResponse) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *UpdateAccessTokenResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *UpdateAccessTokenResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpirationTime returns the ExpirationTime field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateAccessTokenResponse) GetExpirationTime() time.Time { + if o == nil || IsNil(o.ExpirationTime.Get()) { + var ret time.Time + return ret + } + return *o.ExpirationTime.Get() +} + +// GetExpirationTimeOk returns a tuple with the ExpirationTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateAccessTokenResponse) GetExpirationTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.ExpirationTime.Get(), o.ExpirationTime.IsSet() +} + +// HasExpirationTime returns a boolean if a field has been set. +func (o *UpdateAccessTokenResponse) HasExpirationTime() bool { + if o != nil && o.ExpirationTime.IsSet() { + return true + } + + return false +} + +// SetExpirationTime gets a reference to the given NullableTime and assigns it to the ExpirationTime field. +func (o *UpdateAccessTokenResponse) SetExpirationTime(v time.Time) { + o.ExpirationTime.Set(&v) +} + +// SetExpirationTimeNil sets the value for ExpirationTime to be an explicit nil +func (o *UpdateAccessTokenResponse) SetExpirationTimeNil() { + o.ExpirationTime.Set(nil) +} + +// UnsetExpirationTime ensures that no value is present for ExpirationTime, not even an explicit nil +func (o *UpdateAccessTokenResponse) UnsetExpirationTime() { + o.ExpirationTime.Unset() +} + +// GetId returns the Id field value +func (o *UpdateAccessTokenResponse) 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 *UpdateAccessTokenResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *UpdateAccessTokenResponse) SetId(v string) { + o.Id = v +} + +// GetStatus returns the Status field value +func (o *UpdateAccessTokenResponse) 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 *UpdateAccessTokenResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *UpdateAccessTokenResponse) SetStatus(v string) { + o.Status = v +} + +func (o UpdateAccessTokenResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateAccessTokenResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["creatorId"] = o.CreatorId + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if o.ExpirationTime.IsSet() { + toSerialize["expirationTime"] = o.ExpirationTime.Get() + } + toSerialize["id"] = o.Id + toSerialize["status"] = o.Status + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateAccessTokenResponse) 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{ + "creatorId", + "displayName", + "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) + } + } + + varUpdateAccessTokenResponse := _UpdateAccessTokenResponse{} + + err = json.Unmarshal(data, &varUpdateAccessTokenResponse) + + if err != nil { + return err + } + + *o = UpdateAccessTokenResponse(varUpdateAccessTokenResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "creatorId") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "expirationTime") + delete(additionalProperties, "id") + delete(additionalProperties, "status") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateAccessTokenResponse struct { + value *UpdateAccessTokenResponse + isSet bool +} + +func (v NullableUpdateAccessTokenResponse) Get() *UpdateAccessTokenResponse { + return v.value +} + +func (v *NullableUpdateAccessTokenResponse) Set(val *UpdateAccessTokenResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenResponse(val *UpdateAccessTokenResponse) *NullableUpdateAccessTokenResponse { + return &NullableUpdateAccessTokenResponse{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_update_destination_payload.go b/services/telemetryrouter/v1betaapi/model_update_destination_payload.go new file mode 100644 index 000000000..6a4eafed9 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_update_destination_payload.go @@ -0,0 +1,229 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the UpdateDestinationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDestinationPayload{} + +// UpdateDestinationPayload struct for UpdateDestinationPayload +type UpdateDestinationPayload struct { + Config *DestinationConfig `json:"config,omitempty"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDestinationPayload UpdateDestinationPayload + +// NewUpdateDestinationPayload instantiates a new UpdateDestinationPayload 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 NewUpdateDestinationPayload() *UpdateDestinationPayload { + this := UpdateDestinationPayload{} + return &this +} + +// NewUpdateDestinationPayloadWithDefaults instantiates a new UpdateDestinationPayload 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 NewUpdateDestinationPayloadWithDefaults() *UpdateDestinationPayload { + this := UpdateDestinationPayload{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *UpdateDestinationPayload) GetConfig() DestinationConfig { + if o == nil || IsNil(o.Config) { + var ret DestinationConfig + return ret + } + return *o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDestinationPayload) GetConfigOk() (*DestinationConfig, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *UpdateDestinationPayload) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given DestinationConfig and assigns it to the Config field. +func (o *UpdateDestinationPayload) SetConfig(v DestinationConfig) { + o.Config = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateDestinationPayload) 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 *UpdateDestinationPayload) 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 *UpdateDestinationPayload) 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 *UpdateDestinationPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateDestinationPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDestinationPayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateDestinationPayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateDestinationPayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +func (o UpdateDestinationPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDestinationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDestinationPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateDestinationPayload := _UpdateDestinationPayload{} + + err = json.Unmarshal(data, &varUpdateDestinationPayload) + + if err != nil { + return err + } + + *o = UpdateDestinationPayload(varUpdateDestinationPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "config") + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDestinationPayload struct { + value *UpdateDestinationPayload + isSet bool +} + +func (v NullableUpdateDestinationPayload) Get() *UpdateDestinationPayload { + return v.value +} + +func (v *NullableUpdateDestinationPayload) Set(val *UpdateDestinationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDestinationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDestinationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDestinationPayload(val *UpdateDestinationPayload) *NullableUpdateDestinationPayload { + return &NullableUpdateDestinationPayload{value: val, isSet: true} +} + +func (v NullableUpdateDestinationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDestinationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/model_update_telemetry_router_payload.go b/services/telemetryrouter/v1betaapi/model_update_telemetry_router_payload.go new file mode 100644 index 000000000..5d6021386 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/model_update_telemetry_router_payload.go @@ -0,0 +1,229 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the UpdateTelemetryRouterPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateTelemetryRouterPayload{} + +// UpdateTelemetryRouterPayload struct for UpdateTelemetryRouterPayload +type UpdateTelemetryRouterPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description *string `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z0-9][a-zA-Z0-9 \\\\-]*$"` + Filter *ConfigFilter `json:"filter,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateTelemetryRouterPayload UpdateTelemetryRouterPayload + +// NewUpdateTelemetryRouterPayload instantiates a new UpdateTelemetryRouterPayload 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 NewUpdateTelemetryRouterPayload() *UpdateTelemetryRouterPayload { + this := UpdateTelemetryRouterPayload{} + return &this +} + +// NewUpdateTelemetryRouterPayloadWithDefaults instantiates a new UpdateTelemetryRouterPayload 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 NewUpdateTelemetryRouterPayloadWithDefaults() *UpdateTelemetryRouterPayload { + this := UpdateTelemetryRouterPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateTelemetryRouterPayload) 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 *UpdateTelemetryRouterPayload) 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 *UpdateTelemetryRouterPayload) 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 *UpdateTelemetryRouterPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateTelemetryRouterPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTelemetryRouterPayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateTelemetryRouterPayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateTelemetryRouterPayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *UpdateTelemetryRouterPayload) GetFilter() ConfigFilter { + if o == nil || IsNil(o.Filter) { + var ret ConfigFilter + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTelemetryRouterPayload) GetFilterOk() (*ConfigFilter, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *UpdateTelemetryRouterPayload) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given ConfigFilter and assigns it to the Filter field. +func (o *UpdateTelemetryRouterPayload) SetFilter(v ConfigFilter) { + o.Filter = &v +} + +func (o UpdateTelemetryRouterPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateTelemetryRouterPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateTelemetryRouterPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateTelemetryRouterPayload := _UpdateTelemetryRouterPayload{} + + err = json.Unmarshal(data, &varUpdateTelemetryRouterPayload) + + if err != nil { + return err + } + + *o = UpdateTelemetryRouterPayload(varUpdateTelemetryRouterPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "displayName") + delete(additionalProperties, "filter") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateTelemetryRouterPayload struct { + value *UpdateTelemetryRouterPayload + isSet bool +} + +func (v NullableUpdateTelemetryRouterPayload) Get() *UpdateTelemetryRouterPayload { + return v.value +} + +func (v *NullableUpdateTelemetryRouterPayload) Set(val *UpdateTelemetryRouterPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateTelemetryRouterPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateTelemetryRouterPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateTelemetryRouterPayload(val *UpdateTelemetryRouterPayload) *NullableUpdateTelemetryRouterPayload { + return &NullableUpdateTelemetryRouterPayload{value: val, isSet: true} +} + +func (v NullableUpdateTelemetryRouterPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateTelemetryRouterPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/telemetryrouter/v1betaapi/response.go b/services/telemetryrouter/v1betaapi/response.go new file mode 100644 index 000000000..7d45c0b52 --- /dev/null +++ b/services/telemetryrouter/v1betaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// 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/telemetryrouter/v1betaapi/utils.go b/services/telemetryrouter/v1betaapi/utils.go new file mode 100644 index 000000000..5c997627d --- /dev/null +++ b/services/telemetryrouter/v1betaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +API version: 1beta.0.0 +*/ + +// 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...) +}