diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5fb15a6..e58a7f4 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: b81e5def-5b1e-4753-ae7c-0efccc2e6f61 management: - docChecksum: bf793ad8dca95f0e711ff6b2850c7b9d + docChecksum: 775faead244b67eac8090b0b6a8af0fd docVersion: 0.0.1 speakeasyVersion: 1.470.1 generationVersion: 2.493.34 - releaseVersion: 0.1.27 - configChecksum: 9d97302606b945989145a2e4a72376dd + releaseVersion: 0.1.28 + configChecksum: f6aa55aadea433268e0c46840d52ef21 features: go: additionalDependencies: 0.1.0 @@ -44,6 +44,8 @@ generatedFiles: - /models/components/cacertificateinput.go - /models/components/certificate.go - /models/components/certificateinput.go + - /models/components/configstore.go + - /models/components/configstoresecret.go - /models/components/consumer.go - /models/components/consumergroup.go - /models/components/consumergroupinput.go @@ -51,14 +53,17 @@ generatedFiles: - /models/components/consumerinput.go - /models/components/controlplane.go - /models/components/controlplanefilterparameters.go + - /models/components/createconfigstore.go + - /models/components/createconfigstoresecret.go - /models/components/createcontrolplanerequest.go - /models/components/createpluginschemas.go - /models/components/createsystemaccount.go - /models/components/createsystemaccountaccesstoken.go - /models/components/createteam.go + - /models/components/cursormeta.go + - /models/components/cursormetapage.go - /models/components/cursormetawithsizeandtotal.go - /models/components/cursorpaginatedmetawithsizeandtotal.go - - /models/components/customplugin.go - /models/components/dataplaneclientcertificate.go - /models/components/dataplaneclientcertificaterequest.go - /models/components/entityregion.go @@ -90,6 +95,8 @@ generatedFiles: - /models/components/keyset.go - /models/components/keysetinput.go - /models/components/keywithoutparents.go + - /models/components/listconfigstoresecretsresponse.go + - /models/components/listconfigstoresresponse.go - /models/components/listcontrolplanesresponse.go - /models/components/listdataplanecertificatesresponse.go - /models/components/listgroupmemberships.go @@ -133,6 +140,8 @@ generatedFiles: - /models/components/teammappingcollection.go - /models/components/teammappingresponse.go - /models/components/updateauthenticationsettings.go + - /models/components/updateconfigstore.go + - /models/components/updateconfigstoresecret.go - /models/components/updatecontrolplanerequest.go - /models/components/updateidpconfiguration.go - /models/components/updateimpersonationsettingsrequest.go @@ -155,6 +164,8 @@ generatedFiles: - /models/operations/createbasicauthwithconsumer.go - /models/operations/createcacertificate.go - /models/operations/createcertificate.go + - /models/operations/createconfigstore.go + - /models/operations/createconfigstoresecret.go - /models/operations/createconsumer.go - /models/operations/createconsumergroup.go - /models/operations/createcontrolplane.go @@ -185,10 +196,11 @@ generatedFiles: - /models/operations/deletebasicauthwithconsumer.go - /models/operations/deletecacertificate.go - /models/operations/deletecertificate.go + - /models/operations/deleteconfigstore.go + - /models/operations/deleteconfigstoresecret.go - /models/operations/deleteconsumer.go - /models/operations/deleteconsumergroup.go - /models/operations/deletecontrolplane.go - - /models/operations/deletecustomplugin.go - /models/operations/deletedataplanecertificate.go - /models/operations/deletehmacauthwithconsumer.go - /models/operations/deletejwtwithconsumer.go @@ -226,6 +238,8 @@ generatedFiles: - /models/operations/getbasicauthwithconsumer.go - /models/operations/getcacertificate.go - /models/operations/getcertificate.go + - /models/operations/getconfigstore.go + - /models/operations/getconfigstoresecret.go - /models/operations/getconsumer.go - /models/operations/getconsumergroup.go - /models/operations/getcontrolplane.go @@ -284,12 +298,13 @@ generatedFiles: - /models/operations/listbasicauthwithconsumer.go - /models/operations/listcacertificate.go - /models/operations/listcertificate.go + - /models/operations/listconfigstores.go + - /models/operations/listconfigstoresecrets.go - /models/operations/listconsumer.go - /models/operations/listconsumergroup.go - /models/operations/listconsumergroupsforconsumer.go - /models/operations/listconsumersforconsumergroup.go - /models/operations/listcontrolplanes.go - - /models/operations/listcustomplugin.go - /models/operations/listdataplanenodes.go - /models/operations/listdpclientcertificates.go - /models/operations/listhmacauth.go @@ -341,6 +356,8 @@ generatedFiles: - /models/operations/teamsassignrole.go - /models/operations/teamsremoverole.go - /models/operations/updateauthenticationsettings.go + - /models/operations/updateconfigstore.go + - /models/operations/updateconfigstoresecret.go - /models/operations/updatecontrolplane.go - /models/operations/updateidpconfiguration.go - /models/operations/updateidpteammappings.go @@ -386,6 +403,7 @@ generatedFiles: - /models/sdkerrors/ratelimited.go - /models/sdkerrors/serviceunavailable.go - /models/sdkerrors/unauthorizederror.go + - /models/sdkerrors/unsupportedmediatypeerror.go - USAGE.md - acls.go - apikeys.go @@ -394,11 +412,12 @@ generatedFiles: - basicauthcredentials.go - cacertificates.go - certificates.go + - configstores.go + - configstoresecrets.go - consumergroups.go - consumers.go - controlplanegroups.go - controlplanes.go - - customplugins.go - custompluginschemas.go - docs/models/components/acl.md - docs/models/components/aclconsumer.md @@ -433,6 +452,8 @@ generatedFiles: - docs/models/components/clustertype.md - docs/models/components/compatibilitystatus.md - docs/models/components/config.md + - docs/models/components/configstore.md + - docs/models/components/configstoresecret.md - docs/models/components/consumer.md - docs/models/components/consumeradmin.md - docs/models/components/consumergroup.md @@ -444,6 +465,8 @@ generatedFiles: - docs/models/components/controlplaneclustertype.md - docs/models/components/controlplanefilterparameters.md - docs/models/components/controlplanes.md + - docs/models/components/createconfigstore.md + - docs/models/components/createconfigstoresecret.md - docs/models/components/createcontrolplanerequest.md - docs/models/components/createcontrolplanerequestclustertype.md - docs/models/components/createpluginschemas.md @@ -451,9 +474,10 @@ generatedFiles: - docs/models/components/createsystemaccountaccesstoken.md - docs/models/components/createteam.md - docs/models/components/creator.md + - docs/models/components/cursormeta.md + - docs/models/components/cursormetapage.md - docs/models/components/cursormetawithsizeandtotal.md - docs/models/components/cursorpaginatedmetawithsizeandtotal.md - - docs/models/components/customplugin.md - docs/models/components/data.md - docs/models/components/dataplaneclientcertificate.md - docs/models/components/dataplaneclientcertificateitem.md @@ -516,6 +540,8 @@ generatedFiles: - docs/models/components/keywithoutparents.md - docs/models/components/keywithoutparentspem.md - docs/models/components/keywithoutparentsset.md + - docs/models/components/listconfigstoresecretsresponse.md + - docs/models/components/listconfigstoresresponse.md - docs/models/components/listcontrolplanesresponse.md - docs/models/components/listdataplanecertificatesresponse.md - docs/models/components/listdataplanecertificatesresponsepage.md @@ -692,6 +718,8 @@ generatedFiles: - docs/models/components/type.md - docs/models/components/unhealthy.md - docs/models/components/updateauthenticationsettings.md + - docs/models/components/updateconfigstore.md + - docs/models/components/updateconfigstoresecret.md - docs/models/components/updatecontrolplanerequest.md - docs/models/components/updatecontrolplanerequestauthtype.md - docs/models/components/updateidpconfiguration.md @@ -736,6 +764,10 @@ generatedFiles: - docs/models/operations/createcacertificateresponse.md - docs/models/operations/createcertificaterequest.md - docs/models/operations/createcertificateresponse.md + - docs/models/operations/createconfigstorerequest.md + - docs/models/operations/createconfigstoreresponse.md + - docs/models/operations/createconfigstoresecretrequest.md + - docs/models/operations/createconfigstoresecretresponse.md - docs/models/operations/createconsumergrouprequest.md - docs/models/operations/createconsumergroupresponse.md - docs/models/operations/createconsumerrequest.md @@ -794,14 +826,16 @@ generatedFiles: - docs/models/operations/deletecacertificateresponse.md - docs/models/operations/deletecertificaterequest.md - docs/models/operations/deletecertificateresponse.md + - docs/models/operations/deleteconfigstorerequest.md + - docs/models/operations/deleteconfigstoreresponse.md + - docs/models/operations/deleteconfigstoresecretrequest.md + - docs/models/operations/deleteconfigstoresecretresponse.md - docs/models/operations/deleteconsumergrouprequest.md - docs/models/operations/deleteconsumergroupresponse.md - docs/models/operations/deleteconsumerrequest.md - docs/models/operations/deleteconsumerresponse.md - docs/models/operations/deletecontrolplanerequest.md - docs/models/operations/deletecontrolplaneresponse.md - - docs/models/operations/deletecustompluginrequest.md - - docs/models/operations/deletecustompluginresponse.md - docs/models/operations/deletedataplanecertificaterequest.md - docs/models/operations/deletedataplanecertificateresponse.md - docs/models/operations/deletehmacauthwithconsumerrequest.md @@ -864,6 +898,7 @@ generatedFiles: - docs/models/operations/fetchpluginschemaresponse.md - docs/models/operations/fetchpluginschemaresponsebody.md - docs/models/operations/filter.md + - docs/models/operations/force.md - docs/models/operations/getaclrequest.md - docs/models/operations/getaclresponse.md - docs/models/operations/getaclwithconsumerrequest.md @@ -877,6 +912,10 @@ generatedFiles: - docs/models/operations/getcacertificateresponse.md - docs/models/operations/getcertificaterequest.md - docs/models/operations/getcertificateresponse.md + - docs/models/operations/getconfigstorerequest.md + - docs/models/operations/getconfigstoreresponse.md + - docs/models/operations/getconfigstoresecretrequest.md + - docs/models/operations/getconfigstoresecretresponse.md - docs/models/operations/getconsumergrouprequest.md - docs/models/operations/getconsumergroupresponse.md - docs/models/operations/getconsumerrequest.md @@ -996,6 +1035,10 @@ generatedFiles: - docs/models/operations/listcertificaterequest.md - docs/models/operations/listcertificateresponse.md - docs/models/operations/listcertificateresponsebody.md + - docs/models/operations/listconfigstoresecretsrequest.md + - docs/models/operations/listconfigstoresecretsresponse.md + - docs/models/operations/listconfigstoresrequest.md + - docs/models/operations/listconfigstoresresponse.md - docs/models/operations/listconsumergrouprequest.md - docs/models/operations/listconsumergroupresponse.md - docs/models/operations/listconsumergroupresponsebody.md @@ -1010,9 +1053,6 @@ generatedFiles: - docs/models/operations/listconsumersforconsumergroupresponsebody.md - docs/models/operations/listcontrolplanesrequest.md - docs/models/operations/listcontrolplanesresponse.md - - docs/models/operations/listcustompluginrequest.md - - docs/models/operations/listcustompluginresponse.md - - docs/models/operations/listcustompluginresponsebody.md - docs/models/operations/listdataplanenodesrequest.md - docs/models/operations/listdataplanenodesresponse.md - docs/models/operations/listdpclientcertificatesrequest.md @@ -1144,6 +1184,10 @@ generatedFiles: - docs/models/operations/teamsremoverolerequest.md - docs/models/operations/teamsremoveroleresponse.md - docs/models/operations/updateauthenticationsettingsresponse.md + - docs/models/operations/updateconfigstorerequest.md + - docs/models/operations/updateconfigstoreresponse.md + - docs/models/operations/updateconfigstoresecretrequest.md + - docs/models/operations/updateconfigstoresecretresponse.md - docs/models/operations/updatecontrolplanerequest.md - docs/models/operations/updatecontrolplaneresponse.md - docs/models/operations/updateidpconfigurationresponse.md @@ -1223,6 +1267,7 @@ generatedFiles: - docs/models/sdkerrors/serviceunavailable.md - docs/models/sdkerrors/status.md - docs/models/sdkerrors/unauthorizederror.md + - docs/models/sdkerrors/unsupportedmediatypeerror.md - docs/sdks/acls/README.md - docs/sdks/apikeys/README.md - docs/sdks/authentication/README.md @@ -1230,11 +1275,12 @@ generatedFiles: - docs/sdks/basicauthcredentials/README.md - docs/sdks/cacertificates/README.md - docs/sdks/certificates/README.md + - docs/sdks/configstores/README.md + - docs/sdks/configstoresecrets/README.md - docs/sdks/consumergroups/README.md - docs/sdks/consumers/README.md - docs/sdks/controlplanegroups/README.md - docs/sdks/controlplanes/README.md - - docs/sdks/customplugins/README.md - docs/sdks/custompluginschemas/README.md - docs/sdks/dpcertificates/README.md - docs/sdks/dpnodes/README.md @@ -3987,5 +4033,182 @@ examples: responses: "401": application/json: {"message": "", "status": 523768} + list-config-stores: + speakeasy-default-list-config-stores: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + page[size]: 10 + page[after]: "ewogICJpZCI6ICJoZWxsbyB3b3JsZCIKfQ" + responses: + "200": + application/json: {"meta": {"page": {"next": "/etc/periodic", "previous": "/etc/ppp", "size": 10}}, "data": [{"id": "b9e81174-b5bb-4638-a3c3-8afe61a0abf8", "name": "My Name", "created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"}, {"id": "b9e81174-b5bb-4638-a3c3-8afe61a0abf8", "name": "My Name", "created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"}, {"id": "b9e81174-b5bb-4638-a3c3-8afe61a0abf8", "name": "My Name", "created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"}]} + "400": + application/problem+json: {"status": 432502, "title": "", "instance": "", "detail": "", "invalid_parameters": []} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + create-config-store: + speakeasy-default-create-config-store: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"name": "Config Store"} + responses: + "201": + application/json: {"id": "b9e81174-b5bb-4638-a3c3-8afe61a0abf8", "name": "My Name", "created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"} + "400": + application/problem+json: {"status": 264934, "title": "", "instance": "", "detail": "", "invalid_parameters": [{"field": "name", "rule": "enum", "reason": "is a required field", "choices": [""], "source": "body"}, {"field": "name", "rule": "enum", "reason": "is a required field", "choices": ["", ""], "source": "body"}]} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "415": + application/problem+json: {"status": 415, "title": "UnsupportedMediaType", "type": "https://httpstatuses.com/415", "instance": "kong:trace:1234567890", "detail": "UnsupportedMediaType"} + get-config-store: + speakeasy-default-get-config-store: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + responses: + "200": + application/json: {"id": "b9e81174-b5bb-4638-a3c3-8afe61a0abf8", "name": "My Name", "created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + update-config-store: + speakeasy-default-update-config-store: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + requestBody: + application/json: {"name": "Config Store"} + responses: + "200": + application/json: {"id": "b9e81174-b5bb-4638-a3c3-8afe61a0abf8", "name": "My Name", "created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"} + "400": + application/problem+json: {"status": 188203, "title": "", "instance": "", "detail": "", "invalid_parameters": []} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "404": + application/problem+json: {"status": 404, "title": "Not Found", "type": "https://httpstatuses.com/404", "instance": "kong:trace:1234567890", "detail": "Not found"} + "415": + application/problem+json: {"status": 415, "title": "UnsupportedMediaType", "type": "https://httpstatuses.com/415", "instance": "kong:trace:1234567890", "detail": "UnsupportedMediaType"} + delete-config-store: + speakeasy-default-delete-config-store: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + query: + force: "false" + responses: + "400": + application/problem+json: {"status": 632538, "title": "", "instance": "", "detail": "", "invalid_parameters": []} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + create-config-store-secret: + speakeasy-default-create-config-store-secret: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + requestBody: + application/json: {"key": "", "value": ""} + responses: + "201": + application/json: {"created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"} + "400": + application/problem+json: {"status": 940090, "title": "", "instance": "", "detail": "", "invalid_parameters": [{"field": "name", "rule": "max_length", "maximum": 8, "source": "body", "reason": "must not have more than 8 characters"}]} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "404": + application/problem+json: {"status": 404, "title": "Not Found", "type": "https://httpstatuses.com/404", "instance": "kong:trace:1234567890", "detail": "Not found"} + "415": + application/problem+json: {"status": 415, "title": "UnsupportedMediaType", "type": "https://httpstatuses.com/415", "instance": "kong:trace:1234567890", "detail": "UnsupportedMediaType"} + list-config-store-secrets: + speakeasy-default-list-config-store-secrets: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + query: + page[size]: 10 + page[after]: "ewogICJpZCI6ICJoZWxsbyB3b3JsZCIKfQ" + responses: + "200": + application/json: {"meta": {"page": {"next": "/usr/include", "previous": "/opt", "size": 10}}, "data": [{"created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"}, {"created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"}]} + "400": + application/problem+json: {"status": 854272, "title": "", "instance": "", "detail": "", "invalid_parameters": []} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "404": + application/problem+json: {"status": 404, "title": "Not Found", "type": "https://httpstatuses.com/404", "instance": "kong:trace:1234567890", "detail": "Not found"} + get-config-store-secret: + speakeasy-default-get-config-store-secret: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + key: "ConfigStoreSecretKey" + responses: + "200": + application/json: {"created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "404": + application/problem+json: {"status": 404, "title": "Not Found", "type": "https://httpstatuses.com/404", "instance": "kong:trace:1234567890", "detail": "Not found"} + update-config-store-secret: + speakeasy-default-update-config-store-secret: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + key: "ConfigStoreSecretKey" + requestBody: + application/json: {"value": ""} + responses: + "200": + application/json: {"created_at": "2022-11-04T20:10:06.927Z", "updated_at": "2022-11-04T20:10:06.927Z"} + "400": + application/problem+json: {"status": 282423, "title": "", "instance": "", "detail": "", "invalid_parameters": [{"field": "name", "rule": "enum", "reason": "is a required field", "choices": [""], "source": "body"}, {"field": "name", "rule": "max_length", "maximum": 8, "source": "body", "reason": "must not have more than 8 characters"}, {"field": "name", "source": "body", "reason": "is a required field"}]} + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "404": + application/problem+json: {"status": 404, "title": "Not Found", "type": "https://httpstatuses.com/404", "instance": "kong:trace:1234567890", "detail": "Not found"} + "415": + application/problem+json: {"status": 415, "title": "UnsupportedMediaType", "type": "https://httpstatuses.com/415", "instance": "kong:trace:1234567890", "detail": "UnsupportedMediaType"} + delete-config-store-secret: + speakeasy-default-delete-config-store-secret: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + configStoreId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + key: "ConfigStoreSecretKey" + responses: + "401": + application/problem+json: {"status": 401, "title": "Unauthorized", "type": "https://httpstatuses.com/401", "instance": "kong:trace:1234567890", "detail": "Invalid credentials"} + "403": + application/problem+json: {"status": 403, "title": "Forbidden", "type": "https://httpstatuses.com/403", "instance": "kong:trace:1234567890", "detail": "Forbidden"} + "404": + application/problem+json: {"status": 404, "title": "Not Found", "type": "https://httpstatuses.com/404", "instance": "kong:trace:1234567890", "detail": "Not found"} examplesVersion: 1.0.0 generatedTests: {} diff --git a/configstores.go b/configstores.go new file mode 100644 index 0000000..f933909 --- /dev/null +++ b/configstores.go @@ -0,0 +1,1397 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkkonnectgo + +import ( + "bytes" + "context" + "fmt" + "github.com/Kong/sdk-konnect-go/internal/hooks" + "github.com/Kong/sdk-konnect-go/internal/utils" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "github.com/Kong/sdk-konnect-go/models/sdkerrors" + "github.com/Kong/sdk-konnect-go/retry" + "net/http" +) + +// ConfigStores - Config Stores +type ConfigStores struct { + sdkConfiguration sdkConfiguration +} + +func newConfigStores(sdkConfig sdkConfiguration) *ConfigStores { + return &ConfigStores{ + sdkConfiguration: sdkConfig, + } +} + +// ListConfigStores - List all config stores for a control plane +func (s *ConfigStores) ListConfigStores(ctx context.Context, request operations.ListConfigStoresRequest, opts ...operations.Option) (*operations.ListConfigStoresResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-config-stores", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ListConfigStoresResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ListConfigStoresResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ListConfigStoresResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// CreateConfigStore - Create Config Store +// Create a Config Store +func (s *ConfigStores) CreateConfigStore(ctx context.Context, controlPlaneID string, createConfigStore components.CreateConfigStore, opts ...operations.Option) (*operations.CreateConfigStoreResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.CreateConfigStoreRequest{ + ControlPlaneID: controlPlaneID, + CreateConfigStore: createConfigStore, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateConfigStore", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "415", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateConfigStoreResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ConfigStore + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConfigStore = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 415: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnsupportedMediaTypeError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetConfigStore - Fetch Config Store +// Returns a Config Store +func (s *ConfigStores) GetConfigStore(ctx context.Context, controlPlaneID string, configStoreID string, opts ...operations.Option) (*operations.GetConfigStoreResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetConfigStoreRequest{ + ControlPlaneID: controlPlaneID, + ConfigStoreID: configStoreID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "403", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetConfigStoreResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ConfigStore + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConfigStore = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// UpdateConfigStore - Update an individual Config Store +// Updates a Config Store +func (s *ConfigStores) UpdateConfigStore(ctx context.Context, request operations.UpdateConfigStoreRequest, opts ...operations.Option) (*operations.UpdateConfigStoreResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "update-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateConfigStore", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "415", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.UpdateConfigStoreResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ConfigStore + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConfigStore = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.NotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 415: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnsupportedMediaTypeError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// DeleteConfigStore - Delete Config Store +// Removes a config store +func (s *ConfigStores) DeleteConfigStore(ctx context.Context, request operations.DeleteConfigStoreRequest, opts ...operations.Option) (*operations.DeleteConfigStoreResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "delete-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/problem+json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DeleteConfigStoreResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 204: + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/configstoresecrets.go b/configstoresecrets.go new file mode 100644 index 0000000..0cff1e7 --- /dev/null +++ b/configstoresecrets.go @@ -0,0 +1,1447 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkkonnectgo + +import ( + "bytes" + "context" + "fmt" + "github.com/Kong/sdk-konnect-go/internal/hooks" + "github.com/Kong/sdk-konnect-go/internal/utils" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "github.com/Kong/sdk-konnect-go/models/sdkerrors" + "github.com/Kong/sdk-konnect-go/retry" + "net/http" +) + +// ConfigStoreSecrets - Config Store Secrets +type ConfigStoreSecrets struct { + sdkConfiguration sdkConfiguration +} + +func newConfigStoreSecrets(sdkConfig sdkConfiguration) *ConfigStoreSecrets { + return &ConfigStoreSecrets{ + sdkConfiguration: sdkConfig, + } +} + +// CreateConfigStoreSecret - Create Config Store Secret +// Creates a secret for a Config Store. +func (s *ConfigStoreSecrets) CreateConfigStoreSecret(ctx context.Context, request operations.CreateConfigStoreSecretRequest, opts ...operations.Option) (*operations.CreateConfigStoreSecretResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}/secrets", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateConfigStoreSecret", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "415", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateConfigStoreSecretResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ConfigStoreSecret + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConfigStoreSecret = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.NotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 415: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnsupportedMediaTypeError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// ListConfigStoreSecrets - List Config Store Secrets +// Returns a collection of all secrets for a Config Store. +func (s *ConfigStoreSecrets) ListConfigStoreSecrets(ctx context.Context, request operations.ListConfigStoreSecretsRequest, opts ...operations.Option) (*operations.ListConfigStoreSecretsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "list-config-store-secrets", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}/secrets", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.ListConfigStoreSecretsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ListConfigStoreSecretsResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ListConfigStoreSecretsResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.NotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetConfigStoreSecret - Fetch Config Store Secret +// Returns a secret for the Config Store. +func (s *ConfigStoreSecrets) GetConfigStoreSecret(ctx context.Context, request operations.GetConfigStoreSecretRequest, opts ...operations.Option) (*operations.GetConfigStoreSecretResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}/secrets/{key}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "403", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetConfigStoreSecretResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ConfigStoreSecret + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConfigStoreSecret = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.NotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// UpdateConfigStoreSecret - Update Config Store Secret +// Updates a secret for a Config Store. +func (s *ConfigStoreSecrets) UpdateConfigStoreSecret(ctx context.Context, request operations.UpdateConfigStoreSecretRequest, opts ...operations.Option) (*operations.UpdateConfigStoreSecretResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "update-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}/secrets/{key}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateConfigStoreSecret", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "415", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.UpdateConfigStoreSecretResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ConfigStoreSecret + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConfigStoreSecret = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.BadRequestError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.NotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 415: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnsupportedMediaTypeError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// DeleteConfigStoreSecret - Delete Config Store Secret +// Removes a secret from a Config Store. +func (s *ConfigStoreSecrets) DeleteConfigStoreSecret(ctx context.Context, request operations.DeleteConfigStoreSecretRequest, opts ...operations.Option) (*operations.DeleteConfigStoreSecretResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "delete-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/config-stores/{configStoreId}/secrets/{key}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/problem+json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "403", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.DeleteConfigStoreSecretResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 204: + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.UnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.ForbiddenError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.NotFoundError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/customplugins.go b/customplugins.go deleted file mode 100644 index 88a152e..0000000 --- a/customplugins.go +++ /dev/null @@ -1,456 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package sdkkonnectgo - -import ( - "bytes" - "context" - "fmt" - "github.com/Kong/sdk-konnect-go/internal/hooks" - "github.com/Kong/sdk-konnect-go/internal/utils" - "github.com/Kong/sdk-konnect-go/models/operations" - "github.com/Kong/sdk-konnect-go/models/sdkerrors" - "github.com/Kong/sdk-konnect-go/retry" - "net/http" -) - -type CustomPlugins struct { - sdkConfiguration sdkConfiguration -} - -func newCustomPlugins(sdkConfig sdkConfiguration) *CustomPlugins { - return &CustomPlugins{ - sdkConfiguration: sdkConfig, - } -} - -// ListCustomPlugin - List all CustomPlugins -// List all CustomPlugins -func (s *CustomPlugins) ListCustomPlugin(ctx context.Context, request operations.ListCustomPluginRequest, opts ...operations.Option) (*operations.ListCustomPluginResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "list-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionRetries, - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - var baseURL string - if o.ServerURL == nil { - baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - } else { - baseURL = *o.ServerURL - } - opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/custom-plugins", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - for k, v := range o.SetHeaders { - req.Header.Set(k, v) - } - - globalRetryConfig := s.sdkConfiguration.RetryConfig - retryConfig := o.Retries - if retryConfig == nil { - if globalRetryConfig != nil { - retryConfig = globalRetryConfig - } - } - - var httpRes *http.Response - if retryConfig != nil { - httpRes, err = utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { - return nil, err - } - - return nil, retry.Permanent(err) - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err = s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } - - res := &operations.ListCustomPluginResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out operations.ListCustomPluginResponseBody - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - res.Object = &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 401: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out sdkerrors.GatewayUnauthorizedError - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - return nil, &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} - -// DeleteCustomPlugin - Delete a CustomPlugin -// Delete a CustomPlugin -func (s *CustomPlugins) DeleteCustomPlugin(ctx context.Context, controlPlaneID string, customPluginID string, opts ...operations.Option) (*operations.DeleteCustomPluginResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "delete-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - request := operations.DeleteCustomPluginRequest{ - ControlPlaneID: controlPlaneID, - CustomPluginID: customPluginID, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionRetries, - operations.SupportedOptionTimeout, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - - var baseURL string - if o.ServerURL == nil { - baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - } else { - baseURL = *o.ServerURL - } - opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/custom-plugins/{CustomPluginId}", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - timeout := o.Timeout - if timeout == nil { - timeout = s.sdkConfiguration.Timeout - } - - if timeout != nil { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *timeout) - defer cancel() - } - - req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - for k, v := range o.SetHeaders { - req.Header.Set(k, v) - } - - globalRetryConfig := s.sdkConfiguration.RetryConfig - retryConfig := o.Retries - if retryConfig == nil { - if globalRetryConfig != nil { - retryConfig = globalRetryConfig - } - } - - var httpRes *http.Response - if retryConfig != nil { - httpRes, err = utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "429", - "500", - "502", - "503", - "504", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err - } - req.Body = copyBody - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { - return nil, err - } - - return nil, retry.Permanent(err) - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } else { - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err = s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } - - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) - if err != nil { - return nil, err - } else if _httpRes != nil { - httpRes = _httpRes - } - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - } - - res := &operations.DeleteCustomPluginResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 401: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - - var out sdkerrors.GatewayUnauthorizedError - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - return nil, &out - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - default: - rawBody, err := utils.ConsumeRawBody(httpRes) - if err != nil { - return nil, err - } - return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil - -} diff --git a/docs/models/components/configstore.md b/docs/models/components/configstore.md new file mode 100644 index 0000000..273b68a --- /dev/null +++ b/docs/models/components/configstore.md @@ -0,0 +1,11 @@ +# ConfigStore + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `ID` | **string* | :heavy_minus_sign: | The Config Store ID. | b9e81174-b5bb-4638-a3c3-8afe61a0abf8 | +| `Name` | **string* | :heavy_minus_sign: | The name of the Config Store | My Name | +| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | An ISO-8601 timestamp representation of entity creation date. | 2022-11-04T20:10:06.927Z | +| `UpdatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | An ISO-8601 timestamp representation of entity update date. | 2022-11-04T20:10:06.927Z | \ No newline at end of file diff --git a/docs/models/components/configstoresecret.md b/docs/models/components/configstoresecret.md new file mode 100644 index 0000000..b91fdcd --- /dev/null +++ b/docs/models/components/configstoresecret.md @@ -0,0 +1,13 @@ +# ConfigStoreSecret + +Config Store Secret + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `Key` | **string* | :heavy_minus_sign: | N/A | | +| `Value` | **string* | :heavy_minus_sign: | N/A | | +| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | An ISO-8601 timestamp representation of entity creation date. | 2022-11-04T20:10:06.927Z | +| `UpdatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | An ISO-8601 timestamp representation of entity update date. | 2022-11-04T20:10:06.927Z | \ No newline at end of file diff --git a/docs/models/components/createconfigstore.md b/docs/models/components/createconfigstore.md new file mode 100644 index 0000000..b9719d1 --- /dev/null +++ b/docs/models/components/createconfigstore.md @@ -0,0 +1,10 @@ +# CreateConfigStore + +The request schema to create a Config Store. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `Name` | **string* | :heavy_minus_sign: | N/A | Config Store | \ No newline at end of file diff --git a/docs/models/components/createconfigstoresecret.md b/docs/models/components/createconfigstoresecret.md new file mode 100644 index 0000000..997cb2c --- /dev/null +++ b/docs/models/components/createconfigstoresecret.md @@ -0,0 +1,9 @@ +# CreateConfigStoreSecret + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Key` | *string* | :heavy_check_mark: | N/A | +| `Value` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/cursormeta.md b/docs/models/components/cursormeta.md new file mode 100644 index 0000000..647bd10 --- /dev/null +++ b/docs/models/components/cursormeta.md @@ -0,0 +1,10 @@ +# CursorMeta + +Pagination metadata. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `Page` | [components.CursorMetaPage](../../models/components/cursormetapage.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/cursormetapage.md b/docs/models/components/cursormetapage.md new file mode 100644 index 0000000..f84cacb --- /dev/null +++ b/docs/models/components/cursormetapage.md @@ -0,0 +1,12 @@ +# CursorMetaPage + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `First` | **string* | :heavy_minus_sign: | URI to the first page | | +| `Last` | **string* | :heavy_minus_sign: | URI to the last page | | +| `Next` | *string* | :heavy_check_mark: | URI to the next page | | +| `Previous` | *string* | :heavy_check_mark: | URI to the previous page | | +| `Size` | *float64* | :heavy_check_mark: | Requested page size | 10 | \ No newline at end of file diff --git a/docs/models/components/customplugin.md b/docs/models/components/customplugin.md deleted file mode 100644 index 52ff874..0000000 --- a/docs/models/components/customplugin.md +++ /dev/null @@ -1,14 +0,0 @@ -# CustomPlugin - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | -| `CreatedAt` | **int64* | :heavy_minus_sign: | Unix epoch when the resource was created. | -| `Handler` | *string* | :heavy_check_mark: | N/A | -| `ID` | **string* | :heavy_minus_sign: | N/A | -| `Name` | *string* | :heavy_check_mark: | N/A | -| `Schema` | *string* | :heavy_check_mark: | N/A | -| `Tags` | []*string* | :heavy_minus_sign: | N/A | -| `UpdatedAt` | **int64* | :heavy_minus_sign: | Unix epoch when the resource was last updated. | \ No newline at end of file diff --git a/docs/models/components/listconfigstoresecretsresponse.md b/docs/models/components/listconfigstoresecretsresponse.md new file mode 100644 index 0000000..56217e7 --- /dev/null +++ b/docs/models/components/listconfigstoresecretsresponse.md @@ -0,0 +1,11 @@ +# ListConfigStoreSecretsResponse + +List of Config Store Secrets + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `Meta` | [components.CursorMeta](../../models/components/cursormeta.md) | :heavy_check_mark: | Pagination metadata. | +| `Data` | [][components.ConfigStoreSecret](../../models/components/configstoresecret.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/listconfigstoresresponse.md b/docs/models/components/listconfigstoresresponse.md new file mode 100644 index 0000000..193d59f --- /dev/null +++ b/docs/models/components/listconfigstoresresponse.md @@ -0,0 +1,11 @@ +# ListConfigStoresResponse + +List of Config Stores + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `Meta` | [components.CursorMeta](../../models/components/cursormeta.md) | :heavy_check_mark: | Pagination metadata. | +| `Data` | [][components.ConfigStore](../../models/components/configstore.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/updateconfigstore.md b/docs/models/components/updateconfigstore.md new file mode 100644 index 0000000..6f6db11 --- /dev/null +++ b/docs/models/components/updateconfigstore.md @@ -0,0 +1,10 @@ +# UpdateConfigStore + +The request schema to update a Config Store. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `Name` | **string* | :heavy_minus_sign: | N/A | Config Store | \ No newline at end of file diff --git a/docs/models/components/updateconfigstoresecret.md b/docs/models/components/updateconfigstoresecret.md new file mode 100644 index 0000000..703bfc3 --- /dev/null +++ b/docs/models/components/updateconfigstoresecret.md @@ -0,0 +1,8 @@ +# UpdateConfigStoreSecret + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Value` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createconfigstorerequest.md b/docs/models/operations/createconfigstorerequest.md new file mode 100644 index 0000000..d020331 --- /dev/null +++ b/docs/models/operations/createconfigstorerequest.md @@ -0,0 +1,9 @@ +# CreateConfigStoreRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `CreateConfigStore` | [components.CreateConfigStore](../../models/components/createconfigstore.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/createconfigstoreresponse.md b/docs/models/operations/createconfigstoreresponse.md new file mode 100644 index 0000000..3ca284c --- /dev/null +++ b/docs/models/operations/createconfigstoreresponse.md @@ -0,0 +1,11 @@ +# CreateConfigStoreResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ConfigStore` | [*components.ConfigStore](../../models/components/configstore.md) | :heavy_minus_sign: | Config Store | \ No newline at end of file diff --git a/docs/models/operations/createconfigstoresecretrequest.md b/docs/models/operations/createconfigstoresecretrequest.md new file mode 100644 index 0000000..7454c38 --- /dev/null +++ b/docs/models/operations/createconfigstoresecretrequest.md @@ -0,0 +1,10 @@ +# CreateConfigStoreSecretRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `CreateConfigStoreSecret` | [components.CreateConfigStoreSecret](../../models/components/createconfigstoresecret.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/createconfigstoresecretresponse.md b/docs/models/operations/createconfigstoresecretresponse.md new file mode 100644 index 0000000..7a2099c --- /dev/null +++ b/docs/models/operations/createconfigstoresecretresponse.md @@ -0,0 +1,11 @@ +# CreateConfigStoreSecretResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ConfigStoreSecret` | [*components.ConfigStoreSecret](../../models/components/configstoresecret.md) | :heavy_minus_sign: | Config Store Secret | \ No newline at end of file diff --git a/docs/models/operations/deleteconfigstorerequest.md b/docs/models/operations/deleteconfigstorerequest.md new file mode 100644 index 0000000..09939ca --- /dev/null +++ b/docs/models/operations/deleteconfigstorerequest.md @@ -0,0 +1,10 @@ +# DeleteConfigStoreRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `Force` | [*operations.Force](../../models/operations/force.md) | :heavy_minus_sign: | If true, delete specified config store and all secrets, even if there are secrets linked to the config store If false, do not allow deletion if there are secrets linked to the config store | | \ No newline at end of file diff --git a/docs/models/operations/deletecustompluginresponse.md b/docs/models/operations/deleteconfigstoreresponse.md similarity index 97% rename from docs/models/operations/deletecustompluginresponse.md rename to docs/models/operations/deleteconfigstoreresponse.md index 47094ca..7a19545 100644 --- a/docs/models/operations/deletecustompluginresponse.md +++ b/docs/models/operations/deleteconfigstoreresponse.md @@ -1,4 +1,4 @@ -# DeleteCustomPluginResponse +# DeleteConfigStoreResponse ## Fields diff --git a/docs/models/operations/deleteconfigstoresecretrequest.md b/docs/models/operations/deleteconfigstoresecretrequest.md new file mode 100644 index 0000000..b52f412 --- /dev/null +++ b/docs/models/operations/deleteconfigstoresecretrequest.md @@ -0,0 +1,10 @@ +# DeleteConfigStoreSecretRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `Key` | *string* | :heavy_check_mark: | Config Store Secret key | ConfigStoreSecretKey | \ No newline at end of file diff --git a/docs/models/operations/deleteconfigstoresecretresponse.md b/docs/models/operations/deleteconfigstoresecretresponse.md new file mode 100644 index 0000000..769eeee --- /dev/null +++ b/docs/models/operations/deleteconfigstoresecretresponse.md @@ -0,0 +1,10 @@ +# DeleteConfigStoreSecretResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/force.md b/docs/models/operations/force.md new file mode 100644 index 0000000..43662d7 --- /dev/null +++ b/docs/models/operations/force.md @@ -0,0 +1,11 @@ +# Force + +If true, delete specified config store and all secrets, even if there are secrets linked to the config store If false, do not allow deletion if there are secrets linked to the config store + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `ForceTrue` | true | +| `ForceFalse` | false | \ No newline at end of file diff --git a/docs/models/operations/deletecustompluginrequest.md b/docs/models/operations/getconfigstorerequest.md similarity index 87% rename from docs/models/operations/deletecustompluginrequest.md rename to docs/models/operations/getconfigstorerequest.md index dc1698c..c098ec4 100644 --- a/docs/models/operations/deletecustompluginrequest.md +++ b/docs/models/operations/getconfigstorerequest.md @@ -1,4 +1,4 @@ -# DeleteCustomPluginRequest +# GetConfigStoreRequest ## Fields @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | -| `CustomPluginID` | *string* | :heavy_check_mark: | ID of the CustomPlugin to lookup | | \ No newline at end of file +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | \ No newline at end of file diff --git a/docs/models/operations/getconfigstoreresponse.md b/docs/models/operations/getconfigstoreresponse.md new file mode 100644 index 0000000..9e63229 --- /dev/null +++ b/docs/models/operations/getconfigstoreresponse.md @@ -0,0 +1,11 @@ +# GetConfigStoreResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ConfigStore` | [*components.ConfigStore](../../models/components/configstore.md) | :heavy_minus_sign: | Config Store | \ No newline at end of file diff --git a/docs/models/operations/getconfigstoresecretrequest.md b/docs/models/operations/getconfigstoresecretrequest.md new file mode 100644 index 0000000..eb2e13b --- /dev/null +++ b/docs/models/operations/getconfigstoresecretrequest.md @@ -0,0 +1,10 @@ +# GetConfigStoreSecretRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `Key` | *string* | :heavy_check_mark: | Config Store Secret key | ConfigStoreSecretKey | \ No newline at end of file diff --git a/docs/models/operations/getconfigstoresecretresponse.md b/docs/models/operations/getconfigstoresecretresponse.md new file mode 100644 index 0000000..c1b5a18 --- /dev/null +++ b/docs/models/operations/getconfigstoresecretresponse.md @@ -0,0 +1,11 @@ +# GetConfigStoreSecretResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ConfigStoreSecret` | [*components.ConfigStoreSecret](../../models/components/configstoresecret.md) | :heavy_minus_sign: | Config Store Secret | \ No newline at end of file diff --git a/docs/models/operations/listconfigstoresecretsrequest.md b/docs/models/operations/listconfigstoresecretsrequest.md new file mode 100644 index 0000000..667f397 --- /dev/null +++ b/docs/models/operations/listconfigstoresecretsrequest.md @@ -0,0 +1,11 @@ +# ListConfigStoreSecretsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `PageSize` | **int64* | :heavy_minus_sign: | The maximum number of items to include per page. The last page of a collection may include fewer items. | 10 | +| `PageAfter` | **string* | :heavy_minus_sign: | Request the next page of data, starting with the item after this parameter. | ewogICJpZCI6ICJoZWxsbyB3b3JsZCIKfQ | \ No newline at end of file diff --git a/docs/models/operations/listconfigstoresecretsresponse.md b/docs/models/operations/listconfigstoresecretsresponse.md new file mode 100644 index 0000000..a14aa9e --- /dev/null +++ b/docs/models/operations/listconfigstoresecretsresponse.md @@ -0,0 +1,11 @@ +# ListConfigStoreSecretsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ListConfigStoreSecretsResponse` | [*components.ListConfigStoreSecretsResponse](../../models/components/listconfigstoresecretsresponse.md) | :heavy_minus_sign: | List of Config Store Secrets | \ No newline at end of file diff --git a/docs/models/operations/listconfigstoresrequest.md b/docs/models/operations/listconfigstoresrequest.md new file mode 100644 index 0000000..ab0596f --- /dev/null +++ b/docs/models/operations/listconfigstoresrequest.md @@ -0,0 +1,10 @@ +# ListConfigStoresRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `PageSize` | **int64* | :heavy_minus_sign: | The maximum number of items to include per page. The last page of a collection may include fewer items. | 10 | +| `PageAfter` | **string* | :heavy_minus_sign: | Request the next page of data, starting with the item after this parameter. | ewogICJpZCI6ICJoZWxsbyB3b3JsZCIKfQ | \ No newline at end of file diff --git a/docs/models/operations/listconfigstoresresponse.md b/docs/models/operations/listconfigstoresresponse.md new file mode 100644 index 0000000..814c88c --- /dev/null +++ b/docs/models/operations/listconfigstoresresponse.md @@ -0,0 +1,11 @@ +# ListConfigStoresResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ListConfigStoresResponse` | [*components.ListConfigStoresResponse](../../models/components/listconfigstoresresponse.md) | :heavy_minus_sign: | List of Config Stores | \ No newline at end of file diff --git a/docs/models/operations/listcustompluginrequest.md b/docs/models/operations/listcustompluginrequest.md deleted file mode 100644 index a792ef9..0000000 --- a/docs/models/operations/listcustompluginrequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# ListCustomPluginRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | -| `Size` | **int64* | :heavy_minus_sign: | Number of resources to be returned. | | -| `Offset` | **string* | :heavy_minus_sign: | Offset from which to return the next set of resources. Use the value of the 'offset' field from the response of a list operation as input here to paginate through all the resources | | -| `Tags` | **string* | :heavy_minus_sign: | A list of tags to filter the list of resources on. Multiple tags can be concatenated using ',' to mean AND or using '/' to mean OR. | tag1,tag2 | \ No newline at end of file diff --git a/docs/models/operations/listcustompluginresponse.md b/docs/models/operations/listcustompluginresponse.md deleted file mode 100644 index aad2712..0000000 --- a/docs/models/operations/listcustompluginresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# ListCustomPluginResponse - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.ListCustomPluginResponseBody](../../models/operations/listcustompluginresponsebody.md) | :heavy_minus_sign: | A successful response listing CustomPlugins | \ No newline at end of file diff --git a/docs/models/operations/listcustompluginresponsebody.md b/docs/models/operations/listcustompluginresponsebody.md deleted file mode 100644 index 54658d2..0000000 --- a/docs/models/operations/listcustompluginresponsebody.md +++ /dev/null @@ -1,12 +0,0 @@ -# ListCustomPluginResponseBody - -A successful response listing CustomPlugins - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `Data` | [][components.CustomPlugin](../../models/components/customplugin.md) | :heavy_minus_sign: | N/A | -| `Next` | **string* | :heavy_minus_sign: | URI to the next page (may be null) | -| `Offset` | **string* | :heavy_minus_sign: | Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page | \ No newline at end of file diff --git a/docs/models/operations/updateconfigstorerequest.md b/docs/models/operations/updateconfigstorerequest.md new file mode 100644 index 0000000..e91843d --- /dev/null +++ b/docs/models/operations/updateconfigstorerequest.md @@ -0,0 +1,10 @@ +# UpdateConfigStoreRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `UpdateConfigStore` | [components.UpdateConfigStore](../../models/components/updateconfigstore.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updateconfigstoreresponse.md b/docs/models/operations/updateconfigstoreresponse.md new file mode 100644 index 0000000..8315a04 --- /dev/null +++ b/docs/models/operations/updateconfigstoreresponse.md @@ -0,0 +1,11 @@ +# UpdateConfigStoreResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ConfigStore` | [*components.ConfigStore](../../models/components/configstore.md) | :heavy_minus_sign: | Config Store | \ No newline at end of file diff --git a/docs/models/operations/updateconfigstoresecretrequest.md b/docs/models/operations/updateconfigstoresecretrequest.md new file mode 100644 index 0000000..77d59e7 --- /dev/null +++ b/docs/models/operations/updateconfigstoresecretrequest.md @@ -0,0 +1,11 @@ +# UpdateConfigStoreSecretRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConfigStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `Key` | *string* | :heavy_check_mark: | Config Store Secret key | ConfigStoreSecretKey | +| `UpdateConfigStoreSecret` | [components.UpdateConfigStoreSecret](../../models/components/updateconfigstoresecret.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/updateconfigstoresecretresponse.md b/docs/models/operations/updateconfigstoresecretresponse.md new file mode 100644 index 0000000..2e60c15 --- /dev/null +++ b/docs/models/operations/updateconfigstoresecretresponse.md @@ -0,0 +1,11 @@ +# UpdateConfigStoreSecretResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ConfigStoreSecret` | [*components.ConfigStoreSecret](../../models/components/configstoresecret.md) | :heavy_minus_sign: | Config Store Secret | \ No newline at end of file diff --git a/docs/models/sdkerrors/unsupportedmediatypeerror.md b/docs/models/sdkerrors/unsupportedmediatypeerror.md new file mode 100644 index 0000000..ac741f2 --- /dev/null +++ b/docs/models/sdkerrors/unsupportedmediatypeerror.md @@ -0,0 +1,14 @@ +# UnsupportedMediaTypeError + +standard error + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `Status` | *any* | :heavy_check_mark: | N/A | 415 | +| `Title` | *any* | :heavy_check_mark: | N/A | UnsupportedMediaType | +| `Type` | *any* | :heavy_minus_sign: | N/A | https://httpstatuses.com/415 | +| `Instance` | *any* | :heavy_check_mark: | N/A | kong:trace:1234567890 | +| `Detail` | *any* | :heavy_check_mark: | N/A | UnsupportedMediaType | \ No newline at end of file diff --git a/docs/sdks/configstores/README.md b/docs/sdks/configstores/README.md new file mode 100644 index 0000000..fe6566e --- /dev/null +++ b/docs/sdks/configstores/README.md @@ -0,0 +1,317 @@ +# ConfigStores +(*ConfigStores*) + +## Overview + +Config Stores + +### Available Operations + +* [ListConfigStores](#listconfigstores) - List all config stores for a control plane +* [CreateConfigStore](#createconfigstore) - Create Config Store +* [GetConfigStore](#getconfigstore) - Fetch Config Store +* [UpdateConfigStore](#updateconfigstore) - Update an individual Config Store +* [DeleteConfigStore](#deleteconfigstore) - Delete Config Store + +## ListConfigStores + +List all config stores for a control plane + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStores.ListConfigStores(ctx, operations.ListConfigStoresRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + PageSize: sdkkonnectgo.Int64(10), + PageAfter: sdkkonnectgo.String("ewogICJpZCI6ICJoZWxsbyB3b3JsZCIKfQ"), + }) + if err != nil { + log.Fatal(err) + } + if res.ListConfigStoresResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.ListConfigStoresRequest](../../models/operations/listconfigstoresrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.ListConfigStoresResponse](../../models/operations/listconfigstoresresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## CreateConfigStore + +Create a Config Store + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStores.CreateConfigStore(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", components.CreateConfigStore{ + Name: sdkkonnectgo.String("Config Store"), + }) + if err != nil { + log.Fatal(err) + } + if res.ConfigStore != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `controlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `createConfigStore` | [components.CreateConfigStore](../../models/components/createconfigstore.md) | :heavy_check_mark: | N/A | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.CreateConfigStoreResponse](../../models/operations/createconfigstoreresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.UnsupportedMediaTypeError | 415 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## GetConfigStore + +Returns a Config Store + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStores.GetConfigStore(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", "d32d905a-ed33-46a3-a093-d8f536af9a8a") + if err != nil { + log.Fatal(err) + } + if res.ConfigStore != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `controlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `configStoreID` | *string* | :heavy_check_mark: | Config Store identifier | d32d905a-ed33-46a3-a093-d8f536af9a8a | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetConfigStoreResponse](../../models/operations/getconfigstoreresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## UpdateConfigStore + +Updates a Config Store + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStores.UpdateConfigStore(ctx, operations.UpdateConfigStoreRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + UpdateConfigStore: components.UpdateConfigStore{ + Name: sdkkonnectgo.String("Config Store"), + }, + }) + if err != nil { + log.Fatal(err) + } + if res.ConfigStore != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.UpdateConfigStoreRequest](../../models/operations/updateconfigstorerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.UpdateConfigStoreResponse](../../models/operations/updateconfigstoreresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.NotFoundError | 404 | application/problem+json | +| sdkerrors.UnsupportedMediaTypeError | 415 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## DeleteConfigStore + +Removes a config store + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStores.DeleteConfigStore(ctx, operations.DeleteConfigStoreRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + Force: operations.ForceFalse.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.DeleteConfigStoreRequest](../../models/operations/deleteconfigstorerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.DeleteConfigStoreResponse](../../models/operations/deleteconfigstoreresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/configstoresecrets/README.md b/docs/sdks/configstoresecrets/README.md new file mode 100644 index 0000000..214afb9 --- /dev/null +++ b/docs/sdks/configstoresecrets/README.md @@ -0,0 +1,331 @@ +# ConfigStoreSecrets +(*ConfigStoreSecrets*) + +## Overview + +Config Store Secrets + +### Available Operations + +* [CreateConfigStoreSecret](#createconfigstoresecret) - Create Config Store Secret +* [ListConfigStoreSecrets](#listconfigstoresecrets) - List Config Store Secrets +* [GetConfigStoreSecret](#getconfigstoresecret) - Fetch Config Store Secret +* [UpdateConfigStoreSecret](#updateconfigstoresecret) - Update Config Store Secret +* [DeleteConfigStoreSecret](#deleteconfigstoresecret) - Delete Config Store Secret + +## CreateConfigStoreSecret + +Creates a secret for a Config Store. + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStoreSecrets.CreateConfigStoreSecret(ctx, operations.CreateConfigStoreSecretRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + CreateConfigStoreSecret: components.CreateConfigStoreSecret{ + Key: "", + Value: "", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.ConfigStoreSecret != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.CreateConfigStoreSecretRequest](../../models/operations/createconfigstoresecretrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CreateConfigStoreSecretResponse](../../models/operations/createconfigstoresecretresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.NotFoundError | 404 | application/problem+json | +| sdkerrors.UnsupportedMediaTypeError | 415 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## ListConfigStoreSecrets + +Returns a collection of all secrets for a Config Store. + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStoreSecrets.ListConfigStoreSecrets(ctx, operations.ListConfigStoreSecretsRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + PageSize: sdkkonnectgo.Int64(10), + PageAfter: sdkkonnectgo.String("ewogICJpZCI6ICJoZWxsbyB3b3JsZCIKfQ"), + }) + if err != nil { + log.Fatal(err) + } + if res.ListConfigStoreSecretsResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.ListConfigStoreSecretsRequest](../../models/operations/listconfigstoresecretsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.ListConfigStoreSecretsResponse](../../models/operations/listconfigstoresecretsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.NotFoundError | 404 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## GetConfigStoreSecret + +Returns a secret for the Config Store. + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStoreSecrets.GetConfigStoreSecret(ctx, operations.GetConfigStoreSecretRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + Key: "ConfigStoreSecretKey", + }) + if err != nil { + log.Fatal(err) + } + if res.ConfigStoreSecret != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetConfigStoreSecretRequest](../../models/operations/getconfigstoresecretrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetConfigStoreSecretResponse](../../models/operations/getconfigstoresecretresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.NotFoundError | 404 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## UpdateConfigStoreSecret + +Updates a secret for a Config Store. + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStoreSecrets.UpdateConfigStoreSecret(ctx, operations.UpdateConfigStoreSecretRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + Key: "ConfigStoreSecretKey", + UpdateConfigStoreSecret: components.UpdateConfigStoreSecret{ + Value: "", + }, + }) + if err != nil { + log.Fatal(err) + } + if res.ConfigStoreSecret != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.UpdateConfigStoreSecretRequest](../../models/operations/updateconfigstoresecretrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.UpdateConfigStoreSecretResponse](../../models/operations/updateconfigstoresecretresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| sdkerrors.BadRequestError | 400 | application/problem+json | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.NotFoundError | 404 | application/problem+json | +| sdkerrors.UnsupportedMediaTypeError | 415 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## DeleteConfigStoreSecret + +Removes a secret from a Config Store. + +### Example Usage + +```go +package main + +import( + "context" + sdkkonnectgo "github.com/Kong/sdk-konnect-go" + "github.com/Kong/sdk-konnect-go/models/components" + "github.com/Kong/sdk-konnect-go/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := sdkkonnectgo.New( + sdkkonnectgo.WithSecurity(components.Security{ + PersonalAccessToken: sdkkonnectgo.String(""), + }), + ) + + res, err := s.ConfigStoreSecrets.DeleteConfigStoreSecret(ctx, operations.DeleteConfigStoreSecretRequest{ + ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", + ConfigStoreID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", + Key: "ConfigStoreSecretKey", + }) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.DeleteConfigStoreSecretRequest](../../models/operations/deleteconfigstoresecretrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.DeleteConfigStoreSecretResponse](../../models/operations/deleteconfigstoresecretresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.UnauthorizedError | 401 | application/problem+json | +| sdkerrors.ForbiddenError | 403 | application/problem+json | +| sdkerrors.NotFoundError | 404 | application/problem+json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/customplugins/README.md b/docs/sdks/customplugins/README.md deleted file mode 100644 index 6192f9c..0000000 --- a/docs/sdks/customplugins/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# CustomPlugins -(*CustomPlugins*) - -## Overview - -### Available Operations - -* [ListCustomPlugin](#listcustomplugin) - List all CustomPlugins -* [DeleteCustomPlugin](#deletecustomplugin) - Delete a CustomPlugin - -## ListCustomPlugin - -List all CustomPlugins - -### Example Usage - -```go -package main - -import( - "context" - sdkkonnectgo "github.com/Kong/sdk-konnect-go" - "github.com/Kong/sdk-konnect-go/models/components" - "github.com/Kong/sdk-konnect-go/models/operations" - "log" -) - -func main() { - ctx := context.Background() - - s := sdkkonnectgo.New( - sdkkonnectgo.WithSecurity(components.Security{ - PersonalAccessToken: sdkkonnectgo.String(""), - }), - ) - - res, err := s.CustomPlugins.ListCustomPlugin(ctx, operations.ListCustomPluginRequest{ - ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", - Size: sdkkonnectgo.Int64(100), - Tags: sdkkonnectgo.String("tag1,tag2"), - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [operations.ListCustomPluginRequest](../../models/operations/listcustompluginrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - -### Response - -**[*operations.ListCustomPluginResponse](../../models/operations/listcustompluginresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.GatewayUnauthorizedError | 401 | application/json | -| sdkerrors.SDKError | 4XX, 5XX | \*/\* | - -## DeleteCustomPlugin - -Delete a CustomPlugin - -### Example Usage - -```go -package main - -import( - "context" - sdkkonnectgo "github.com/Kong/sdk-konnect-go" - "github.com/Kong/sdk-konnect-go/models/components" - "log" -) - -func main() { - ctx := context.Background() - - s := sdkkonnectgo.New( - sdkkonnectgo.WithSecurity(components.Security{ - PersonalAccessToken: sdkkonnectgo.String(""), - }), - ) - - res, err := s.CustomPlugins.DeleteCustomPlugin(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", "") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `controlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | -| `customPluginID` | *string* | :heavy_check_mark: | ID of the CustomPlugin to lookup | | -| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - -### Response - -**[*operations.DeleteCustomPluginResponse](../../models/operations/deletecustompluginresponse.md), error** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.GatewayUnauthorizedError | 401 | application/json | -| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/models/components/configstore.go b/models/components/configstore.go new file mode 100644 index 0000000..c96e943 --- /dev/null +++ b/models/components/configstore.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/Kong/sdk-konnect-go/internal/utils" + "time" +) + +type ConfigStore struct { + // The Config Store ID. + ID *string `json:"id,omitempty"` + // The name of the Config Store + Name *string `json:"name,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt *time.Time `json:"created_at,omitempty"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt *time.Time `json:"updated_at,omitempty"` +} + +func (c ConfigStore) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConfigStore) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConfigStore) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ConfigStore) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ConfigStore) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ConfigStore) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/models/components/configstoresecret.go b/models/components/configstoresecret.go new file mode 100644 index 0000000..1e7afc1 --- /dev/null +++ b/models/components/configstoresecret.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/Kong/sdk-konnect-go/internal/utils" + "time" +) + +// ConfigStoreSecret - Config Store Secret +type ConfigStoreSecret struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt *time.Time `json:"created_at,omitempty"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt *time.Time `json:"updated_at,omitempty"` +} + +func (c ConfigStoreSecret) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConfigStoreSecret) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConfigStoreSecret) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *ConfigStoreSecret) GetValue() *string { + if o == nil { + return nil + } + return o.Value +} + +func (o *ConfigStoreSecret) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ConfigStoreSecret) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/models/components/createconfigstore.go b/models/components/createconfigstore.go new file mode 100644 index 0000000..46a7025 --- /dev/null +++ b/models/components/createconfigstore.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateConfigStore - The request schema to create a Config Store. +type CreateConfigStore struct { + Name *string `json:"name,omitempty"` +} + +func (o *CreateConfigStore) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/models/components/createconfigstoresecret.go b/models/components/createconfigstoresecret.go new file mode 100644 index 0000000..d10feff --- /dev/null +++ b/models/components/createconfigstoresecret.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CreateConfigStoreSecret struct { + Key string `json:"key"` + Value string `json:"value"` +} + +func (o *CreateConfigStoreSecret) GetKey() string { + if o == nil { + return "" + } + return o.Key +} + +func (o *CreateConfigStoreSecret) GetValue() string { + if o == nil { + return "" + } + return o.Value +} diff --git a/models/components/cursormeta.go b/models/components/cursormeta.go new file mode 100644 index 0000000..d5a726b --- /dev/null +++ b/models/components/cursormeta.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CursorMeta - Pagination metadata. +type CursorMeta struct { + Page CursorMetaPage `json:"page"` +} + +func (o *CursorMeta) GetPage() CursorMetaPage { + if o == nil { + return CursorMetaPage{} + } + return o.Page +} diff --git a/models/components/cursormetapage.go b/models/components/cursormetapage.go new file mode 100644 index 0000000..f39ee2a --- /dev/null +++ b/models/components/cursormetapage.go @@ -0,0 +1,51 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CursorMetaPage struct { + // URI to the first page + First *string `json:"first,omitempty"` + // URI to the last page + Last *string `json:"last,omitempty"` + // URI to the next page + Next *string `json:"next"` + // URI to the previous page + Previous *string `json:"previous"` + // Requested page size + Size float64 `json:"size"` +} + +func (o *CursorMetaPage) GetFirst() *string { + if o == nil { + return nil + } + return o.First +} + +func (o *CursorMetaPage) GetLast() *string { + if o == nil { + return nil + } + return o.Last +} + +func (o *CursorMetaPage) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *CursorMetaPage) GetPrevious() *string { + if o == nil { + return nil + } + return o.Previous +} + +func (o *CursorMetaPage) GetSize() float64 { + if o == nil { + return 0.0 + } + return o.Size +} diff --git a/models/components/listconfigstoresecretsresponse.go b/models/components/listconfigstoresecretsresponse.go new file mode 100644 index 0000000..4b3b1be --- /dev/null +++ b/models/components/listconfigstoresecretsresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListConfigStoreSecretsResponse - List of Config Store Secrets +type ListConfigStoreSecretsResponse struct { + // Pagination metadata. + Meta CursorMeta `json:"meta"` + Data []ConfigStoreSecret `json:"data"` +} + +func (o *ListConfigStoreSecretsResponse) GetMeta() CursorMeta { + if o == nil { + return CursorMeta{} + } + return o.Meta +} + +func (o *ListConfigStoreSecretsResponse) GetData() []ConfigStoreSecret { + if o == nil { + return []ConfigStoreSecret{} + } + return o.Data +} diff --git a/models/components/listconfigstoresresponse.go b/models/components/listconfigstoresresponse.go new file mode 100644 index 0000000..24d9c5c --- /dev/null +++ b/models/components/listconfigstoresresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListConfigStoresResponse - List of Config Stores +type ListConfigStoresResponse struct { + // Pagination metadata. + Meta CursorMeta `json:"meta"` + Data []ConfigStore `json:"data"` +} + +func (o *ListConfigStoresResponse) GetMeta() CursorMeta { + if o == nil { + return CursorMeta{} + } + return o.Meta +} + +func (o *ListConfigStoresResponse) GetData() []ConfigStore { + if o == nil { + return []ConfigStore{} + } + return o.Data +} diff --git a/models/components/updateconfigstore.go b/models/components/updateconfigstore.go new file mode 100644 index 0000000..5197c01 --- /dev/null +++ b/models/components/updateconfigstore.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateConfigStore - The request schema to update a Config Store. +type UpdateConfigStore struct { + Name *string `json:"name,omitempty"` +} + +func (o *UpdateConfigStore) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/models/components/updateconfigstoresecret.go b/models/components/updateconfigstoresecret.go new file mode 100644 index 0000000..44c6392 --- /dev/null +++ b/models/components/updateconfigstoresecret.go @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type UpdateConfigStoreSecret struct { + Value string `json:"value"` +} + +func (o *UpdateConfigStoreSecret) GetValue() string { + if o == nil { + return "" + } + return o.Value +} diff --git a/models/operations/createconfigstore.go b/models/operations/createconfigstore.go new file mode 100644 index 0000000..de83002 --- /dev/null +++ b/models/operations/createconfigstore.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type CreateConfigStoreRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + CreateConfigStore components.CreateConfigStore `request:"mediaType=application/json"` +} + +func (o *CreateConfigStoreRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateConfigStoreRequest) GetCreateConfigStore() components.CreateConfigStore { + if o == nil { + return components.CreateConfigStore{} + } + return o.CreateConfigStore +} + +type CreateConfigStoreResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Config Store + ConfigStore *components.ConfigStore +} + +func (o *CreateConfigStoreResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateConfigStoreResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateConfigStoreResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateConfigStoreResponse) GetConfigStore() *components.ConfigStore { + if o == nil { + return nil + } + return o.ConfigStore +} diff --git a/models/operations/createconfigstoresecret.go b/models/operations/createconfigstoresecret.go new file mode 100644 index 0000000..bffc1c4 --- /dev/null +++ b/models/operations/createconfigstoresecret.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type CreateConfigStoreSecretRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + CreateConfigStoreSecret components.CreateConfigStoreSecret `request:"mediaType=application/json"` +} + +func (o *CreateConfigStoreSecretRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateConfigStoreSecretRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *CreateConfigStoreSecretRequest) GetCreateConfigStoreSecret() components.CreateConfigStoreSecret { + if o == nil { + return components.CreateConfigStoreSecret{} + } + return o.CreateConfigStoreSecret +} + +type CreateConfigStoreSecretResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Config Store Secret + ConfigStoreSecret *components.ConfigStoreSecret +} + +func (o *CreateConfigStoreSecretResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateConfigStoreSecretResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateConfigStoreSecretResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateConfigStoreSecretResponse) GetConfigStoreSecret() *components.ConfigStoreSecret { + if o == nil { + return nil + } + return o.ConfigStoreSecret +} diff --git a/models/operations/deleteconfigstore.go b/models/operations/deleteconfigstore.go new file mode 100644 index 0000000..4ff9b4b --- /dev/null +++ b/models/operations/deleteconfigstore.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/Kong/sdk-konnect-go/internal/utils" + "net/http" +) + +// Force - If true, delete specified config store and all secrets, even if there are secrets linked to the config store If false, do not allow deletion if there are secrets linked to the config store +type Force string + +const ( + ForceTrue Force = "true" + ForceFalse Force = "false" +) + +func (e Force) ToPointer() *Force { + return &e +} +func (e *Force) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "true": + fallthrough + case "false": + *e = Force(v) + return nil + default: + return fmt.Errorf("invalid value for Force: %v", v) + } +} + +type DeleteConfigStoreRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + // If true, delete specified config store and all secrets, even if there are secrets linked to the config store If false, do not allow deletion if there are secrets linked to the config store + Force *Force `default:"false" queryParam:"style=form,explode=true,name=force"` +} + +func (d DeleteConfigStoreRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DeleteConfigStoreRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DeleteConfigStoreRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteConfigStoreRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *DeleteConfigStoreRequest) GetForce() *Force { + if o == nil { + return nil + } + return o.Force +} + +type DeleteConfigStoreResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *DeleteConfigStoreResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteConfigStoreResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteConfigStoreResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/models/operations/deleteconfigstoresecret.go b/models/operations/deleteconfigstoresecret.go new file mode 100644 index 0000000..29d9145 --- /dev/null +++ b/models/operations/deleteconfigstoresecret.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +type DeleteConfigStoreSecretRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + // Config Store Secret key + Key string `pathParam:"style=simple,explode=false,name=key"` +} + +func (o *DeleteConfigStoreSecretRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteConfigStoreSecretRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *DeleteConfigStoreSecretRequest) GetKey() string { + if o == nil { + return "" + } + return o.Key +} + +type DeleteConfigStoreSecretResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *DeleteConfigStoreSecretResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteConfigStoreSecretResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteConfigStoreSecretResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/models/operations/getconfigstore.go b/models/operations/getconfigstore.go new file mode 100644 index 0000000..b2264db --- /dev/null +++ b/models/operations/getconfigstore.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type GetConfigStoreRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` +} + +func (o *GetConfigStoreRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetConfigStoreRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +type GetConfigStoreResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Config Store + ConfigStore *components.ConfigStore +} + +func (o *GetConfigStoreResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetConfigStoreResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetConfigStoreResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetConfigStoreResponse) GetConfigStore() *components.ConfigStore { + if o == nil { + return nil + } + return o.ConfigStore +} diff --git a/models/operations/getconfigstoresecret.go b/models/operations/getconfigstoresecret.go new file mode 100644 index 0000000..5bf0107 --- /dev/null +++ b/models/operations/getconfigstoresecret.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type GetConfigStoreSecretRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + // Config Store Secret key + Key string `pathParam:"style=simple,explode=false,name=key"` +} + +func (o *GetConfigStoreSecretRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetConfigStoreSecretRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *GetConfigStoreSecretRequest) GetKey() string { + if o == nil { + return "" + } + return o.Key +} + +type GetConfigStoreSecretResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Config Store Secret + ConfigStoreSecret *components.ConfigStoreSecret +} + +func (o *GetConfigStoreSecretResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetConfigStoreSecretResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetConfigStoreSecretResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetConfigStoreSecretResponse) GetConfigStoreSecret() *components.ConfigStoreSecret { + if o == nil { + return nil + } + return o.ConfigStoreSecret +} diff --git a/models/operations/listconfigstores.go b/models/operations/listconfigstores.go new file mode 100644 index 0000000..96c0835 --- /dev/null +++ b/models/operations/listconfigstores.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type ListConfigStoresRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // The maximum number of items to include per page. The last page of a collection may include fewer items. + PageSize *int64 `queryParam:"style=form,explode=true,name=page[size]"` + // Request the next page of data, starting with the item after this parameter. + PageAfter *string `queryParam:"style=form,explode=true,name=page[after]"` +} + +func (o *ListConfigStoresRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListConfigStoresRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListConfigStoresRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +type ListConfigStoresResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // List of Config Stores + ListConfigStoresResponse *components.ListConfigStoresResponse +} + +func (o *ListConfigStoresResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListConfigStoresResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListConfigStoresResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListConfigStoresResponse) GetListConfigStoresResponse() *components.ListConfigStoresResponse { + if o == nil { + return nil + } + return o.ListConfigStoresResponse +} diff --git a/models/operations/listconfigstoresecrets.go b/models/operations/listconfigstoresecrets.go new file mode 100644 index 0000000..5582c3a --- /dev/null +++ b/models/operations/listconfigstoresecrets.go @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type ListConfigStoreSecretsRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + // The maximum number of items to include per page. The last page of a collection may include fewer items. + PageSize *int64 `queryParam:"style=form,explode=true,name=page[size]"` + // Request the next page of data, starting with the item after this parameter. + PageAfter *string `queryParam:"style=form,explode=true,name=page[after]"` +} + +func (o *ListConfigStoreSecretsRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListConfigStoreSecretsRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *ListConfigStoreSecretsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListConfigStoreSecretsRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +type ListConfigStoreSecretsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // List of Config Store Secrets + ListConfigStoreSecretsResponse *components.ListConfigStoreSecretsResponse +} + +func (o *ListConfigStoreSecretsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListConfigStoreSecretsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListConfigStoreSecretsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListConfigStoreSecretsResponse) GetListConfigStoreSecretsResponse() *components.ListConfigStoreSecretsResponse { + if o == nil { + return nil + } + return o.ListConfigStoreSecretsResponse +} diff --git a/models/operations/updateconfigstore.go b/models/operations/updateconfigstore.go new file mode 100644 index 0000000..5d3ee18 --- /dev/null +++ b/models/operations/updateconfigstore.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type UpdateConfigStoreRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + UpdateConfigStore components.UpdateConfigStore `request:"mediaType=application/json"` +} + +func (o *UpdateConfigStoreRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpdateConfigStoreRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *UpdateConfigStoreRequest) GetUpdateConfigStore() components.UpdateConfigStore { + if o == nil { + return components.UpdateConfigStore{} + } + return o.UpdateConfigStore +} + +type UpdateConfigStoreResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Config Store + ConfigStore *components.ConfigStore +} + +func (o *UpdateConfigStoreResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateConfigStoreResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateConfigStoreResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateConfigStoreResponse) GetConfigStore() *components.ConfigStore { + if o == nil { + return nil + } + return o.ConfigStore +} diff --git a/models/operations/updateconfigstoresecret.go b/models/operations/updateconfigstoresecret.go new file mode 100644 index 0000000..bf79f4c --- /dev/null +++ b/models/operations/updateconfigstoresecret.go @@ -0,0 +1,85 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type UpdateConfigStoreSecretRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Config Store identifier + ConfigStoreID string `pathParam:"style=simple,explode=false,name=configStoreId"` + // Config Store Secret key + Key string `pathParam:"style=simple,explode=false,name=key"` + UpdateConfigStoreSecret components.UpdateConfigStoreSecret `request:"mediaType=application/json"` +} + +func (o *UpdateConfigStoreSecretRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpdateConfigStoreSecretRequest) GetConfigStoreID() string { + if o == nil { + return "" + } + return o.ConfigStoreID +} + +func (o *UpdateConfigStoreSecretRequest) GetKey() string { + if o == nil { + return "" + } + return o.Key +} + +func (o *UpdateConfigStoreSecretRequest) GetUpdateConfigStoreSecret() components.UpdateConfigStoreSecret { + if o == nil { + return components.UpdateConfigStoreSecret{} + } + return o.UpdateConfigStoreSecret +} + +type UpdateConfigStoreSecretResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Config Store Secret + ConfigStoreSecret *components.ConfigStoreSecret +} + +func (o *UpdateConfigStoreSecretResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateConfigStoreSecretResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateConfigStoreSecretResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateConfigStoreSecretResponse) GetConfigStoreSecret() *components.ConfigStoreSecret { + if o == nil { + return nil + } + return o.ConfigStoreSecret +} diff --git a/models/sdkerrors/unsupportedmediatypeerror.go b/models/sdkerrors/unsupportedmediatypeerror.go new file mode 100644 index 0000000..44d7c70 --- /dev/null +++ b/models/sdkerrors/unsupportedmediatypeerror.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" +) + +// UnsupportedMediaTypeError - standard error +type UnsupportedMediaTypeError struct { + Status any `json:"status"` + Title any `json:"title"` + Type any `json:"type,omitempty"` + Instance any `json:"instance"` + Detail any `json:"detail"` +} + +var _ error = &UnsupportedMediaTypeError{} + +func (e *UnsupportedMediaTypeError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/sdk.go b/sdk.go index 02df826..12ca78f 100644 --- a/sdk.go +++ b/sdk.go @@ -74,7 +74,11 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { // // https://docs.konghq.com - Documentation for Kong Gateway and its APIs type SDK struct { - ControlPlanes *ControlPlanes + ControlPlanes *ControlPlanes + // Config Stores + ConfigStores *ConfigStores + // Config Store Secrets + ConfigStoreSecrets *ConfigStoreSecrets ACLs *ACLs BasicAuthCredentials *BasicAuthCredentials // A CA certificate object represents a trusted certificate authority. @@ -110,7 +114,6 @@ type SDK struct { JWTs *JWTs APIKeys *APIKeys MTLSAuthCredentials *MTLSAuthCredentials - CustomPlugins *CustomPlugins // A JSON Web key set. Key sets are the preferred way to expose keys to plugins because they tell the plugin where to look for keys or have a scoping mechanism to restrict plugins to specific keys. // KeySets *KeySets @@ -265,9 +268,9 @@ func New(opts ...SDKOption) *SDK { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.1", - SDKVersion: "0.1.27", + SDKVersion: "0.1.28", GenVersion: "2.493.34", - UserAgent: "speakeasy-sdk/go 0.1.27 2.493.34 0.0.1 github.com/Kong/sdk-konnect-go", + UserAgent: "speakeasy-sdk/go 0.1.28 2.493.34 0.0.1 github.com/Kong/sdk-konnect-go", Hooks: hooks.New(), }, } @@ -289,6 +292,10 @@ func New(opts ...SDKOption) *SDK { sdk.ControlPlanes = newControlPlanes(sdk.sdkConfiguration) + sdk.ConfigStores = newConfigStores(sdk.sdkConfiguration) + + sdk.ConfigStoreSecrets = newConfigStoreSecrets(sdk.sdkConfiguration) + sdk.ACLs = newACLs(sdk.sdkConfiguration) sdk.BasicAuthCredentials = newBasicAuthCredentials(sdk.sdkConfiguration) @@ -313,8 +320,6 @@ func New(opts ...SDKOption) *SDK { sdk.MTLSAuthCredentials = newMTLSAuthCredentials(sdk.sdkConfiguration) - sdk.CustomPlugins = newCustomPlugins(sdk.sdkConfiguration) - sdk.KeySets = newKeySets(sdk.sdkConfiguration) sdk.Keys = newKeys(sdk.sdkConfiguration)