From 59f3a750b5bed7461b8475a3b3ef852e9cb7a607 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 16:48:28 +0000 Subject: [PATCH 1/3] chore(deps): update dependency speakeasy-api/speakeasy to v1.570.2 --- .github/workflows/bump-version.yaml | 2 +- .github/workflows/generate_on_pr.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml index 27983dc5..8392e1e7 100644 --- a/.github/workflows/bump-version.yaml +++ b/.github/workflows/bump-version.yaml @@ -40,7 +40,7 @@ jobs: repo: speakeasy cli_name: speakeasy package_type: zip - version: 1.548.4 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy + version: 1.570.2 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 diff --git a/.github/workflows/generate_on_pr.yaml b/.github/workflows/generate_on_pr.yaml index 54925c46..c7ed236a 100644 --- a/.github/workflows/generate_on_pr.yaml +++ b/.github/workflows/generate_on_pr.yaml @@ -48,7 +48,7 @@ jobs: repo: speakeasy cli_name: speakeasy package_type: zip - version: 1.548.4 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy + version: 1.570.2 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy - name: Checkout current repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 From 60059661daed8a686a0327ddf1094c42d05b2a18 Mon Sep 17 00:00:00 2001 From: pmalek Date: Thu, 26 Jun 2025 18:35:35 +0000 Subject: [PATCH 2/3] Bump .speakeasy/gen.yaml based on label --- .speakeasy/gen.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index afed653b..4d177433 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -4,6 +4,7 @@ generation: maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true @@ -15,8 +16,12 @@ generation: auth: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false + tests: + generateTests: true + generateNewTests: false + skipResponseBodyAssertions: false go: - version: 0.3.1 + version: 0.3.2 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true From 2d87e874274db3b65dc58e855ba4dafb790d87ee Mon Sep 17 00:00:00 2001 From: team-k8s-bot Date: Thu, 26 Jun 2025 18:37:03 +0000 Subject: [PATCH 3/3] Update provider based on openapi.yaml changes --- .speakeasy/gen.lock | 2180 ++++++++++++++++- .speakeasy/gen.yaml | 1 + acls.go | 219 +- apikeys.go | 219 +- appauthstrategies.go | 189 +- authentication.go | 39 +- authsettings.go | 399 +-- basicauthcredentials.go | 219 +- cacertificates.go | 159 +- certificates.go | 159 +- cloudgateways.go | 819 ++++--- configstores.go | 159 +- configstoresecrets.go | 159 +- consumergroups.go | 399 +-- consumers.go | 159 +- controlplanegroups.go | 189 +- controlplanes.go | 159 +- customplugins.go | 159 +- custompluginschemas.go | 159 +- dcrproviders.go | 189 +- degraphqlroutes.go | 219 +- docs/sdks/authsettings/README.md | 1 + dpcertificates.go | 129 +- dpnodes.go | 159 +- go.mod | 2 +- hmacauthcredentials.go | 219 +- impersonationsettings.go | 69 +- internal/config/sdkconfiguration.go | 33 + internal/hooks/hooks.go | 18 +- internal/utils/requestbody.go | 39 +- invites.go | 39 +- jwts.go | 219 +- keys.go | 309 ++- keysets.go | 159 +- me.go | 69 +- mtlsauthcredentials.go | 219 +- notifications.go | 339 +-- partiallinks.go | 39 +- partials.go | 159 +- plugins.go | 789 +++--- roles.go | 219 +- routes.go | 309 ++- sdk.go | 188 +- services.go | 159 +- snis.go | 309 ++- systemaccounts.go | 159 +- systemaccountsaccesstokens.go | 159 +- systemaccountsroles.go | 99 +- systemaccountsteammembership.go | 129 +- targets.go | 159 +- teammembership.go | 129 +- teams.go | 159 +- tests/mockserver/.gitignore | 1 + tests/mockserver/Dockerfile | 11 + tests/mockserver/Makefile | 18 + tests/mockserver/README.md | 52 + tests/mockserver/go.mod | 15 + tests/mockserver/go.sum | 16 + .../internal/handler/assert/contenttype.go | 99 + .../internal/handler/assert/header.go | 70 + .../internal/handler/assert/parameter.go | 110 + .../internal/handler/assert/pointer.go | 12 + .../internal/handler/assert/security.go | 75 + tests/mockserver/internal/handler/doc.go | 5 + .../internal/handler/generated_handler.go | 35 + .../internal/handler/generated_handlers.go | 14 + .../internal/handler/values/files.go | 40 + tests/mockserver/internal/logging/doc.go | 4 + tests/mockserver/internal/logging/formats.go | 38 + .../mockserver/internal/logging/http_file.go | 310 +++ .../internal/logging/http_logger.go | 90 + tests/mockserver/internal/logging/levels.go | 55 + tests/mockserver/internal/logging/logger.go | 40 + .../internal/logging/oas_operation.go | 87 + .../internal/logging/oas_operation_call.go | 123 + .../internal/sdk/models/components/acl.go | 58 + .../models/components/aclwithoutparents.go | 58 + .../components/addsystemaccounttoteam.go | 16 + .../sdk/models/components/addusertoteam.go | 16 + .../sdk/models/components/apiaccess.go | 38 + .../sdk/models/components/appauthstrategy.go | 470 ++++ .../appauthstrategyconfigkeyauth.go | 18 + .../appauthstrategyconfigopenidconnect.go | 77 + .../sdk/models/components/assignedrole.go | 96 + .../components/assignedrolecollection.go | 25 + .../sdk/models/components/assignrole.go | 258 ++ .../components/authenticationsettings.go | 52 + .../models/components/availabilitydocument.go | 34 + .../models/components/awstransitgateway.go | 45 + .../awstransitgatewayattachmentconfig.go | 60 + .../components/awstransitgatewayresponse.go | 147 ++ .../models/components/awsvpcpeeringgateway.go | 45 + .../awsvpcpeeringgatewayattachmentconfig.go | 66 + .../awsvpcpeeringgatewayresponse.go | 147 ++ .../models/components/azuretransitgateway.go | 34 + .../components/azuretransitgatewayresponse.go | 136 + .../azurevnetpeeringattachmentconfig.go | 78 + .../sdk/models/components/basicauth.go | 66 + .../components/basicauthwithoutparents.go | 66 + .../sdk/models/components/bulkpayload.go | 24 + .../sdk/models/components/cacertificate.go | 60 + .../sdk/models/components/certificate.go | 86 + ...gatewaysstringfieldequalsfilteroverride.go | 84 + .../cloudgatewaysstringfieldfilteroverride.go | 138 ++ .../sdk/models/components/configstore.go | 58 + .../models/components/configstoresecret.go | 57 + .../components/configurationdataplanegroup.go | 193 ++ .../configurationdataplanegroupautoscale.go | 72 + ...urationdataplanegroupautoscaleautopilot.go | 63 + ...figurationdataplanegroupautoscalestatic.go | 61 + .../configurationdataplanegroupconfig.go | 50 + ...igurationdataplanegroupenvironmentfield.go | 26 + .../configurationfilterparameters.go | 42 + .../components/configurationmanifest.go | 114 + .../configurationsfilterparameters.go | 23 + .../configureoidcidentityproviderconfig.go | 54 + .../sdk/models/components/consumer.go | 60 + .../sdk/models/components/consumergroup.go | 48 + .../components/consumergroupinsidewrapper.go | 14 + .../sdk/models/components/controlplane.go | 212 ++ .../controlplanefilterparameters.go | 110 + .../sdk/models/components/controlplanegeo.go | 44 + .../controlplanegeofieldequalsfilter.go | 85 + .../components/controlplanegeofieldfilter.go | 94 + .../controlplanegeofieldnotequalsfilter.go | 16 + .../controlplanegeofieldorequalityfilter.go | 16 + .../createappauthstrategyrequest.go | 289 +++ .../createappauthstrategyresponse.go | 470 ++++ .../models/components/createconfigstore.go | 15 + .../components/createconfigstoresecret.go | 22 + .../createconfigurationdataplanegroup.go | 50 + .../components/createconfigurationrequest.go | 66 + .../components/createcontrolplanerequest.go | 141 ++ .../components/createcustomdomainrequest.go | 33 + .../createdcrconfigauth0inrequest.go | 49 + .../createdcrconfigazureadinrequest.go | 29 + .../createdcrconfigcurityinrequest.go | 29 + .../createdcrconfighttpinrequest.go | 47 + .../createdcrconfigoktainrequest.go | 18 + .../components/createdcrproviderrequest.go | 177 ++ .../createdcrproviderrequestauth0.go | 92 + .../createdcrproviderrequestazuread.go | 92 + .../createdcrproviderrequestcurity.go | 92 + .../createdcrproviderrequesthttp.go | 92 + .../createdcrproviderrequestokta.go | 92 + .../components/createdcrproviderresponse.go | 748 ++++++ .../components/createidentityprovider.go | 102 + .../models/components/createnetworkrequest.go | 75 + .../models/components/createpluginschemas.go | 16 + .../models/components/createsystemaccount.go | 34 + .../createsystemaccountaccesstoken.go | 39 + .../sdk/models/components/createteam.go | 39 + .../components/createtransitgatewayrequest.go | 95 + .../sdk/models/components/cursormeta.go | 15 + .../sdk/models/components/cursormetapage.go | 51 + .../components/cursormetawithsizeandtotal.go | 33 + .../cursorpaginatedmetawithsizeandtotal.go | 15 + .../sdk/models/components/customdomain.go | 150 ++ .../customdomainonlinepropertystatus.go | 35 + .../components/customdomainonlinestatus.go | 25 + .../customdomainsfilterparameters.go | 39 + .../models/components/customdomainstate.go | 47 + .../customdomainstatefieldequalsfilter.go | 76 + .../customdomainstatefieldfilter.go | 94 + .../customdomainstatefieldnotequalsfilter.go | 7 + .../customdomainstatefieldorequalityfilter.go | 16 + .../sdk/models/components/customplugin.go | 64 + .../components/dataplaneclientcertificate.go | 42 + .../dataplaneclientcertificaterequest.go | 16 + .../dataplaneclientcertificateresponse.go | 15 + .../models/components/dcrproviderresponse.go | 748 ++++++ .../sdk/models/components/dcrprovidertype.go | 44 + .../defaultresourceconfiguration.go | 94 + .../models/components/defaultresourcequota.go | 95 + .../models/components/defaultsubscription.go | 22 + .../sdk/models/components/degraphqlroute.go | 75 + .../degraphqlroutewithoutparents.go | 75 + .../sdk/models/components/entitytypes.go | 46 + .../models/components/eventsubscription.go | 49 + .../eventsubscriptionlistresponse.go | 23 + .../components/eventsubscriptionresponse.go | 100 + .../getexpectedconfighashresponse.go | 34 + .../sdk/models/components/getgroupstatus.go | 16 + .../getimpersonationsettingsresponse.go | 16 + .../internal/sdk/models/components/getnode.go | 101 + .../sdk/models/components/groupconflict.go | 34 + .../components/groupconflictresource.go | 25 + .../sdk/models/components/groupmembership.go | 26 + .../models/components/groupmemberstatus.go | 16 + .../sdk/models/components/groupstatus.go | 99 + .../sdk/models/components/hmacauth.go | 66 + .../components/hmacauthwithoutparents.go | 66 + .../sdk/models/components/httpmetadata.go | 28 + .../sdk/models/components/identityprovider.go | 152 ++ .../models/components/identityprovidertype.go | 35 + .../sdk/models/components/idfieldfilter.go | 31 + .../internal/sdk/models/components/idp.go | 76 + .../sdk/models/components/instancetype.go | 43 + .../sdk/models/components/instancetypename.go | 38 + .../models/components/internalservererror.go | 32 + .../components/invalidparameterchoiceitem.go | 76 + .../invalidparameterdependentitem.go | 76 + .../invalidparametermaximumlength.go | 82 + .../invalidparameterminimumlength.go | 94 + .../models/components/invalidparameters.go | 138 ++ .../components/invalidparameterstandard.go | 39 + .../sdk/models/components/invalidrules.go | 92 + .../sdk/models/components/inviteuser.go | 17 + .../internal/sdk/models/components/jwt.go | 146 ++ .../models/components/jwtwithoutparents.go | 146 ++ .../internal/sdk/models/components/key.go | 127 + .../internal/sdk/models/components/keyauth.go | 67 + .../components/keyauthwithoutparents.go | 67 + .../internal/sdk/models/components/keyset.go | 48 + .../models/components/keywithoutparents.go | 127 + .../listappauthstrategiesresponse.go | 24 + .../listconfigstoresecretsresponse.go | 24 + .../components/listconfigstoresresponse.go | 24 + .../components/listconfigurationsresponse.go | 24 + .../components/listcontrolplanesresponse.go | 24 + .../components/listcustomdomainsresponse.go | 24 + .../listdataplanecertificatesresponse.go | 34 + .../components/listdcrprovidersresponse.go | 24 + ...stdefaultresourceconfigurationsresponse.go | 24 + .../listdefaultresourcequotasresponse.go | 24 + .../models/components/listgroupmemberships.go | 25 + ...tnetworkconfigurationreferencesresponse.go | 24 + .../models/components/listnetworksresponse.go | 24 + .../sdk/models/components/listnodes.go | 128 + .../sdk/models/components/listnodeseol.go | 61 + .../models/components/listpluginschemas.go | 73 + .../listprovideraccountsresponse.go | 24 + .../listresourceconfigurationsresponse.go | 24 + .../components/listresourcequotasresponse.go | 24 + .../components/listtransitgatewaysresponse.go | 24 + .../sdk/models/components/meorganization.go | 130 + .../sdk/models/components/mtlsauth.go | 77 + .../components/mtlsauthwithoutparents.go | 77 + .../internal/sdk/models/components/network.go | 160 ++ .../networkconfigurationreference.go | 114 + .../models/components/networkcreatestate.go | 35 + .../components/networkprovidermetadata.go | 23 + .../components/networksfilterparameters.go | 22 + .../sdk/models/components/networkstate.go | 47 + .../networkstatefieldequalsfilter.go | 76 + .../components/networkstatefieldfilter.go | 94 + .../networkstatefieldnotequalsfilter.go | 7 + .../networkstatefieldorequalityfilter.go | 16 + .../models/components/networkstatemetadata.go | 26 + .../sdk/models/components/notification.go | 114 + .../models/components/notificationchannel.go | 23 + .../components/notificationchanneltype.go | 34 + .../notificationfilterparameters.go | 51 + .../components/notificationlistresponse.go | 23 + .../components/notificationnamespace.go | 43 + .../models/components/notificationregion.go | 47 + .../models/components/notificationstatus.go | 38 + .../components/notificationupdatepayload.go | 16 + .../oidcidentityproviderclaimmappings.go | 35 + .../components/oidcidentityproviderconfig.go | 45 + .../sdk/models/components/pagemeta.go | 31 + .../sdk/models/components/paginatedmeta.go | 16 + .../internal/sdk/models/components/partial.go | 64 + ...rtialappauthstrategyconfigopenidconnect.go | 65 + .../sdk/models/components/partiallink.go | 33 + .../models/components/patchnetworkrequest.go | 16 + .../components/patchteamgroupmappings.go | 35 + .../internal/sdk/models/components/plugin.go | 307 +++ .../sdk/models/components/pluginschemas.go | 54 + .../models/components/pluginwithoutparents.go | 307 +++ .../sdk/models/components/provider.go | 25 + .../sdk/models/components/provideraccount.go | 67 + .../provideraccountsfilterparameters.go | 14 + .../sdk/models/components/providername.go | 35 + .../sdk/models/components/providerregion.go | 58 + .../sdk/models/components/proxyurl.go | 34 + .../components/resourceconfiguration.go | 33 + .../resourceconfigurationqualifier.go | 32 + .../sdk/models/components/resourcequota.go | 86 + .../components/resourcequotaqualifier.go | 41 + .../internal/sdk/models/components/roles.go | 2102 ++++++++++++++++ .../internal/sdk/models/components/route.go | 72 + .../sdk/models/components/routeexpression.go | 270 ++ .../sdk/models/components/routejson.go | 363 +++ .../models/components/routewithoutparents.go | 72 + .../components/samlidentityproviderconfig.go | 61 + .../samlidentityproviderconfiginput.go | 26 + .../sdk/models/components/security.go | 38 + .../sdk/models/components/serviceoutput.go | 410 ++++ .../components/serviceunavailableerror.go | 32 + .../internal/sdk/models/components/sni.go | 72 + .../models/components/sniwithoutparents.go | 72 + .../components/stringfieldcontainsfilter.go | 15 + .../models/components/stringfieldfilter.go | 47 + .../models/components/stringfieldneqfilter.go | 15 + .../components/stringfieldocontainsfilter.go | 15 + .../models/components/stringfieldoeqfilter.go | 15 + .../sdk/models/components/systemaccount.go | 77 + .../components/systemaccountaccesstoken.go | 77 + .../systemaccountaccesstokencollection.go | 24 + .../systemaccountaccesstokencreated.go | 86 + .../components/systemaccountcollection.go | 24 + .../internal/sdk/models/components/target.go | 79 + .../models/components/targetwithoutparents.go | 79 + .../internal/sdk/models/components/team.go | 90 + .../sdk/models/components/teamcollection.go | 24 + .../sdk/models/components/teamgroupmapping.go | 25 + .../components/teamgroupmappingcollection.go | 24 + .../sdk/models/components/teammapping.go | 25 + .../components/teammappingcollection.go | 15 + .../models/components/teammappingresponse.go | 89 + .../components/transitgatewaydnsconfig.go | 26 + .../components/transitgatewayresponse.go | 94 + .../transitgatewaysfilterparameters.go | 22 + .../models/components/transitgatewaystate.go | 53 + .../transitgatewaystatefieldequalsfilter.go | 76 + .../transitgatewaystatefieldfilter.go | 94 + ...transitgatewaystatefieldnotequalsfilter.go | 7 + ...ransitgatewaystatefieldorequalityfilter.go | 16 + .../updateappauthstrategyrequest.go | 159 ++ .../updateauthenticationsettings.go | 52 + .../models/components/updateconfigstore.go | 15 + .../components/updateconfigstoresecret.go | 14 + .../components/updatecontrolplanerequest.go | 87 + .../updatedcrconfigauth0inrequest.go | 49 + .../updatedcrconfigazureadinrequest.go | 29 + .../updatedcrconfigcurityinrequest.go | 29 + .../updatedcrconfighttpinrequest.go | 47 + .../updatedcrconfigoktainrequest.go | 18 + .../components/updatedcrproviderrequest.go | 192 ++ .../components/updateidentityprovider.go | 115 + .../components/updateidpconfiguration.go | 82 + .../updateimpersonationsettingsrequest.go | 16 + .../updateimpersonationsettingsresponse.go | 16 + .../models/components/updatesystemaccount.go | 25 + .../updatesystemaccountaccesstoken.go | 15 + .../sdk/models/components/updateteam.go | 39 + .../models/components/updateteammappings.go | 35 + .../sdk/models/components/updateuser.go | 25 + .../sdk/models/components/upstream.go | 657 +++++ .../internal/sdk/models/components/user.go | 95 + .../sdk/models/components/usercollection.go | 24 + .../models/components/userconfiguration.go | 55 + .../userconfigurationlistresponse.go | 15 + .../sdk/models/components/uuidfieldfilter.go | 31 + .../internal/sdk/models/components/vault.go | 78 + .../components/verifydcrproviderresponse.go | 54 + .../models/operations/addconsumertogroup.go | 86 + .../addconsumertospecificconsumergroup.go | 88 + .../sdk/models/operations/addusertoteam.go | 39 + .../sdk/models/operations/authenticatesso.go | 39 + .../models/operations/bulknotifications.go | 18 + .../operations/createaclwithconsumer.go | 57 + .../operations/createappauthstrategy.go | 41 + .../operations/createbasicauthwithconsumer.go | 57 + .../models/operations/createcacertificate.go | 48 + .../models/operations/createcertificate.go | 48 + .../models/operations/createconfigstore.go | 47 + .../operations/createconfigstoresecret.go | 56 + .../models/operations/createconfiguration.go | 27 + .../sdk/models/operations/createconsumer.go | 48 + .../models/operations/createconsumergroup.go | 48 + .../models/operations/createcontrolplane.go | 27 + .../models/operations/createcustomdomains.go | 27 + .../models/operations/createcustomplugin.go | 48 + .../operations/createdataplanecertificate.go | 48 + .../models/operations/createdcrprovider.go | 62 + .../createdegraphqlroutewithservice.go | 57 + .../operations/createeventsubscription.go | 48 + .../operations/createhmacauthwithconsumer.go | 57 + .../operations/createidentityprovider.go | 28 + .../operations/createjwtwithconsumer.go | 57 + .../sdk/models/operations/createkey.go | 48 + .../operations/createkeyauthwithconsumer.go | 57 + .../sdk/models/operations/createkeyset.go | 48 + .../models/operations/createkeywithkeyset.go | 57 + .../operations/createmtlsauthwithconsumer.go | 57 + .../sdk/models/operations/createnetwork.go | 27 + .../sdk/models/operations/createpartial.go | 48 + .../sdk/models/operations/createplugin.go | 48 + .../models/operations/createpluginschemas.go | 47 + .../operations/createpluginwithconsumer.go | 57 + .../createpluginwithconsumergroup.go | 57 + .../operations/createpluginwithroute.go | 57 + .../operations/createpluginwithservice.go | 57 + .../sdk/models/operations/createroute.go | 48 + .../operations/createroutewithservice.go | 57 + .../sdk/models/operations/createservice.go | 48 + .../sdk/models/operations/createsni.go | 48 + .../operations/createsniwithcertificate.go | 57 + .../operations/createtargetwithupstream.go | 57 + .../sdk/models/operations/createteam.go | 27 + .../models/operations/createtransitgateway.go | 47 + .../sdk/models/operations/createupstream.go | 48 + .../sdk/models/operations/createvault.go | 48 + .../operations/deleteaclwithconsumer.go | 48 + .../operations/deleteappauthstrategy.go | 30 + .../operations/deletebasicauthwithconsumer.go | 48 + .../models/operations/deletecacertificate.go | 39 + .../models/operations/deletecertificate.go | 39 + .../models/operations/deleteconfigstore.go | 89 + .../operations/deleteconfigstoresecret.go | 48 + .../sdk/models/operations/deleteconsumer.go | 39 + .../models/operations/deleteconsumergroup.go | 39 + .../models/operations/deletecontrolplane.go | 30 + .../models/operations/deletecustomdomain.go | 30 + .../models/operations/deletecustomplugin.go | 39 + .../operations/deletedataplanecertificate.go | 38 + .../models/operations/deletedcrprovider.go | 30 + .../deletedegraphqlroutewithservice.go | 48 + .../operations/deleteeventsubscription.go | 39 + .../operations/deletehmacauthwithconsumer.go | 48 + .../operations/deleteidentityprovider.go | 30 + .../operations/deletejwtwithconsumer.go | 48 + .../sdk/models/operations/deletekey.go | 39 + .../operations/deletekeyauthwithconsumer.go | 48 + .../sdk/models/operations/deletekeyset.go | 39 + .../models/operations/deletekeywithkeyset.go | 48 + .../operations/deletemtlsauthwithconsumer.go | 48 + .../sdk/models/operations/deletenetwork.go | 30 + .../models/operations/deletenodesnodeid.go | 39 + .../models/operations/deletenotification.go | 30 + .../sdk/models/operations/deletepartial.go | 39 + .../sdk/models/operations/deleteplugin.go | 39 + .../models/operations/deletepluginschemas.go | 39 + .../operations/deletepluginwithconsumer.go | 48 + .../deletepluginwithconsumergroup.go | 48 + .../operations/deletepluginwithroute.go | 48 + .../operations/deletepluginwithservice.go | 48 + .../sdk/models/operations/deleteroute.go | 39 + .../operations/deleteroutewithservice.go | 48 + .../sdk/models/operations/deleteservice.go | 39 + .../sdk/models/operations/deletesni.go | 39 + .../operations/deletesniwithcertificate.go | 48 + ...temaccountsaccountidassignedrolesroleid.go | 39 + .../operations/deletesystemaccountsid.go | 30 + .../deletesystemaccountsidaccesstokensid.go | 39 + .../operations/deletetargetwithupstream.go | 48 + .../sdk/models/operations/deleteteam.go | 30 + ...eleteteamsteamidsystemaccountsaccountid.go | 39 + .../models/operations/deletetransitgateway.go | 39 + .../sdk/models/operations/deleteupstream.go | 39 + .../sdk/models/operations/deleteuser.go | 30 + .../sdk/models/operations/deletevault.go | 39 + .../models/operations/fetchpluginschema.go | 60 + .../internal/sdk/models/operations/getacl.go | 48 + .../models/operations/getaclwithconsumer.go | 57 + .../models/operations/getappauthstrategy.go | 53 + .../operations/getauthenticationsettings.go | 27 + .../models/operations/getavailabilityjson.go | 27 + .../sdk/models/operations/getbasicauth.go | 48 + .../operations/getbasicauthwithconsumer.go | 57 + .../sdk/models/operations/getcacertificate.go | 48 + .../sdk/models/operations/getcertificate.go | 48 + .../sdk/models/operations/getconfigstore.go | 48 + .../models/operations/getconfigstoresecret.go | 57 + .../sdk/models/operations/getconfiguration.go | 39 + .../sdk/models/operations/getconsumer.go | 48 + .../sdk/models/operations/getconsumergroup.go | 48 + .../sdk/models/operations/getcontrolplane.go | 39 + .../getcontrolplanesidgroupmemberships.go | 57 + .../getcontrolplanesidgroupmemberstatus.go | 39 + .../getcontrolplanesidgroupstatus.go | 39 + .../sdk/models/operations/getcustomdomain.go | 39 + .../operations/getcustomdomainonlinestatus.go | 39 + .../sdk/models/operations/getcustomplugin.go | 48 + .../operations/getdataplanecertificate.go | 47 + .../sdk/models/operations/getdcrprovider.go | 74 + .../models/operations/getdegraphqlroute.go | 48 + .../getdegraphqlroutewithservice.go | 57 + .../models/operations/geteventsubscription.go | 48 + .../operations/getexpectedconfighash.go | 39 + .../sdk/models/operations/gethmacauth.go | 48 + .../operations/gethmacauthwithconsumer.go | 57 + .../models/operations/getidentityprovider.go | 40 + .../models/operations/getidentityproviders.go | 53 + .../models/operations/getidpconfiguration.go | 27 + .../models/operations/getidpteammappings.go | 48 + .../operations/getimpersonationsettings.go | 27 + .../internal/sdk/models/operations/getjwt.go | 48 + .../models/operations/getjwtwithconsumer.go | 57 + .../internal/sdk/models/operations/getkey.go | 48 + .../sdk/models/operations/getkeyauth.go | 48 + .../operations/getkeyauthwithconsumer.go | 57 + .../sdk/models/operations/getkeyset.go | 48 + .../sdk/models/operations/getkeywithkeyset.go | 57 + .../sdk/models/operations/getmtlsauth.go | 48 + .../operations/getmtlsauthwithconsumer.go | 57 + .../sdk/models/operations/getnetwork.go | 39 + .../sdk/models/operations/getnodeseol.go | 57 + .../sdk/models/operations/getnodesnodeid.go | 78 + .../operations/getnotificationdetails.go | 39 + .../models/operations/getorganizationsme.go | 27 + .../sdk/models/operations/getpartial.go | 48 + .../sdk/models/operations/getplugin.go | 48 + .../sdk/models/operations/getpluginschema.go | 48 + .../operations/getpluginwithconsumer.go | 57 + .../operations/getpluginwithconsumergroup.go | 57 + .../models/operations/getpluginwithroute.go | 57 + .../models/operations/getpluginwithservice.go | 57 + .../models/operations/getpredefinedroles.go | 27 + .../models/operations/getprovideraccount.go | 39 + .../operations/getresourceconfiguration.go | 39 + .../sdk/models/operations/getresourcequota.go | 39 + .../sdk/models/operations/getroute.go | 48 + .../models/operations/getroutewithservice.go | 57 + .../sdk/models/operations/getservice.go | 48 + .../internal/sdk/models/operations/getsni.go | 48 + .../operations/getsniwithcertificate.go | 57 + .../getsystemaccountidaccesstokens.go | 79 + .../models/operations/getsystemaccounts.go | 88 + ...getsystemaccountsaccountidassignedroles.go | 70 + .../getsystemaccountsaccountidteams.go | 79 + .../models/operations/getsystemaccountsid.go | 39 + .../getsystemaccountsidaccesstokensid.go | 48 + .../operations/gettargetwithupstream.go | 57 + .../internal/sdk/models/operations/getteam.go | 39 + .../models/operations/getteamgroupmappings.go | 48 + .../getteamsteamidsystemaccounts.go | 79 + .../models/operations/gettransitgateway.go | 48 + .../sdk/models/operations/getupstream.go | 48 + .../internal/sdk/models/operations/getuser.go | 39 + .../sdk/models/operations/getusersme.go | 27 + .../sdk/models/operations/getvault.go | 48 + .../sdk/models/operations/inviteuser.go | 18 + .../internal/sdk/models/operations/listacl.go | 108 + .../models/operations/listaclwithconsumer.go | 117 + .../operations/listappauthstrategies.go | 136 + .../sdk/models/operations/listbasicauth.go | 108 + .../operations/listbasicauthwithconsumer.go | 117 + .../models/operations/listcacertificate.go | 108 + .../sdk/models/operations/listcertificate.go | 108 + .../sdk/models/operations/listconfigstores.go | 57 + .../operations/listconfigstoresecrets.go | 66 + .../models/operations/listconfigurations.go | 57 + .../sdk/models/operations/listconsumer.go | 108 + .../models/operations/listconsumergroup.go | 108 + .../listconsumergroupsforconsumer.go | 117 + .../listconsumersforconsumergroup.go | 116 + .../models/operations/listcontrolplanes.go | 77 + .../models/operations/listcustomdomains.go | 57 + .../sdk/models/operations/listcustomplugin.go | 108 + .../models/operations/listdataplanenodes.go | 57 + .../sdk/models/operations/listdcrproviders.go | 216 ++ .../listdefaultresourceconfigurations.go | 48 + .../operations/listdefaultresourcequotas.go | 48 + .../models/operations/listdegraphqlroute.go | 108 + .../listdegraphqlroutewithservice.go | 117 + .../operations/listdpclientcertificates.go | 39 + .../operations/listeventsubscriptions.go | 39 + .../sdk/models/operations/listhmacauth.go | 108 + .../operations/listhmacauthwithconsumer.go | 117 + .../internal/sdk/models/operations/listjwt.go | 108 + .../models/operations/listjwtwithconsumer.go | 117 + .../internal/sdk/models/operations/listkey.go | 108 + .../sdk/models/operations/listkeyauth.go | 108 + .../operations/listkeyauthwithconsumer.go | 117 + .../sdk/models/operations/listkeyset.go | 108 + .../models/operations/listkeywithkeyset.go | 117 + .../sdk/models/operations/listmtlsauth.go | 108 + .../operations/listmtlsauthwithconsumer.go | 117 + .../operations/listnetworkconfigurations.go | 57 + .../sdk/models/operations/listnetworks.go | 57 + .../models/operations/listnotifications.go | 57 + .../sdk/models/operations/listpartial.go | 108 + .../sdk/models/operations/listpartiallink.go | 126 + .../sdk/models/operations/listplugin.go | 108 + .../models/operations/listpluginschemas.go | 57 + .../operations/listpluginwithconsumer.go | 117 + .../operations/listpluginwithconsumergroup.go | 117 + .../models/operations/listpluginwithroute.go | 117 + .../operations/listpluginwithservice.go | 117 + .../models/operations/listprovideraccounts.go | 57 + .../operations/listresourceconfigurations.go | 48 + .../models/operations/listresourcequotas.go | 48 + .../sdk/models/operations/listroute.go | 108 + .../models/operations/listroutewithservice.go | 117 + .../sdk/models/operations/listservice.go | 108 + .../internal/sdk/models/operations/listsni.go | 108 + .../operations/listsniwithcertificate.go | 117 + .../operations/listtargetwithupstream.go | 117 + .../sdk/models/operations/listteamroles.go | 70 + .../sdk/models/operations/listteams.go | 70 + .../sdk/models/operations/listteamusers.go | 106 + .../models/operations/listtransitgateways.go | 66 + .../sdk/models/operations/listupstream.go | 108 + .../operations/listuserconfigurations.go | 39 + .../sdk/models/operations/listuserroles.go | 70 + .../sdk/models/operations/listusers.go | 97 + .../sdk/models/operations/listuserteams.go | 79 + .../sdk/models/operations/listvault.go | 108 + .../operations/patchsystemaccountsid.go | 48 + .../patchsystemaccountsidaccesstokensid.go | 56 + .../operations/patchteamgroupmappings.go | 27 + .../postcontrolplanesidgroupmembershipsadd.go | 39 + ...stcontrolplanesidgroupmembershipsremove.go | 39 + .../models/operations/postsystemaccounts.go | 27 + ...ostsystemaccountsaccountidassignedroles.go | 48 + .../postsystemaccountsidaccesstokens.go | 48 + .../postteamsteamidsystemaccounts.go | 39 + .../putcontrolplanesidgroupmemberships.go | 39 + .../removeallconsumersfromconsumergroup.go | 38 + .../removeconsumerfromallconsumergroups.go | 39 + .../removeconsumerfromconsumergroup.go | 48 + .../operations/removeconsumerfromgroup.go | 46 + .../models/operations/removeuserfromteam.go | 39 + .../operations/replaceappauthstrategy.go | 69 + .../sdk/models/operations/teamsassignrole.go | 48 + .../sdk/models/operations/teamsremoverole.go | 39 + .../operations/updateappauthstrategy.go | 61 + .../updateauthenticationsettings.go | 27 + .../models/operations/updateconfigstore.go | 56 + .../operations/updateconfigstoresecret.go | 65 + .../models/operations/updatecontrolplane.go | 47 + .../models/operations/updatedcrprovider.go | 82 + .../operations/updateeventsubscription.go | 57 + .../operations/updateidentityprovider.go | 50 + .../operations/updateidpconfiguration.go | 27 + .../operations/updateidpteammappings.go | 27 + .../operations/updateimpersonationsettings.go | 27 + .../sdk/models/operations/updatenetwork.go | 47 + .../models/operations/updatenotification.go | 48 + .../models/operations/updatepluginschemas.go | 56 + .../sdk/models/operations/updateteam.go | 48 + .../sdk/models/operations/updateuser.go | 48 + .../operations/upsertaclwithconsumer.go | 66 + .../operations/upsertbasicauthwithconsumer.go | 66 + .../models/operations/upsertcacertificate.go | 57 + .../models/operations/upsertcertificate.go | 57 + .../sdk/models/operations/upsertconsumer.go | 57 + .../models/operations/upsertconsumergroup.go | 57 + .../models/operations/upsertcustomplugin.go | 57 + .../upsertdegraphqlroutewithservice.go | 66 + .../operations/upserthmacauthwithconsumer.go | 66 + .../operations/upsertjwtwithconsumer.go | 66 + .../sdk/models/operations/upsertkey.go | 57 + .../operations/upsertkeyauthwithconsumer.go | 66 + .../sdk/models/operations/upsertkeyset.go | 57 + .../models/operations/upsertkeywithkeyset.go | 66 + .../operations/upsertmtlsauthwithconsumer.go | 66 + .../sdk/models/operations/upsertpartial.go | 57 + .../sdk/models/operations/upsertplugin.go | 57 + .../operations/upsertpluginwithconsumer.go | 66 + .../upsertpluginwithconsumergroup.go | 66 + .../operations/upsertpluginwithroute.go | 66 + .../operations/upsertpluginwithservice.go | 66 + .../sdk/models/operations/upsertroute.go | 57 + .../operations/upsertroutewithservice.go | 66 + .../sdk/models/operations/upsertservice.go | 57 + .../sdk/models/operations/upsertsni.go | 57 + .../operations/upsertsniwithcertificate.go | 66 + .../operations/upserttargetwithupstream.go | 66 + .../sdk/models/operations/upsertupstream.go | 57 + .../sdk/models/operations/upsertvault.go | 57 + .../sdk/models/operations/usersassignrole.go | 48 + .../sdk/models/operations/usersremoverole.go | 39 + .../models/operations/verifydcrprovider.go | 39 + .../sdk/models/sdkerrors/badrequesterror.go | 44 + .../sdk/models/sdkerrors/baseerror.go | 42 + .../sdk/models/sdkerrors/conflicterror.go | 25 + .../sdk/models/sdkerrors/forbiddenerror.go | 25 + .../sdkerrors/gatewayunauthorizederror.go | 22 + .../models/sdkerrors/internalservererror.go | 28 + .../sdk/models/sdkerrors/notfounderror.go | 25 + .../sdkerrors/preconditionfailederror.go | 28 + .../sdk/models/sdkerrors/ratelimitederror.go | 28 + .../sdkerrors/serviceunavailableerror.go | 28 + .../sdk/models/sdkerrors/unauthorizederror.go | 25 + .../sdkerrors/unsupportedmediatypeerror.go | 25 + tests/mockserver/internal/sdk/types/bigint.go | 21 + tests/mockserver/internal/sdk/types/date.go | 90 + .../mockserver/internal/sdk/types/datetime.go | 23 + .../mockserver/internal/sdk/types/decimal.go | 20 + .../internal/sdk/types/jsonl/jsonl.go | 7 + .../mockserver/internal/sdk/types/pointers.go | 11 + tests/mockserver/internal/sdk/utils/json.go | 675 +++++ .../mockserver/internal/sdk/utils/reflect.go | 49 + tests/mockserver/internal/sdk/utils/sort.go | 94 + tests/mockserver/internal/server/doc.go | 4 + .../internal/server/generated_handlers.go | 17 + .../internal/server/internal_handlers.go | 343 +++ tests/mockserver/internal/server/server.go | 134 + .../internal/server/server_option.go | 30 + .../server/templates/log/index.html.tmpl | 22 + .../server/templates/log/operation.html.tmpl | 93 + .../server/templates/log/style.css.tmpl | 64 + .../internal/tracking/requesttracker.go | 47 + tests/mockserver/main.go | 74 + upstreams.go | 159 +- users.go | 129 +- vaults.go | 159 +- 691 files changed, 51182 insertions(+), 4276 deletions(-) create mode 100644 internal/config/sdkconfiguration.go create mode 100644 tests/mockserver/.gitignore create mode 100644 tests/mockserver/Dockerfile create mode 100644 tests/mockserver/Makefile create mode 100644 tests/mockserver/README.md create mode 100644 tests/mockserver/go.mod create mode 100644 tests/mockserver/go.sum create mode 100644 tests/mockserver/internal/handler/assert/contenttype.go create mode 100644 tests/mockserver/internal/handler/assert/header.go create mode 100644 tests/mockserver/internal/handler/assert/parameter.go create mode 100644 tests/mockserver/internal/handler/assert/pointer.go create mode 100644 tests/mockserver/internal/handler/assert/security.go create mode 100644 tests/mockserver/internal/handler/doc.go create mode 100644 tests/mockserver/internal/handler/generated_handler.go create mode 100644 tests/mockserver/internal/handler/generated_handlers.go create mode 100644 tests/mockserver/internal/handler/values/files.go create mode 100644 tests/mockserver/internal/logging/doc.go create mode 100644 tests/mockserver/internal/logging/formats.go create mode 100644 tests/mockserver/internal/logging/http_file.go create mode 100644 tests/mockserver/internal/logging/http_logger.go create mode 100644 tests/mockserver/internal/logging/levels.go create mode 100644 tests/mockserver/internal/logging/logger.go create mode 100644 tests/mockserver/internal/logging/oas_operation.go create mode 100644 tests/mockserver/internal/logging/oas_operation_call.go create mode 100644 tests/mockserver/internal/sdk/models/components/acl.go create mode 100644 tests/mockserver/internal/sdk/models/components/aclwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/addsystemaccounttoteam.go create mode 100644 tests/mockserver/internal/sdk/models/components/addusertoteam.go create mode 100644 tests/mockserver/internal/sdk/models/components/apiaccess.go create mode 100644 tests/mockserver/internal/sdk/models/components/appauthstrategy.go create mode 100644 tests/mockserver/internal/sdk/models/components/appauthstrategyconfigkeyauth.go create mode 100644 tests/mockserver/internal/sdk/models/components/appauthstrategyconfigopenidconnect.go create mode 100644 tests/mockserver/internal/sdk/models/components/assignedrole.go create mode 100644 tests/mockserver/internal/sdk/models/components/assignedrolecollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/assignrole.go create mode 100644 tests/mockserver/internal/sdk/models/components/authenticationsettings.go create mode 100644 tests/mockserver/internal/sdk/models/components/availabilitydocument.go create mode 100644 tests/mockserver/internal/sdk/models/components/awstransitgateway.go create mode 100644 tests/mockserver/internal/sdk/models/components/awstransitgatewayattachmentconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/awstransitgatewayresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/awsvpcpeeringgateway.go create mode 100644 tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayattachmentconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/azuretransitgateway.go create mode 100644 tests/mockserver/internal/sdk/models/components/azuretransitgatewayresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/azurevnetpeeringattachmentconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/basicauth.go create mode 100644 tests/mockserver/internal/sdk/models/components/basicauthwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/bulkpayload.go create mode 100644 tests/mockserver/internal/sdk/models/components/cacertificate.go create mode 100644 tests/mockserver/internal/sdk/models/components/certificate.go create mode 100644 tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldequalsfilteroverride.go create mode 100644 tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldfilteroverride.go create mode 100644 tests/mockserver/internal/sdk/models/components/configstore.go create mode 100644 tests/mockserver/internal/sdk/models/components/configstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationdataplanegroup.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscale.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscaleautopilot.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscalestatic.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationdataplanegroupconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationdataplanegroupenvironmentfield.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationmanifest.go create mode 100644 tests/mockserver/internal/sdk/models/components/configurationsfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/configureoidcidentityproviderconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/consumer.go create mode 100644 tests/mockserver/internal/sdk/models/components/consumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/components/consumergroupinsidewrapper.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplane.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplanefilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplanegeo.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplanegeofieldequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplanegeofieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplanegeofieldnotequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/controlplanegeofieldorequalityfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/createappauthstrategyrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createappauthstrategyresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/createconfigstore.go create mode 100644 tests/mockserver/internal/sdk/models/components/createconfigstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/components/createconfigurationdataplanegroup.go create mode 100644 tests/mockserver/internal/sdk/models/components/createconfigurationrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createcontrolplanerequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createcustomdomainrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrconfigauth0inrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrconfigazureadinrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrconfigcurityinrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrconfighttpinrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrconfigoktainrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderrequestauth0.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderrequestazuread.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderrequestcurity.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderrequesthttp.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderrequestokta.go create mode 100644 tests/mockserver/internal/sdk/models/components/createdcrproviderresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/createidentityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/components/createnetworkrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/createpluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/components/createsystemaccount.go create mode 100644 tests/mockserver/internal/sdk/models/components/createsystemaccountaccesstoken.go create mode 100644 tests/mockserver/internal/sdk/models/components/createteam.go create mode 100644 tests/mockserver/internal/sdk/models/components/createtransitgatewayrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/cursormeta.go create mode 100644 tests/mockserver/internal/sdk/models/components/cursormetapage.go create mode 100644 tests/mockserver/internal/sdk/models/components/cursormetawithsizeandtotal.go create mode 100644 tests/mockserver/internal/sdk/models/components/cursorpaginatedmetawithsizeandtotal.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomain.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainonlinepropertystatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainonlinestatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainsfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainstate.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainstatefieldequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainstatefieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainstatefieldnotequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/customdomainstatefieldorequalityfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/customplugin.go create mode 100644 tests/mockserver/internal/sdk/models/components/dataplaneclientcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/components/dataplaneclientcertificaterequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/dataplaneclientcertificateresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/dcrproviderresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/dcrprovidertype.go create mode 100644 tests/mockserver/internal/sdk/models/components/defaultresourceconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/components/defaultresourcequota.go create mode 100644 tests/mockserver/internal/sdk/models/components/defaultsubscription.go create mode 100644 tests/mockserver/internal/sdk/models/components/degraphqlroute.go create mode 100644 tests/mockserver/internal/sdk/models/components/degraphqlroutewithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/entitytypes.go create mode 100644 tests/mockserver/internal/sdk/models/components/eventsubscription.go create mode 100644 tests/mockserver/internal/sdk/models/components/eventsubscriptionlistresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/eventsubscriptionresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/getexpectedconfighashresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/getgroupstatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/getimpersonationsettingsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/getnode.go create mode 100644 tests/mockserver/internal/sdk/models/components/groupconflict.go create mode 100644 tests/mockserver/internal/sdk/models/components/groupconflictresource.go create mode 100644 tests/mockserver/internal/sdk/models/components/groupmembership.go create mode 100644 tests/mockserver/internal/sdk/models/components/groupmemberstatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/groupstatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/hmacauth.go create mode 100644 tests/mockserver/internal/sdk/models/components/hmacauthwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/httpmetadata.go create mode 100644 tests/mockserver/internal/sdk/models/components/identityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/components/identityprovidertype.go create mode 100644 tests/mockserver/internal/sdk/models/components/idfieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/idp.go create mode 100644 tests/mockserver/internal/sdk/models/components/instancetype.go create mode 100644 tests/mockserver/internal/sdk/models/components/instancetypename.go create mode 100644 tests/mockserver/internal/sdk/models/components/internalservererror.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidparameterchoiceitem.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidparameterdependentitem.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidparametermaximumlength.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidparameterminimumlength.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidparameterstandard.go create mode 100644 tests/mockserver/internal/sdk/models/components/invalidrules.go create mode 100644 tests/mockserver/internal/sdk/models/components/inviteuser.go create mode 100644 tests/mockserver/internal/sdk/models/components/jwt.go create mode 100644 tests/mockserver/internal/sdk/models/components/jwtwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/key.go create mode 100644 tests/mockserver/internal/sdk/models/components/keyauth.go create mode 100644 tests/mockserver/internal/sdk/models/components/keyauthwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/keyset.go create mode 100644 tests/mockserver/internal/sdk/models/components/keywithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/listappauthstrategiesresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listconfigstoresecretsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listconfigstoresresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listconfigurationsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listcontrolplanesresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listcustomdomainsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listdataplanecertificatesresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listdcrprovidersresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listdefaultresourceconfigurationsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listdefaultresourcequotasresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listgroupmemberships.go create mode 100644 tests/mockserver/internal/sdk/models/components/listnetworkconfigurationreferencesresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listnetworksresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listnodes.go create mode 100644 tests/mockserver/internal/sdk/models/components/listnodeseol.go create mode 100644 tests/mockserver/internal/sdk/models/components/listpluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/components/listprovideraccountsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listresourceconfigurationsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listresourcequotasresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/listtransitgatewaysresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/meorganization.go create mode 100644 tests/mockserver/internal/sdk/models/components/mtlsauth.go create mode 100644 tests/mockserver/internal/sdk/models/components/mtlsauthwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/network.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkconfigurationreference.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkcreatestate.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkprovidermetadata.go create mode 100644 tests/mockserver/internal/sdk/models/components/networksfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkstate.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkstatefieldequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkstatefieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkstatefieldnotequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkstatefieldorequalityfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/networkstatemetadata.go create mode 100644 tests/mockserver/internal/sdk/models/components/notification.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationchannel.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationchanneltype.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationlistresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationnamespace.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationregion.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationstatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/notificationupdatepayload.go create mode 100644 tests/mockserver/internal/sdk/models/components/oidcidentityproviderclaimmappings.go create mode 100644 tests/mockserver/internal/sdk/models/components/oidcidentityproviderconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/pagemeta.go create mode 100644 tests/mockserver/internal/sdk/models/components/paginatedmeta.go create mode 100644 tests/mockserver/internal/sdk/models/components/partial.go create mode 100644 tests/mockserver/internal/sdk/models/components/partialappauthstrategyconfigopenidconnect.go create mode 100644 tests/mockserver/internal/sdk/models/components/partiallink.go create mode 100644 tests/mockserver/internal/sdk/models/components/patchnetworkrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/patchteamgroupmappings.go create mode 100644 tests/mockserver/internal/sdk/models/components/plugin.go create mode 100644 tests/mockserver/internal/sdk/models/components/pluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/components/pluginwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/provider.go create mode 100644 tests/mockserver/internal/sdk/models/components/provideraccount.go create mode 100644 tests/mockserver/internal/sdk/models/components/provideraccountsfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/providername.go create mode 100644 tests/mockserver/internal/sdk/models/components/providerregion.go create mode 100644 tests/mockserver/internal/sdk/models/components/proxyurl.go create mode 100644 tests/mockserver/internal/sdk/models/components/resourceconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/components/resourceconfigurationqualifier.go create mode 100644 tests/mockserver/internal/sdk/models/components/resourcequota.go create mode 100644 tests/mockserver/internal/sdk/models/components/resourcequotaqualifier.go create mode 100644 tests/mockserver/internal/sdk/models/components/roles.go create mode 100644 tests/mockserver/internal/sdk/models/components/route.go create mode 100644 tests/mockserver/internal/sdk/models/components/routeexpression.go create mode 100644 tests/mockserver/internal/sdk/models/components/routejson.go create mode 100644 tests/mockserver/internal/sdk/models/components/routewithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/samlidentityproviderconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/samlidentityproviderconfiginput.go create mode 100644 tests/mockserver/internal/sdk/models/components/security.go create mode 100644 tests/mockserver/internal/sdk/models/components/serviceoutput.go create mode 100644 tests/mockserver/internal/sdk/models/components/serviceunavailableerror.go create mode 100644 tests/mockserver/internal/sdk/models/components/sni.go create mode 100644 tests/mockserver/internal/sdk/models/components/sniwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/stringfieldcontainsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/stringfieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/stringfieldneqfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/stringfieldocontainsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/stringfieldoeqfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/systemaccount.go create mode 100644 tests/mockserver/internal/sdk/models/components/systemaccountaccesstoken.go create mode 100644 tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencreated.go create mode 100644 tests/mockserver/internal/sdk/models/components/systemaccountcollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/target.go create mode 100644 tests/mockserver/internal/sdk/models/components/targetwithoutparents.go create mode 100644 tests/mockserver/internal/sdk/models/components/team.go create mode 100644 tests/mockserver/internal/sdk/models/components/teamcollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/teamgroupmapping.go create mode 100644 tests/mockserver/internal/sdk/models/components/teamgroupmappingcollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/teammapping.go create mode 100644 tests/mockserver/internal/sdk/models/components/teammappingcollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/teammappingresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaydnsconfig.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewayresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaysfilterparameters.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaystate.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldnotequalsfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldorequalityfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateappauthstrategyrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateauthenticationsettings.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateconfigstore.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateconfigstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatecontrolplanerequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatedcrconfigauth0inrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatedcrconfigazureadinrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatedcrconfigcurityinrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatedcrconfighttpinrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatedcrconfigoktainrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatedcrproviderrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateidentityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateidpconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsrequest.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatesystemaccount.go create mode 100644 tests/mockserver/internal/sdk/models/components/updatesystemaccountaccesstoken.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateteam.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateteammappings.go create mode 100644 tests/mockserver/internal/sdk/models/components/updateuser.go create mode 100644 tests/mockserver/internal/sdk/models/components/upstream.go create mode 100644 tests/mockserver/internal/sdk/models/components/user.go create mode 100644 tests/mockserver/internal/sdk/models/components/usercollection.go create mode 100644 tests/mockserver/internal/sdk/models/components/userconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/components/userconfigurationlistresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/uuidfieldfilter.go create mode 100644 tests/mockserver/internal/sdk/models/components/vault.go create mode 100644 tests/mockserver/internal/sdk/models/components/verifydcrproviderresponse.go create mode 100644 tests/mockserver/internal/sdk/models/operations/addconsumertogroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/addconsumertospecificconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/addusertoteam.go create mode 100644 tests/mockserver/internal/sdk/models/operations/authenticatesso.go create mode 100644 tests/mockserver/internal/sdk/models/operations/bulknotifications.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createaclwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createappauthstrategy.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createbasicauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createcacertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createconfigstore.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createconfigstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createcontrolplane.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createcustomdomains.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createcustomplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createdataplanecertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createdcrprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createdegraphqlroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createeventsubscription.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createhmacauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createidentityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createjwtwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createkey.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createkeyauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createkeywithkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createmtlsauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createnetwork.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createpartial.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createpluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createpluginwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createpluginwithconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createpluginwithroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createpluginwithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createsni.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createsniwithcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createtargetwithupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createteam.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createtransitgateway.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/createvault.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteaclwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteappauthstrategy.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletebasicauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletecacertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletecertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteconfigstore.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteconfigstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletecontrolplane.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletecustomdomain.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletecustomplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletedataplanecertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletedcrprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletedegraphqlroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteeventsubscription.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletehmacauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteidentityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletejwtwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletekey.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletekeyauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletekeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletekeywithkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletemtlsauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletenetwork.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletenodesnodeid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletenotification.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletepartial.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletepluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletepluginwithroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletepluginwithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletesni.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletesniwithcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletesystemaccountsaccountidassignedrolesroleid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletesystemaccountsid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletesystemaccountsidaccesstokensid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletetargetwithupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteteam.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteteamsteamidsystemaccountsaccountid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletetransitgateway.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deleteuser.go create mode 100644 tests/mockserver/internal/sdk/models/operations/deletevault.go create mode 100644 tests/mockserver/internal/sdk/models/operations/fetchpluginschema.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getacl.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getaclwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getappauthstrategy.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getauthenticationsettings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getavailabilityjson.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getbasicauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getbasicauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcacertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getconfigstore.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getconfigstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcontrolplane.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberships.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberstatus.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupstatus.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcustomdomain.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcustomdomainonlinestatus.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getcustomplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getdataplanecertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getdcrprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getdegraphqlroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getdegraphqlroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/geteventsubscription.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getexpectedconfighash.go create mode 100644 tests/mockserver/internal/sdk/models/operations/gethmacauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/gethmacauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getidentityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getidentityproviders.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getidpconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getidpteammappings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getimpersonationsettings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getjwt.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getjwtwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getkey.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getkeyauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getkeyauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getkeywithkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getmtlsauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getmtlsauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getnetwork.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getnodeseol.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getnodesnodeid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getnotificationdetails.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getorganizationsme.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpartial.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpluginschema.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpluginwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpluginwithconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpluginwithroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpluginwithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getpredefinedroles.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getprovideraccount.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getresourceconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getresourcequota.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsni.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsniwithcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsystemaccountidaccesstokens.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsystemaccounts.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidassignedroles.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidteams.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsystemaccountsid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getsystemaccountsidaccesstokensid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/gettargetwithupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getteam.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getteamgroupmappings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getteamsteamidsystemaccounts.go create mode 100644 tests/mockserver/internal/sdk/models/operations/gettransitgateway.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getuser.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getusersme.go create mode 100644 tests/mockserver/internal/sdk/models/operations/getvault.go create mode 100644 tests/mockserver/internal/sdk/models/operations/inviteuser.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listacl.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listaclwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listappauthstrategies.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listbasicauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listbasicauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listcacertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconfigstores.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconfigstoresecrets.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconfigurations.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconsumergroupsforconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listconsumersforconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listcontrolplanes.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listcustomdomains.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listcustomplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdataplanenodes.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdcrproviders.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdefaultresourceconfigurations.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdefaultresourcequotas.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdegraphqlroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdegraphqlroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listdpclientcertificates.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listeventsubscriptions.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listhmacauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listhmacauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listjwt.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listjwtwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listkey.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listkeyauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listkeyauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listkeywithkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listmtlsauth.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listmtlsauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listnetworkconfigurations.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listnetworks.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listnotifications.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpartial.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpartiallink.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpluginwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpluginwithconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpluginwithroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listpluginwithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listprovideraccounts.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listresourceconfigurations.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listresourcequotas.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listsni.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listsniwithcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listtargetwithupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listteamroles.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listteams.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listteamusers.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listtransitgateways.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listuserconfigurations.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listuserroles.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listusers.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listuserteams.go create mode 100644 tests/mockserver/internal/sdk/models/operations/listvault.go create mode 100644 tests/mockserver/internal/sdk/models/operations/patchsystemaccountsid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/patchsystemaccountsidaccesstokensid.go create mode 100644 tests/mockserver/internal/sdk/models/operations/patchteamgroupmappings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsadd.go create mode 100644 tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsremove.go create mode 100644 tests/mockserver/internal/sdk/models/operations/postsystemaccounts.go create mode 100644 tests/mockserver/internal/sdk/models/operations/postsystemaccountsaccountidassignedroles.go create mode 100644 tests/mockserver/internal/sdk/models/operations/postsystemaccountsidaccesstokens.go create mode 100644 tests/mockserver/internal/sdk/models/operations/postteamsteamidsystemaccounts.go create mode 100644 tests/mockserver/internal/sdk/models/operations/putcontrolplanesidgroupmemberships.go create mode 100644 tests/mockserver/internal/sdk/models/operations/removeallconsumersfromconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/removeconsumerfromallconsumergroups.go create mode 100644 tests/mockserver/internal/sdk/models/operations/removeconsumerfromconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/removeconsumerfromgroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/removeuserfromteam.go create mode 100644 tests/mockserver/internal/sdk/models/operations/replaceappauthstrategy.go create mode 100644 tests/mockserver/internal/sdk/models/operations/teamsassignrole.go create mode 100644 tests/mockserver/internal/sdk/models/operations/teamsremoverole.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateappauthstrategy.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateauthenticationsettings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateconfigstore.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateconfigstoresecret.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updatecontrolplane.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updatedcrprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateeventsubscription.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateidentityprovider.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateidpconfiguration.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateidpteammappings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateimpersonationsettings.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updatenetwork.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updatenotification.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updatepluginschemas.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateteam.go create mode 100644 tests/mockserver/internal/sdk/models/operations/updateuser.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertaclwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertbasicauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertcacertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertcustomplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertdegraphqlroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upserthmacauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertjwtwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertkey.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertkeyauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertkeywithkeyset.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertmtlsauthwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertpartial.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertplugin.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumer.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumergroup.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertpluginwithroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertpluginwithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertroute.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertroutewithservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertservice.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertsni.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertsniwithcertificate.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upserttargetwithupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertupstream.go create mode 100644 tests/mockserver/internal/sdk/models/operations/upsertvault.go create mode 100644 tests/mockserver/internal/sdk/models/operations/usersassignrole.go create mode 100644 tests/mockserver/internal/sdk/models/operations/usersremoverole.go create mode 100644 tests/mockserver/internal/sdk/models/operations/verifydcrprovider.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/badrequesterror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/baseerror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/conflicterror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/forbiddenerror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/gatewayunauthorizederror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/internalservererror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/notfounderror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/preconditionfailederror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/ratelimitederror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/serviceunavailableerror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/unauthorizederror.go create mode 100644 tests/mockserver/internal/sdk/models/sdkerrors/unsupportedmediatypeerror.go create mode 100644 tests/mockserver/internal/sdk/types/bigint.go create mode 100644 tests/mockserver/internal/sdk/types/date.go create mode 100644 tests/mockserver/internal/sdk/types/datetime.go create mode 100644 tests/mockserver/internal/sdk/types/decimal.go create mode 100644 tests/mockserver/internal/sdk/types/jsonl/jsonl.go create mode 100644 tests/mockserver/internal/sdk/types/pointers.go create mode 100644 tests/mockserver/internal/sdk/utils/json.go create mode 100644 tests/mockserver/internal/sdk/utils/reflect.go create mode 100644 tests/mockserver/internal/sdk/utils/sort.go create mode 100644 tests/mockserver/internal/server/doc.go create mode 100644 tests/mockserver/internal/server/generated_handlers.go create mode 100644 tests/mockserver/internal/server/internal_handlers.go create mode 100644 tests/mockserver/internal/server/server.go create mode 100644 tests/mockserver/internal/server/server_option.go create mode 100644 tests/mockserver/internal/server/templates/log/index.html.tmpl create mode 100644 tests/mockserver/internal/server/templates/log/operation.html.tmpl create mode 100644 tests/mockserver/internal/server/templates/log/style.css.tmpl create mode 100644 tests/mockserver/internal/tracking/requesttracker.go create mode 100644 tests/mockserver/main.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 7a1b401c..c2274a70 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,16 +3,16 @@ id: b81e5def-5b1e-4753-ae7c-0efccc2e6f61 management: docChecksum: 900e219fd377dba982105df7e07317a6 docVersion: 0.0.1 - speakeasyVersion: 1.548.4 - generationVersion: 2.605.6 - releaseVersion: 0.3.1 - configChecksum: a76713de9e9f537a49e324c5d62ca1d0 + speakeasyVersion: 1.570.2 + generationVersion: 2.638.5 + releaseVersion: 0.3.2 + configChecksum: e74101dd3c5f1676567c207d553a68a3 features: go: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 constsAndDefaults: 0.1.12 - core: 3.7.5 + core: 3.8.1 deepObjectParams: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 2.81.3 @@ -25,12 +25,13 @@ features: inputOutputModels: 2.83.0 intellisenseMarkdownSupport: 0.1.0 methodServerURLs: 2.82.1 + mockServer: 0.1.0 nameOverrides: 2.81.2 nullables: 0.1.1 responseFormat: 0.1.2 - retries: 2.83.2 - sdkHooks: 0.1.0 - unions: 2.85.10 + retries: 2.83.3 + sdkHooks: 0.2.0 + unions: 2.85.11 generatedFiles: - .gitattributes - /models/components/acl.go @@ -1906,6 +1907,7 @@ generatedFiles: - go.mod - hmacauthcredentials.go - impersonationsettings.go + - internal/config/sdkconfiguration.go - internal/hooks/hooks.go - internal/utils/contenttype.go - internal/utils/env.go @@ -1943,6 +1945,642 @@ generatedFiles: - targets.go - teammembership.go - teams.go + - tests/mockserver/.gitignore + - tests/mockserver/Dockerfile + - tests/mockserver/Makefile + - tests/mockserver/README.md + - tests/mockserver/go.mod + - tests/mockserver/go.sum + - tests/mockserver/internal/handler/assert/contenttype.go + - tests/mockserver/internal/handler/assert/header.go + - tests/mockserver/internal/handler/assert/parameter.go + - tests/mockserver/internal/handler/assert/pointer.go + - tests/mockserver/internal/handler/assert/security.go + - tests/mockserver/internal/handler/doc.go + - tests/mockserver/internal/handler/generated_handler.go + - tests/mockserver/internal/handler/generated_handlers.go + - tests/mockserver/internal/handler/values/files.go + - tests/mockserver/internal/logging/doc.go + - tests/mockserver/internal/logging/formats.go + - tests/mockserver/internal/logging/http_file.go + - tests/mockserver/internal/logging/http_logger.go + - tests/mockserver/internal/logging/levels.go + - tests/mockserver/internal/logging/logger.go + - tests/mockserver/internal/logging/oas_operation.go + - tests/mockserver/internal/logging/oas_operation_call.go + - tests/mockserver/internal/sdk/models/components/acl.go + - tests/mockserver/internal/sdk/models/components/aclwithoutparents.go + - tests/mockserver/internal/sdk/models/components/addsystemaccounttoteam.go + - tests/mockserver/internal/sdk/models/components/addusertoteam.go + - tests/mockserver/internal/sdk/models/components/apiaccess.go + - tests/mockserver/internal/sdk/models/components/appauthstrategy.go + - tests/mockserver/internal/sdk/models/components/appauthstrategyconfigkeyauth.go + - tests/mockserver/internal/sdk/models/components/appauthstrategyconfigopenidconnect.go + - tests/mockserver/internal/sdk/models/components/assignedrole.go + - tests/mockserver/internal/sdk/models/components/assignedrolecollection.go + - tests/mockserver/internal/sdk/models/components/assignrole.go + - tests/mockserver/internal/sdk/models/components/authenticationsettings.go + - tests/mockserver/internal/sdk/models/components/availabilitydocument.go + - tests/mockserver/internal/sdk/models/components/awstransitgateway.go + - tests/mockserver/internal/sdk/models/components/awstransitgatewayattachmentconfig.go + - tests/mockserver/internal/sdk/models/components/awstransitgatewayresponse.go + - tests/mockserver/internal/sdk/models/components/awsvpcpeeringgateway.go + - tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayattachmentconfig.go + - tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayresponse.go + - tests/mockserver/internal/sdk/models/components/azuretransitgateway.go + - tests/mockserver/internal/sdk/models/components/azuretransitgatewayresponse.go + - tests/mockserver/internal/sdk/models/components/azurevnetpeeringattachmentconfig.go + - tests/mockserver/internal/sdk/models/components/basicauth.go + - tests/mockserver/internal/sdk/models/components/basicauthwithoutparents.go + - tests/mockserver/internal/sdk/models/components/bulkpayload.go + - tests/mockserver/internal/sdk/models/components/cacertificate.go + - tests/mockserver/internal/sdk/models/components/certificate.go + - tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldequalsfilteroverride.go + - tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldfilteroverride.go + - tests/mockserver/internal/sdk/models/components/configstore.go + - tests/mockserver/internal/sdk/models/components/configstoresecret.go + - tests/mockserver/internal/sdk/models/components/configurationdataplanegroup.go + - tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscale.go + - tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscaleautopilot.go + - tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscalestatic.go + - tests/mockserver/internal/sdk/models/components/configurationdataplanegroupconfig.go + - tests/mockserver/internal/sdk/models/components/configurationdataplanegroupenvironmentfield.go + - tests/mockserver/internal/sdk/models/components/configurationfilterparameters.go + - tests/mockserver/internal/sdk/models/components/configurationmanifest.go + - tests/mockserver/internal/sdk/models/components/configurationsfilterparameters.go + - tests/mockserver/internal/sdk/models/components/configureoidcidentityproviderconfig.go + - tests/mockserver/internal/sdk/models/components/consumer.go + - tests/mockserver/internal/sdk/models/components/consumergroup.go + - tests/mockserver/internal/sdk/models/components/consumergroupinsidewrapper.go + - tests/mockserver/internal/sdk/models/components/controlplane.go + - tests/mockserver/internal/sdk/models/components/controlplanefilterparameters.go + - tests/mockserver/internal/sdk/models/components/controlplanegeo.go + - tests/mockserver/internal/sdk/models/components/controlplanegeofieldequalsfilter.go + - tests/mockserver/internal/sdk/models/components/controlplanegeofieldfilter.go + - tests/mockserver/internal/sdk/models/components/controlplanegeofieldnotequalsfilter.go + - tests/mockserver/internal/sdk/models/components/controlplanegeofieldorequalityfilter.go + - tests/mockserver/internal/sdk/models/components/createappauthstrategyrequest.go + - tests/mockserver/internal/sdk/models/components/createappauthstrategyresponse.go + - tests/mockserver/internal/sdk/models/components/createconfigstore.go + - tests/mockserver/internal/sdk/models/components/createconfigstoresecret.go + - tests/mockserver/internal/sdk/models/components/createconfigurationdataplanegroup.go + - tests/mockserver/internal/sdk/models/components/createconfigurationrequest.go + - tests/mockserver/internal/sdk/models/components/createcontrolplanerequest.go + - tests/mockserver/internal/sdk/models/components/createcustomdomainrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrconfigauth0inrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrconfigazureadinrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrconfigcurityinrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrconfighttpinrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrconfigoktainrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderrequest.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderrequestauth0.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderrequestazuread.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderrequestcurity.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderrequesthttp.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderrequestokta.go + - tests/mockserver/internal/sdk/models/components/createdcrproviderresponse.go + - tests/mockserver/internal/sdk/models/components/createidentityprovider.go + - tests/mockserver/internal/sdk/models/components/createnetworkrequest.go + - tests/mockserver/internal/sdk/models/components/createpluginschemas.go + - tests/mockserver/internal/sdk/models/components/createsystemaccount.go + - tests/mockserver/internal/sdk/models/components/createsystemaccountaccesstoken.go + - tests/mockserver/internal/sdk/models/components/createteam.go + - tests/mockserver/internal/sdk/models/components/createtransitgatewayrequest.go + - tests/mockserver/internal/sdk/models/components/cursormeta.go + - tests/mockserver/internal/sdk/models/components/cursormetapage.go + - tests/mockserver/internal/sdk/models/components/cursormetawithsizeandtotal.go + - tests/mockserver/internal/sdk/models/components/cursorpaginatedmetawithsizeandtotal.go + - tests/mockserver/internal/sdk/models/components/customdomain.go + - tests/mockserver/internal/sdk/models/components/customdomainonlinepropertystatus.go + - tests/mockserver/internal/sdk/models/components/customdomainonlinestatus.go + - tests/mockserver/internal/sdk/models/components/customdomainsfilterparameters.go + - tests/mockserver/internal/sdk/models/components/customdomainstate.go + - tests/mockserver/internal/sdk/models/components/customdomainstatefieldequalsfilter.go + - tests/mockserver/internal/sdk/models/components/customdomainstatefieldfilter.go + - tests/mockserver/internal/sdk/models/components/customdomainstatefieldnotequalsfilter.go + - tests/mockserver/internal/sdk/models/components/customdomainstatefieldorequalityfilter.go + - tests/mockserver/internal/sdk/models/components/customplugin.go + - tests/mockserver/internal/sdk/models/components/dataplaneclientcertificate.go + - tests/mockserver/internal/sdk/models/components/dataplaneclientcertificaterequest.go + - tests/mockserver/internal/sdk/models/components/dataplaneclientcertificateresponse.go + - tests/mockserver/internal/sdk/models/components/dcrproviderresponse.go + - tests/mockserver/internal/sdk/models/components/dcrprovidertype.go + - tests/mockserver/internal/sdk/models/components/defaultresourceconfiguration.go + - tests/mockserver/internal/sdk/models/components/defaultresourcequota.go + - tests/mockserver/internal/sdk/models/components/defaultsubscription.go + - tests/mockserver/internal/sdk/models/components/degraphqlroute.go + - tests/mockserver/internal/sdk/models/components/degraphqlroutewithoutparents.go + - tests/mockserver/internal/sdk/models/components/entitytypes.go + - tests/mockserver/internal/sdk/models/components/eventsubscription.go + - tests/mockserver/internal/sdk/models/components/eventsubscriptionlistresponse.go + - tests/mockserver/internal/sdk/models/components/eventsubscriptionresponse.go + - tests/mockserver/internal/sdk/models/components/getexpectedconfighashresponse.go + - tests/mockserver/internal/sdk/models/components/getgroupstatus.go + - tests/mockserver/internal/sdk/models/components/getimpersonationsettingsresponse.go + - tests/mockserver/internal/sdk/models/components/getnode.go + - tests/mockserver/internal/sdk/models/components/groupconflict.go + - tests/mockserver/internal/sdk/models/components/groupconflictresource.go + - tests/mockserver/internal/sdk/models/components/groupmembership.go + - tests/mockserver/internal/sdk/models/components/groupmemberstatus.go + - tests/mockserver/internal/sdk/models/components/groupstatus.go + - tests/mockserver/internal/sdk/models/components/hmacauth.go + - tests/mockserver/internal/sdk/models/components/hmacauthwithoutparents.go + - tests/mockserver/internal/sdk/models/components/httpmetadata.go + - tests/mockserver/internal/sdk/models/components/identityprovider.go + - tests/mockserver/internal/sdk/models/components/identityprovidertype.go + - tests/mockserver/internal/sdk/models/components/idfieldfilter.go + - tests/mockserver/internal/sdk/models/components/idp.go + - tests/mockserver/internal/sdk/models/components/instancetype.go + - tests/mockserver/internal/sdk/models/components/instancetypename.go + - tests/mockserver/internal/sdk/models/components/internalservererror.go + - tests/mockserver/internal/sdk/models/components/invalidparameterchoiceitem.go + - tests/mockserver/internal/sdk/models/components/invalidparameterdependentitem.go + - tests/mockserver/internal/sdk/models/components/invalidparametermaximumlength.go + - tests/mockserver/internal/sdk/models/components/invalidparameterminimumlength.go + - tests/mockserver/internal/sdk/models/components/invalidparameters.go + - tests/mockserver/internal/sdk/models/components/invalidparameterstandard.go + - tests/mockserver/internal/sdk/models/components/invalidrules.go + - tests/mockserver/internal/sdk/models/components/inviteuser.go + - tests/mockserver/internal/sdk/models/components/jwt.go + - tests/mockserver/internal/sdk/models/components/jwtwithoutparents.go + - tests/mockserver/internal/sdk/models/components/key.go + - tests/mockserver/internal/sdk/models/components/keyauth.go + - tests/mockserver/internal/sdk/models/components/keyauthwithoutparents.go + - tests/mockserver/internal/sdk/models/components/keyset.go + - tests/mockserver/internal/sdk/models/components/keywithoutparents.go + - tests/mockserver/internal/sdk/models/components/listappauthstrategiesresponse.go + - tests/mockserver/internal/sdk/models/components/listconfigstoresecretsresponse.go + - tests/mockserver/internal/sdk/models/components/listconfigstoresresponse.go + - tests/mockserver/internal/sdk/models/components/listconfigurationsresponse.go + - tests/mockserver/internal/sdk/models/components/listcontrolplanesresponse.go + - tests/mockserver/internal/sdk/models/components/listcustomdomainsresponse.go + - tests/mockserver/internal/sdk/models/components/listdataplanecertificatesresponse.go + - tests/mockserver/internal/sdk/models/components/listdcrprovidersresponse.go + - tests/mockserver/internal/sdk/models/components/listdefaultresourceconfigurationsresponse.go + - tests/mockserver/internal/sdk/models/components/listdefaultresourcequotasresponse.go + - tests/mockserver/internal/sdk/models/components/listgroupmemberships.go + - tests/mockserver/internal/sdk/models/components/listnetworkconfigurationreferencesresponse.go + - tests/mockserver/internal/sdk/models/components/listnetworksresponse.go + - tests/mockserver/internal/sdk/models/components/listnodes.go + - tests/mockserver/internal/sdk/models/components/listnodeseol.go + - tests/mockserver/internal/sdk/models/components/listpluginschemas.go + - tests/mockserver/internal/sdk/models/components/listprovideraccountsresponse.go + - tests/mockserver/internal/sdk/models/components/listresourceconfigurationsresponse.go + - tests/mockserver/internal/sdk/models/components/listresourcequotasresponse.go + - tests/mockserver/internal/sdk/models/components/listtransitgatewaysresponse.go + - tests/mockserver/internal/sdk/models/components/meorganization.go + - tests/mockserver/internal/sdk/models/components/mtlsauth.go + - tests/mockserver/internal/sdk/models/components/mtlsauthwithoutparents.go + - tests/mockserver/internal/sdk/models/components/network.go + - tests/mockserver/internal/sdk/models/components/networkconfigurationreference.go + - tests/mockserver/internal/sdk/models/components/networkcreatestate.go + - tests/mockserver/internal/sdk/models/components/networkprovidermetadata.go + - tests/mockserver/internal/sdk/models/components/networksfilterparameters.go + - tests/mockserver/internal/sdk/models/components/networkstate.go + - tests/mockserver/internal/sdk/models/components/networkstatefieldequalsfilter.go + - tests/mockserver/internal/sdk/models/components/networkstatefieldfilter.go + - tests/mockserver/internal/sdk/models/components/networkstatefieldnotequalsfilter.go + - tests/mockserver/internal/sdk/models/components/networkstatefieldorequalityfilter.go + - tests/mockserver/internal/sdk/models/components/networkstatemetadata.go + - tests/mockserver/internal/sdk/models/components/notification.go + - tests/mockserver/internal/sdk/models/components/notificationchannel.go + - tests/mockserver/internal/sdk/models/components/notificationchanneltype.go + - tests/mockserver/internal/sdk/models/components/notificationfilterparameters.go + - tests/mockserver/internal/sdk/models/components/notificationlistresponse.go + - tests/mockserver/internal/sdk/models/components/notificationnamespace.go + - tests/mockserver/internal/sdk/models/components/notificationregion.go + - tests/mockserver/internal/sdk/models/components/notificationstatus.go + - tests/mockserver/internal/sdk/models/components/notificationupdatepayload.go + - tests/mockserver/internal/sdk/models/components/oidcidentityproviderclaimmappings.go + - tests/mockserver/internal/sdk/models/components/oidcidentityproviderconfig.go + - tests/mockserver/internal/sdk/models/components/pagemeta.go + - tests/mockserver/internal/sdk/models/components/paginatedmeta.go + - tests/mockserver/internal/sdk/models/components/partial.go + - tests/mockserver/internal/sdk/models/components/partialappauthstrategyconfigopenidconnect.go + - tests/mockserver/internal/sdk/models/components/partiallink.go + - tests/mockserver/internal/sdk/models/components/patchnetworkrequest.go + - tests/mockserver/internal/sdk/models/components/patchteamgroupmappings.go + - tests/mockserver/internal/sdk/models/components/plugin.go + - tests/mockserver/internal/sdk/models/components/pluginschemas.go + - tests/mockserver/internal/sdk/models/components/pluginwithoutparents.go + - tests/mockserver/internal/sdk/models/components/provider.go + - tests/mockserver/internal/sdk/models/components/provideraccount.go + - tests/mockserver/internal/sdk/models/components/provideraccountsfilterparameters.go + - tests/mockserver/internal/sdk/models/components/providername.go + - tests/mockserver/internal/sdk/models/components/providerregion.go + - tests/mockserver/internal/sdk/models/components/proxyurl.go + - tests/mockserver/internal/sdk/models/components/resourceconfiguration.go + - tests/mockserver/internal/sdk/models/components/resourceconfigurationqualifier.go + - tests/mockserver/internal/sdk/models/components/resourcequota.go + - tests/mockserver/internal/sdk/models/components/resourcequotaqualifier.go + - tests/mockserver/internal/sdk/models/components/roles.go + - tests/mockserver/internal/sdk/models/components/route.go + - tests/mockserver/internal/sdk/models/components/routeexpression.go + - tests/mockserver/internal/sdk/models/components/routejson.go + - tests/mockserver/internal/sdk/models/components/routewithoutparents.go + - tests/mockserver/internal/sdk/models/components/samlidentityproviderconfig.go + - tests/mockserver/internal/sdk/models/components/samlidentityproviderconfiginput.go + - tests/mockserver/internal/sdk/models/components/security.go + - tests/mockserver/internal/sdk/models/components/serviceoutput.go + - tests/mockserver/internal/sdk/models/components/serviceunavailableerror.go + - tests/mockserver/internal/sdk/models/components/sni.go + - tests/mockserver/internal/sdk/models/components/sniwithoutparents.go + - tests/mockserver/internal/sdk/models/components/stringfieldcontainsfilter.go + - tests/mockserver/internal/sdk/models/components/stringfieldfilter.go + - tests/mockserver/internal/sdk/models/components/stringfieldneqfilter.go + - tests/mockserver/internal/sdk/models/components/stringfieldocontainsfilter.go + - tests/mockserver/internal/sdk/models/components/stringfieldoeqfilter.go + - tests/mockserver/internal/sdk/models/components/systemaccount.go + - tests/mockserver/internal/sdk/models/components/systemaccountaccesstoken.go + - tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencollection.go + - tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencreated.go + - tests/mockserver/internal/sdk/models/components/systemaccountcollection.go + - tests/mockserver/internal/sdk/models/components/target.go + - tests/mockserver/internal/sdk/models/components/targetwithoutparents.go + - tests/mockserver/internal/sdk/models/components/team.go + - tests/mockserver/internal/sdk/models/components/teamcollection.go + - tests/mockserver/internal/sdk/models/components/teamgroupmapping.go + - tests/mockserver/internal/sdk/models/components/teamgroupmappingcollection.go + - tests/mockserver/internal/sdk/models/components/teammapping.go + - tests/mockserver/internal/sdk/models/components/teammappingcollection.go + - tests/mockserver/internal/sdk/models/components/teammappingresponse.go + - tests/mockserver/internal/sdk/models/components/transitgatewaydnsconfig.go + - tests/mockserver/internal/sdk/models/components/transitgatewayresponse.go + - tests/mockserver/internal/sdk/models/components/transitgatewaysfilterparameters.go + - tests/mockserver/internal/sdk/models/components/transitgatewaystate.go + - tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldequalsfilter.go + - tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldfilter.go + - tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldnotequalsfilter.go + - tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldorequalityfilter.go + - tests/mockserver/internal/sdk/models/components/updateappauthstrategyrequest.go + - tests/mockserver/internal/sdk/models/components/updateauthenticationsettings.go + - tests/mockserver/internal/sdk/models/components/updateconfigstore.go + - tests/mockserver/internal/sdk/models/components/updateconfigstoresecret.go + - tests/mockserver/internal/sdk/models/components/updatecontrolplanerequest.go + - tests/mockserver/internal/sdk/models/components/updatedcrconfigauth0inrequest.go + - tests/mockserver/internal/sdk/models/components/updatedcrconfigazureadinrequest.go + - tests/mockserver/internal/sdk/models/components/updatedcrconfigcurityinrequest.go + - tests/mockserver/internal/sdk/models/components/updatedcrconfighttpinrequest.go + - tests/mockserver/internal/sdk/models/components/updatedcrconfigoktainrequest.go + - tests/mockserver/internal/sdk/models/components/updatedcrproviderrequest.go + - tests/mockserver/internal/sdk/models/components/updateidentityprovider.go + - tests/mockserver/internal/sdk/models/components/updateidpconfiguration.go + - tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsrequest.go + - tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsresponse.go + - tests/mockserver/internal/sdk/models/components/updatesystemaccount.go + - tests/mockserver/internal/sdk/models/components/updatesystemaccountaccesstoken.go + - tests/mockserver/internal/sdk/models/components/updateteam.go + - tests/mockserver/internal/sdk/models/components/updateteammappings.go + - tests/mockserver/internal/sdk/models/components/updateuser.go + - tests/mockserver/internal/sdk/models/components/upstream.go + - tests/mockserver/internal/sdk/models/components/user.go + - tests/mockserver/internal/sdk/models/components/usercollection.go + - tests/mockserver/internal/sdk/models/components/userconfiguration.go + - tests/mockserver/internal/sdk/models/components/userconfigurationlistresponse.go + - tests/mockserver/internal/sdk/models/components/uuidfieldfilter.go + - tests/mockserver/internal/sdk/models/components/vault.go + - tests/mockserver/internal/sdk/models/components/verifydcrproviderresponse.go + - tests/mockserver/internal/sdk/models/operations/addconsumertogroup.go + - tests/mockserver/internal/sdk/models/operations/addconsumertospecificconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/addusertoteam.go + - tests/mockserver/internal/sdk/models/operations/authenticatesso.go + - tests/mockserver/internal/sdk/models/operations/bulknotifications.go + - tests/mockserver/internal/sdk/models/operations/createaclwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createappauthstrategy.go + - tests/mockserver/internal/sdk/models/operations/createbasicauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createcacertificate.go + - tests/mockserver/internal/sdk/models/operations/createcertificate.go + - tests/mockserver/internal/sdk/models/operations/createconfigstore.go + - tests/mockserver/internal/sdk/models/operations/createconfigstoresecret.go + - tests/mockserver/internal/sdk/models/operations/createconfiguration.go + - tests/mockserver/internal/sdk/models/operations/createconsumer.go + - tests/mockserver/internal/sdk/models/operations/createconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/createcontrolplane.go + - tests/mockserver/internal/sdk/models/operations/createcustomdomains.go + - tests/mockserver/internal/sdk/models/operations/createcustomplugin.go + - tests/mockserver/internal/sdk/models/operations/createdataplanecertificate.go + - tests/mockserver/internal/sdk/models/operations/createdcrprovider.go + - tests/mockserver/internal/sdk/models/operations/createdegraphqlroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/createeventsubscription.go + - tests/mockserver/internal/sdk/models/operations/createhmacauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createidentityprovider.go + - tests/mockserver/internal/sdk/models/operations/createjwtwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createkey.go + - tests/mockserver/internal/sdk/models/operations/createkeyauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createkeyset.go + - tests/mockserver/internal/sdk/models/operations/createkeywithkeyset.go + - tests/mockserver/internal/sdk/models/operations/createmtlsauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createnetwork.go + - tests/mockserver/internal/sdk/models/operations/createpartial.go + - tests/mockserver/internal/sdk/models/operations/createplugin.go + - tests/mockserver/internal/sdk/models/operations/createpluginschemas.go + - tests/mockserver/internal/sdk/models/operations/createpluginwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/createpluginwithconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/createpluginwithroute.go + - tests/mockserver/internal/sdk/models/operations/createpluginwithservice.go + - tests/mockserver/internal/sdk/models/operations/createroute.go + - tests/mockserver/internal/sdk/models/operations/createroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/createservice.go + - tests/mockserver/internal/sdk/models/operations/createsni.go + - tests/mockserver/internal/sdk/models/operations/createsniwithcertificate.go + - tests/mockserver/internal/sdk/models/operations/createtargetwithupstream.go + - tests/mockserver/internal/sdk/models/operations/createteam.go + - tests/mockserver/internal/sdk/models/operations/createtransitgateway.go + - tests/mockserver/internal/sdk/models/operations/createupstream.go + - tests/mockserver/internal/sdk/models/operations/createvault.go + - tests/mockserver/internal/sdk/models/operations/deleteaclwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deleteappauthstrategy.go + - tests/mockserver/internal/sdk/models/operations/deletebasicauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deletecacertificate.go + - tests/mockserver/internal/sdk/models/operations/deletecertificate.go + - tests/mockserver/internal/sdk/models/operations/deleteconfigstore.go + - tests/mockserver/internal/sdk/models/operations/deleteconfigstoresecret.go + - tests/mockserver/internal/sdk/models/operations/deleteconsumer.go + - tests/mockserver/internal/sdk/models/operations/deleteconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/deletecontrolplane.go + - tests/mockserver/internal/sdk/models/operations/deletecustomdomain.go + - tests/mockserver/internal/sdk/models/operations/deletecustomplugin.go + - tests/mockserver/internal/sdk/models/operations/deletedataplanecertificate.go + - tests/mockserver/internal/sdk/models/operations/deletedcrprovider.go + - tests/mockserver/internal/sdk/models/operations/deletedegraphqlroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/deleteeventsubscription.go + - tests/mockserver/internal/sdk/models/operations/deletehmacauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deleteidentityprovider.go + - tests/mockserver/internal/sdk/models/operations/deletejwtwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deletekey.go + - tests/mockserver/internal/sdk/models/operations/deletekeyauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deletekeyset.go + - tests/mockserver/internal/sdk/models/operations/deletekeywithkeyset.go + - tests/mockserver/internal/sdk/models/operations/deletemtlsauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deletenetwork.go + - tests/mockserver/internal/sdk/models/operations/deletenodesnodeid.go + - tests/mockserver/internal/sdk/models/operations/deletenotification.go + - tests/mockserver/internal/sdk/models/operations/deletepartial.go + - tests/mockserver/internal/sdk/models/operations/deleteplugin.go + - tests/mockserver/internal/sdk/models/operations/deletepluginschemas.go + - tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/deletepluginwithroute.go + - tests/mockserver/internal/sdk/models/operations/deletepluginwithservice.go + - tests/mockserver/internal/sdk/models/operations/deleteroute.go + - tests/mockserver/internal/sdk/models/operations/deleteroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/deleteservice.go + - tests/mockserver/internal/sdk/models/operations/deletesni.go + - tests/mockserver/internal/sdk/models/operations/deletesniwithcertificate.go + - tests/mockserver/internal/sdk/models/operations/deletesystemaccountsaccountidassignedrolesroleid.go + - tests/mockserver/internal/sdk/models/operations/deletesystemaccountsid.go + - tests/mockserver/internal/sdk/models/operations/deletesystemaccountsidaccesstokensid.go + - tests/mockserver/internal/sdk/models/operations/deletetargetwithupstream.go + - tests/mockserver/internal/sdk/models/operations/deleteteam.go + - tests/mockserver/internal/sdk/models/operations/deleteteamsteamidsystemaccountsaccountid.go + - tests/mockserver/internal/sdk/models/operations/deletetransitgateway.go + - tests/mockserver/internal/sdk/models/operations/deleteupstream.go + - tests/mockserver/internal/sdk/models/operations/deleteuser.go + - tests/mockserver/internal/sdk/models/operations/deletevault.go + - tests/mockserver/internal/sdk/models/operations/fetchpluginschema.go + - tests/mockserver/internal/sdk/models/operations/getacl.go + - tests/mockserver/internal/sdk/models/operations/getaclwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getappauthstrategy.go + - tests/mockserver/internal/sdk/models/operations/getauthenticationsettings.go + - tests/mockserver/internal/sdk/models/operations/getavailabilityjson.go + - tests/mockserver/internal/sdk/models/operations/getbasicauth.go + - tests/mockserver/internal/sdk/models/operations/getbasicauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getcacertificate.go + - tests/mockserver/internal/sdk/models/operations/getcertificate.go + - tests/mockserver/internal/sdk/models/operations/getconfigstore.go + - tests/mockserver/internal/sdk/models/operations/getconfigstoresecret.go + - tests/mockserver/internal/sdk/models/operations/getconfiguration.go + - tests/mockserver/internal/sdk/models/operations/getconsumer.go + - tests/mockserver/internal/sdk/models/operations/getconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/getcontrolplane.go + - tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberships.go + - tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberstatus.go + - tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupstatus.go + - tests/mockserver/internal/sdk/models/operations/getcustomdomain.go + - tests/mockserver/internal/sdk/models/operations/getcustomdomainonlinestatus.go + - tests/mockserver/internal/sdk/models/operations/getcustomplugin.go + - tests/mockserver/internal/sdk/models/operations/getdataplanecertificate.go + - tests/mockserver/internal/sdk/models/operations/getdcrprovider.go + - tests/mockserver/internal/sdk/models/operations/getdegraphqlroute.go + - tests/mockserver/internal/sdk/models/operations/getdegraphqlroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/geteventsubscription.go + - tests/mockserver/internal/sdk/models/operations/getexpectedconfighash.go + - tests/mockserver/internal/sdk/models/operations/gethmacauth.go + - tests/mockserver/internal/sdk/models/operations/gethmacauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getidentityprovider.go + - tests/mockserver/internal/sdk/models/operations/getidentityproviders.go + - tests/mockserver/internal/sdk/models/operations/getidpconfiguration.go + - tests/mockserver/internal/sdk/models/operations/getidpteammappings.go + - tests/mockserver/internal/sdk/models/operations/getimpersonationsettings.go + - tests/mockserver/internal/sdk/models/operations/getjwt.go + - tests/mockserver/internal/sdk/models/operations/getjwtwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getkey.go + - tests/mockserver/internal/sdk/models/operations/getkeyauth.go + - tests/mockserver/internal/sdk/models/operations/getkeyauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getkeyset.go + - tests/mockserver/internal/sdk/models/operations/getkeywithkeyset.go + - tests/mockserver/internal/sdk/models/operations/getmtlsauth.go + - tests/mockserver/internal/sdk/models/operations/getmtlsauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getnetwork.go + - tests/mockserver/internal/sdk/models/operations/getnodeseol.go + - tests/mockserver/internal/sdk/models/operations/getnodesnodeid.go + - tests/mockserver/internal/sdk/models/operations/getnotificationdetails.go + - tests/mockserver/internal/sdk/models/operations/getorganizationsme.go + - tests/mockserver/internal/sdk/models/operations/getpartial.go + - tests/mockserver/internal/sdk/models/operations/getplugin.go + - tests/mockserver/internal/sdk/models/operations/getpluginschema.go + - tests/mockserver/internal/sdk/models/operations/getpluginwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/getpluginwithconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/getpluginwithroute.go + - tests/mockserver/internal/sdk/models/operations/getpluginwithservice.go + - tests/mockserver/internal/sdk/models/operations/getpredefinedroles.go + - tests/mockserver/internal/sdk/models/operations/getprovideraccount.go + - tests/mockserver/internal/sdk/models/operations/getresourceconfiguration.go + - tests/mockserver/internal/sdk/models/operations/getresourcequota.go + - tests/mockserver/internal/sdk/models/operations/getroute.go + - tests/mockserver/internal/sdk/models/operations/getroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/getservice.go + - tests/mockserver/internal/sdk/models/operations/getsni.go + - tests/mockserver/internal/sdk/models/operations/getsniwithcertificate.go + - tests/mockserver/internal/sdk/models/operations/getsystemaccountidaccesstokens.go + - tests/mockserver/internal/sdk/models/operations/getsystemaccounts.go + - tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidassignedroles.go + - tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidteams.go + - tests/mockserver/internal/sdk/models/operations/getsystemaccountsid.go + - tests/mockserver/internal/sdk/models/operations/getsystemaccountsidaccesstokensid.go + - tests/mockserver/internal/sdk/models/operations/gettargetwithupstream.go + - tests/mockserver/internal/sdk/models/operations/getteam.go + - tests/mockserver/internal/sdk/models/operations/getteamgroupmappings.go + - tests/mockserver/internal/sdk/models/operations/getteamsteamidsystemaccounts.go + - tests/mockserver/internal/sdk/models/operations/gettransitgateway.go + - tests/mockserver/internal/sdk/models/operations/getupstream.go + - tests/mockserver/internal/sdk/models/operations/getuser.go + - tests/mockserver/internal/sdk/models/operations/getusersme.go + - tests/mockserver/internal/sdk/models/operations/getvault.go + - tests/mockserver/internal/sdk/models/operations/inviteuser.go + - tests/mockserver/internal/sdk/models/operations/listacl.go + - tests/mockserver/internal/sdk/models/operations/listaclwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listappauthstrategies.go + - tests/mockserver/internal/sdk/models/operations/listbasicauth.go + - tests/mockserver/internal/sdk/models/operations/listbasicauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listcacertificate.go + - tests/mockserver/internal/sdk/models/operations/listcertificate.go + - tests/mockserver/internal/sdk/models/operations/listconfigstores.go + - tests/mockserver/internal/sdk/models/operations/listconfigstoresecrets.go + - tests/mockserver/internal/sdk/models/operations/listconfigurations.go + - tests/mockserver/internal/sdk/models/operations/listconsumer.go + - tests/mockserver/internal/sdk/models/operations/listconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/listconsumergroupsforconsumer.go + - tests/mockserver/internal/sdk/models/operations/listconsumersforconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/listcontrolplanes.go + - tests/mockserver/internal/sdk/models/operations/listcustomdomains.go + - tests/mockserver/internal/sdk/models/operations/listcustomplugin.go + - tests/mockserver/internal/sdk/models/operations/listdataplanenodes.go + - tests/mockserver/internal/sdk/models/operations/listdcrproviders.go + - tests/mockserver/internal/sdk/models/operations/listdefaultresourceconfigurations.go + - tests/mockserver/internal/sdk/models/operations/listdefaultresourcequotas.go + - tests/mockserver/internal/sdk/models/operations/listdegraphqlroute.go + - tests/mockserver/internal/sdk/models/operations/listdegraphqlroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/listdpclientcertificates.go + - tests/mockserver/internal/sdk/models/operations/listeventsubscriptions.go + - tests/mockserver/internal/sdk/models/operations/listhmacauth.go + - tests/mockserver/internal/sdk/models/operations/listhmacauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listjwt.go + - tests/mockserver/internal/sdk/models/operations/listjwtwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listkey.go + - tests/mockserver/internal/sdk/models/operations/listkeyauth.go + - tests/mockserver/internal/sdk/models/operations/listkeyauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listkeyset.go + - tests/mockserver/internal/sdk/models/operations/listkeywithkeyset.go + - tests/mockserver/internal/sdk/models/operations/listmtlsauth.go + - tests/mockserver/internal/sdk/models/operations/listmtlsauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listnetworkconfigurations.go + - tests/mockserver/internal/sdk/models/operations/listnetworks.go + - tests/mockserver/internal/sdk/models/operations/listnotifications.go + - tests/mockserver/internal/sdk/models/operations/listpartial.go + - tests/mockserver/internal/sdk/models/operations/listpartiallink.go + - tests/mockserver/internal/sdk/models/operations/listplugin.go + - tests/mockserver/internal/sdk/models/operations/listpluginschemas.go + - tests/mockserver/internal/sdk/models/operations/listpluginwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/listpluginwithconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/listpluginwithroute.go + - tests/mockserver/internal/sdk/models/operations/listpluginwithservice.go + - tests/mockserver/internal/sdk/models/operations/listprovideraccounts.go + - tests/mockserver/internal/sdk/models/operations/listresourceconfigurations.go + - tests/mockserver/internal/sdk/models/operations/listresourcequotas.go + - tests/mockserver/internal/sdk/models/operations/listroute.go + - tests/mockserver/internal/sdk/models/operations/listroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/listservice.go + - tests/mockserver/internal/sdk/models/operations/listsni.go + - tests/mockserver/internal/sdk/models/operations/listsniwithcertificate.go + - tests/mockserver/internal/sdk/models/operations/listtargetwithupstream.go + - tests/mockserver/internal/sdk/models/operations/listteamroles.go + - tests/mockserver/internal/sdk/models/operations/listteams.go + - tests/mockserver/internal/sdk/models/operations/listteamusers.go + - tests/mockserver/internal/sdk/models/operations/listtransitgateways.go + - tests/mockserver/internal/sdk/models/operations/listupstream.go + - tests/mockserver/internal/sdk/models/operations/listuserconfigurations.go + - tests/mockserver/internal/sdk/models/operations/listuserroles.go + - tests/mockserver/internal/sdk/models/operations/listusers.go + - tests/mockserver/internal/sdk/models/operations/listuserteams.go + - tests/mockserver/internal/sdk/models/operations/listvault.go + - tests/mockserver/internal/sdk/models/operations/patchsystemaccountsid.go + - tests/mockserver/internal/sdk/models/operations/patchsystemaccountsidaccesstokensid.go + - tests/mockserver/internal/sdk/models/operations/patchteamgroupmappings.go + - tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsadd.go + - tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsremove.go + - tests/mockserver/internal/sdk/models/operations/postsystemaccounts.go + - tests/mockserver/internal/sdk/models/operations/postsystemaccountsaccountidassignedroles.go + - tests/mockserver/internal/sdk/models/operations/postsystemaccountsidaccesstokens.go + - tests/mockserver/internal/sdk/models/operations/postteamsteamidsystemaccounts.go + - tests/mockserver/internal/sdk/models/operations/putcontrolplanesidgroupmemberships.go + - tests/mockserver/internal/sdk/models/operations/removeallconsumersfromconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/removeconsumerfromallconsumergroups.go + - tests/mockserver/internal/sdk/models/operations/removeconsumerfromconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/removeconsumerfromgroup.go + - tests/mockserver/internal/sdk/models/operations/removeuserfromteam.go + - tests/mockserver/internal/sdk/models/operations/replaceappauthstrategy.go + - tests/mockserver/internal/sdk/models/operations/teamsassignrole.go + - tests/mockserver/internal/sdk/models/operations/teamsremoverole.go + - tests/mockserver/internal/sdk/models/operations/updateappauthstrategy.go + - tests/mockserver/internal/sdk/models/operations/updateauthenticationsettings.go + - tests/mockserver/internal/sdk/models/operations/updateconfigstore.go + - tests/mockserver/internal/sdk/models/operations/updateconfigstoresecret.go + - tests/mockserver/internal/sdk/models/operations/updatecontrolplane.go + - tests/mockserver/internal/sdk/models/operations/updatedcrprovider.go + - tests/mockserver/internal/sdk/models/operations/updateeventsubscription.go + - tests/mockserver/internal/sdk/models/operations/updateidentityprovider.go + - tests/mockserver/internal/sdk/models/operations/updateidpconfiguration.go + - tests/mockserver/internal/sdk/models/operations/updateidpteammappings.go + - tests/mockserver/internal/sdk/models/operations/updateimpersonationsettings.go + - tests/mockserver/internal/sdk/models/operations/updatenetwork.go + - tests/mockserver/internal/sdk/models/operations/updatenotification.go + - tests/mockserver/internal/sdk/models/operations/updatepluginschemas.go + - tests/mockserver/internal/sdk/models/operations/updateteam.go + - tests/mockserver/internal/sdk/models/operations/updateuser.go + - tests/mockserver/internal/sdk/models/operations/upsertaclwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertbasicauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertcacertificate.go + - tests/mockserver/internal/sdk/models/operations/upsertcertificate.go + - tests/mockserver/internal/sdk/models/operations/upsertconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/upsertcustomplugin.go + - tests/mockserver/internal/sdk/models/operations/upsertdegraphqlroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/upserthmacauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertjwtwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertkey.go + - tests/mockserver/internal/sdk/models/operations/upsertkeyauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertkeyset.go + - tests/mockserver/internal/sdk/models/operations/upsertkeywithkeyset.go + - tests/mockserver/internal/sdk/models/operations/upsertmtlsauthwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertpartial.go + - tests/mockserver/internal/sdk/models/operations/upsertplugin.go + - tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumer.go + - tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumergroup.go + - tests/mockserver/internal/sdk/models/operations/upsertpluginwithroute.go + - tests/mockserver/internal/sdk/models/operations/upsertpluginwithservice.go + - tests/mockserver/internal/sdk/models/operations/upsertroute.go + - tests/mockserver/internal/sdk/models/operations/upsertroutewithservice.go + - tests/mockserver/internal/sdk/models/operations/upsertservice.go + - tests/mockserver/internal/sdk/models/operations/upsertsni.go + - tests/mockserver/internal/sdk/models/operations/upsertsniwithcertificate.go + - tests/mockserver/internal/sdk/models/operations/upserttargetwithupstream.go + - tests/mockserver/internal/sdk/models/operations/upsertupstream.go + - tests/mockserver/internal/sdk/models/operations/upsertvault.go + - tests/mockserver/internal/sdk/models/operations/usersassignrole.go + - tests/mockserver/internal/sdk/models/operations/usersremoverole.go + - tests/mockserver/internal/sdk/models/operations/verifydcrprovider.go + - tests/mockserver/internal/sdk/models/sdkerrors/badrequesterror.go + - tests/mockserver/internal/sdk/models/sdkerrors/baseerror.go + - tests/mockserver/internal/sdk/models/sdkerrors/conflicterror.go + - tests/mockserver/internal/sdk/models/sdkerrors/forbiddenerror.go + - tests/mockserver/internal/sdk/models/sdkerrors/gatewayunauthorizederror.go + - tests/mockserver/internal/sdk/models/sdkerrors/internalservererror.go + - tests/mockserver/internal/sdk/models/sdkerrors/notfounderror.go + - tests/mockserver/internal/sdk/models/sdkerrors/preconditionfailederror.go + - tests/mockserver/internal/sdk/models/sdkerrors/ratelimitederror.go + - tests/mockserver/internal/sdk/models/sdkerrors/serviceunavailableerror.go + - tests/mockserver/internal/sdk/models/sdkerrors/unauthorizederror.go + - tests/mockserver/internal/sdk/models/sdkerrors/unsupportedmediatypeerror.go + - tests/mockserver/internal/sdk/types/bigint.go + - tests/mockserver/internal/sdk/types/date.go + - tests/mockserver/internal/sdk/types/datetime.go + - tests/mockserver/internal/sdk/types/decimal.go + - tests/mockserver/internal/sdk/types/jsonl/jsonl.go + - tests/mockserver/internal/sdk/types/pointers.go + - tests/mockserver/internal/sdk/utils/json.go + - tests/mockserver/internal/sdk/utils/reflect.go + - tests/mockserver/internal/sdk/utils/sort.go + - tests/mockserver/internal/server/doc.go + - tests/mockserver/internal/server/generated_handlers.go + - tests/mockserver/internal/server/internal_handlers.go + - tests/mockserver/internal/server/server.go + - tests/mockserver/internal/server/server_option.go + - tests/mockserver/internal/server/templates/log/index.html.tmpl + - tests/mockserver/internal/server/templates/log/operation.html.tmpl + - tests/mockserver/internal/server/templates/log/style.css.tmpl + - tests/mockserver/internal/tracking/requesttracker.go + - tests/mockserver/main.go - types/bigint.go - types/date.go - types/datetime.go @@ -2809,6 +3447,18 @@ examples: application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"}]} "401": application/json: {"message": "", "status": 500789} + speakeasy-default-list-acl: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"}]} + "401": + application/json: {"message": "", "status": 500789} get-acl: "": parameters: @@ -2820,6 +3470,16 @@ examples: application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} "401": application/json: {"message": "", "status": 468894} + speakeasy-default-get-acl: + parameters: + path: + ACLId: "f28acbfa-c866-4587-b688-0208ac24df21" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} + "401": + application/json: {"message": "", "status": 468894} list-acl-with-consumer: "": parameters: @@ -2832,6 +3492,17 @@ examples: responses: "200": application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"}]} + speakeasy-default-list-acl-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"}]} create-acl-with-consumer: "": parameters: @@ -2843,6 +3514,16 @@ examples: responses: "201": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} + speakeasy-default-create-acl-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} + responses: + "201": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} delete-acl-with-consumer: "": parameters: @@ -2850,6 +3531,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" ACLId: "f28acbfa-c866-4587-b688-0208ac24df21" + speakeasy-default-delete-acl-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + ACLId: "f28acbfa-c866-4587-b688-0208ac24df21" get-acl-with-consumer: "": parameters: @@ -2860,6 +3547,15 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} + speakeasy-default-get-acl-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + ACLId: "f28acbfa-c866-4587-b688-0208ac24df21" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} upsert-acl-with-consumer: "": parameters: @@ -2872,6 +3568,17 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} + speakeasy-default-upsert-acl-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + ACLId: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "group": "foo", "id": "b1f34145-0343-41a4-9602-4c69dec2f269"} list-basic-auth: "": parameters: @@ -2885,6 +3592,18 @@ examples: application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"}]} "401": application/json: {"message": "", "status": 101752} + speakeasy-default-list-basic-auth: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"}]} + "401": + application/json: {"message": "", "status": 101752} get-basic-auth: "": parameters: @@ -2896,6 +3615,16 @@ examples: application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} "401": application/json: {"message": "", "status": 944690} + speakeasy-default-get-basic-auth: + parameters: + path: + BasicAuthId: "80db1b58-ca7c-4d21-b92a-64eb07725872" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} + "401": + application/json: {"message": "", "status": 944690} list-basic-auth-with-consumer: "": parameters: @@ -2908,6 +3637,17 @@ examples: responses: "200": application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"}]} + speakeasy-default-list-basic-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"}]} create-basic-auth-with-consumer: "": parameters: @@ -2919,6 +3659,16 @@ examples: responses: "201": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} + speakeasy-default-create-basic-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} + responses: + "201": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} delete-basic-auth-with-consumer: "": parameters: @@ -2926,6 +3676,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" BasicAuthId: "80db1b58-ca7c-4d21-b92a-64eb07725872" + speakeasy-default-delete-basic-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + BasicAuthId: "80db1b58-ca7c-4d21-b92a-64eb07725872" get-basic-auth-with-consumer: "": parameters: @@ -2936,6 +3692,15 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} + speakeasy-default-get-basic-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + BasicAuthId: "80db1b58-ca7c-4d21-b92a-64eb07725872" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} upsert-basic-auth-with-consumer: "": parameters: @@ -2948,6 +3713,17 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} + speakeasy-default-upsert-basic-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + BasicAuthId: "80db1b58-ca7c-4d21-b92a-64eb07725872" + requestBody: + application/json: {"id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "password": "hashedsoopersecretvalue", "username": "darius"} list-ca_certificate: "": parameters: @@ -2961,6 +3737,18 @@ examples: application/json: {"data": [{"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"}]} "401": application/json: {"message": "", "status": 281078} + speakeasy-default-list-ca-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"}]} + "401": + application/json: {"message": "", "status": 281078} create-ca_certificate: speakeasy-default-create-ca-certificate: parameters: @@ -2982,6 +3770,14 @@ examples: responses: "401": application/json: {"message": "", "status": 534948} + speakeasy-default-delete-ca-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CACertificateId: "3c31f18a-f27a-4f9b-8cd4-bf841554612f" + responses: + "401": + application/json: {"message": "", "status": 534948} get-ca_certificate: "": parameters: @@ -2993,6 +3789,16 @@ examples: application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"} "401": application/json: {"message": "", "status": 897051} + speakeasy-default-get-ca-certificate: + parameters: + path: + CACertificateId: "3c31f18a-f27a-4f9b-8cd4-bf841554612f" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"} + "401": + application/json: {"message": "", "status": 897051} upsert-ca_certificate: "": parameters: @@ -3006,6 +3812,18 @@ examples: application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"} "401": application/json: {"message": "", "status": 838404} + speakeasy-default-upsert-ca-certificate: + parameters: + path: + CACertificateId: "3c31f18a-f27a-4f9b-8cd4-bf841554612f" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"} + responses: + "200": + application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f260"} + "401": + application/json: {"message": "", "status": 838404} list-certificate: "": parameters: @@ -3019,6 +3837,18 @@ examples: application/json: {"data": [{"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"}]} "401": application/json: {"message": "", "status": 578370} + speakeasy-default-list-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"}]} + "401": + application/json: {"message": "", "status": 578370} create-certificate: speakeasy-default-create-certificate: parameters: @@ -3040,6 +3870,14 @@ examples: responses: "401": application/json: {"message": "", "status": 841627} + speakeasy-default-delete-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + responses: + "401": + application/json: {"message": "", "status": 841627} get-certificate: "": parameters: @@ -3051,6 +3889,16 @@ examples: application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"} "401": application/json: {"message": "", "status": 769994} + speakeasy-default-get-certificate: + parameters: + path: + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"} + "401": + application/json: {"message": "", "status": 769994} upsert-certificate: "": parameters: @@ -3064,6 +3912,18 @@ examples: application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"} "401": application/json: {"message": "", "status": 501690} + speakeasy-default-upsert-certificate: + parameters: + path: + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"} + responses: + "200": + application/json: {"cert": "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----"} + "401": + application/json: {"message": "", "status": 501690} list-sni-with-certificate: "": parameters: @@ -3076,6 +3936,17 @@ examples: responses: "200": application/json: {"data": [{"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"}]} + speakeasy-default-list-sni-with-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"}]} create-sni-with-certificate: "": parameters: @@ -3087,6 +3958,16 @@ examples: responses: "201": application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + speakeasy-default-create-sni-with-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + requestBody: + application/json: {"id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + responses: + "201": + application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} delete-sni-with-certificate: "": parameters: @@ -3094,6 +3975,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + speakeasy-default-delete-sni-with-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" get-sni-with-certificate: "": parameters: @@ -3104,6 +3991,15 @@ examples: responses: "200": application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + speakeasy-default-get-sni-with-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + responses: + "200": + application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} upsert-sni-with-certificate: "": parameters: @@ -3116,6 +4012,17 @@ examples: responses: "200": application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + speakeasy-default-upsert-sni-with-certificate: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CertificateId: "ddf3cdaa-3329-4961-822a-ce6dbd38eff7" + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + requestBody: + application/json: {"id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + responses: + "200": + application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} list-sni: "": parameters: @@ -3129,6 +4036,18 @@ examples: application/json: {"data": [{"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"}]} "401": application/json: {"message": "", "status": 842632} + speakeasy-default-list-sni: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"}]} + "401": + application/json: {"message": "", "status": 842632} create-sni: speakeasy-default-create-sni: parameters: @@ -3150,11 +4069,29 @@ examples: responses: "401": application/json: {"message": "", "status": 880922} - get-sni: - "": + speakeasy-default-delete-sni: parameters: path: - SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + responses: + "401": + application/json: {"message": "", "status": 880922} + get-sni: + "": + parameters: + path: + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + "401": + application/json: {"message": "", "status": 464092} + speakeasy-default-get-sni: + parameters: + path: + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" responses: "200": @@ -3174,6 +4111,18 @@ examples: application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} "401": application/json: {"message": "", "status": 361528} + speakeasy-default-upsert-sni: + parameters: + path: + SNIId: "64c17a1a-b7d7-4a65-a5a4-42e4a7016e7f" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + responses: + "200": + application/json: {"certificate": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "id": "36c4566c-14cc-4132-9011-4139fcbbe50a", "name": "some.example.org"} + "401": + application/json: {"message": "", "status": 361528} list-consumer_group: "": parameters: @@ -3187,6 +4136,18 @@ examples: application/json: {} "401": application/json: {"message": "", "status": 256390} + speakeasy-default-list-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {} + "401": + application/json: {"message": "", "status": 256390} create-consumer_group: speakeasy-default-create-consumer-group: parameters: @@ -3208,6 +4169,14 @@ examples: responses: "401": application/json: {"message": "", "status": 915587} + speakeasy-default-delete-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerGroupId: "" + responses: + "401": + application/json: {"message": "", "status": 915587} get-consumer_group: "": parameters: @@ -3219,6 +4188,16 @@ examples: application/json: {} "401": application/json: {"message": "", "status": 522065} + speakeasy-default-get-consumer-group: + parameters: + path: + ConsumerGroupId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {} + "401": + application/json: {"message": "", "status": 522065} upsert-consumer_group: "": parameters: @@ -3232,6 +4211,18 @@ examples: application/json: {"name": ""} "401": application/json: {"message": "", "status": 310688} + speakeasy-default-upsert-consumer-group: + parameters: + path: + ConsumerGroupId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"name": ""} + responses: + "200": + application/json: {"name": ""} + "401": + application/json: {"message": "", "status": 310688} remove-all-consumers-from-consumer-group: speakeasy-default-remove-all-consumers-from-consumer-group: parameters: @@ -3250,6 +4241,17 @@ examples: responses: "200": application/json: {"data": [{"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"}]} + speakeasy-default-list-consumers-for-consumer-group: + parameters: + path: + ConsumerGroupId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"}]} add-consumer-to-group: speakeasy-default-add-consumer-to-group: parameters: @@ -3274,6 +4276,11 @@ examples: path: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + speakeasy-default-remove-consumer-from-all-consumer-groups: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" list-consumer-groups-for-consumer: "": parameters: @@ -3286,6 +4293,17 @@ examples: responses: "200": application/json: {} + speakeasy-default-list-consumer-groups-for-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {} add-consumer-to-specific-consumer-group: "": parameters: @@ -3297,6 +4315,16 @@ examples: responses: "201": application/json: {"consumer": {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"}} + speakeasy-default-add-consumer-to-specific-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + requestBody: + application/json: {"group": "fedee695-2ae2-4e45-877a-776d9b2fc793"} + responses: + "201": + application/json: {"consumer": {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"}} remove-consumer-from-consumer-group: "": parameters: @@ -3304,6 +4332,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" ConsumerGroupId: "" + speakeasy-default-remove-consumer-from-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + ConsumerGroupId: "" list-plugin-with-consumer_group: "": parameters: @@ -3316,6 +4350,17 @@ examples: responses: "200": application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} + speakeasy-default-list-plugin-with-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerGroupId: "" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} create-plugin-with-consumer_group: "": parameters: @@ -3327,6 +4372,16 @@ examples: responses: "201": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-create-plugin-with-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerGroupId: "" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "201": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} delete-plugin-with-consumer_group: "": parameters: @@ -3334,6 +4389,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerGroupId: "" PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + speakeasy-default-delete-plugin-with-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerGroupId: "" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" get-plugin-with-consumer_group: "": parameters: @@ -3344,6 +4405,15 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-get-plugin-with-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerGroupId: "" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} upsert-plugin-with-consumer_group: "": parameters: @@ -3356,6 +4426,17 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-upsert-plugin-with-consumer-group: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerGroupId: "" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} list-plugin-with-consumer: "": parameters: @@ -3368,6 +4449,17 @@ examples: responses: "200": application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} + speakeasy-default-list-plugin-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} create-plugin-with-consumer: "": parameters: @@ -3379,6 +4471,16 @@ examples: responses: "201": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-create-plugin-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "201": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} delete-plugin-with-consumer: "": parameters: @@ -3386,6 +4488,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + speakeasy-default-delete-plugin-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" get-plugin-with-consumer: "": parameters: @@ -3396,6 +4504,15 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-get-plugin-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} upsert-plugin-with-consumer: "": parameters: @@ -3408,6 +4525,17 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-upsert-plugin-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} list-plugin: "": parameters: @@ -3421,6 +4549,18 @@ examples: application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} "401": application/json: {"message": "", "status": 240713} + speakeasy-default-list-plugin: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} + "401": + application/json: {"message": "", "status": 240713} create-plugin: speakeasy-default-create-plugin: parameters: @@ -3442,6 +4582,14 @@ examples: responses: "401": application/json: {"message": "", "status": 228522} + speakeasy-default-delete-plugin: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + responses: + "401": + application/json: {"message": "", "status": 228522} get-plugin: "": parameters: @@ -3453,6 +4601,16 @@ examples: application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} "401": application/json: {"message": "", "status": 939243} + speakeasy-default-get-plugin: + parameters: + path: + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + "401": + application/json: {"message": "", "status": 939243} upsert-plugin: "": parameters: @@ -3466,6 +4624,18 @@ examples: application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} "401": application/json: {"message": "", "status": 294960} + speakeasy-default-upsert-plugin: + parameters: + path: + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + "401": + application/json: {"message": "", "status": 294960} list-plugin-with-route: "": parameters: @@ -3478,6 +4648,17 @@ examples: responses: "200": application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} + speakeasy-default-list-plugin-with-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} create-plugin-with-route: "": parameters: @@ -3489,6 +4670,16 @@ examples: responses: "201": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-create-plugin-with-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "201": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} delete-plugin-with-route: "": parameters: @@ -3496,6 +4687,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + speakeasy-default-delete-plugin-with-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" get-plugin-with-route: "": parameters: @@ -3506,15 +4703,35 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} - upsert-plugin-with-route: - "": + speakeasy-default-get-plugin-with-route: parameters: path: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" - requestBody: - application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + upsert-plugin-with-route: + "": + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-upsert-plugin-with-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} @@ -3539,6 +4756,17 @@ examples: responses: "200": application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} + speakeasy-default-list-plugin-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]}]} create-plugin-with-service: "": parameters: @@ -3550,6 +4778,16 @@ examples: responses: "201": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-create-plugin-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "201": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} delete-plugin-with-service: "": parameters: @@ -3557,6 +4795,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + speakeasy-default-delete-plugin-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" get-plugin-with-service: "": parameters: @@ -3567,6 +4811,15 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-get-plugin-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} upsert-plugin-with-service: "": parameters: @@ -3579,6 +4832,17 @@ examples: responses: "200": application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + speakeasy-default-upsert-plugin-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + PluginId: "3473c251-5b6c-4f45-b1ff-7ede735a366d" + requestBody: + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} + responses: + "200": + application/json: {"config": {"anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": ["apikey"], "run_on_preflight": true}, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [{"id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis"}, {"id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis"}], "protocols": ["grpc", "grpcs", "http", "https"]} list-consumer: "": parameters: @@ -3592,6 +4856,18 @@ examples: application/json: {"data": [{"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"}]} "401": application/json: {"message": "", "status": 929834} + speakeasy-default-list-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"}]} + "401": + application/json: {"message": "", "status": 929834} create-consumer: speakeasy-default-create-consumer: parameters: @@ -3613,6 +4889,14 @@ examples: responses: "401": application/json: {"message": "", "status": 128133} + speakeasy-default-delete-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + responses: + "401": + application/json: {"message": "", "status": 128133} get-consumer: "": parameters: @@ -3624,6 +4908,16 @@ examples: application/json: {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"} "401": application/json: {"message": "", "status": 441110} + speakeasy-default-get-consumer: + parameters: + path: + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"} + "401": + application/json: {"message": "", "status": 441110} upsert-consumer: "": parameters: @@ -3637,6 +4931,18 @@ examples: application/json: {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"} "401": application/json: {"message": "", "status": 653018} + speakeasy-default-upsert-consumer: + parameters: + path: + ConsumerId: "c1059869-6fa7-4329-a5f5-5946d14ca2c5" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"} + responses: + "200": + application/json: {"custom_id": "4200", "id": "8a388226-80e8-4027-a486-25e4f7db5d21", "tags": ["silver-tier"], "username": "bob-the-builder"} + "401": + application/json: {"message": "", "status": 653018} list-hmac-auth-with-consumer: "": parameters: @@ -3649,6 +4955,17 @@ examples: responses: "200": application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"}]} + speakeasy-default-list-hmac-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"}]} create-hmac-auth-with-consumer: "": parameters: @@ -3660,6 +4977,16 @@ examples: responses: "201": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} + speakeasy-default-create-hmac-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} + responses: + "201": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} delete-hmac-auth-with-consumer: "": parameters: @@ -3667,6 +4994,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" HMACAuthId: "70e7b00b-72f2-471b-a5ce-9c4171775360" + speakeasy-default-delete-hmac-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + HMACAuthId: "70e7b00b-72f2-471b-a5ce-9c4171775360" get-hmac-auth-with-consumer: "": parameters: @@ -3677,6 +5010,15 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} + speakeasy-default-get-hmac-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + HMACAuthId: "70e7b00b-72f2-471b-a5ce-9c4171775360" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} upsert-hmac-auth-with-consumer: "": parameters: @@ -3689,6 +5031,17 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} + speakeasy-default-upsert-hmac-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + HMACAuthId: "70e7b00b-72f2-471b-a5ce-9c4171775360" + requestBody: + application/json: {"id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} list-hmac-auth: "": parameters: @@ -3702,6 +5055,18 @@ examples: application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"}]} "401": application/json: {"message": "", "status": 449721} + speakeasy-default-list-hmac-auth: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"}]} + "401": + application/json: {"message": "", "status": 449721} get-hmac-auth: "": parameters: @@ -3713,6 +5078,16 @@ examples: application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} "401": application/json: {"message": "", "status": 97799} + speakeasy-default-get-hmac-auth: + parameters: + path: + HMACAuthId: "70e7b00b-72f2-471b-a5ce-9c4171775360" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ", "username": "xerxes"} + "401": + application/json: {"message": "", "status": 97799} list-jwt-with-consumer: "": parameters: @@ -3725,6 +5100,17 @@ examples: responses: "200": application/json: {"data": [{"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"}]} + speakeasy-default-list-jwt-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"}]} create-jwt-with-consumer: "": parameters: @@ -3736,6 +5122,16 @@ examples: responses: "201": application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} + speakeasy-default-create-jwt-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"algorithm": "HS256", "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} + responses: + "201": + application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} delete-jwt-with-consumer: "": parameters: @@ -3743,6 +5139,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" JWTId: "4a7f5faa-8c96-46d6-8214-c87573ef2ac4" + speakeasy-default-delete-jwt-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + JWTId: "4a7f5faa-8c96-46d6-8214-c87573ef2ac4" get-jwt-with-consumer: "": parameters: @@ -3753,6 +5155,15 @@ examples: responses: "200": application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} + speakeasy-default-get-jwt-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + JWTId: "4a7f5faa-8c96-46d6-8214-c87573ef2ac4" + responses: + "200": + application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} upsert-jwt-with-consumer: "": parameters: @@ -3765,6 +5176,17 @@ examples: responses: "200": application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} + speakeasy-default-upsert-jwt-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + JWTId: "4a7f5faa-8c96-46d6-8214-c87573ef2ac4" + requestBody: + application/json: {"algorithm": "HS256", "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} + responses: + "200": + application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} list-jwt: "": parameters: @@ -3778,6 +5200,18 @@ examples: application/json: {"data": [{"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"}]} "401": application/json: {"message": "", "status": 85274} + speakeasy-default-list-jwt: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"}]} + "401": + application/json: {"message": "", "status": 85274} get-jwt: "": parameters: @@ -3789,6 +5223,16 @@ examples: application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} "401": application/json: {"message": "", "status": 328558} + speakeasy-default-get-jwt: + parameters: + path: + JWTId: "4a7f5faa-8c96-46d6-8214-c87573ef2ac4" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"algorithm": "HS256", "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "75695322-e8a0-4109-aed4-5416b0308d85", "key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz", "secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"} + "401": + application/json: {"message": "", "status": 328558} list-key-auth-with-consumer: "": parameters: @@ -3801,6 +5245,17 @@ examples: responses: "200": application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"}]} + speakeasy-default-list-key-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"}]} create-key-auth-with-consumer: "": parameters: @@ -3812,6 +5267,16 @@ examples: responses: "201": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} + speakeasy-default-create-key-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} + responses: + "201": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} delete-key-auth-with-consumer: "": parameters: @@ -3819,6 +5284,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" KeyAuthId: "" + speakeasy-default-delete-key-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + KeyAuthId: "" get-key-auth-with-consumer: "": parameters: @@ -3829,6 +5300,15 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} + speakeasy-default-get-key-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + KeyAuthId: "" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} upsert-key-auth-with-consumer: "": parameters: @@ -3841,6 +5321,17 @@ examples: responses: "200": application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} + speakeasy-default-upsert-key-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + KeyAuthId: "" + requestBody: + application/json: {"id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} list-key-auth: "": parameters: @@ -3854,6 +5345,18 @@ examples: application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"}]} "401": application/json: {"message": "", "status": 456570} + speakeasy-default-list-key-auth: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"}]} + "401": + application/json: {"message": "", "status": 456570} get-key-auth: "": parameters: @@ -3865,6 +5368,16 @@ examples: application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} "401": application/json: {"message": "", "status": 857754} + speakeasy-default-get-key-auth: + parameters: + path: + KeyAuthId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"} + "401": + application/json: {"message": "", "status": 857754} list-mtls-auth-with-consumer: "": parameters: @@ -3877,6 +5390,17 @@ examples: responses: "200": application/json: {"data": [{"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"}]} + speakeasy-default-list-mtls-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"}]} create-mtls-auth-with-consumer: "": parameters: @@ -3888,6 +5412,16 @@ examples: responses: "201": application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} + speakeasy-default-create-mtls-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + requestBody: + application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} + responses: + "201": + application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} delete-mtls-auth-with-consumer: "": parameters: @@ -3895,6 +5429,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" MTLSAuthId: "" + speakeasy-default-delete-mtls-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + MTLSAuthId: "" get-mtls-auth-with-consumer: "": parameters: @@ -3905,6 +5445,15 @@ examples: responses: "200": application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} + speakeasy-default-get-mtls-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + MTLSAuthId: "" + responses: + "200": + application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} upsert-mtls-auth-with-consumer: "": parameters: @@ -3917,6 +5466,17 @@ examples: responses: "200": application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} + speakeasy-default-upsert-mtls-auth-with-consumer: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerIdForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21" + MTLSAuthId: "" + requestBody: + application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} + responses: + "200": + application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} list-mtls-auth: "": parameters: @@ -3930,6 +5490,18 @@ examples: application/json: {"data": [{"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"}]} "401": application/json: {"message": "", "status": 833347} + speakeasy-default-list-mtls-auth: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"}]} + "401": + application/json: {"message": "", "status": 833347} get-mtls-auth: "": parameters: @@ -3941,6 +5513,16 @@ examples: application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} "401": application/json: {"message": "", "status": 965636} + speakeasy-default-get-mtls-auth: + parameters: + path: + MTLSAuthId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"ca_certificate": {"id": "b2f34145-0343-41a4-9602-4c69dec2f260"}, "consumer": {"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"}, "id": "b2f34145-0343-41a4-9602-4c69dec2f269", "subject_name": "CA_Subject_Name"} + "401": + application/json: {"message": "", "status": 965636} list-custom-plugin: "": parameters: @@ -3954,6 +5536,18 @@ examples: application/json: {"data": [{"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"}]} "401": application/json: {"message": "", "status": 593347} + speakeasy-default-list-custom-plugin: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"}]} + "401": + application/json: {"message": "", "status": 593347} create-custom-plugin: speakeasy-default-create-custom-plugin: parameters: @@ -3975,6 +5569,14 @@ examples: responses: "401": application/json: {"message": "", "status": 907684} + speakeasy-default-delete-custom-plugin: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + CustomPluginId: "" + responses: + "401": + application/json: {"message": "", "status": 907684} get-custom-plugin: "": parameters: @@ -3986,6 +5588,16 @@ examples: application/json: {"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"} "401": application/json: {"message": "", "status": 233734} + speakeasy-default-get-custom-plugin: + parameters: + path: + CustomPluginId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"} + "401": + application/json: {"message": "", "status": 233734} upsert-custom-plugin: "": parameters: @@ -3999,6 +5611,18 @@ examples: application/json: {"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"} "401": application/json: {"message": "", "status": 408156} + speakeasy-default-upsert-custom-plugin: + parameters: + path: + CustomPluginId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"} + responses: + "200": + application/json: {"handler": "return { VERSION = '1.0,0', PRIORITY = 500, access = function(self, config) kong.service.request.set_header(config.name, config.value) end }", "id": "868346aa-1105-4b77-8346-aa1105fb77c4", "name": "set-header", "schema": "return { name = 'set-header', fields = { { protocols = require('kong.db.schema.typedefs').protocols_http }, { config = { type = 'record', fields = { { name = { description = 'The name of the header to set.', type = 'string', required = true } }, { value = { description = 'The value for the header.', type = 'string', required = true } } } } } } }"} + "401": + application/json: {"message": "", "status": 408156} list-degraphql_route: "": parameters: @@ -4012,6 +5636,18 @@ examples: application/json: {"data": [{"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"}]} "401": application/json: {"message": "", "status": 278214} + speakeasy-default-list-degraphql-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"}]} + "401": + application/json: {"message": "", "status": 278214} get-degraphql_route: "": parameters: @@ -4023,6 +5659,16 @@ examples: application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} "401": application/json: {"message": "", "status": 588326} + speakeasy-default-get-degraphql-route: + parameters: + path: + Degraphql_routeId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} + "401": + application/json: {"message": "", "status": 588326} list-degraphql_route-with-service: "": parameters: @@ -4035,6 +5681,17 @@ examples: responses: "200": application/json: {"data": [{"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"}]} + speakeasy-default-list-degraphql-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"}]} create-degraphql_route-with-service: "": parameters: @@ -4046,6 +5703,16 @@ examples: responses: "201": application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} + speakeasy-default-create-degraphql-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + requestBody: + application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "uri": "/users"} + responses: + "201": + application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} delete-degraphql_route-with-service: "": parameters: @@ -4053,6 +5720,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" Degraphql_routeId: "" + speakeasy-default-delete-degraphql-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + Degraphql_routeId: "" get-degraphql_route-with-service: "": parameters: @@ -4063,6 +5736,15 @@ examples: responses: "200": application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} + speakeasy-default-get-degraphql-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + Degraphql_routeId: "" + responses: + "200": + application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} upsert-degraphql_route-with-service: "": parameters: @@ -4075,6 +5757,17 @@ examples: responses: "200": application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} + speakeasy-default-upsert-degraphql-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + Degraphql_routeId: "" + requestBody: + application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "uri": "/users"} + responses: + "200": + application/json: {"id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "query": "query{ user { email } }", "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}, "uri": "/users"} list-key-set: "": parameters: @@ -4088,6 +5781,18 @@ examples: application/json: {"data": [{"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]}]} "401": application/json: {"message": "", "status": 364189} + speakeasy-default-list-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]}]} + "401": + application/json: {"message": "", "status": 364189} create-key-set: speakeasy-default-create-key-set: parameters: @@ -4109,6 +5814,14 @@ examples: responses: "401": application/json: {"message": "", "status": 925820} + speakeasy-default-delete-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + responses: + "401": + application/json: {"message": "", "status": 925820} get-key-set: "": parameters: @@ -4120,6 +5833,16 @@ examples: application/json: {"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]} "401": application/json: {"message": "", "status": 260853} + speakeasy-default-get-key-set: + parameters: + path: + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]} + "401": + application/json: {"message": "", "status": 260853} upsert-key-set: "": parameters: @@ -4133,6 +5856,18 @@ examples: application/json: {"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]} "401": application/json: {"message": "", "status": 792318} + speakeasy-default-upsert-key-set: + parameters: + path: + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]} + responses: + "200": + application/json: {"id": "b58c7d9d-e54f-444c-b24d-cdfc4159f61e", "name": "example-key-set", "tags": ["idp-keys"]} + "401": + application/json: {"message": "", "status": 792318} list-key-with-key-set: "": parameters: @@ -4145,6 +5880,17 @@ examples: responses: "200": application/json: {"data": [{"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}}]} + speakeasy-default-list-key-with-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}}]} create-key-with-key-set: "": parameters: @@ -4156,6 +5902,16 @@ examples: responses: "201": application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + speakeasy-default-create-key-with-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + requestBody: + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + responses: + "201": + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} delete-key-with-key-set: "": parameters: @@ -4163,6 +5919,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" + speakeasy-default-delete-key-with-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" get-key-with-key-set: "": parameters: @@ -4173,6 +5935,15 @@ examples: responses: "200": application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + speakeasy-default-get-key-with-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" + responses: + "200": + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} upsert-key-with-key-set: "": parameters: @@ -4185,6 +5956,17 @@ examples: responses: "200": application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + speakeasy-default-upsert-key-with-key-set: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeySetId: "6cc34248-50b4-4a81-9201-3bdf7a83f712" + KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" + requestBody: + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + responses: + "200": + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} list-key: "": parameters: @@ -4198,6 +5980,18 @@ examples: application/json: {"data": [{"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}}]} "401": application/json: {"message": "", "status": 316138} + speakeasy-default-list-key: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}}]} + "401": + application/json: {"message": "", "status": 316138} create-key: speakeasy-default-create-key: parameters: @@ -4219,6 +6013,14 @@ examples: responses: "401": application/json: {"message": "", "status": 803172} + speakeasy-default-delete-key: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" + responses: + "401": + application/json: {"message": "", "status": 803172} get-key: "": parameters: @@ -4230,6 +6032,16 @@ examples: application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} "401": application/json: {"message": "", "status": 647780} + speakeasy-default-get-key: + parameters: + path: + KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + "401": + application/json: {"message": "", "status": 647780} upsert-key: "": parameters: @@ -4243,6 +6055,18 @@ examples: application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} "401": application/json: {"message": "", "status": 849792} + speakeasy-default-upsert-key: + parameters: + path: + KeyId: "bba22c06-a632-42be-a018-1b9ff357b5b9" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + responses: + "200": + application/json: {"id": "d958f66b-8e99-44d2-b0b4-edd5bbf24658", "jwk": "{\"alg\":\"RSA\", \"kid\": \"42\", ...}", "kid": "42", "name": "a-key", "pem": {"private_key": "-----BEGIN", "public_key": "-----BEGIN"}, "set": {"id": "b86b331c-dcd0-4b3e-97ce-47c5a9543031"}} + "401": + application/json: {"message": "", "status": 849792} list-partial: "": parameters: @@ -4256,6 +6080,18 @@ examples: application/json: {} "401": application/json: {"message": "", "status": 707684} + speakeasy-default-list-partial: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {} + "401": + application/json: {"message": "", "status": 707684} create-partial: speakeasy-default-create-partial: parameters: @@ -4277,6 +6113,14 @@ examples: responses: "401": application/json: {"message": "", "status": 63304} + speakeasy-default-delete-partial: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + PartialId: "" + responses: + "401": + application/json: {"message": "", "status": 63304} get-partial: "": parameters: @@ -4288,6 +6132,16 @@ examples: application/json: {"config": {"key": "", "key1": ""}, "type": ""} "401": application/json: {"message": "", "status": 629733} + speakeasy-default-get-partial: + parameters: + path: + PartialId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"config": {"key": "", "key1": ""}, "type": ""} + "401": + application/json: {"message": "", "status": 629733} upsert-partial: "": parameters: @@ -4301,6 +6155,18 @@ examples: application/json: {"config": {}, "type": ""} "401": application/json: {"message": "", "status": 445128} + speakeasy-default-upsert-partial: + parameters: + path: + PartialId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"config": {"key": "", "key1": "", "key2": ""}, "type": ""} + responses: + "200": + application/json: {"config": {}, "type": ""} + "401": + application/json: {"message": "", "status": 445128} list-partial-link: "": parameters: @@ -4313,6 +6179,17 @@ examples: responses: "200": application/json: {"count": 10} + speakeasy-default-list-partial-link: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + PartialId: "" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"count": 10} list-plugin-schemas: speakeasy-default-list-plugin-schemas: parameters: @@ -4406,6 +6283,18 @@ examples: application/json: {"data": [{"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}, {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}, {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}]} "401": application/json: {"message": "", "status": 9867} + speakeasy-default-list-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}]} + "401": + application/json: {"message": "", "status": 736426} create-route: speakeasy-default-create-route: parameters: @@ -4427,6 +6316,14 @@ examples: responses: "401": application/json: {"message": "", "status": 665842} + speakeasy-default-delete-route: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + responses: + "401": + application/json: {"message": "", "status": 665842} get-route: "": parameters: @@ -4438,6 +6335,16 @@ examples: application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} "401": application/json: {"message": "", "status": 591882} + speakeasy-default-get-route: + parameters: + path: + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + "401": + application/json: {"message": "", "status": 591882} upsert-route: "": parameters: @@ -4451,6 +6358,18 @@ examples: application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} "401": application/json: {"message": "", "status": 535322} + speakeasy-default-upsert-route: + parameters: + path: + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + responses: + "200": + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + "401": + application/json: {"message": "", "status": 535322} list-route-with-service: "": parameters: @@ -4463,6 +6382,17 @@ examples: responses: "200": application/json: {"data": [{"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}, {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}]} + speakeasy-default-list-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}}]} create-route-with-service: "": parameters: @@ -4474,6 +6404,16 @@ examples: responses: "201": application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + speakeasy-default-create-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + requestBody: + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + responses: + "201": + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} delete-route-with-service: "": parameters: @@ -4481,6 +6421,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + speakeasy-default-delete-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" get-route-with-service: "": parameters: @@ -4491,6 +6437,15 @@ examples: responses: "200": application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + speakeasy-default-get-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + responses: + "200": + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} upsert-route-with-service: "": parameters: @@ -4503,6 +6458,17 @@ examples: responses: "200": application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + speakeasy-default-upsert-route-with-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + RouteId: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7" + requestBody: + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} + responses: + "200": + application/json: {"hosts": ["foo.example.com", "foo.example.us"], "id": "56c4566c-14cc-4132-9011-4139fcbbe50a", "name": "example-route", "paths": ["/v1", "/v2"], "service": {"id": "bd380f99-659d-415e-b0e7-72ea05df3218"}} list-service: "": parameters: @@ -4516,6 +6482,18 @@ examples: application/json: {"data": [{"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"}]} "401": application/json: {"message": "", "status": 460889} + speakeasy-default-list-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"}]} + "401": + application/json: {"message": "", "status": 460889} create-service: speakeasy-default-create-service: parameters: @@ -4537,6 +6515,14 @@ examples: responses: "401": application/json: {"message": "", "status": 748444} + speakeasy-default-delete-service: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + responses: + "401": + application/json: {"message": "", "status": 748444} get-service: "": parameters: @@ -4548,6 +6534,16 @@ examples: application/json: {"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"} "401": application/json: {"message": "", "status": 416010} + speakeasy-default-get-service: + parameters: + path: + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"} + "401": + application/json: {"message": "", "status": 416010} upsert-service: "": parameters: @@ -4561,6 +6557,18 @@ examples: application/json: {"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"} "401": application/json: {"message": "", "status": 715531} + speakeasy-default-upsert-service: + parameters: + path: + ServiceId: "7fca84d6-7d37-4a74-a7b0-93e576089a41" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"} + responses: + "200": + application/json: {"host": "example.internal", "id": "49fd316e-c457-481c-9fc7-8079153e4f3c", "name": "example-service", "path": "/", "port": 80, "protocol": "http"} + "401": + application/json: {"message": "", "status": 715531} list-upstream: "": parameters: @@ -4574,6 +6582,18 @@ examples: application/json: {"data": [{"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000}]} "401": application/json: {"message": "", "status": 235016} + speakeasy-default-list-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000}]} + "401": + application/json: {"message": "", "status": 235016} create-upstream: speakeasy-default-create-upstream: parameters: @@ -4595,6 +6615,14 @@ examples: responses: "401": application/json: {"message": "", "status": 561527} + speakeasy-default-delete-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + UpstreamId: "426d620c-7058-4ae6-aacc-f85a3204a2c5" + responses: + "401": + application/json: {"message": "", "status": 561527} get-upstream: "": parameters: @@ -4606,6 +6634,16 @@ examples: application/json: {"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000} "401": application/json: {"message": "", "status": 768603} + speakeasy-default-get-upstream: + parameters: + path: + UpstreamId: "426d620c-7058-4ae6-aacc-f85a3204a2c5" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000} + "401": + application/json: {"message": "", "status": 768603} upsert-upstream: "": parameters: @@ -4619,6 +6657,18 @@ examples: application/json: {"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000} "401": application/json: {"message": "", "status": 414556} + speakeasy-default-upsert-upstream: + parameters: + path: + UpstreamId: "426d620c-7058-4ae6-aacc-f85a3204a2c5" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000} + responses: + "200": + application/json: {"algorithm": "round-robin", "hash_fallback": "none", "hash_on": "none", "hash_on_cookie_path": "/", "healthchecks": {"active": {"concurrency": 10, "healthy": {"http_statuses": [200, 302], "interval": 0, "successes": 0}, "http_path": "/", "https_verify_certificate": true, "timeout": 1, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 404, 500, 501, 502, 503, 504, 505], "interval": 0, "tcp_failures": 0, "timeouts": 0}}, "passive": {"healthy": {"http_statuses": [200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308], "successes": 0}, "type": "http", "unhealthy": {"http_failures": 0, "http_statuses": [429, 500, 503], "tcp_failures": 0, "timeouts": 0}}, "threshold": 0}, "id": "6eed5e9c-5398-4026-9a4c-d48f18a2431e", "name": "api.example.internal", "slots": 10000} + "401": + application/json: {"message": "", "status": 414556} list-target-with-upstream: "": parameters: @@ -4631,6 +6681,17 @@ examples: responses: "200": application/json: {"data": [{"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100}]} + speakeasy-default-list-target-with-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + UpstreamIdForTarget: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100}]} create-target-with-upstream: "": parameters: @@ -4642,6 +6703,16 @@ examples: responses: "201": application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100} + speakeasy-default-create-target-with-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + UpstreamIdForTarget: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + requestBody: + application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "weight": 100} + responses: + "201": + application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100} delete-target-with-upstream: "": parameters: @@ -4649,6 +6720,12 @@ examples: controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" UpstreamIdForTarget: "5a078780-5d4c-4aae-984a-bdc6f52113d8" TargetId: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + speakeasy-default-delete-target-with-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + UpstreamIdForTarget: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + TargetId: "5a078780-5d4c-4aae-984a-bdc6f52113d8" get-target-with-upstream: "": parameters: @@ -4659,6 +6736,15 @@ examples: responses: "200": application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100} + speakeasy-default-get-target-with-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + UpstreamIdForTarget: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + TargetId: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + responses: + "200": + application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100} upsert-target-with-upstream: "": parameters: @@ -4671,6 +6757,17 @@ examples: responses: "200": application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100} + speakeasy-default-upsert-target-with-upstream: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + UpstreamIdForTarget: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + TargetId: "5a078780-5d4c-4aae-984a-bdc6f52113d8" + requestBody: + application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "weight": 100} + responses: + "200": + application/json: {"id": "089292a7-ba3d-4d88-acf0-97b4b2e2621a", "target": "203.0.113.42", "upstream": {"id": "5f1d7e76-2fed-4806-a6af-869984f025cb"}, "weight": 100} list-vault: "": parameters: @@ -4684,6 +6781,18 @@ examples: application/json: {"data": [{"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]}]} "401": application/json: {"message": "", "status": 957540} + speakeasy-default-list-vault: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {"data": [{"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]}]} + "401": + application/json: {"message": "", "status": 957540} create-vault: speakeasy-default-create-vault: parameters: @@ -4705,6 +6814,14 @@ examples: responses: "401": application/json: {"message": "", "status": 74301} + speakeasy-default-delete-vault: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + VaultId: "9d4d6d19-77c6-428e-a965-9bc9647633e9" + responses: + "401": + application/json: {"message": "", "status": 74301} get-vault: "": parameters: @@ -4716,6 +6833,16 @@ examples: application/json: {"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]} "401": application/json: {"message": "", "status": 357221} + speakeasy-default-get-vault: + parameters: + path: + VaultId: "9d4d6d19-77c6-428e-a965-9bc9647633e9" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + responses: + "200": + application/json: {"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]} + "401": + application/json: {"message": "", "status": 357221} upsert-vault: "": parameters: @@ -4729,6 +6856,18 @@ examples: application/json: {"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]} "401": application/json: {"message": "", "status": 808712} + speakeasy-default-upsert-vault: + parameters: + path: + VaultId: "9d4d6d19-77c6-428e-a965-9bc9647633e9" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + requestBody: + application/json: {"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]} + responses: + "200": + application/json: {"config": {"prefix": "ENV_PREFIX"}, "description": "environment variable based vault", "id": "2747d1e5-8246-4f65-a939-b392f1ee17f8", "name": "env", "prefix": "env", "tags": ["foo", "bar"]} + "401": + application/json: {"message": "", "status": 808712} list-dp-client-certificates: speakeasy-default-list-dp-client-certificates: parameters: @@ -4791,6 +6930,17 @@ examples: responses: "200": application/json: {} + speakeasy-default-get-nodes-node-id: + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + nodeId: "d32d905a-ed33-46a3-a093-d8f536af9a8a" + query: + size: 100 + tags: "tag1,tag2" + responses: + "200": + application/json: {} delete-nodes-node_id: speakeasy-default-delete-nodes-node-id: parameters: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4d177433..0f9832e2 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -24,6 +24,7 @@ go: version: 0.3.2 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false + baseErrorName: SDKBaseError clientServerStatusCodesAsErrors: true defaultErrorName: SDKError flattenGlobalSecurity: true diff --git a/acls.go b/acls.go index 5cf77bb4..2e62fc5b 100644 --- a/acls.go +++ b/acls.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type ACLs struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newACLs(sdkConfig sdkConfiguration) *ACLs { +func newACLs(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ACLs { return &ACLs{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *ACLs) ListACL(ctx context.Context, request operations.ListACLRequest, o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-acl", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-acl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *ACLs) ListACL(ctx context.Context, request operations.ListACLRequest, o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *ACLs) ListACL(ctx context.Context, request operations.ListACLRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *ACLs) ListACL(ctx context.Context, request operations.ListACLRequest, o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *ACLs) ListACL(ctx context.Context, request operations.ListACLRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -283,11 +292,13 @@ func (s *ACLs) GetACL(ctx context.Context, aclID string, controlPlaneID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-acl", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-acl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -336,15 +347,17 @@ func (s *ACLs) GetACL(ctx context.Context, aclID string, controlPlaneID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -361,7 +374,7 @@ func (s *ACLs) GetACL(ctx context.Context, aclID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -369,13 +382,13 @@ func (s *ACLs) GetACL(ctx context.Context, aclID string, controlPlaneID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -388,17 +401,17 @@ func (s *ACLs) GetACL(ctx context.Context, aclID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -507,11 +520,13 @@ func (s *ACLs) ListACLWithConsumer(ctx context.Context, request operations.ListA } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-acl-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-acl-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -564,15 +579,17 @@ func (s *ACLs) ListACLWithConsumer(ctx context.Context, request operations.ListA "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -589,7 +606,7 @@ func (s *ACLs) ListACLWithConsumer(ctx context.Context, request operations.ListA err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -597,13 +614,13 @@ func (s *ACLs) ListACLWithConsumer(ctx context.Context, request operations.ListA if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -616,17 +633,17 @@ func (s *ACLs) ListACLWithConsumer(ctx context.Context, request operations.ListA err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -712,11 +729,13 @@ func (s *ACLs) CreateACLWithConsumer(ctx context.Context, request operations.Cre } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-acl-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-acl-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "ACLWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -772,15 +791,17 @@ func (s *ACLs) CreateACLWithConsumer(ctx context.Context, request operations.Cre "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -797,7 +818,7 @@ func (s *ACLs) CreateACLWithConsumer(ctx context.Context, request operations.Cre err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -805,13 +826,13 @@ func (s *ACLs) CreateACLWithConsumer(ctx context.Context, request operations.Cre if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -824,17 +845,17 @@ func (s *ACLs) CreateACLWithConsumer(ctx context.Context, request operations.Cre err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -920,11 +941,13 @@ func (s *ACLs) DeleteACLWithConsumer(ctx context.Context, request operations.Del } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-acl-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-acl-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -973,15 +996,17 @@ func (s *ACLs) DeleteACLWithConsumer(ctx context.Context, request operations.Del "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -998,7 +1023,7 @@ func (s *ACLs) DeleteACLWithConsumer(ctx context.Context, request operations.Del err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1006,13 +1031,13 @@ func (s *ACLs) DeleteACLWithConsumer(ctx context.Context, request operations.Del if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1025,17 +1050,17 @@ func (s *ACLs) DeleteACLWithConsumer(ctx context.Context, request operations.Del err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1101,11 +1126,13 @@ func (s *ACLs) GetACLWithConsumer(ctx context.Context, request operations.GetACL } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-acl-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-acl-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1154,15 +1181,17 @@ func (s *ACLs) GetACLWithConsumer(ctx context.Context, request operations.GetACL "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1179,7 +1208,7 @@ func (s *ACLs) GetACLWithConsumer(ctx context.Context, request operations.GetACL err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1187,13 +1216,13 @@ func (s *ACLs) GetACLWithConsumer(ctx context.Context, request operations.GetACL if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1206,17 +1235,17 @@ func (s *ACLs) GetACLWithConsumer(ctx context.Context, request operations.GetACL err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1304,11 +1333,13 @@ func (s *ACLs) UpsertACLWithConsumer(ctx context.Context, request operations.Ups } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-acl-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-acl-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "ACLWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1364,15 +1395,17 @@ func (s *ACLs) UpsertACLWithConsumer(ctx context.Context, request operations.Ups "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1389,7 +1422,7 @@ func (s *ACLs) UpsertACLWithConsumer(ctx context.Context, request operations.Ups err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1397,13 +1430,13 @@ func (s *ACLs) UpsertACLWithConsumer(ctx context.Context, request operations.Ups if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1416,17 +1449,17 @@ func (s *ACLs) UpsertACLWithConsumer(ctx context.Context, request operations.Ups err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/apikeys.go b/apikeys.go index bf096443..babfe371 100644 --- a/apikeys.go +++ b/apikeys.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type APIKeys struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newAPIKeys(sdkConfig sdkConfiguration) *APIKeys { +func newAPIKeys(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *APIKeys { return &APIKeys{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *APIKeys) ListKeyAuthWithConsumer(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-key-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-key-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *APIKeys) ListKeyAuthWithConsumer(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *APIKeys) ListKeyAuthWithConsumer(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *APIKeys) ListKeyAuthWithConsumer(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *APIKeys) ListKeyAuthWithConsumer(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -257,11 +266,13 @@ func (s *APIKeys) CreateKeyAuthWithConsumer(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-key-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-key-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "KeyAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -317,15 +328,17 @@ func (s *APIKeys) CreateKeyAuthWithConsumer(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -342,7 +355,7 @@ func (s *APIKeys) CreateKeyAuthWithConsumer(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -350,13 +363,13 @@ func (s *APIKeys) CreateKeyAuthWithConsumer(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -369,17 +382,17 @@ func (s *APIKeys) CreateKeyAuthWithConsumer(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -465,11 +478,13 @@ func (s *APIKeys) DeleteKeyAuthWithConsumer(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-key-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-key-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -518,15 +533,17 @@ func (s *APIKeys) DeleteKeyAuthWithConsumer(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -543,7 +560,7 @@ func (s *APIKeys) DeleteKeyAuthWithConsumer(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -551,13 +568,13 @@ func (s *APIKeys) DeleteKeyAuthWithConsumer(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -570,17 +587,17 @@ func (s *APIKeys) DeleteKeyAuthWithConsumer(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -646,11 +663,13 @@ func (s *APIKeys) GetKeyAuthWithConsumer(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-key-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-key-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -699,15 +718,17 @@ func (s *APIKeys) GetKeyAuthWithConsumer(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -724,7 +745,7 @@ func (s *APIKeys) GetKeyAuthWithConsumer(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -732,13 +753,13 @@ func (s *APIKeys) GetKeyAuthWithConsumer(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -751,17 +772,17 @@ func (s *APIKeys) GetKeyAuthWithConsumer(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -849,11 +870,13 @@ func (s *APIKeys) UpsertKeyAuthWithConsumer(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-key-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-key-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "KeyAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -909,15 +932,17 @@ func (s *APIKeys) UpsertKeyAuthWithConsumer(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -934,7 +959,7 @@ func (s *APIKeys) UpsertKeyAuthWithConsumer(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -942,13 +967,13 @@ func (s *APIKeys) UpsertKeyAuthWithConsumer(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -961,17 +986,17 @@ func (s *APIKeys) UpsertKeyAuthWithConsumer(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1057,11 +1082,13 @@ func (s *APIKeys) ListKeyAuth(ctx context.Context, request operations.ListKeyAut } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-key-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-key-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1114,15 +1141,17 @@ func (s *APIKeys) ListKeyAuth(ctx context.Context, request operations.ListKeyAut "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1139,7 +1168,7 @@ func (s *APIKeys) ListKeyAuth(ctx context.Context, request operations.ListKeyAut err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1147,13 +1176,13 @@ func (s *APIKeys) ListKeyAuth(ctx context.Context, request operations.ListKeyAut if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1166,17 +1195,17 @@ func (s *APIKeys) ListKeyAuth(ctx context.Context, request operations.ListKeyAut err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1288,11 +1317,13 @@ func (s *APIKeys) GetKeyAuth(ctx context.Context, keyAuthID string, controlPlane } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-key-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-key-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1341,15 +1372,17 @@ func (s *APIKeys) GetKeyAuth(ctx context.Context, keyAuthID string, controlPlane "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1366,7 +1399,7 @@ func (s *APIKeys) GetKeyAuth(ctx context.Context, keyAuthID string, controlPlane err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1374,13 +1407,13 @@ func (s *APIKeys) GetKeyAuth(ctx context.Context, keyAuthID string, controlPlane if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1393,17 +1426,17 @@ func (s *APIKeys) GetKeyAuth(ctx context.Context, keyAuthID string, controlPlane err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/appauthstrategies.go b/appauthstrategies.go index d910c5f5..86d81e9b 100644 --- a/appauthstrategies.go +++ b/appauthstrategies.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -20,12 +21,16 @@ import ( // Called “Auth Strategy” for short in the context of portals/applications. // The plugins are synced to any Gateway Service that is currently linked or becomes linked to the Product Version. type AppAuthStrategies struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newAppAuthStrategies(sdkConfig sdkConfiguration) *AppAuthStrategies { +func newAppAuthStrategies(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *AppAuthStrategies { return &AppAuthStrategies{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -56,11 +61,13 @@ func (s *AppAuthStrategies) CreateAppAuthStrategy(ctx context.Context, request c } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-app-auth-strategy", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-app-auth-strategy", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -116,15 +123,17 @@ func (s *AppAuthStrategies) CreateAppAuthStrategy(ctx context.Context, request c "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -141,7 +150,7 @@ func (s *AppAuthStrategies) CreateAppAuthStrategy(ctx context.Context, request c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -149,13 +158,13 @@ func (s *AppAuthStrategies) CreateAppAuthStrategy(ctx context.Context, request c if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -168,17 +177,17 @@ func (s *AppAuthStrategies) CreateAppAuthStrategy(ctx context.Context, request c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -327,11 +336,13 @@ func (s *AppAuthStrategies) ListAppAuthStrategies(ctx context.Context, request o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-app-auth-strategies", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-app-auth-strategies", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -384,15 +395,17 @@ func (s *AppAuthStrategies) ListAppAuthStrategies(ctx context.Context, request o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -409,7 +422,7 @@ func (s *AppAuthStrategies) ListAppAuthStrategies(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -417,13 +430,13 @@ func (s *AppAuthStrategies) ListAppAuthStrategies(ctx context.Context, request o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -436,17 +449,17 @@ func (s *AppAuthStrategies) ListAppAuthStrategies(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -599,11 +612,13 @@ func (s *AppAuthStrategies) GetAppAuthStrategy(ctx context.Context, authStrategy } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-app-auth-strategy", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-app-auth-strategy", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -652,15 +667,17 @@ func (s *AppAuthStrategies) GetAppAuthStrategy(ctx context.Context, authStrategy "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -677,7 +694,7 @@ func (s *AppAuthStrategies) GetAppAuthStrategy(ctx context.Context, authStrategy err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -685,13 +702,13 @@ func (s *AppAuthStrategies) GetAppAuthStrategy(ctx context.Context, authStrategy if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -704,17 +721,17 @@ func (s *AppAuthStrategies) GetAppAuthStrategy(ctx context.Context, authStrategy err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -868,11 +885,13 @@ func (s *AppAuthStrategies) ReplaceAppAuthStrategy(ctx context.Context, authStra } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "replace-app-auth-strategy", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "replace-app-auth-strategy", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateAppAuthStrategyRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -928,15 +947,17 @@ func (s *AppAuthStrategies) ReplaceAppAuthStrategy(ctx context.Context, authStra "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -953,7 +974,7 @@ func (s *AppAuthStrategies) ReplaceAppAuthStrategy(ctx context.Context, authStra err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -961,13 +982,13 @@ func (s *AppAuthStrategies) ReplaceAppAuthStrategy(ctx context.Context, authStra if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -980,17 +1001,17 @@ func (s *AppAuthStrategies) ReplaceAppAuthStrategy(ctx context.Context, authStra err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1144,11 +1165,13 @@ func (s *AppAuthStrategies) UpdateAppAuthStrategy(ctx context.Context, authStrat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-app-auth-strategy", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-app-auth-strategy", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateAppAuthStrategyRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1204,15 +1227,17 @@ func (s *AppAuthStrategies) UpdateAppAuthStrategy(ctx context.Context, authStrat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1229,7 +1254,7 @@ func (s *AppAuthStrategies) UpdateAppAuthStrategy(ctx context.Context, authStrat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1237,13 +1262,13 @@ func (s *AppAuthStrategies) UpdateAppAuthStrategy(ctx context.Context, authStrat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1256,17 +1281,17 @@ func (s *AppAuthStrategies) UpdateAppAuthStrategy(ctx context.Context, authStrat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1440,11 +1465,13 @@ func (s *AppAuthStrategies) DeleteAppAuthStrategy(ctx context.Context, authStrat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-app-auth-strategy", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-app-auth-strategy", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1493,15 +1520,17 @@ func (s *AppAuthStrategies) DeleteAppAuthStrategy(ctx context.Context, authStrat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1518,7 +1547,7 @@ func (s *AppAuthStrategies) DeleteAppAuthStrategy(ctx context.Context, authStrat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1526,13 +1555,13 @@ func (s *AppAuthStrategies) DeleteAppAuthStrategy(ctx context.Context, authStrat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1545,17 +1574,17 @@ func (s *AppAuthStrategies) DeleteAppAuthStrategy(ctx context.Context, authStrat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/authentication.go b/authentication.go index 97bc0843..90463e2c 100644 --- a/authentication.go +++ b/authentication.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/operations" @@ -15,12 +16,16 @@ import ( ) type Authentication struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newAuthentication(sdkConfig sdkConfiguration) *Authentication { +func newAuthentication(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Authentication { return &Authentication{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -55,11 +60,13 @@ func (s *Authentication) AuthenticateSso(ctx context.Context, organizationLoginP } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "authenticate-sso", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "authenticate-sso", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -112,15 +119,17 @@ func (s *Authentication) AuthenticateSso(ctx context.Context, organizationLoginP "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -137,7 +146,7 @@ func (s *Authentication) AuthenticateSso(ctx context.Context, organizationLoginP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -145,13 +154,13 @@ func (s *Authentication) AuthenticateSso(ctx context.Context, organizationLoginP if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -164,17 +173,17 @@ func (s *Authentication) AuthenticateSso(ctx context.Context, organizationLoginP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/authsettings.go b/authsettings.go index f3efe4d1..8524d13c 100644 --- a/authsettings.go +++ b/authsettings.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type AuthSettings struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newAuthSettings(sdkConfig sdkConfiguration) *AuthSettings { +func newAuthSettings(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *AuthSettings { return &AuthSettings{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *AuthSettings) GetAuthenticationSettings(ctx context.Context, opts ...op } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-authentication-settings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-authentication-settings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -105,15 +112,17 @@ func (s *AuthSettings) GetAuthenticationSettings(ctx context.Context, opts ...op "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -130,7 +139,7 @@ func (s *AuthSettings) GetAuthenticationSettings(ctx context.Context, opts ...op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -138,13 +147,13 @@ func (s *AuthSettings) GetAuthenticationSettings(ctx context.Context, opts ...op if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -157,17 +166,17 @@ func (s *AuthSettings) GetAuthenticationSettings(ctx context.Context, opts ...op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -273,11 +282,13 @@ func (s *AuthSettings) UpdateAuthenticationSettings(ctx context.Context, request } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-authentication-settings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-authentication-settings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -333,15 +344,17 @@ func (s *AuthSettings) UpdateAuthenticationSettings(ctx context.Context, request "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -358,7 +371,7 @@ func (s *AuthSettings) UpdateAuthenticationSettings(ctx context.Context, request err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -366,13 +379,13 @@ func (s *AuthSettings) UpdateAuthenticationSettings(ctx context.Context, request if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -385,17 +398,17 @@ func (s *AuthSettings) UpdateAuthenticationSettings(ctx context.Context, request err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -524,11 +537,13 @@ func (s *AuthSettings) GetIdpConfiguration(ctx context.Context, opts ...operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-idp-configuration", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-idp-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -577,15 +592,17 @@ func (s *AuthSettings) GetIdpConfiguration(ctx context.Context, opts ...operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -602,7 +619,7 @@ func (s *AuthSettings) GetIdpConfiguration(ctx context.Context, opts ...operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -610,13 +627,13 @@ func (s *AuthSettings) GetIdpConfiguration(ctx context.Context, opts ...operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -629,17 +646,17 @@ func (s *AuthSettings) GetIdpConfiguration(ctx context.Context, opts ...operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -808,11 +825,13 @@ func (s *AuthSettings) UpdateIdpConfiguration(ctx context.Context, request *comp } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-idp-configuration", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-idp-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -868,15 +887,17 @@ func (s *AuthSettings) UpdateIdpConfiguration(ctx context.Context, request *comp "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -893,7 +914,7 @@ func (s *AuthSettings) UpdateIdpConfiguration(ctx context.Context, request *comp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -901,13 +922,13 @@ func (s *AuthSettings) UpdateIdpConfiguration(ctx context.Context, request *comp if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -920,17 +941,17 @@ func (s *AuthSettings) UpdateIdpConfiguration(ctx context.Context, request *comp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1065,11 +1086,13 @@ func (s *AuthSettings) GetTeamGroupMappings(ctx context.Context, pageSize *int64 } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-team-group-mappings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-team-group-mappings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1122,15 +1145,17 @@ func (s *AuthSettings) GetTeamGroupMappings(ctx context.Context, pageSize *int64 "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1147,7 +1172,7 @@ func (s *AuthSettings) GetTeamGroupMappings(ctx context.Context, pageSize *int64 err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1155,13 +1180,13 @@ func (s *AuthSettings) GetTeamGroupMappings(ctx context.Context, pageSize *int64 if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1174,17 +1199,17 @@ func (s *AuthSettings) GetTeamGroupMappings(ctx context.Context, pageSize *int64 err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1337,11 +1362,13 @@ func (s *AuthSettings) PatchTeamGroupMappings(ctx context.Context, request *comp } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "patch-team-group-mappings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "patch-team-group-mappings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1397,15 +1424,17 @@ func (s *AuthSettings) PatchTeamGroupMappings(ctx context.Context, request *comp "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1422,7 +1451,7 @@ func (s *AuthSettings) PatchTeamGroupMappings(ctx context.Context, request *comp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1430,13 +1459,13 @@ func (s *AuthSettings) PatchTeamGroupMappings(ctx context.Context, request *comp if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1449,17 +1478,17 @@ func (s *AuthSettings) PatchTeamGroupMappings(ctx context.Context, request *comp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1607,11 +1636,13 @@ func (s *AuthSettings) UpdateIdpTeamMappings(ctx context.Context, request *compo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-idp-team-mappings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-idp-team-mappings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1667,15 +1698,17 @@ func (s *AuthSettings) UpdateIdpTeamMappings(ctx context.Context, request *compo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1692,7 +1725,7 @@ func (s *AuthSettings) UpdateIdpTeamMappings(ctx context.Context, request *compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1700,13 +1733,13 @@ func (s *AuthSettings) UpdateIdpTeamMappings(ctx context.Context, request *compo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1719,17 +1752,17 @@ func (s *AuthSettings) UpdateIdpTeamMappings(ctx context.Context, request *compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "404", "412", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1903,11 +1936,13 @@ func (s *AuthSettings) GetIdpTeamMappings(ctx context.Context, pageSize *int64, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-idp-team-mappings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-idp-team-mappings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1960,15 +1995,17 @@ func (s *AuthSettings) GetIdpTeamMappings(ctx context.Context, pageSize *int64, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1985,7 +2022,7 @@ func (s *AuthSettings) GetIdpTeamMappings(ctx context.Context, pageSize *int64, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1993,13 +2030,13 @@ func (s *AuthSettings) GetIdpTeamMappings(ctx context.Context, pageSize *int64, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2012,17 +2049,17 @@ func (s *AuthSettings) GetIdpTeamMappings(ctx context.Context, pageSize *int64, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "412", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2196,11 +2233,13 @@ func (s *AuthSettings) GetIdentityProviders(ctx context.Context, filter *operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-identity-providers", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-identity-providers", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2253,15 +2292,17 @@ func (s *AuthSettings) GetIdentityProviders(ctx context.Context, filter *operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2278,7 +2319,7 @@ func (s *AuthSettings) GetIdentityProviders(ctx context.Context, filter *operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2286,13 +2327,13 @@ func (s *AuthSettings) GetIdentityProviders(ctx context.Context, filter *operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2305,17 +2346,17 @@ func (s *AuthSettings) GetIdentityProviders(ctx context.Context, filter *operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2443,11 +2484,13 @@ func (s *AuthSettings) CreateIdentityProvider(ctx context.Context, request compo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-identity-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-identity-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2503,15 +2546,17 @@ func (s *AuthSettings) CreateIdentityProvider(ctx context.Context, request compo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2528,7 +2573,7 @@ func (s *AuthSettings) CreateIdentityProvider(ctx context.Context, request compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2536,13 +2581,13 @@ func (s *AuthSettings) CreateIdentityProvider(ctx context.Context, request compo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2555,17 +2600,17 @@ func (s *AuthSettings) CreateIdentityProvider(ctx context.Context, request compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2718,11 +2763,13 @@ func (s *AuthSettings) GetIdentityProvider(ctx context.Context, id string, opts } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-identity-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-identity-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2771,15 +2818,17 @@ func (s *AuthSettings) GetIdentityProvider(ctx context.Context, id string, opts "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2796,7 +2845,7 @@ func (s *AuthSettings) GetIdentityProvider(ctx context.Context, id string, opts err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2804,13 +2853,13 @@ func (s *AuthSettings) GetIdentityProvider(ctx context.Context, id string, opts if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2823,17 +2872,17 @@ func (s *AuthSettings) GetIdentityProvider(ctx context.Context, id string, opts err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3008,11 +3057,13 @@ func (s *AuthSettings) UpdateIdentityProvider(ctx context.Context, id string, up } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-identity-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-identity-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateIdentityProvider", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3068,15 +3119,17 @@ func (s *AuthSettings) UpdateIdentityProvider(ctx context.Context, id string, up "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3093,7 +3146,7 @@ func (s *AuthSettings) UpdateIdentityProvider(ctx context.Context, id string, up err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3101,13 +3154,13 @@ func (s *AuthSettings) UpdateIdentityProvider(ctx context.Context, id string, up if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3120,17 +3173,17 @@ func (s *AuthSettings) UpdateIdentityProvider(ctx context.Context, id string, up err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3304,11 +3357,13 @@ func (s *AuthSettings) DeleteIdentityProvider(ctx context.Context, id string, op } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-identity-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-identity-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3357,15 +3412,17 @@ func (s *AuthSettings) DeleteIdentityProvider(ctx context.Context, id string, op "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3382,7 +3439,7 @@ func (s *AuthSettings) DeleteIdentityProvider(ctx context.Context, id string, op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3390,13 +3447,13 @@ func (s *AuthSettings) DeleteIdentityProvider(ctx context.Context, id string, op if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3409,17 +3466,17 @@ func (s *AuthSettings) DeleteIdentityProvider(ctx context.Context, id string, op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/basicauthcredentials.go b/basicauthcredentials.go index d78194d7..13ae255d 100644 --- a/basicauthcredentials.go +++ b/basicauthcredentials.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type BasicAuthCredentials struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newBasicAuthCredentials(sdkConfig sdkConfiguration) *BasicAuthCredentials { +func newBasicAuthCredentials(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *BasicAuthCredentials { return &BasicAuthCredentials{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *BasicAuthCredentials) ListBasicAuth(ctx context.Context, request operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-basic-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-basic-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *BasicAuthCredentials) ListBasicAuth(ctx context.Context, request operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *BasicAuthCredentials) ListBasicAuth(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *BasicAuthCredentials) ListBasicAuth(ctx context.Context, request operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *BasicAuthCredentials) ListBasicAuth(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -283,11 +292,13 @@ func (s *BasicAuthCredentials) GetBasicAuth(ctx context.Context, basicAuthID str } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-basic-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-basic-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -336,15 +347,17 @@ func (s *BasicAuthCredentials) GetBasicAuth(ctx context.Context, basicAuthID str "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -361,7 +374,7 @@ func (s *BasicAuthCredentials) GetBasicAuth(ctx context.Context, basicAuthID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -369,13 +382,13 @@ func (s *BasicAuthCredentials) GetBasicAuth(ctx context.Context, basicAuthID str if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -388,17 +401,17 @@ func (s *BasicAuthCredentials) GetBasicAuth(ctx context.Context, basicAuthID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -507,11 +520,13 @@ func (s *BasicAuthCredentials) ListBasicAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-basic-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-basic-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -564,15 +579,17 @@ func (s *BasicAuthCredentials) ListBasicAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -589,7 +606,7 @@ func (s *BasicAuthCredentials) ListBasicAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -597,13 +614,13 @@ func (s *BasicAuthCredentials) ListBasicAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -616,17 +633,17 @@ func (s *BasicAuthCredentials) ListBasicAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -712,11 +729,13 @@ func (s *BasicAuthCredentials) CreateBasicAuthWithConsumer(ctx context.Context, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-basic-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-basic-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "BasicAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -772,15 +791,17 @@ func (s *BasicAuthCredentials) CreateBasicAuthWithConsumer(ctx context.Context, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -797,7 +818,7 @@ func (s *BasicAuthCredentials) CreateBasicAuthWithConsumer(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -805,13 +826,13 @@ func (s *BasicAuthCredentials) CreateBasicAuthWithConsumer(ctx context.Context, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -824,17 +845,17 @@ func (s *BasicAuthCredentials) CreateBasicAuthWithConsumer(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -920,11 +941,13 @@ func (s *BasicAuthCredentials) DeleteBasicAuthWithConsumer(ctx context.Context, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-basic-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-basic-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -973,15 +996,17 @@ func (s *BasicAuthCredentials) DeleteBasicAuthWithConsumer(ctx context.Context, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -998,7 +1023,7 @@ func (s *BasicAuthCredentials) DeleteBasicAuthWithConsumer(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1006,13 +1031,13 @@ func (s *BasicAuthCredentials) DeleteBasicAuthWithConsumer(ctx context.Context, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1025,17 +1050,17 @@ func (s *BasicAuthCredentials) DeleteBasicAuthWithConsumer(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1101,11 +1126,13 @@ func (s *BasicAuthCredentials) GetBasicAuthWithConsumer(ctx context.Context, req } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-basic-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-basic-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1154,15 +1181,17 @@ func (s *BasicAuthCredentials) GetBasicAuthWithConsumer(ctx context.Context, req "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1179,7 +1208,7 @@ func (s *BasicAuthCredentials) GetBasicAuthWithConsumer(ctx context.Context, req err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1187,13 +1216,13 @@ func (s *BasicAuthCredentials) GetBasicAuthWithConsumer(ctx context.Context, req if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1206,17 +1235,17 @@ func (s *BasicAuthCredentials) GetBasicAuthWithConsumer(ctx context.Context, req err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1304,11 +1333,13 @@ func (s *BasicAuthCredentials) UpsertBasicAuthWithConsumer(ctx context.Context, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-basic-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-basic-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "BasicAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1364,15 +1395,17 @@ func (s *BasicAuthCredentials) UpsertBasicAuthWithConsumer(ctx context.Context, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1389,7 +1422,7 @@ func (s *BasicAuthCredentials) UpsertBasicAuthWithConsumer(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1397,13 +1430,13 @@ func (s *BasicAuthCredentials) UpsertBasicAuthWithConsumer(ctx context.Context, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1416,17 +1449,17 @@ func (s *BasicAuthCredentials) UpsertBasicAuthWithConsumer(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/cacertificates.go b/cacertificates.go index e8bdf767..de7d5752 100644 --- a/cacertificates.go +++ b/cacertificates.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -18,12 +19,16 @@ import ( // CACertificates - A CA certificate object represents a trusted certificate authority. // These objects are used by Kong Gateway to verify the validity of a client or server certificate. type CACertificates struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newCACertificates(sdkConfig sdkConfiguration) *CACertificates { +func newCACertificates(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *CACertificates { return &CACertificates{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *CACertificates) ListCaCertificate(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-ca_certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-ca_certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -111,15 +118,17 @@ func (s *CACertificates) ListCaCertificate(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -136,7 +145,7 @@ func (s *CACertificates) ListCaCertificate(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -144,13 +153,13 @@ func (s *CACertificates) ListCaCertificate(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -163,17 +172,17 @@ func (s *CACertificates) ListCaCertificate(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -285,11 +294,13 @@ func (s *CACertificates) CreateCaCertificate(ctx context.Context, controlPlaneID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-ca_certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-ca_certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CACertificate", "json", `request:"mediaType=application/json"`) if err != nil { @@ -345,15 +356,17 @@ func (s *CACertificates) CreateCaCertificate(ctx context.Context, controlPlaneID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -370,7 +383,7 @@ func (s *CACertificates) CreateCaCertificate(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -378,13 +391,13 @@ func (s *CACertificates) CreateCaCertificate(ctx context.Context, controlPlaneID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -397,17 +410,17 @@ func (s *CACertificates) CreateCaCertificate(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -519,11 +532,13 @@ func (s *CACertificates) DeleteCaCertificate(ctx context.Context, controlPlaneID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-ca_certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-ca_certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -572,15 +587,17 @@ func (s *CACertificates) DeleteCaCertificate(ctx context.Context, controlPlaneID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -597,7 +614,7 @@ func (s *CACertificates) DeleteCaCertificate(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -605,13 +622,13 @@ func (s *CACertificates) DeleteCaCertificate(ctx context.Context, controlPlaneID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -624,17 +641,17 @@ func (s *CACertificates) DeleteCaCertificate(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -726,11 +743,13 @@ func (s *CACertificates) GetCaCertificate(ctx context.Context, caCertificateID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-ca_certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-ca_certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -779,15 +798,17 @@ func (s *CACertificates) GetCaCertificate(ctx context.Context, caCertificateID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -804,7 +825,7 @@ func (s *CACertificates) GetCaCertificate(ctx context.Context, caCertificateID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -812,13 +833,13 @@ func (s *CACertificates) GetCaCertificate(ctx context.Context, caCertificateID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -831,17 +852,17 @@ func (s *CACertificates) GetCaCertificate(ctx context.Context, caCertificateID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -950,11 +971,13 @@ func (s *CACertificates) UpsertCaCertificate(ctx context.Context, request operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-ca_certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-ca_certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CACertificate", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1010,15 +1033,17 @@ func (s *CACertificates) UpsertCaCertificate(ctx context.Context, request operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1035,7 +1060,7 @@ func (s *CACertificates) UpsertCaCertificate(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1043,13 +1068,13 @@ func (s *CACertificates) UpsertCaCertificate(ctx context.Context, request operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1062,17 +1087,17 @@ func (s *CACertificates) UpsertCaCertificate(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/certificates.go b/certificates.go index ef47ec32..9684b935 100644 --- a/certificates.go +++ b/certificates.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -21,12 +22,16 @@ import ( //

// If intermediate certificates are required in addition to the main certificate, they should be concatenated together into one string. type Certificates struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newCertificates(sdkConfig sdkConfiguration) *Certificates { +func newCertificates(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Certificates { return &Certificates{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -57,11 +62,13 @@ func (s *Certificates) ListCertificate(ctx context.Context, request operations.L } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -114,15 +121,17 @@ func (s *Certificates) ListCertificate(ctx context.Context, request operations.L "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -139,7 +148,7 @@ func (s *Certificates) ListCertificate(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -147,13 +156,13 @@ func (s *Certificates) ListCertificate(ctx context.Context, request operations.L if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -166,17 +175,17 @@ func (s *Certificates) ListCertificate(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -288,11 +297,13 @@ func (s *Certificates) CreateCertificate(ctx context.Context, controlPlaneID str } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Certificate", "json", `request:"mediaType=application/json"`) if err != nil { @@ -348,15 +359,17 @@ func (s *Certificates) CreateCertificate(ctx context.Context, controlPlaneID str "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -373,7 +386,7 @@ func (s *Certificates) CreateCertificate(ctx context.Context, controlPlaneID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -381,13 +394,13 @@ func (s *Certificates) CreateCertificate(ctx context.Context, controlPlaneID str if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -400,17 +413,17 @@ func (s *Certificates) CreateCertificate(ctx context.Context, controlPlaneID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -522,11 +535,13 @@ func (s *Certificates) DeleteCertificate(ctx context.Context, controlPlaneID str } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -575,15 +590,17 @@ func (s *Certificates) DeleteCertificate(ctx context.Context, controlPlaneID str "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -600,7 +617,7 @@ func (s *Certificates) DeleteCertificate(ctx context.Context, controlPlaneID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -608,13 +625,13 @@ func (s *Certificates) DeleteCertificate(ctx context.Context, controlPlaneID str if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -627,17 +644,17 @@ func (s *Certificates) DeleteCertificate(ctx context.Context, controlPlaneID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -729,11 +746,13 @@ func (s *Certificates) GetCertificate(ctx context.Context, certificateID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -782,15 +801,17 @@ func (s *Certificates) GetCertificate(ctx context.Context, certificateID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -807,7 +828,7 @@ func (s *Certificates) GetCertificate(ctx context.Context, certificateID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -815,13 +836,13 @@ func (s *Certificates) GetCertificate(ctx context.Context, certificateID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -834,17 +855,17 @@ func (s *Certificates) GetCertificate(ctx context.Context, certificateID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -953,11 +974,13 @@ func (s *Certificates) UpsertCertificate(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Certificate", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1013,15 +1036,17 @@ func (s *Certificates) UpsertCertificate(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1038,7 +1063,7 @@ func (s *Certificates) UpsertCertificate(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1046,13 +1071,13 @@ func (s *Certificates) UpsertCertificate(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1065,17 +1090,17 @@ func (s *Certificates) UpsertCertificate(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/cloudgateways.go b/cloudgateways.go index f616d401..152d4f46 100644 --- a/cloudgateways.go +++ b/cloudgateways.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type CloudGateways struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newCloudGateways(sdkConfig sdkConfiguration) *CloudGateways { +func newCloudGateways(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *CloudGateways { return &CloudGateways{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *CloudGateways) GetAvailabilityJSON(ctx context.Context, opts ...operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-availability-json", - OAuth2Scopes: []string{}, - SecuritySource: nil, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-availability-json", + OAuth2Scopes: []string{}, + SecuritySource: nil, } timeout := o.Timeout @@ -102,15 +109,17 @@ func (s *CloudGateways) GetAvailabilityJSON(ctx context.Context, opts ...operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -127,7 +136,7 @@ func (s *CloudGateways) GetAvailabilityJSON(ctx context.Context, opts ...operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -135,13 +144,13 @@ func (s *CloudGateways) GetAvailabilityJSON(ctx context.Context, opts ...operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -154,17 +163,17 @@ func (s *CloudGateways) GetAvailabilityJSON(ctx context.Context, opts ...operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -250,11 +259,13 @@ func (s *CloudGateways) ListConfigurations(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-configurations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-configurations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -307,15 +318,17 @@ func (s *CloudGateways) ListConfigurations(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -332,7 +345,7 @@ func (s *CloudGateways) ListConfigurations(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -340,13 +353,13 @@ func (s *CloudGateways) ListConfigurations(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -359,17 +372,17 @@ func (s *CloudGateways) ListConfigurations(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -522,11 +535,13 @@ func (s *CloudGateways) CreateConfiguration(ctx context.Context, request compone } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-configuration", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -582,15 +597,17 @@ func (s *CloudGateways) CreateConfiguration(ctx context.Context, request compone "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -607,7 +624,7 @@ func (s *CloudGateways) CreateConfiguration(ctx context.Context, request compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -615,13 +632,13 @@ func (s *CloudGateways) CreateConfiguration(ctx context.Context, request compone if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -634,17 +651,17 @@ func (s *CloudGateways) CreateConfiguration(ctx context.Context, request compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -838,11 +855,13 @@ func (s *CloudGateways) GetConfiguration(ctx context.Context, configurationID st } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-configuration", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -891,15 +910,17 @@ func (s *CloudGateways) GetConfiguration(ctx context.Context, configurationID st "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -916,7 +937,7 @@ func (s *CloudGateways) GetConfiguration(ctx context.Context, configurationID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -924,13 +945,13 @@ func (s *CloudGateways) GetConfiguration(ctx context.Context, configurationID st if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -943,17 +964,17 @@ func (s *CloudGateways) GetConfiguration(ctx context.Context, configurationID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1102,11 +1123,13 @@ func (s *CloudGateways) ListCustomDomains(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-custom-domains", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-custom-domains", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1159,15 +1182,17 @@ func (s *CloudGateways) ListCustomDomains(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1184,7 +1209,7 @@ func (s *CloudGateways) ListCustomDomains(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1192,13 +1217,13 @@ func (s *CloudGateways) ListCustomDomains(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1211,17 +1236,17 @@ func (s *CloudGateways) ListCustomDomains(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1391,11 +1416,13 @@ func (s *CloudGateways) CreateCustomDomains(ctx context.Context, request compone } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-custom-domains", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-custom-domains", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1451,15 +1478,17 @@ func (s *CloudGateways) CreateCustomDomains(ctx context.Context, request compone "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1476,7 +1505,7 @@ func (s *CloudGateways) CreateCustomDomains(ctx context.Context, request compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1484,13 +1513,13 @@ func (s *CloudGateways) CreateCustomDomains(ctx context.Context, request compone if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1503,17 +1532,17 @@ func (s *CloudGateways) CreateCustomDomains(ctx context.Context, request compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1707,11 +1736,13 @@ func (s *CloudGateways) GetCustomDomain(ctx context.Context, customDomainID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-custom-domain", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-custom-domain", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1760,15 +1791,17 @@ func (s *CloudGateways) GetCustomDomain(ctx context.Context, customDomainID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1785,7 +1818,7 @@ func (s *CloudGateways) GetCustomDomain(ctx context.Context, customDomainID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1793,13 +1826,13 @@ func (s *CloudGateways) GetCustomDomain(ctx context.Context, customDomainID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1812,17 +1845,17 @@ func (s *CloudGateways) GetCustomDomain(ctx context.Context, customDomainID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1974,11 +2007,13 @@ func (s *CloudGateways) DeleteCustomDomain(ctx context.Context, customDomainID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-custom-domain", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-custom-domain", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2033,15 +2068,17 @@ func (s *CloudGateways) DeleteCustomDomain(ctx context.Context, customDomainID s "400", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2058,7 +2095,7 @@ func (s *CloudGateways) DeleteCustomDomain(ctx context.Context, customDomainID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2066,13 +2103,13 @@ func (s *CloudGateways) DeleteCustomDomain(ctx context.Context, customDomainID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2085,17 +2122,17 @@ func (s *CloudGateways) DeleteCustomDomain(ctx context.Context, customDomainID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2248,11 +2285,13 @@ func (s *CloudGateways) GetCustomDomainOnlineStatus(ctx context.Context, customD } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-custom-domain-online-status", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-custom-domain-online-status", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2301,15 +2340,17 @@ func (s *CloudGateways) GetCustomDomainOnlineStatus(ctx context.Context, customD "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2326,7 +2367,7 @@ func (s *CloudGateways) GetCustomDomainOnlineStatus(ctx context.Context, customD err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2334,13 +2375,13 @@ func (s *CloudGateways) GetCustomDomainOnlineStatus(ctx context.Context, customD if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2353,17 +2394,17 @@ func (s *CloudGateways) GetCustomDomainOnlineStatus(ctx context.Context, customD err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2519,11 +2560,13 @@ func (s *CloudGateways) ListDefaultResourceConfigurations(ctx context.Context, p } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-default-resource-configurations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-default-resource-configurations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2576,15 +2619,17 @@ func (s *CloudGateways) ListDefaultResourceConfigurations(ctx context.Context, p "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2601,7 +2646,7 @@ func (s *CloudGateways) ListDefaultResourceConfigurations(ctx context.Context, p err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2609,13 +2654,13 @@ func (s *CloudGateways) ListDefaultResourceConfigurations(ctx context.Context, p if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2628,17 +2673,17 @@ func (s *CloudGateways) ListDefaultResourceConfigurations(ctx context.Context, p err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2792,11 +2837,13 @@ func (s *CloudGateways) ListDefaultResourceQuotas(ctx context.Context, pageSize } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-default-resource-quotas", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-default-resource-quotas", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2849,15 +2896,17 @@ func (s *CloudGateways) ListDefaultResourceQuotas(ctx context.Context, pageSize "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2874,7 +2923,7 @@ func (s *CloudGateways) ListDefaultResourceQuotas(ctx context.Context, pageSize err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2882,13 +2931,13 @@ func (s *CloudGateways) ListDefaultResourceQuotas(ctx context.Context, pageSize if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2901,17 +2950,17 @@ func (s *CloudGateways) ListDefaultResourceQuotas(ctx context.Context, pageSize err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3059,11 +3108,13 @@ func (s *CloudGateways) ListNetworks(ctx context.Context, request operations.Lis } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-networks", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-networks", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3116,15 +3167,17 @@ func (s *CloudGateways) ListNetworks(ctx context.Context, request operations.Lis "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3141,7 +3194,7 @@ func (s *CloudGateways) ListNetworks(ctx context.Context, request operations.Lis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3149,13 +3202,13 @@ func (s *CloudGateways) ListNetworks(ctx context.Context, request operations.Lis if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3168,17 +3221,17 @@ func (s *CloudGateways) ListNetworks(ctx context.Context, request operations.Lis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3326,11 +3379,13 @@ func (s *CloudGateways) CreateNetwork(ctx context.Context, request components.Cr } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-network", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-network", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3386,15 +3441,17 @@ func (s *CloudGateways) CreateNetwork(ctx context.Context, request components.Cr "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3411,7 +3468,7 @@ func (s *CloudGateways) CreateNetwork(ctx context.Context, request components.Cr err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3419,13 +3476,13 @@ func (s *CloudGateways) CreateNetwork(ctx context.Context, request components.Cr if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3438,17 +3495,17 @@ func (s *CloudGateways) CreateNetwork(ctx context.Context, request components.Cr err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3621,11 +3678,13 @@ func (s *CloudGateways) GetNetwork(ctx context.Context, networkID string, opts . } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-network", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-network", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3674,15 +3733,17 @@ func (s *CloudGateways) GetNetwork(ctx context.Context, networkID string, opts . "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3699,7 +3760,7 @@ func (s *CloudGateways) GetNetwork(ctx context.Context, networkID string, opts . err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3707,13 +3768,13 @@ func (s *CloudGateways) GetNetwork(ctx context.Context, networkID string, opts . if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3726,17 +3787,17 @@ func (s *CloudGateways) GetNetwork(ctx context.Context, networkID string, opts . err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3889,11 +3950,13 @@ func (s *CloudGateways) UpdateNetwork(ctx context.Context, networkID string, pat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-network", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-network", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PatchNetworkRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3949,15 +4012,17 @@ func (s *CloudGateways) UpdateNetwork(ctx context.Context, networkID string, pat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3974,7 +4039,7 @@ func (s *CloudGateways) UpdateNetwork(ctx context.Context, networkID string, pat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3982,13 +4047,13 @@ func (s *CloudGateways) UpdateNetwork(ctx context.Context, networkID string, pat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4001,17 +4066,17 @@ func (s *CloudGateways) UpdateNetwork(ctx context.Context, networkID string, pat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4205,11 +4270,13 @@ func (s *CloudGateways) DeleteNetwork(ctx context.Context, networkID string, opt } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-network", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-network", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4264,15 +4331,17 @@ func (s *CloudGateways) DeleteNetwork(ctx context.Context, networkID string, opt "400", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4289,7 +4358,7 @@ func (s *CloudGateways) DeleteNetwork(ctx context.Context, networkID string, opt err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4297,13 +4366,13 @@ func (s *CloudGateways) DeleteNetwork(ctx context.Context, networkID string, opt if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4316,17 +4385,17 @@ func (s *CloudGateways) DeleteNetwork(ctx context.Context, networkID string, opt err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4476,11 +4545,13 @@ func (s *CloudGateways) ListNetworkConfigurations(ctx context.Context, request o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-network-configurations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-network-configurations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4533,15 +4604,17 @@ func (s *CloudGateways) ListNetworkConfigurations(ctx context.Context, request o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4558,7 +4631,7 @@ func (s *CloudGateways) ListNetworkConfigurations(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4566,13 +4639,13 @@ func (s *CloudGateways) ListNetworkConfigurations(ctx context.Context, request o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4585,17 +4658,17 @@ func (s *CloudGateways) ListNetworkConfigurations(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4764,11 +4837,13 @@ func (s *CloudGateways) ListTransitGateways(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-transit-gateways", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-transit-gateways", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4821,15 +4896,17 @@ func (s *CloudGateways) ListTransitGateways(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4846,7 +4923,7 @@ func (s *CloudGateways) ListTransitGateways(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4854,13 +4931,13 @@ func (s *CloudGateways) ListTransitGateways(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4873,17 +4950,17 @@ func (s *CloudGateways) ListTransitGateways(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -5057,11 +5134,13 @@ func (s *CloudGateways) CreateTransitGateway(ctx context.Context, networkID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-transit-gateway", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-transit-gateway", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateTransitGatewayRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -5123,15 +5202,17 @@ func (s *CloudGateways) CreateTransitGateway(ctx context.Context, networkID stri "400", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -5148,7 +5229,7 @@ func (s *CloudGateways) CreateTransitGateway(ctx context.Context, networkID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -5156,13 +5237,13 @@ func (s *CloudGateways) CreateTransitGateway(ctx context.Context, networkID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -5175,17 +5256,17 @@ func (s *CloudGateways) CreateTransitGateway(ctx context.Context, networkID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -5380,11 +5461,13 @@ func (s *CloudGateways) GetTransitGateway(ctx context.Context, networkID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-transit-gateway", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-transit-gateway", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -5433,15 +5516,17 @@ func (s *CloudGateways) GetTransitGateway(ctx context.Context, networkID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -5458,7 +5543,7 @@ func (s *CloudGateways) GetTransitGateway(ctx context.Context, networkID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -5466,13 +5551,13 @@ func (s *CloudGateways) GetTransitGateway(ctx context.Context, networkID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -5485,17 +5570,17 @@ func (s *CloudGateways) GetTransitGateway(ctx context.Context, networkID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -5648,11 +5733,13 @@ func (s *CloudGateways) DeleteTransitGateway(ctx context.Context, networkID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-transit-gateway", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-transit-gateway", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -5707,15 +5794,17 @@ func (s *CloudGateways) DeleteTransitGateway(ctx context.Context, networkID stri "400", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -5732,7 +5821,7 @@ func (s *CloudGateways) DeleteTransitGateway(ctx context.Context, networkID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -5740,13 +5829,13 @@ func (s *CloudGateways) DeleteTransitGateway(ctx context.Context, networkID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -5759,17 +5848,17 @@ func (s *CloudGateways) DeleteTransitGateway(ctx context.Context, networkID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -5918,11 +6007,13 @@ func (s *CloudGateways) ListProviderAccounts(ctx context.Context, request operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-provider-accounts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-provider-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -5975,15 +6066,17 @@ func (s *CloudGateways) ListProviderAccounts(ctx context.Context, request operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -6000,7 +6093,7 @@ func (s *CloudGateways) ListProviderAccounts(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -6008,13 +6101,13 @@ func (s *CloudGateways) ListProviderAccounts(ctx context.Context, request operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -6027,17 +6120,17 @@ func (s *CloudGateways) ListProviderAccounts(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -6189,11 +6282,13 @@ func (s *CloudGateways) GetProviderAccount(ctx context.Context, providerAccountI } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-provider-account", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-provider-account", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -6242,15 +6337,17 @@ func (s *CloudGateways) GetProviderAccount(ctx context.Context, providerAccountI "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -6267,7 +6364,7 @@ func (s *CloudGateways) GetProviderAccount(ctx context.Context, providerAccountI err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -6275,13 +6372,13 @@ func (s *CloudGateways) GetProviderAccount(ctx context.Context, providerAccountI if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -6294,17 +6391,17 @@ func (s *CloudGateways) GetProviderAccount(ctx context.Context, providerAccountI err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -6459,11 +6556,13 @@ func (s *CloudGateways) ListResourceConfigurations(ctx context.Context, pageSize } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-resource-configurations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-resource-configurations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -6516,15 +6615,17 @@ func (s *CloudGateways) ListResourceConfigurations(ctx context.Context, pageSize "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -6541,7 +6642,7 @@ func (s *CloudGateways) ListResourceConfigurations(ctx context.Context, pageSize err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -6549,13 +6650,13 @@ func (s *CloudGateways) ListResourceConfigurations(ctx context.Context, pageSize if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -6568,17 +6669,17 @@ func (s *CloudGateways) ListResourceConfigurations(ctx context.Context, pageSize err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -6730,11 +6831,13 @@ func (s *CloudGateways) GetResourceConfiguration(ctx context.Context, resourceCo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-resource-configuration", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-resource-configuration", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -6783,15 +6886,17 @@ func (s *CloudGateways) GetResourceConfiguration(ctx context.Context, resourceCo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -6808,7 +6913,7 @@ func (s *CloudGateways) GetResourceConfiguration(ctx context.Context, resourceCo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -6816,13 +6921,13 @@ func (s *CloudGateways) GetResourceConfiguration(ctx context.Context, resourceCo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -6835,17 +6940,17 @@ func (s *CloudGateways) GetResourceConfiguration(ctx context.Context, resourceCo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -6998,11 +7103,13 @@ func (s *CloudGateways) ListResourceQuotas(ctx context.Context, pageSize *int64, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-resource-quotas", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-resource-quotas", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -7055,15 +7162,17 @@ func (s *CloudGateways) ListResourceQuotas(ctx context.Context, pageSize *int64, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -7080,7 +7189,7 @@ func (s *CloudGateways) ListResourceQuotas(ctx context.Context, pageSize *int64, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -7088,13 +7197,13 @@ func (s *CloudGateways) ListResourceQuotas(ctx context.Context, pageSize *int64, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -7107,17 +7216,17 @@ func (s *CloudGateways) ListResourceQuotas(ctx context.Context, pageSize *int64, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -7269,11 +7378,13 @@ func (s *CloudGateways) GetResourceQuota(ctx context.Context, resourceQuotaID st } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-resource-quota", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-resource-quota", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -7322,15 +7433,17 @@ func (s *CloudGateways) GetResourceQuota(ctx context.Context, resourceQuotaID st "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -7347,7 +7460,7 @@ func (s *CloudGateways) GetResourceQuota(ctx context.Context, resourceQuotaID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -7355,13 +7468,13 @@ func (s *CloudGateways) GetResourceQuota(ctx context.Context, resourceQuotaID st if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -7374,17 +7487,17 @@ func (s *CloudGateways) GetResourceQuota(ctx context.Context, resourceQuotaID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/configstores.go b/configstores.go index bd2de532..01e261c2 100644 --- a/configstores.go +++ b/configstores.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // ConfigStores - Config Stores type ConfigStores struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newConfigStores(sdkConfig sdkConfiguration) *ConfigStores { +func newConfigStores(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ConfigStores { return &ConfigStores{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *ConfigStores) ListConfigStores(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-config-stores", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-config-stores", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *ConfigStores) ListConfigStores(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *ConfigStores) ListConfigStores(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *ConfigStores) ListConfigStores(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *ConfigStores) ListConfigStores(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -325,11 +334,13 @@ func (s *ConfigStores) CreateConfigStore(ctx context.Context, controlPlaneID str } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-config-store", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateConfigStore", "json", `request:"mediaType=application/json"`) if err != nil { @@ -385,15 +396,17 @@ func (s *ConfigStores) CreateConfigStore(ctx context.Context, controlPlaneID str "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -410,7 +423,7 @@ func (s *ConfigStores) CreateConfigStore(ctx context.Context, controlPlaneID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -418,13 +431,13 @@ func (s *ConfigStores) CreateConfigStore(ctx context.Context, controlPlaneID str if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -437,17 +450,17 @@ func (s *ConfigStores) CreateConfigStore(ctx context.Context, controlPlaneID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -622,11 +635,13 @@ func (s *ConfigStores) GetConfigStore(ctx context.Context, controlPlaneID string } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-config-store", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -675,15 +690,17 @@ func (s *ConfigStores) GetConfigStore(ctx context.Context, controlPlaneID string "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -700,7 +717,7 @@ func (s *ConfigStores) GetConfigStore(ctx context.Context, controlPlaneID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -708,13 +725,13 @@ func (s *ConfigStores) GetConfigStore(ctx context.Context, controlPlaneID string if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -727,17 +744,17 @@ func (s *ConfigStores) GetConfigStore(ctx context.Context, controlPlaneID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -865,11 +882,13 @@ func (s *ConfigStores) UpdateConfigStore(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-config-store", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateConfigStore", "json", `request:"mediaType=application/json"`) if err != nil { @@ -925,15 +944,17 @@ func (s *ConfigStores) UpdateConfigStore(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -950,7 +971,7 @@ func (s *ConfigStores) UpdateConfigStore(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -958,13 +979,13 @@ func (s *ConfigStores) UpdateConfigStore(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -977,17 +998,17 @@ func (s *ConfigStores) UpdateConfigStore(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1178,11 +1199,13 @@ func (s *ConfigStores) DeleteConfigStore(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-config-store", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-config-store", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1235,15 +1258,17 @@ func (s *ConfigStores) DeleteConfigStore(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1260,7 +1285,7 @@ func (s *ConfigStores) DeleteConfigStore(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1268,13 +1293,13 @@ func (s *ConfigStores) DeleteConfigStore(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1287,17 +1312,17 @@ func (s *ConfigStores) DeleteConfigStore(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/configstoresecrets.go b/configstoresecrets.go index 9b9f56b7..244ae755 100644 --- a/configstoresecrets.go +++ b/configstoresecrets.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // ConfigStoreSecrets - Config Store Secrets type ConfigStoreSecrets struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newConfigStoreSecrets(sdkConfig sdkConfiguration) *ConfigStoreSecrets { +func newConfigStoreSecrets(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ConfigStoreSecrets { return &ConfigStoreSecrets{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *ConfigStoreSecrets) CreateConfigStoreSecret(ctx context.Context, reques } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-config-store-secret", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CreateConfigStoreSecret", "json", `request:"mediaType=application/json"`) if err != nil { @@ -113,15 +120,17 @@ func (s *ConfigStoreSecrets) CreateConfigStoreSecret(ctx context.Context, reques "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -138,7 +147,7 @@ func (s *ConfigStoreSecrets) CreateConfigStoreSecret(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -146,13 +155,13 @@ func (s *ConfigStoreSecrets) CreateConfigStoreSecret(ctx context.Context, reques if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -165,17 +174,17 @@ func (s *ConfigStoreSecrets) CreateConfigStoreSecret(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -366,11 +375,13 @@ func (s *ConfigStoreSecrets) ListConfigStoreSecrets(ctx context.Context, request } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-config-store-secrets", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-config-store-secrets", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -423,15 +434,17 @@ func (s *ConfigStoreSecrets) ListConfigStoreSecrets(ctx context.Context, request "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -448,7 +461,7 @@ func (s *ConfigStoreSecrets) ListConfigStoreSecrets(ctx context.Context, request err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -456,13 +469,13 @@ func (s *ConfigStoreSecrets) ListConfigStoreSecrets(ctx context.Context, request if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -475,17 +488,17 @@ func (s *ConfigStoreSecrets) ListConfigStoreSecrets(ctx context.Context, request err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -655,11 +668,13 @@ func (s *ConfigStoreSecrets) GetConfigStoreSecret(ctx context.Context, request o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-config-store-secret", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -708,15 +723,17 @@ func (s *ConfigStoreSecrets) GetConfigStoreSecret(ctx context.Context, request o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -733,7 +750,7 @@ func (s *ConfigStoreSecrets) GetConfigStoreSecret(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -741,13 +758,13 @@ func (s *ConfigStoreSecrets) GetConfigStoreSecret(ctx context.Context, request o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -760,17 +777,17 @@ func (s *ConfigStoreSecrets) GetConfigStoreSecret(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -919,11 +936,13 @@ func (s *ConfigStoreSecrets) UpdateConfigStoreSecret(ctx context.Context, reques } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-config-store-secret", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateConfigStoreSecret", "json", `request:"mediaType=application/json"`) if err != nil { @@ -979,15 +998,17 @@ func (s *ConfigStoreSecrets) UpdateConfigStoreSecret(ctx context.Context, reques "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1004,7 +1025,7 @@ func (s *ConfigStoreSecrets) UpdateConfigStoreSecret(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1012,13 +1033,13 @@ func (s *ConfigStoreSecrets) UpdateConfigStoreSecret(ctx context.Context, reques if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1031,17 +1052,17 @@ func (s *ConfigStoreSecrets) UpdateConfigStoreSecret(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1232,11 +1253,13 @@ func (s *ConfigStoreSecrets) DeleteConfigStoreSecret(ctx context.Context, reques } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-config-store-secret", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-config-store-secret", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1285,15 +1308,17 @@ func (s *ConfigStoreSecrets) DeleteConfigStoreSecret(ctx context.Context, reques "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1310,7 +1335,7 @@ func (s *ConfigStoreSecrets) DeleteConfigStoreSecret(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1318,13 +1343,13 @@ func (s *ConfigStoreSecrets) DeleteConfigStoreSecret(ctx context.Context, reques if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1337,17 +1362,17 @@ func (s *ConfigStoreSecrets) DeleteConfigStoreSecret(ctx context.Context, reques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/consumergroups.go b/consumergroups.go index 80fb88fd..a5745bfa 100644 --- a/consumergroups.go +++ b/consumergroups.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -18,12 +19,16 @@ import ( // ConsumerGroups - Consumer groups enable the organization and categorization of consumers (users or applications) within an API ecosystem. // By grouping consumers together, you eliminate the need to manage them individually, providing a scalable, efficient approach to managing configurations. type ConsumerGroups struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newConsumerGroups(sdkConfig sdkConfiguration) *ConsumerGroups { +func newConsumerGroups(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ConsumerGroups { return &ConsumerGroups{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *ConsumerGroups) ListConsumerGroup(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -111,15 +118,17 @@ func (s *ConsumerGroups) ListConsumerGroup(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -136,7 +145,7 @@ func (s *ConsumerGroups) ListConsumerGroup(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -144,13 +153,13 @@ func (s *ConsumerGroups) ListConsumerGroup(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -163,17 +172,17 @@ func (s *ConsumerGroups) ListConsumerGroup(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -285,11 +294,13 @@ func (s *ConsumerGroups) CreateConsumerGroup(ctx context.Context, controlPlaneID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "ConsumerGroup", "json", `request:"mediaType=application/json"`) if err != nil { @@ -345,15 +356,17 @@ func (s *ConsumerGroups) CreateConsumerGroup(ctx context.Context, controlPlaneID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -370,7 +383,7 @@ func (s *ConsumerGroups) CreateConsumerGroup(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -378,13 +391,13 @@ func (s *ConsumerGroups) CreateConsumerGroup(ctx context.Context, controlPlaneID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -397,17 +410,17 @@ func (s *ConsumerGroups) CreateConsumerGroup(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -519,11 +532,13 @@ func (s *ConsumerGroups) DeleteConsumerGroup(ctx context.Context, controlPlaneID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -572,15 +587,17 @@ func (s *ConsumerGroups) DeleteConsumerGroup(ctx context.Context, controlPlaneID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -597,7 +614,7 @@ func (s *ConsumerGroups) DeleteConsumerGroup(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -605,13 +622,13 @@ func (s *ConsumerGroups) DeleteConsumerGroup(ctx context.Context, controlPlaneID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -624,17 +641,17 @@ func (s *ConsumerGroups) DeleteConsumerGroup(ctx context.Context, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -726,11 +743,13 @@ func (s *ConsumerGroups) GetConsumerGroup(ctx context.Context, consumerGroupID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -779,15 +798,17 @@ func (s *ConsumerGroups) GetConsumerGroup(ctx context.Context, consumerGroupID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -804,7 +825,7 @@ func (s *ConsumerGroups) GetConsumerGroup(ctx context.Context, consumerGroupID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -812,13 +833,13 @@ func (s *ConsumerGroups) GetConsumerGroup(ctx context.Context, consumerGroupID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -831,17 +852,17 @@ func (s *ConsumerGroups) GetConsumerGroup(ctx context.Context, consumerGroupID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -950,11 +971,13 @@ func (s *ConsumerGroups) UpsertConsumerGroup(ctx context.Context, request operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "ConsumerGroup", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1010,15 +1033,17 @@ func (s *ConsumerGroups) UpsertConsumerGroup(ctx context.Context, request operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1035,7 +1060,7 @@ func (s *ConsumerGroups) UpsertConsumerGroup(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1043,13 +1068,13 @@ func (s *ConsumerGroups) UpsertConsumerGroup(ctx context.Context, request operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1062,17 +1087,17 @@ func (s *ConsumerGroups) UpsertConsumerGroup(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1187,11 +1212,13 @@ func (s *ConsumerGroups) RemoveAllConsumersFromConsumerGroup(ctx context.Context } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "remove-all-consumers-from-consumer-group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "remove-all-consumers-from-consumer-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1240,15 +1267,17 @@ func (s *ConsumerGroups) RemoveAllConsumersFromConsumerGroup(ctx context.Context "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1265,7 +1294,7 @@ func (s *ConsumerGroups) RemoveAllConsumersFromConsumerGroup(ctx context.Context err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1273,13 +1302,13 @@ func (s *ConsumerGroups) RemoveAllConsumersFromConsumerGroup(ctx context.Context if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1292,17 +1321,17 @@ func (s *ConsumerGroups) RemoveAllConsumersFromConsumerGroup(ctx context.Context err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1370,11 +1399,13 @@ func (s *ConsumerGroups) ListConsumersForConsumerGroup(ctx context.Context, requ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-consumers-for-consumer-group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-consumers-for-consumer-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1427,15 +1458,17 @@ func (s *ConsumerGroups) ListConsumersForConsumerGroup(ctx context.Context, requ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1452,7 +1485,7 @@ func (s *ConsumerGroups) ListConsumersForConsumerGroup(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1460,13 +1493,13 @@ func (s *ConsumerGroups) ListConsumersForConsumerGroup(ctx context.Context, requ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1479,17 +1512,17 @@ func (s *ConsumerGroups) ListConsumersForConsumerGroup(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1575,11 +1608,13 @@ func (s *ConsumerGroups) AddConsumerToGroup(ctx context.Context, request operati } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "add-consumer-to-group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "add-consumer-to-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1635,15 +1670,17 @@ func (s *ConsumerGroups) AddConsumerToGroup(ctx context.Context, request operati "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1660,7 +1697,7 @@ func (s *ConsumerGroups) AddConsumerToGroup(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1668,13 +1705,13 @@ func (s *ConsumerGroups) AddConsumerToGroup(ctx context.Context, request operati if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1687,17 +1724,17 @@ func (s *ConsumerGroups) AddConsumerToGroup(ctx context.Context, request operati err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1783,11 +1820,13 @@ func (s *ConsumerGroups) RemoveConsumerFromGroup(ctx context.Context, request op } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "remove-consumer-from-group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "remove-consumer-from-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1836,15 +1875,17 @@ func (s *ConsumerGroups) RemoveConsumerFromGroup(ctx context.Context, request op "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1861,7 +1902,7 @@ func (s *ConsumerGroups) RemoveConsumerFromGroup(ctx context.Context, request op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1869,13 +1910,13 @@ func (s *ConsumerGroups) RemoveConsumerFromGroup(ctx context.Context, request op if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1888,17 +1929,17 @@ func (s *ConsumerGroups) RemoveConsumerFromGroup(ctx context.Context, request op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1969,11 +2010,13 @@ func (s *ConsumerGroups) RemoveConsumerFromAllConsumerGroups(ctx context.Context } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "remove-consumer-from-all-consumer-groups", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "remove-consumer-from-all-consumer-groups", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2022,15 +2065,17 @@ func (s *ConsumerGroups) RemoveConsumerFromAllConsumerGroups(ctx context.Context "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2047,7 +2092,7 @@ func (s *ConsumerGroups) RemoveConsumerFromAllConsumerGroups(ctx context.Context err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2055,13 +2100,13 @@ func (s *ConsumerGroups) RemoveConsumerFromAllConsumerGroups(ctx context.Context if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2074,17 +2119,17 @@ func (s *ConsumerGroups) RemoveConsumerFromAllConsumerGroups(ctx context.Context err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2152,11 +2197,13 @@ func (s *ConsumerGroups) ListConsumerGroupsForConsumer(ctx context.Context, requ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-consumer-groups-for-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-consumer-groups-for-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2209,15 +2256,17 @@ func (s *ConsumerGroups) ListConsumerGroupsForConsumer(ctx context.Context, requ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2234,7 +2283,7 @@ func (s *ConsumerGroups) ListConsumerGroupsForConsumer(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2242,13 +2291,13 @@ func (s *ConsumerGroups) ListConsumerGroupsForConsumer(ctx context.Context, requ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2261,17 +2310,17 @@ func (s *ConsumerGroups) ListConsumerGroupsForConsumer(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2357,11 +2406,13 @@ func (s *ConsumerGroups) AddConsumerToSpecificConsumerGroup(ctx context.Context, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "add-consumer-to-specific-consumer-group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "add-consumer-to-specific-consumer-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2417,15 +2468,17 @@ func (s *ConsumerGroups) AddConsumerToSpecificConsumerGroup(ctx context.Context, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2442,7 +2495,7 @@ func (s *ConsumerGroups) AddConsumerToSpecificConsumerGroup(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2450,13 +2503,13 @@ func (s *ConsumerGroups) AddConsumerToSpecificConsumerGroup(ctx context.Context, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2469,17 +2522,17 @@ func (s *ConsumerGroups) AddConsumerToSpecificConsumerGroup(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2565,11 +2618,13 @@ func (s *ConsumerGroups) RemoveConsumerFromConsumerGroup(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "remove-consumer-from-consumer-group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "remove-consumer-from-consumer-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2618,15 +2673,17 @@ func (s *ConsumerGroups) RemoveConsumerFromConsumerGroup(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2643,7 +2700,7 @@ func (s *ConsumerGroups) RemoveConsumerFromConsumerGroup(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2651,13 +2708,13 @@ func (s *ConsumerGroups) RemoveConsumerFromConsumerGroup(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2670,17 +2727,17 @@ func (s *ConsumerGroups) RemoveConsumerFromConsumerGroup(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/consumers.go b/consumers.go index d0ebd587..9f18af3d 100644 --- a/consumers.go +++ b/consumers.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -18,12 +19,16 @@ import ( // Consumers - The consumer object represents a consumer - or a user - of a service. // You can either rely on Kong Gateway as the primary datastore, or you can map the consumer list with your database to keep consistency between Kong Gateway and your existing primary datastore. type Consumers struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newConsumers(sdkConfig sdkConfiguration) *Consumers { +func newConsumers(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Consumers { return &Consumers{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -54,11 +59,13 @@ func (s *Consumers) ListConsumer(ctx context.Context, request operations.ListCon } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -111,15 +118,17 @@ func (s *Consumers) ListConsumer(ctx context.Context, request operations.ListCon "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -136,7 +145,7 @@ func (s *Consumers) ListConsumer(ctx context.Context, request operations.ListCon err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -144,13 +153,13 @@ func (s *Consumers) ListConsumer(ctx context.Context, request operations.ListCon if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -163,17 +172,17 @@ func (s *Consumers) ListConsumer(ctx context.Context, request operations.ListCon err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -285,11 +294,13 @@ func (s *Consumers) CreateConsumer(ctx context.Context, controlPlaneID string, c } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Consumer", "json", `request:"mediaType=application/json"`) if err != nil { @@ -345,15 +356,17 @@ func (s *Consumers) CreateConsumer(ctx context.Context, controlPlaneID string, c "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -370,7 +383,7 @@ func (s *Consumers) CreateConsumer(ctx context.Context, controlPlaneID string, c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -378,13 +391,13 @@ func (s *Consumers) CreateConsumer(ctx context.Context, controlPlaneID string, c if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -397,17 +410,17 @@ func (s *Consumers) CreateConsumer(ctx context.Context, controlPlaneID string, c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -519,11 +532,13 @@ func (s *Consumers) DeleteConsumer(ctx context.Context, controlPlaneID string, c } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -572,15 +587,17 @@ func (s *Consumers) DeleteConsumer(ctx context.Context, controlPlaneID string, c "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -597,7 +614,7 @@ func (s *Consumers) DeleteConsumer(ctx context.Context, controlPlaneID string, c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -605,13 +622,13 @@ func (s *Consumers) DeleteConsumer(ctx context.Context, controlPlaneID string, c if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -624,17 +641,17 @@ func (s *Consumers) DeleteConsumer(ctx context.Context, controlPlaneID string, c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -726,11 +743,13 @@ func (s *Consumers) GetConsumer(ctx context.Context, consumerID string, controlP } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -779,15 +798,17 @@ func (s *Consumers) GetConsumer(ctx context.Context, consumerID string, controlP "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -804,7 +825,7 @@ func (s *Consumers) GetConsumer(ctx context.Context, consumerID string, controlP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -812,13 +833,13 @@ func (s *Consumers) GetConsumer(ctx context.Context, consumerID string, controlP if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -831,17 +852,17 @@ func (s *Consumers) GetConsumer(ctx context.Context, consumerID string, controlP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -950,11 +971,13 @@ func (s *Consumers) UpsertConsumer(ctx context.Context, request operations.Upser } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Consumer", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1010,15 +1033,17 @@ func (s *Consumers) UpsertConsumer(ctx context.Context, request operations.Upser "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1035,7 +1060,7 @@ func (s *Consumers) UpsertConsumer(ctx context.Context, request operations.Upser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1043,13 +1068,13 @@ func (s *Consumers) UpsertConsumer(ctx context.Context, request operations.Upser if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1062,17 +1087,17 @@ func (s *Consumers) UpsertConsumer(ctx context.Context, request operations.Upser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/controlplanegroups.go b/controlplanegroups.go index f02671d4..f50a96ab 100644 --- a/controlplanegroups.go +++ b/controlplanegroups.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type ControlPlaneGroups struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newControlPlaneGroups(sdkConfig sdkConfiguration) *ControlPlaneGroups { +func newControlPlaneGroups(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ControlPlaneGroups { return &ControlPlaneGroups{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -56,11 +61,13 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberStatus(ctx context.Con } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-control-planes-id-group-member-status", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-control-planes-id-group-member-status", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberStatus(ctx context.Con "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberStatus(ctx context.Con err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberStatus(ctx context.Con if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberStatus(ctx context.Con err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -383,11 +392,13 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberships(ctx context.Cont } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-control-planes-id-group-memberships", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-control-planes-id-group-memberships", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -440,15 +451,17 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberships(ctx context.Cont "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -465,7 +478,7 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberships(ctx context.Cont err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -473,13 +486,13 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberships(ctx context.Cont if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -492,17 +505,17 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupMemberships(ctx context.Cont err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -719,11 +732,13 @@ func (s *ControlPlaneGroups) PutControlPlanesIDGroupMemberships(ctx context.Cont } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "put-control-planes-id-group-memberships", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "put-control-planes-id-group-memberships", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "GroupMembership", "json", `request:"mediaType=application/json"`) if err != nil { @@ -779,15 +794,17 @@ func (s *ControlPlaneGroups) PutControlPlanesIDGroupMemberships(ctx context.Cont "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -804,7 +821,7 @@ func (s *ControlPlaneGroups) PutControlPlanesIDGroupMemberships(ctx context.Cont err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -812,13 +829,13 @@ func (s *ControlPlaneGroups) PutControlPlanesIDGroupMemberships(ctx context.Cont if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -831,17 +848,17 @@ func (s *ControlPlaneGroups) PutControlPlanesIDGroupMemberships(ctx context.Cont err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1038,11 +1055,13 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsAdd(ctx context. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "post-control-planes-id-group-memberships-add", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "post-control-planes-id-group-memberships-add", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "GroupMembership", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1098,15 +1117,17 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsAdd(ctx context. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1123,7 +1144,7 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsAdd(ctx context. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1131,13 +1152,13 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsAdd(ctx context. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1150,17 +1171,17 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsAdd(ctx context. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1357,11 +1378,13 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsRemove(ctx conte } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "post-control-planes-id-group-memberships-remove", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "post-control-planes-id-group-memberships-remove", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "GroupMembership", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1417,15 +1440,17 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsRemove(ctx conte "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1442,7 +1467,7 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsRemove(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1450,13 +1475,13 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsRemove(ctx conte if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1469,17 +1494,17 @@ func (s *ControlPlaneGroups) PostControlPlanesIDGroupMembershipsRemove(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1675,11 +1700,13 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupStatus(ctx context.Context, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-control-planes-id-group-status", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-control-planes-id-group-status", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1728,15 +1755,17 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupStatus(ctx context.Context, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1753,7 +1782,7 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupStatus(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1761,13 +1790,13 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupStatus(ctx context.Context, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1780,17 +1809,17 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupStatus(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/controlplanes.go b/controlplanes.go index 82bf0d76..2c7bea59 100644 --- a/controlplanes.go +++ b/controlplanes.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type ControlPlanes struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newControlPlanes(sdkConfig sdkConfiguration) *ControlPlanes { +func newControlPlanes(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ControlPlanes { return &ControlPlanes{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *ControlPlanes) ListControlPlanes(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-control-planes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-control-planes", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -110,15 +117,17 @@ func (s *ControlPlanes) ListControlPlanes(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -135,7 +144,7 @@ func (s *ControlPlanes) ListControlPlanes(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -143,13 +152,13 @@ func (s *ControlPlanes) ListControlPlanes(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -162,17 +171,17 @@ func (s *ControlPlanes) ListControlPlanes(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -363,11 +372,13 @@ func (s *ControlPlanes) CreateControlPlane(ctx context.Context, request componen } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-control-plane", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-control-plane", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -423,15 +434,17 @@ func (s *ControlPlanes) CreateControlPlane(ctx context.Context, request componen "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -448,7 +461,7 @@ func (s *ControlPlanes) CreateControlPlane(ctx context.Context, request componen err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -456,13 +469,13 @@ func (s *ControlPlanes) CreateControlPlane(ctx context.Context, request componen if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -475,17 +488,17 @@ func (s *ControlPlanes) CreateControlPlane(ctx context.Context, request componen err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "409", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -701,11 +714,13 @@ func (s *ControlPlanes) GetControlPlane(ctx context.Context, id string, opts ... } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-control-plane", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-control-plane", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -754,15 +769,17 @@ func (s *ControlPlanes) GetControlPlane(ctx context.Context, id string, opts ... "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -779,7 +796,7 @@ func (s *ControlPlanes) GetControlPlane(ctx context.Context, id string, opts ... err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -787,13 +804,13 @@ func (s *ControlPlanes) GetControlPlane(ctx context.Context, id string, opts ... if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -806,17 +823,17 @@ func (s *ControlPlanes) GetControlPlane(ctx context.Context, id string, opts ... err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1033,11 +1050,13 @@ func (s *ControlPlanes) UpdateControlPlane(ctx context.Context, id string, updat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-control-plane", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-control-plane", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateControlPlaneRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1093,15 +1112,17 @@ func (s *ControlPlanes) UpdateControlPlane(ctx context.Context, id string, updat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1118,7 +1139,7 @@ func (s *ControlPlanes) UpdateControlPlane(ctx context.Context, id string, updat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1126,13 +1147,13 @@ func (s *ControlPlanes) UpdateControlPlane(ctx context.Context, id string, updat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1145,17 +1166,17 @@ func (s *ControlPlanes) UpdateControlPlane(ctx context.Context, id string, updat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1371,11 +1392,13 @@ func (s *ControlPlanes) DeleteControlPlane(ctx context.Context, id string, opts } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-control-plane", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-control-plane", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1424,15 +1447,17 @@ func (s *ControlPlanes) DeleteControlPlane(ctx context.Context, id string, opts "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1449,7 +1474,7 @@ func (s *ControlPlanes) DeleteControlPlane(ctx context.Context, id string, opts err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1457,13 +1482,13 @@ func (s *ControlPlanes) DeleteControlPlane(ctx context.Context, id string, opts if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1476,17 +1501,17 @@ func (s *ControlPlanes) DeleteControlPlane(ctx context.Context, id string, opts err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/customplugins.go b/customplugins.go index 10f6361c..06686e4c 100644 --- a/customplugins.go +++ b/customplugins.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type CustomPlugins struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newCustomPlugins(sdkConfig sdkConfiguration) *CustomPlugins { +func newCustomPlugins(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *CustomPlugins { return &CustomPlugins{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -55,11 +60,13 @@ func (s *CustomPlugins) ListCustomPlugin(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-custom-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -112,15 +119,17 @@ func (s *CustomPlugins) ListCustomPlugin(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -137,7 +146,7 @@ func (s *CustomPlugins) ListCustomPlugin(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -145,13 +154,13 @@ func (s *CustomPlugins) ListCustomPlugin(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -164,17 +173,17 @@ func (s *CustomPlugins) ListCustomPlugin(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -289,11 +298,13 @@ func (s *CustomPlugins) CreateCustomPlugin(ctx context.Context, controlPlaneID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-custom-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CustomPlugin", "json", `request:"mediaType=application/json"`) if err != nil { @@ -349,15 +360,17 @@ func (s *CustomPlugins) CreateCustomPlugin(ctx context.Context, controlPlaneID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -374,7 +387,7 @@ func (s *CustomPlugins) CreateCustomPlugin(ctx context.Context, controlPlaneID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -382,13 +395,13 @@ func (s *CustomPlugins) CreateCustomPlugin(ctx context.Context, controlPlaneID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -401,17 +414,17 @@ func (s *CustomPlugins) CreateCustomPlugin(ctx context.Context, controlPlaneID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -526,11 +539,13 @@ func (s *CustomPlugins) DeleteCustomPlugin(ctx context.Context, controlPlaneID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-custom-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -579,15 +594,17 @@ func (s *CustomPlugins) DeleteCustomPlugin(ctx context.Context, controlPlaneID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -604,7 +621,7 @@ func (s *CustomPlugins) DeleteCustomPlugin(ctx context.Context, controlPlaneID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -612,13 +629,13 @@ func (s *CustomPlugins) DeleteCustomPlugin(ctx context.Context, controlPlaneID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -631,17 +648,17 @@ func (s *CustomPlugins) DeleteCustomPlugin(ctx context.Context, controlPlaneID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -736,11 +753,13 @@ func (s *CustomPlugins) GetCustomPlugin(ctx context.Context, customPluginID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-custom-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -789,15 +808,17 @@ func (s *CustomPlugins) GetCustomPlugin(ctx context.Context, customPluginID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -814,7 +835,7 @@ func (s *CustomPlugins) GetCustomPlugin(ctx context.Context, customPluginID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -822,13 +843,13 @@ func (s *CustomPlugins) GetCustomPlugin(ctx context.Context, customPluginID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -841,17 +862,17 @@ func (s *CustomPlugins) GetCustomPlugin(ctx context.Context, customPluginID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -963,11 +984,13 @@ func (s *CustomPlugins) UpsertCustomPlugin(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-custom-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-custom-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "CustomPlugin", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1023,15 +1046,17 @@ func (s *CustomPlugins) UpsertCustomPlugin(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1048,7 +1073,7 @@ func (s *CustomPlugins) UpsertCustomPlugin(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1056,13 +1081,13 @@ func (s *CustomPlugins) UpsertCustomPlugin(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1075,17 +1100,17 @@ func (s *CustomPlugins) UpsertCustomPlugin(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/custompluginschemas.go b/custompluginschemas.go index d27fa8ab..19000d2c 100644 --- a/custompluginschemas.go +++ b/custompluginschemas.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // CustomPluginSchemas - Custom Plugin Schemas type CustomPluginSchemas struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newCustomPluginSchemas(sdkConfig sdkConfiguration) *CustomPluginSchemas { +func newCustomPluginSchemas(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *CustomPluginSchemas { return &CustomPluginSchemas{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *CustomPluginSchemas) ListPluginSchemas(ctx context.Context, request ope } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-plugin-schemas", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-plugin-schemas", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -110,15 +117,17 @@ func (s *CustomPluginSchemas) ListPluginSchemas(ctx context.Context, request ope "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -135,7 +144,7 @@ func (s *CustomPluginSchemas) ListPluginSchemas(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -143,13 +152,13 @@ func (s *CustomPluginSchemas) ListPluginSchemas(ctx context.Context, request ope if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -162,17 +171,17 @@ func (s *CustomPluginSchemas) ListPluginSchemas(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -326,11 +335,13 @@ func (s *CustomPluginSchemas) CreatePluginSchemas(ctx context.Context, controlPl } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-plugin-schemas", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-plugin-schemas", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreatePluginSchemas", "json", `request:"mediaType=application/json"`) if err != nil { @@ -386,15 +397,17 @@ func (s *CustomPluginSchemas) CreatePluginSchemas(ctx context.Context, controlPl "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -411,7 +424,7 @@ func (s *CustomPluginSchemas) CreatePluginSchemas(ctx context.Context, controlPl err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -419,13 +432,13 @@ func (s *CustomPluginSchemas) CreatePluginSchemas(ctx context.Context, controlPl if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -438,17 +451,17 @@ func (s *CustomPluginSchemas) CreatePluginSchemas(ctx context.Context, controlPl err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -623,11 +636,13 @@ func (s *CustomPluginSchemas) GetPluginSchema(ctx context.Context, controlPlaneI } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-plugin-schema", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-plugin-schema", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -676,15 +691,17 @@ func (s *CustomPluginSchemas) GetPluginSchema(ctx context.Context, controlPlaneI "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -701,7 +718,7 @@ func (s *CustomPluginSchemas) GetPluginSchema(ctx context.Context, controlPlaneI err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -709,13 +726,13 @@ func (s *CustomPluginSchemas) GetPluginSchema(ctx context.Context, controlPlaneI if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -728,17 +745,17 @@ func (s *CustomPluginSchemas) GetPluginSchema(ctx context.Context, controlPlaneI err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -892,11 +909,13 @@ func (s *CustomPluginSchemas) DeletePluginSchemas(ctx context.Context, controlPl } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-plugin-schemas", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-plugin-schemas", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -945,15 +964,17 @@ func (s *CustomPluginSchemas) DeletePluginSchemas(ctx context.Context, controlPl "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -970,7 +991,7 @@ func (s *CustomPluginSchemas) DeletePluginSchemas(ctx context.Context, controlPl err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -978,13 +999,13 @@ func (s *CustomPluginSchemas) DeletePluginSchemas(ctx context.Context, controlPl if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -997,17 +1018,17 @@ func (s *CustomPluginSchemas) DeletePluginSchemas(ctx context.Context, controlPl err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1136,11 +1157,13 @@ func (s *CustomPluginSchemas) UpdatePluginSchemas(ctx context.Context, request o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-plugin-schemas", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-plugin-schemas", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreatePluginSchemas", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1196,15 +1219,17 @@ func (s *CustomPluginSchemas) UpdatePluginSchemas(ctx context.Context, request o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1221,7 +1246,7 @@ func (s *CustomPluginSchemas) UpdatePluginSchemas(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1229,13 +1254,13 @@ func (s *CustomPluginSchemas) UpdatePluginSchemas(ctx context.Context, request o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1248,17 +1273,17 @@ func (s *CustomPluginSchemas) UpdatePluginSchemas(ctx context.Context, request o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/dcrproviders.go b/dcrproviders.go index f75ef0d8..14fb36f2 100644 --- a/dcrproviders.go +++ b/dcrproviders.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -20,12 +21,16 @@ import ( // For instance, they will be able to perform dynamic client registration (DCR) with the provider. // The DCR provider provides credentials to each DCR-enabled application in Konnect that can be used to access Product Versions that the app is registered for. type DCRProviders struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newDCRProviders(sdkConfig sdkConfiguration) *DCRProviders { +func newDCRProviders(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *DCRProviders { return &DCRProviders{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -56,11 +61,13 @@ func (s *DCRProviders) CreateDcrProvider(ctx context.Context, request components } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-dcr-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-dcr-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -116,15 +123,17 @@ func (s *DCRProviders) CreateDcrProvider(ctx context.Context, request components "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -141,7 +150,7 @@ func (s *DCRProviders) CreateDcrProvider(ctx context.Context, request components err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -149,13 +158,13 @@ func (s *DCRProviders) CreateDcrProvider(ctx context.Context, request components if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -168,17 +177,17 @@ func (s *DCRProviders) CreateDcrProvider(ctx context.Context, request components err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -327,11 +336,13 @@ func (s *DCRProviders) ListDcrProviders(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-dcr-providers", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-dcr-providers", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -384,15 +395,17 @@ func (s *DCRProviders) ListDcrProviders(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -409,7 +422,7 @@ func (s *DCRProviders) ListDcrProviders(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -417,13 +430,13 @@ func (s *DCRProviders) ListDcrProviders(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -436,17 +449,17 @@ func (s *DCRProviders) ListDcrProviders(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -599,11 +612,13 @@ func (s *DCRProviders) GetDcrProvider(ctx context.Context, dcrProviderID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-dcr-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-dcr-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -652,15 +667,17 @@ func (s *DCRProviders) GetDcrProvider(ctx context.Context, dcrProviderID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -677,7 +694,7 @@ func (s *DCRProviders) GetDcrProvider(ctx context.Context, dcrProviderID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -685,13 +702,13 @@ func (s *DCRProviders) GetDcrProvider(ctx context.Context, dcrProviderID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -704,17 +721,17 @@ func (s *DCRProviders) GetDcrProvider(ctx context.Context, dcrProviderID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -868,11 +885,13 @@ func (s *DCRProviders) UpdateDcrProvider(ctx context.Context, dcrProviderID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-dcr-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-dcr-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "UpdateDcrProviderRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -928,15 +947,17 @@ func (s *DCRProviders) UpdateDcrProvider(ctx context.Context, dcrProviderID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -953,7 +974,7 @@ func (s *DCRProviders) UpdateDcrProvider(ctx context.Context, dcrProviderID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -961,13 +982,13 @@ func (s *DCRProviders) UpdateDcrProvider(ctx context.Context, dcrProviderID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -980,17 +1001,17 @@ func (s *DCRProviders) UpdateDcrProvider(ctx context.Context, dcrProviderID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1164,11 +1185,13 @@ func (s *DCRProviders) DeleteDcrProvider(ctx context.Context, dcrProviderID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-dcr-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-dcr-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1217,15 +1240,17 @@ func (s *DCRProviders) DeleteDcrProvider(ctx context.Context, dcrProviderID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1242,7 +1267,7 @@ func (s *DCRProviders) DeleteDcrProvider(ctx context.Context, dcrProviderID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1250,13 +1275,13 @@ func (s *DCRProviders) DeleteDcrProvider(ctx context.Context, dcrProviderID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1269,17 +1294,17 @@ func (s *DCRProviders) DeleteDcrProvider(ctx context.Context, dcrProviderID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1412,11 +1437,13 @@ func (s *DCRProviders) VerifyDcrProvider(ctx context.Context, dcrProviderID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "verify-dcr-provider", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "verify-dcr-provider", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1465,15 +1492,17 @@ func (s *DCRProviders) VerifyDcrProvider(ctx context.Context, dcrProviderID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1490,7 +1519,7 @@ func (s *DCRProviders) VerifyDcrProvider(ctx context.Context, dcrProviderID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1498,13 +1527,13 @@ func (s *DCRProviders) VerifyDcrProvider(ctx context.Context, dcrProviderID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1517,17 +1546,17 @@ func (s *DCRProviders) VerifyDcrProvider(ctx context.Context, dcrProviderID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/degraphqlroutes.go b/degraphqlroutes.go index 9aa851e5..b0701701 100644 --- a/degraphqlroutes.go +++ b/degraphqlroutes.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type DegraphqlRoutes struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newDegraphqlRoutes(sdkConfig sdkConfiguration) *DegraphqlRoutes { +func newDegraphqlRoutes(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *DegraphqlRoutes { return &DegraphqlRoutes{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *DegraphqlRoutes) ListDegraphqlRoute(ctx context.Context, request operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-degraphql_route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-degraphql_route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *DegraphqlRoutes) ListDegraphqlRoute(ctx context.Context, request operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *DegraphqlRoutes) ListDegraphqlRoute(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *DegraphqlRoutes) ListDegraphqlRoute(ctx context.Context, request operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *DegraphqlRoutes) ListDegraphqlRoute(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -283,11 +292,13 @@ func (s *DegraphqlRoutes) GetDegraphqlRoute(ctx context.Context, degraphqlRouteI } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-degraphql_route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-degraphql_route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -336,15 +347,17 @@ func (s *DegraphqlRoutes) GetDegraphqlRoute(ctx context.Context, degraphqlRouteI "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -361,7 +374,7 @@ func (s *DegraphqlRoutes) GetDegraphqlRoute(ctx context.Context, degraphqlRouteI err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -369,13 +382,13 @@ func (s *DegraphqlRoutes) GetDegraphqlRoute(ctx context.Context, degraphqlRouteI if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -388,17 +401,17 @@ func (s *DegraphqlRoutes) GetDegraphqlRoute(ctx context.Context, degraphqlRouteI err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -507,11 +520,13 @@ func (s *DegraphqlRoutes) ListDegraphqlRouteWithService(ctx context.Context, req } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-degraphql_route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-degraphql_route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -564,15 +579,17 @@ func (s *DegraphqlRoutes) ListDegraphqlRouteWithService(ctx context.Context, req "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -589,7 +606,7 @@ func (s *DegraphqlRoutes) ListDegraphqlRouteWithService(ctx context.Context, req err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -597,13 +614,13 @@ func (s *DegraphqlRoutes) ListDegraphqlRouteWithService(ctx context.Context, req if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -616,17 +633,17 @@ func (s *DegraphqlRoutes) ListDegraphqlRouteWithService(ctx context.Context, req err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -712,11 +729,13 @@ func (s *DegraphqlRoutes) CreateDegraphqlRouteWithService(ctx context.Context, r } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-degraphql_route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-degraphql_route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "DegraphqlRouteWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -772,15 +791,17 @@ func (s *DegraphqlRoutes) CreateDegraphqlRouteWithService(ctx context.Context, r "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -797,7 +818,7 @@ func (s *DegraphqlRoutes) CreateDegraphqlRouteWithService(ctx context.Context, r err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -805,13 +826,13 @@ func (s *DegraphqlRoutes) CreateDegraphqlRouteWithService(ctx context.Context, r if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -824,17 +845,17 @@ func (s *DegraphqlRoutes) CreateDegraphqlRouteWithService(ctx context.Context, r err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -920,11 +941,13 @@ func (s *DegraphqlRoutes) DeleteDegraphqlRouteWithService(ctx context.Context, r } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-degraphql_route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-degraphql_route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -973,15 +996,17 @@ func (s *DegraphqlRoutes) DeleteDegraphqlRouteWithService(ctx context.Context, r "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -998,7 +1023,7 @@ func (s *DegraphqlRoutes) DeleteDegraphqlRouteWithService(ctx context.Context, r err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1006,13 +1031,13 @@ func (s *DegraphqlRoutes) DeleteDegraphqlRouteWithService(ctx context.Context, r if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1025,17 +1050,17 @@ func (s *DegraphqlRoutes) DeleteDegraphqlRouteWithService(ctx context.Context, r err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1101,11 +1126,13 @@ func (s *DegraphqlRoutes) GetDegraphqlRouteWithService(ctx context.Context, requ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-degraphql_route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-degraphql_route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1154,15 +1181,17 @@ func (s *DegraphqlRoutes) GetDegraphqlRouteWithService(ctx context.Context, requ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1179,7 +1208,7 @@ func (s *DegraphqlRoutes) GetDegraphqlRouteWithService(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1187,13 +1216,13 @@ func (s *DegraphqlRoutes) GetDegraphqlRouteWithService(ctx context.Context, requ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1206,17 +1235,17 @@ func (s *DegraphqlRoutes) GetDegraphqlRouteWithService(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1304,11 +1333,13 @@ func (s *DegraphqlRoutes) UpsertDegraphqlRouteWithService(ctx context.Context, r } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-degraphql_route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-degraphql_route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "DegraphqlRouteWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1364,15 +1395,17 @@ func (s *DegraphqlRoutes) UpsertDegraphqlRouteWithService(ctx context.Context, r "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1389,7 +1422,7 @@ func (s *DegraphqlRoutes) UpsertDegraphqlRouteWithService(ctx context.Context, r err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1397,13 +1430,13 @@ func (s *DegraphqlRoutes) UpsertDegraphqlRouteWithService(ctx context.Context, r if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1416,17 +1449,17 @@ func (s *DegraphqlRoutes) UpsertDegraphqlRouteWithService(ctx context.Context, r err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/docs/sdks/authsettings/README.md b/docs/sdks/authsettings/README.md index 62d1d8dd..634f7770 100644 --- a/docs/sdks/authsettings/README.md +++ b/docs/sdks/authsettings/README.md @@ -716,6 +716,7 @@ func main() { ) res, err := s.AuthSettings.UpdateIdentityProvider(ctx, "d32d905a-ed33-46a3-a093-d8f536af9a8a", components.UpdateIdentityProvider{ + Enabled: sdkkonnectgo.Bool(true), LoginPath: sdkkonnectgo.String("myapp"), Config: sdkkonnectgo.Pointer(components.CreateUpdateIdentityProviderConfigConfigureOIDCIdentityProviderConfig( components.ConfigureOIDCIdentityProviderConfig{ diff --git a/dpcertificates.go b/dpcertificates.go index f52d59b4..8c9da926 100644 --- a/dpcertificates.go +++ b/dpcertificates.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // DPCertificates - DP Certificates type DPCertificates struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newDPCertificates(sdkConfig sdkConfiguration) *DPCertificates { +func newDPCertificates(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *DPCertificates { return &DPCertificates{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -57,11 +62,13 @@ func (s *DPCertificates) ListDpClientCertificates(ctx context.Context, controlPl } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-dp-client-certificates", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-dp-client-certificates", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -110,15 +117,17 @@ func (s *DPCertificates) ListDpClientCertificates(ctx context.Context, controlPl "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -135,7 +144,7 @@ func (s *DPCertificates) ListDpClientCertificates(ctx context.Context, controlPl err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -143,13 +152,13 @@ func (s *DPCertificates) ListDpClientCertificates(ctx context.Context, controlPl if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -162,17 +171,17 @@ func (s *DPCertificates) ListDpClientCertificates(ctx context.Context, controlPl err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -263,11 +272,13 @@ func (s *DPCertificates) CreateDataplaneCertificate(ctx context.Context, control } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-dataplane-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-dataplane-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "DataPlaneClientCertificateRequest", "json", `request:"mediaType=application/json"`) if err != nil { @@ -323,15 +334,17 @@ func (s *DPCertificates) CreateDataplaneCertificate(ctx context.Context, control "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -348,7 +361,7 @@ func (s *DPCertificates) CreateDataplaneCertificate(ctx context.Context, control err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -356,13 +369,13 @@ func (s *DPCertificates) CreateDataplaneCertificate(ctx context.Context, control if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -375,17 +388,17 @@ func (s *DPCertificates) CreateDataplaneCertificate(ctx context.Context, control err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -476,11 +489,13 @@ func (s *DPCertificates) GetDataplaneCertificate(ctx context.Context, controlPla } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-dataplane-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-dataplane-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -529,15 +544,17 @@ func (s *DPCertificates) GetDataplaneCertificate(ctx context.Context, controlPla "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -554,7 +571,7 @@ func (s *DPCertificates) GetDataplaneCertificate(ctx context.Context, controlPla err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -562,13 +579,13 @@ func (s *DPCertificates) GetDataplaneCertificate(ctx context.Context, controlPla if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -581,17 +598,17 @@ func (s *DPCertificates) GetDataplaneCertificate(ctx context.Context, controlPla err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -682,11 +699,13 @@ func (s *DPCertificates) DeleteDataplaneCertificate(ctx context.Context, control } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-dataplane-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-dataplane-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -735,15 +754,17 @@ func (s *DPCertificates) DeleteDataplaneCertificate(ctx context.Context, control "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -760,7 +781,7 @@ func (s *DPCertificates) DeleteDataplaneCertificate(ctx context.Context, control err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -768,13 +789,13 @@ func (s *DPCertificates) DeleteDataplaneCertificate(ctx context.Context, control if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -787,17 +808,17 @@ func (s *DPCertificates) DeleteDataplaneCertificate(ctx context.Context, control err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/dpnodes.go b/dpnodes.go index 2f7b33a4..64981863 100644 --- a/dpnodes.go +++ b/dpnodes.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // DPNodes - DP Nodes type DPNodes struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newDPNodes(sdkConfig sdkConfiguration) *DPNodes { +func newDPNodes(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *DPNodes { return &DPNodes{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -57,11 +62,13 @@ func (s *DPNodes) GetExpectedConfigHash(ctx context.Context, controlPlaneID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-expected-config-hash", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-expected-config-hash", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -110,15 +117,17 @@ func (s *DPNodes) GetExpectedConfigHash(ctx context.Context, controlPlaneID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -135,7 +144,7 @@ func (s *DPNodes) GetExpectedConfigHash(ctx context.Context, controlPlaneID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -143,13 +152,13 @@ func (s *DPNodes) GetExpectedConfigHash(ctx context.Context, controlPlaneID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -162,17 +171,17 @@ func (s *DPNodes) GetExpectedConfigHash(ctx context.Context, controlPlaneID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -258,11 +267,13 @@ func (s *DPNodes) ListDataplaneNodes(ctx context.Context, request operations.Lis } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-dataplane-nodes", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-dataplane-nodes", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -315,15 +326,17 @@ func (s *DPNodes) ListDataplaneNodes(ctx context.Context, request operations.Lis "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -340,7 +353,7 @@ func (s *DPNodes) ListDataplaneNodes(ctx context.Context, request operations.Lis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -348,13 +361,13 @@ func (s *DPNodes) ListDataplaneNodes(ctx context.Context, request operations.Lis if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -367,17 +380,17 @@ func (s *DPNodes) ListDataplaneNodes(ctx context.Context, request operations.Lis err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -463,11 +476,13 @@ func (s *DPNodes) GetNodesNodeID(ctx context.Context, request operations.GetNode } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-nodes-node_id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-nodes-node_id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -520,15 +535,17 @@ func (s *DPNodes) GetNodesNodeID(ctx context.Context, request operations.GetNode "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -545,7 +562,7 @@ func (s *DPNodes) GetNodesNodeID(ctx context.Context, request operations.GetNode err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -553,13 +570,13 @@ func (s *DPNodes) GetNodesNodeID(ctx context.Context, request operations.GetNode if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -572,17 +589,17 @@ func (s *DPNodes) GetNodesNodeID(ctx context.Context, request operations.GetNode err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -673,11 +690,13 @@ func (s *DPNodes) DeleteNodesNodeID(ctx context.Context, controlPlaneID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-nodes-node_id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-nodes-node_id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -726,15 +745,17 @@ func (s *DPNodes) DeleteNodesNodeID(ctx context.Context, controlPlaneID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -751,7 +772,7 @@ func (s *DPNodes) DeleteNodesNodeID(ctx context.Context, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -759,13 +780,13 @@ func (s *DPNodes) DeleteNodesNodeID(ctx context.Context, controlPlaneID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -778,17 +799,17 @@ func (s *DPNodes) DeleteNodesNodeID(ctx context.Context, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -854,11 +875,13 @@ func (s *DPNodes) GetNodesEol(ctx context.Context, request operations.GetNodesEo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-nodes-eol", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-nodes-eol", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -911,15 +934,17 @@ func (s *DPNodes) GetNodesEol(ctx context.Context, request operations.GetNodesEo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -936,7 +961,7 @@ func (s *DPNodes) GetNodesEol(ctx context.Context, request operations.GetNodesEo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -944,13 +969,13 @@ func (s *DPNodes) GetNodesEol(ctx context.Context, request operations.GetNodesEo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -963,17 +988,17 @@ func (s *DPNodes) GetNodesEol(ctx context.Context, request operations.GetNodesEo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 43de157d..19a8d4fb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Kong/sdk-konnect-go -go 1.20 +go 1.22 require ( github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 diff --git a/hmacauthcredentials.go b/hmacauthcredentials.go index f23375dd..3f238d88 100644 --- a/hmacauthcredentials.go +++ b/hmacauthcredentials.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type HMACAuthCredentials struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newHMACAuthCredentials(sdkConfig sdkConfiguration) *HMACAuthCredentials { +func newHMACAuthCredentials(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *HMACAuthCredentials { return &HMACAuthCredentials{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *HMACAuthCredentials) ListHmacAuthWithConsumer(ctx context.Context, requ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-hmac-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-hmac-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *HMACAuthCredentials) ListHmacAuthWithConsumer(ctx context.Context, requ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *HMACAuthCredentials) ListHmacAuthWithConsumer(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *HMACAuthCredentials) ListHmacAuthWithConsumer(ctx context.Context, requ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *HMACAuthCredentials) ListHmacAuthWithConsumer(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -257,11 +266,13 @@ func (s *HMACAuthCredentials) CreateHmacAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-hmac-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-hmac-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "HMACAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -317,15 +328,17 @@ func (s *HMACAuthCredentials) CreateHmacAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -342,7 +355,7 @@ func (s *HMACAuthCredentials) CreateHmacAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -350,13 +363,13 @@ func (s *HMACAuthCredentials) CreateHmacAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -369,17 +382,17 @@ func (s *HMACAuthCredentials) CreateHmacAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -465,11 +478,13 @@ func (s *HMACAuthCredentials) DeleteHmacAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-hmac-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-hmac-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -518,15 +533,17 @@ func (s *HMACAuthCredentials) DeleteHmacAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -543,7 +560,7 @@ func (s *HMACAuthCredentials) DeleteHmacAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -551,13 +568,13 @@ func (s *HMACAuthCredentials) DeleteHmacAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -570,17 +587,17 @@ func (s *HMACAuthCredentials) DeleteHmacAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -646,11 +663,13 @@ func (s *HMACAuthCredentials) GetHmacAuthWithConsumer(ctx context.Context, reque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-hmac-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-hmac-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -699,15 +718,17 @@ func (s *HMACAuthCredentials) GetHmacAuthWithConsumer(ctx context.Context, reque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -724,7 +745,7 @@ func (s *HMACAuthCredentials) GetHmacAuthWithConsumer(ctx context.Context, reque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -732,13 +753,13 @@ func (s *HMACAuthCredentials) GetHmacAuthWithConsumer(ctx context.Context, reque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -751,17 +772,17 @@ func (s *HMACAuthCredentials) GetHmacAuthWithConsumer(ctx context.Context, reque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -849,11 +870,13 @@ func (s *HMACAuthCredentials) UpsertHmacAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-hmac-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-hmac-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "HMACAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -909,15 +932,17 @@ func (s *HMACAuthCredentials) UpsertHmacAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -934,7 +959,7 @@ func (s *HMACAuthCredentials) UpsertHmacAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -942,13 +967,13 @@ func (s *HMACAuthCredentials) UpsertHmacAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -961,17 +986,17 @@ func (s *HMACAuthCredentials) UpsertHmacAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1057,11 +1082,13 @@ func (s *HMACAuthCredentials) ListHmacAuth(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-hmac-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-hmac-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1114,15 +1141,17 @@ func (s *HMACAuthCredentials) ListHmacAuth(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1139,7 +1168,7 @@ func (s *HMACAuthCredentials) ListHmacAuth(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1147,13 +1176,13 @@ func (s *HMACAuthCredentials) ListHmacAuth(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1166,17 +1195,17 @@ func (s *HMACAuthCredentials) ListHmacAuth(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1288,11 +1317,13 @@ func (s *HMACAuthCredentials) GetHmacAuth(ctx context.Context, hmacAuthID string } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-hmac-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-hmac-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1341,15 +1372,17 @@ func (s *HMACAuthCredentials) GetHmacAuth(ctx context.Context, hmacAuthID string "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1366,7 +1399,7 @@ func (s *HMACAuthCredentials) GetHmacAuth(ctx context.Context, hmacAuthID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1374,13 +1407,13 @@ func (s *HMACAuthCredentials) GetHmacAuth(ctx context.Context, hmacAuthID string if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1393,17 +1426,17 @@ func (s *HMACAuthCredentials) GetHmacAuth(ctx context.Context, hmacAuthID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/impersonationsettings.go b/impersonationsettings.go index c2a86417..ab9f58b3 100644 --- a/impersonationsettings.go +++ b/impersonationsettings.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type ImpersonationSettings struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newImpersonationSettings(sdkConfig sdkConfiguration) *ImpersonationSettings { +func newImpersonationSettings(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *ImpersonationSettings { return &ImpersonationSettings{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *ImpersonationSettings) GetImpersonationSettings(ctx context.Context, op } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-impersonation-settings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-impersonation-settings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -105,15 +112,17 @@ func (s *ImpersonationSettings) GetImpersonationSettings(ctx context.Context, op "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -130,7 +139,7 @@ func (s *ImpersonationSettings) GetImpersonationSettings(ctx context.Context, op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -138,13 +147,13 @@ func (s *ImpersonationSettings) GetImpersonationSettings(ctx context.Context, op if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -157,17 +166,17 @@ func (s *ImpersonationSettings) GetImpersonationSettings(ctx context.Context, op err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -294,11 +303,13 @@ func (s *ImpersonationSettings) UpdateImpersonationSettings(ctx context.Context, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-impersonation-settings", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-impersonation-settings", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -354,15 +365,17 @@ func (s *ImpersonationSettings) UpdateImpersonationSettings(ctx context.Context, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -379,7 +392,7 @@ func (s *ImpersonationSettings) UpdateImpersonationSettings(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -387,13 +400,13 @@ func (s *ImpersonationSettings) UpdateImpersonationSettings(ctx context.Context, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -406,17 +419,17 @@ func (s *ImpersonationSettings) UpdateImpersonationSettings(ctx context.Context, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/internal/config/sdkconfiguration.go b/internal/config/sdkconfiguration.go new file mode 100644 index 00000000..0700e8f2 --- /dev/null +++ b/internal/config/sdkconfiguration.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package config + +import ( + "context" + "github.com/Kong/sdk-konnect-go/retry" + "net/http" + "time" +) + +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +type SDKConfiguration struct { + Client HTTPClient + Security func(context.Context) (interface{}, error) + ServerURL string + ServerIndex int + ServerList []string + UserAgent string + RetryConfig *retry.Config + Timeout *time.Duration +} + +func (c *SDKConfiguration) GetServerDetails() (string, map[string]string) { + if c.ServerURL != "" { + return c.ServerURL, nil + } + + return c.ServerList[c.ServerIndex], nil +} diff --git a/internal/hooks/hooks.go b/internal/hooks/hooks.go index a0b49da2..7d14a7e0 100644 --- a/internal/hooks/hooks.go +++ b/internal/hooks/hooks.go @@ -5,6 +5,7 @@ package hooks import ( "context" "errors" + "github.com/Kong/sdk-konnect-go/internal/config" "net/http" ) @@ -24,11 +25,13 @@ type HTTPClient interface { } type HookContext struct { - BaseURL string - Context context.Context - OperationID string - OAuth2Scopes []string - SecuritySource func(context.Context) (interface{}, error) + SDK any + SDKConfiguration config.SDKConfiguration + BaseURL string + Context context.Context + OperationID string + OAuth2Scopes []string + SecuritySource func(context.Context) (interface{}, error) } type BeforeRequestContext struct { @@ -71,6 +74,11 @@ type Hooks struct { afterErrorHook []afterErrorHook } +var _ sdkInitHook = (*Hooks)(nil) +var _ beforeRequestHook = (*Hooks)(nil) +var _ afterSuccessHook = (*Hooks)(nil) +var _ afterErrorHook = (*Hooks)(nil) + func New() *Hooks { h := &Hooks{ sdkInitHooks: []sdkInitHook{}, diff --git a/internal/utils/requestbody.go b/internal/utils/requestbody.go index 8fe01ad4..8622ec58 100644 --- a/internal/utils/requestbody.go +++ b/internal/utils/requestbody.go @@ -7,8 +7,11 @@ import ( "context" "fmt" "io" + "mime" "mime/multipart" + "net/textproto" "net/url" + "path/filepath" "reflect" "regexp" ) @@ -166,9 +169,21 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { tag := parseMultipartFormTag(field) if tag.File { - if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { - writer.Close() - return "", err + switch fieldType.Kind() { + case reflect.Slice, reflect.Array: + for i := 0; i < valType.Len(); i++ { + arrayVal := valType.Index(i) + + if err := encodeMultipartFormDataFile(writer, tag.Name+"[]", arrayVal.Type(), arrayVal); err != nil { + writer.Close() + return "", err + } + } + default: + if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { + writer.Close() + return "", err + } } } else if tag.JSON { jw, err := writer.CreateFormField(tag.Name) @@ -243,7 +258,18 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldTyp return fmt.Errorf("invalid multipart/form-data file") } - fw, err := w.CreateFormFile(fieldName, fileName) + // Detect content type based on file extension + contentType := mime.TypeByExtension(filepath.Ext(fileName)) + if contentType == "" { + contentType = "application/octet-stream" + } + + // Create multipart header with proper content type + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, fieldName, fileName)) + h.Set("Content-Type", contentType) + + fw, err := w.CreatePart(h) if err != nil { return err } @@ -251,6 +277,11 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldTyp return err } + // Reset seek position to 0 if the reader supports seeking + if seeker, ok := reader.(io.Seeker); ok { + _, _ = seeker.Seek(0, io.SeekStart) + } + return nil } diff --git a/invites.go b/invites.go index 950b9295..b281a979 100644 --- a/invites.go +++ b/invites.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type Invites struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newInvites(sdkConfig sdkConfiguration) *Invites { +func newInvites(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Invites { return &Invites{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Invites) InviteUser(ctx context.Context, request *components.InviteUser } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "invite-user", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "invite-user", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -112,15 +119,17 @@ func (s *Invites) InviteUser(ctx context.Context, request *components.InviteUser "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -137,7 +146,7 @@ func (s *Invites) InviteUser(ctx context.Context, request *components.InviteUser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -145,13 +154,13 @@ func (s *Invites) InviteUser(ctx context.Context, request *components.InviteUser if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -164,17 +173,17 @@ func (s *Invites) InviteUser(ctx context.Context, request *components.InviteUser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "409", "429", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/jwts.go b/jwts.go index 440c06b5..8384e2be 100644 --- a/jwts.go +++ b/jwts.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type JWTs struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newJWTs(sdkConfig sdkConfiguration) *JWTs { +func newJWTs(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *JWTs { return &JWTs{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *JWTs) ListJwtWithConsumer(ctx context.Context, request operations.ListJ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-jwt-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-jwt-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *JWTs) ListJwtWithConsumer(ctx context.Context, request operations.ListJ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *JWTs) ListJwtWithConsumer(ctx context.Context, request operations.ListJ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *JWTs) ListJwtWithConsumer(ctx context.Context, request operations.ListJ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *JWTs) ListJwtWithConsumer(ctx context.Context, request operations.ListJ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -257,11 +266,13 @@ func (s *JWTs) CreateJwtWithConsumer(ctx context.Context, request operations.Cre } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-jwt-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-jwt-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "JWTWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -317,15 +328,17 @@ func (s *JWTs) CreateJwtWithConsumer(ctx context.Context, request operations.Cre "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -342,7 +355,7 @@ func (s *JWTs) CreateJwtWithConsumer(ctx context.Context, request operations.Cre err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -350,13 +363,13 @@ func (s *JWTs) CreateJwtWithConsumer(ctx context.Context, request operations.Cre if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -369,17 +382,17 @@ func (s *JWTs) CreateJwtWithConsumer(ctx context.Context, request operations.Cre err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -465,11 +478,13 @@ func (s *JWTs) DeleteJwtWithConsumer(ctx context.Context, request operations.Del } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-jwt-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-jwt-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -518,15 +533,17 @@ func (s *JWTs) DeleteJwtWithConsumer(ctx context.Context, request operations.Del "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -543,7 +560,7 @@ func (s *JWTs) DeleteJwtWithConsumer(ctx context.Context, request operations.Del err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -551,13 +568,13 @@ func (s *JWTs) DeleteJwtWithConsumer(ctx context.Context, request operations.Del if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -570,17 +587,17 @@ func (s *JWTs) DeleteJwtWithConsumer(ctx context.Context, request operations.Del err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -646,11 +663,13 @@ func (s *JWTs) GetJwtWithConsumer(ctx context.Context, request operations.GetJwt } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-jwt-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-jwt-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -699,15 +718,17 @@ func (s *JWTs) GetJwtWithConsumer(ctx context.Context, request operations.GetJwt "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -724,7 +745,7 @@ func (s *JWTs) GetJwtWithConsumer(ctx context.Context, request operations.GetJwt err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -732,13 +753,13 @@ func (s *JWTs) GetJwtWithConsumer(ctx context.Context, request operations.GetJwt if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -751,17 +772,17 @@ func (s *JWTs) GetJwtWithConsumer(ctx context.Context, request operations.GetJwt err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -849,11 +870,13 @@ func (s *JWTs) UpsertJwtWithConsumer(ctx context.Context, request operations.Ups } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-jwt-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-jwt-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "JWTWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -909,15 +932,17 @@ func (s *JWTs) UpsertJwtWithConsumer(ctx context.Context, request operations.Ups "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -934,7 +959,7 @@ func (s *JWTs) UpsertJwtWithConsumer(ctx context.Context, request operations.Ups err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -942,13 +967,13 @@ func (s *JWTs) UpsertJwtWithConsumer(ctx context.Context, request operations.Ups if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -961,17 +986,17 @@ func (s *JWTs) UpsertJwtWithConsumer(ctx context.Context, request operations.Ups err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1057,11 +1082,13 @@ func (s *JWTs) ListJwt(ctx context.Context, request operations.ListJwtRequest, o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-jwt", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-jwt", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1114,15 +1141,17 @@ func (s *JWTs) ListJwt(ctx context.Context, request operations.ListJwtRequest, o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1139,7 +1168,7 @@ func (s *JWTs) ListJwt(ctx context.Context, request operations.ListJwtRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1147,13 +1176,13 @@ func (s *JWTs) ListJwt(ctx context.Context, request operations.ListJwtRequest, o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1166,17 +1195,17 @@ func (s *JWTs) ListJwt(ctx context.Context, request operations.ListJwtRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1288,11 +1317,13 @@ func (s *JWTs) GetJwt(ctx context.Context, jwtID string, controlPlaneID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-jwt", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-jwt", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1341,15 +1372,17 @@ func (s *JWTs) GetJwt(ctx context.Context, jwtID string, controlPlaneID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1366,7 +1399,7 @@ func (s *JWTs) GetJwt(ctx context.Context, jwtID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1374,13 +1407,13 @@ func (s *JWTs) GetJwt(ctx context.Context, jwtID string, controlPlaneID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1393,17 +1426,17 @@ func (s *JWTs) GetJwt(ctx context.Context, jwtID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/keys.go b/keys.go index 82badb51..16f953f4 100644 --- a/keys.go +++ b/keys.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // Keys - A key object holds a representation of asymmetric keys in various formats. When Kong Gateway or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity. type Keys struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newKeys(sdkConfig sdkConfiguration) *Keys { +func newKeys(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Keys { return &Keys{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *Keys) ListKeyWithKeySet(ctx context.Context, request operations.ListKey } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-key-with-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-key-with-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -110,15 +117,17 @@ func (s *Keys) ListKeyWithKeySet(ctx context.Context, request operations.ListKey "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -135,7 +144,7 @@ func (s *Keys) ListKeyWithKeySet(ctx context.Context, request operations.ListKey err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -143,13 +152,13 @@ func (s *Keys) ListKeyWithKeySet(ctx context.Context, request operations.ListKey if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -162,17 +171,17 @@ func (s *Keys) ListKeyWithKeySet(ctx context.Context, request operations.ListKey err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -258,11 +267,13 @@ func (s *Keys) CreateKeyWithKeySet(ctx context.Context, request operations.Creat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-key-with-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-key-with-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "KeyWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -318,15 +329,17 @@ func (s *Keys) CreateKeyWithKeySet(ctx context.Context, request operations.Creat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -343,7 +356,7 @@ func (s *Keys) CreateKeyWithKeySet(ctx context.Context, request operations.Creat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -351,13 +364,13 @@ func (s *Keys) CreateKeyWithKeySet(ctx context.Context, request operations.Creat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -370,17 +383,17 @@ func (s *Keys) CreateKeyWithKeySet(ctx context.Context, request operations.Creat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -466,11 +479,13 @@ func (s *Keys) DeleteKeyWithKeySet(ctx context.Context, request operations.Delet } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-key-with-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-key-with-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -519,15 +534,17 @@ func (s *Keys) DeleteKeyWithKeySet(ctx context.Context, request operations.Delet "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -544,7 +561,7 @@ func (s *Keys) DeleteKeyWithKeySet(ctx context.Context, request operations.Delet err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -552,13 +569,13 @@ func (s *Keys) DeleteKeyWithKeySet(ctx context.Context, request operations.Delet if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -571,17 +588,17 @@ func (s *Keys) DeleteKeyWithKeySet(ctx context.Context, request operations.Delet err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -647,11 +664,13 @@ func (s *Keys) GetKeyWithKeySet(ctx context.Context, request operations.GetKeyWi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-key-with-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-key-with-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -700,15 +719,17 @@ func (s *Keys) GetKeyWithKeySet(ctx context.Context, request operations.GetKeyWi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -725,7 +746,7 @@ func (s *Keys) GetKeyWithKeySet(ctx context.Context, request operations.GetKeyWi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -733,13 +754,13 @@ func (s *Keys) GetKeyWithKeySet(ctx context.Context, request operations.GetKeyWi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -752,17 +773,17 @@ func (s *Keys) GetKeyWithKeySet(ctx context.Context, request operations.GetKeyWi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -850,11 +871,13 @@ func (s *Keys) UpsertKeyWithKeySet(ctx context.Context, request operations.Upser } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-key-with-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-key-with-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "KeyWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -910,15 +933,17 @@ func (s *Keys) UpsertKeyWithKeySet(ctx context.Context, request operations.Upser "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -935,7 +960,7 @@ func (s *Keys) UpsertKeyWithKeySet(ctx context.Context, request operations.Upser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -943,13 +968,13 @@ func (s *Keys) UpsertKeyWithKeySet(ctx context.Context, request operations.Upser if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -962,17 +987,17 @@ func (s *Keys) UpsertKeyWithKeySet(ctx context.Context, request operations.Upser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1058,11 +1083,13 @@ func (s *Keys) ListKey(ctx context.Context, request operations.ListKeyRequest, o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-key", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-key", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1115,15 +1142,17 @@ func (s *Keys) ListKey(ctx context.Context, request operations.ListKeyRequest, o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1140,7 +1169,7 @@ func (s *Keys) ListKey(ctx context.Context, request operations.ListKeyRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1148,13 +1177,13 @@ func (s *Keys) ListKey(ctx context.Context, request operations.ListKeyRequest, o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1167,17 +1196,17 @@ func (s *Keys) ListKey(ctx context.Context, request operations.ListKeyRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1289,11 +1318,13 @@ func (s *Keys) CreateKey(ctx context.Context, controlPlaneID string, key compone } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-key", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-key", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Key", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1349,15 +1380,17 @@ func (s *Keys) CreateKey(ctx context.Context, controlPlaneID string, key compone "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1374,7 +1407,7 @@ func (s *Keys) CreateKey(ctx context.Context, controlPlaneID string, key compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1382,13 +1415,13 @@ func (s *Keys) CreateKey(ctx context.Context, controlPlaneID string, key compone if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1401,17 +1434,17 @@ func (s *Keys) CreateKey(ctx context.Context, controlPlaneID string, key compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1523,11 +1556,13 @@ func (s *Keys) DeleteKey(ctx context.Context, controlPlaneID string, keyID strin } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-key", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-key", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1576,15 +1611,17 @@ func (s *Keys) DeleteKey(ctx context.Context, controlPlaneID string, keyID strin "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1601,7 +1638,7 @@ func (s *Keys) DeleteKey(ctx context.Context, controlPlaneID string, keyID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1609,13 +1646,13 @@ func (s *Keys) DeleteKey(ctx context.Context, controlPlaneID string, keyID strin if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1628,17 +1665,17 @@ func (s *Keys) DeleteKey(ctx context.Context, controlPlaneID string, keyID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1730,11 +1767,13 @@ func (s *Keys) GetKey(ctx context.Context, keyID string, controlPlaneID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-key", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-key", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1783,15 +1822,17 @@ func (s *Keys) GetKey(ctx context.Context, keyID string, controlPlaneID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1808,7 +1849,7 @@ func (s *Keys) GetKey(ctx context.Context, keyID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1816,13 +1857,13 @@ func (s *Keys) GetKey(ctx context.Context, keyID string, controlPlaneID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1835,17 +1876,17 @@ func (s *Keys) GetKey(ctx context.Context, keyID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1954,11 +1995,13 @@ func (s *Keys) UpsertKey(ctx context.Context, request operations.UpsertKeyReques } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-key", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-key", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Key", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2014,15 +2057,17 @@ func (s *Keys) UpsertKey(ctx context.Context, request operations.UpsertKeyReques "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2039,7 +2084,7 @@ func (s *Keys) UpsertKey(ctx context.Context, request operations.UpsertKeyReques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2047,13 +2092,13 @@ func (s *Keys) UpsertKey(ctx context.Context, request operations.UpsertKeyReques if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2066,17 +2111,17 @@ func (s *Keys) UpsertKey(ctx context.Context, request operations.UpsertKeyReques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/keysets.go b/keysets.go index 6d62b9ca..142288fe 100644 --- a/keysets.go +++ b/keysets.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( // KeySets - 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. type KeySets struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newKeySets(sdkConfig sdkConfiguration) *KeySets { +func newKeySets(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *KeySets { return &KeySets{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -53,11 +58,13 @@ func (s *KeySets) ListKeySet(ctx context.Context, request operations.ListKeySetR } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -110,15 +117,17 @@ func (s *KeySets) ListKeySet(ctx context.Context, request operations.ListKeySetR "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -135,7 +144,7 @@ func (s *KeySets) ListKeySet(ctx context.Context, request operations.ListKeySetR err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -143,13 +152,13 @@ func (s *KeySets) ListKeySet(ctx context.Context, request operations.ListKeySetR if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -162,17 +171,17 @@ func (s *KeySets) ListKeySet(ctx context.Context, request operations.ListKeySetR err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -284,11 +293,13 @@ func (s *KeySets) CreateKeySet(ctx context.Context, controlPlaneID string, keySe } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "KeySet", "json", `request:"mediaType=application/json"`) if err != nil { @@ -344,15 +355,17 @@ func (s *KeySets) CreateKeySet(ctx context.Context, controlPlaneID string, keySe "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -369,7 +382,7 @@ func (s *KeySets) CreateKeySet(ctx context.Context, controlPlaneID string, keySe err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -377,13 +390,13 @@ func (s *KeySets) CreateKeySet(ctx context.Context, controlPlaneID string, keySe if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -396,17 +409,17 @@ func (s *KeySets) CreateKeySet(ctx context.Context, controlPlaneID string, keySe err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -518,11 +531,13 @@ func (s *KeySets) DeleteKeySet(ctx context.Context, controlPlaneID string, keySe } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -571,15 +586,17 @@ func (s *KeySets) DeleteKeySet(ctx context.Context, controlPlaneID string, keySe "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -596,7 +613,7 @@ func (s *KeySets) DeleteKeySet(ctx context.Context, controlPlaneID string, keySe err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -604,13 +621,13 @@ func (s *KeySets) DeleteKeySet(ctx context.Context, controlPlaneID string, keySe if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -623,17 +640,17 @@ func (s *KeySets) DeleteKeySet(ctx context.Context, controlPlaneID string, keySe err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -725,11 +742,13 @@ func (s *KeySets) GetKeySet(ctx context.Context, keySetID string, controlPlaneID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -778,15 +797,17 @@ func (s *KeySets) GetKeySet(ctx context.Context, keySetID string, controlPlaneID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -803,7 +824,7 @@ func (s *KeySets) GetKeySet(ctx context.Context, keySetID string, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -811,13 +832,13 @@ func (s *KeySets) GetKeySet(ctx context.Context, keySetID string, controlPlaneID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -830,17 +851,17 @@ func (s *KeySets) GetKeySet(ctx context.Context, keySetID string, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -949,11 +970,13 @@ func (s *KeySets) UpsertKeySet(ctx context.Context, request operations.UpsertKey } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-key-set", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-key-set", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "KeySet", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1009,15 +1032,17 @@ func (s *KeySets) UpsertKeySet(ctx context.Context, request operations.UpsertKey "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1034,7 +1059,7 @@ func (s *KeySets) UpsertKeySet(ctx context.Context, request operations.UpsertKey err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1042,13 +1067,13 @@ func (s *KeySets) UpsertKeySet(ctx context.Context, request operations.UpsertKey if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1061,17 +1086,17 @@ func (s *KeySets) UpsertKeySet(ctx context.Context, request operations.UpsertKey err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/me.go b/me.go index 9976c6b2..050eb4e4 100644 --- a/me.go +++ b/me.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type Me struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newMe(sdkConfig sdkConfiguration) *Me { +func newMe(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Me { return &Me{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Me) GetOrganizationsMe(ctx context.Context, opts ...operations.Option) } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-organizations-me", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-organizations-me", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -105,15 +112,17 @@ func (s *Me) GetOrganizationsMe(ctx context.Context, opts ...operations.Option) "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -130,7 +139,7 @@ func (s *Me) GetOrganizationsMe(ctx context.Context, opts ...operations.Option) err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -138,13 +147,13 @@ func (s *Me) GetOrganizationsMe(ctx context.Context, opts ...operations.Option) if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -157,17 +166,17 @@ func (s *Me) GetOrganizationsMe(ctx context.Context, opts ...operations.Option) err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -273,11 +282,13 @@ func (s *Me) GetUsersMe(ctx context.Context, opts ...operations.Option) (*operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-users-me", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-users-me", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -326,15 +337,17 @@ func (s *Me) GetUsersMe(ctx context.Context, opts ...operations.Option) (*operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -351,7 +364,7 @@ func (s *Me) GetUsersMe(ctx context.Context, opts ...operations.Option) (*operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -359,13 +372,13 @@ func (s *Me) GetUsersMe(ctx context.Context, opts ...operations.Option) (*operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -378,17 +391,17 @@ func (s *Me) GetUsersMe(ctx context.Context, opts ...operations.Option) (*operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/mtlsauthcredentials.go b/mtlsauthcredentials.go index 6f82e27e..e2ffcb9d 100644 --- a/mtlsauthcredentials.go +++ b/mtlsauthcredentials.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type MTLSAuthCredentials struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newMTLSAuthCredentials(sdkConfig sdkConfiguration) *MTLSAuthCredentials { +func newMTLSAuthCredentials(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *MTLSAuthCredentials { return &MTLSAuthCredentials{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *MTLSAuthCredentials) ListMtlsAuthWithConsumer(ctx context.Context, requ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-mtls-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-mtls-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *MTLSAuthCredentials) ListMtlsAuthWithConsumer(ctx context.Context, requ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *MTLSAuthCredentials) ListMtlsAuthWithConsumer(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *MTLSAuthCredentials) ListMtlsAuthWithConsumer(ctx context.Context, requ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *MTLSAuthCredentials) ListMtlsAuthWithConsumer(ctx context.Context, requ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -257,11 +266,13 @@ func (s *MTLSAuthCredentials) CreateMtlsAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-mtls-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-mtls-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "MTLSAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -317,15 +328,17 @@ func (s *MTLSAuthCredentials) CreateMtlsAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -342,7 +355,7 @@ func (s *MTLSAuthCredentials) CreateMtlsAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -350,13 +363,13 @@ func (s *MTLSAuthCredentials) CreateMtlsAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -369,17 +382,17 @@ func (s *MTLSAuthCredentials) CreateMtlsAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -465,11 +478,13 @@ func (s *MTLSAuthCredentials) DeleteMtlsAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-mtls-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-mtls-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -518,15 +533,17 @@ func (s *MTLSAuthCredentials) DeleteMtlsAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -543,7 +560,7 @@ func (s *MTLSAuthCredentials) DeleteMtlsAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -551,13 +568,13 @@ func (s *MTLSAuthCredentials) DeleteMtlsAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -570,17 +587,17 @@ func (s *MTLSAuthCredentials) DeleteMtlsAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -646,11 +663,13 @@ func (s *MTLSAuthCredentials) GetMtlsAuthWithConsumer(ctx context.Context, reque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-mtls-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-mtls-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -699,15 +718,17 @@ func (s *MTLSAuthCredentials) GetMtlsAuthWithConsumer(ctx context.Context, reque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -724,7 +745,7 @@ func (s *MTLSAuthCredentials) GetMtlsAuthWithConsumer(ctx context.Context, reque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -732,13 +753,13 @@ func (s *MTLSAuthCredentials) GetMtlsAuthWithConsumer(ctx context.Context, reque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -751,17 +772,17 @@ func (s *MTLSAuthCredentials) GetMtlsAuthWithConsumer(ctx context.Context, reque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -849,11 +870,13 @@ func (s *MTLSAuthCredentials) UpsertMtlsAuthWithConsumer(ctx context.Context, re } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-mtls-auth-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-mtls-auth-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "MTLSAuthWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -909,15 +932,17 @@ func (s *MTLSAuthCredentials) UpsertMtlsAuthWithConsumer(ctx context.Context, re "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -934,7 +959,7 @@ func (s *MTLSAuthCredentials) UpsertMtlsAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -942,13 +967,13 @@ func (s *MTLSAuthCredentials) UpsertMtlsAuthWithConsumer(ctx context.Context, re if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -961,17 +986,17 @@ func (s *MTLSAuthCredentials) UpsertMtlsAuthWithConsumer(ctx context.Context, re err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1057,11 +1082,13 @@ func (s *MTLSAuthCredentials) ListMtlsAuth(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-mtls-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-mtls-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1114,15 +1141,17 @@ func (s *MTLSAuthCredentials) ListMtlsAuth(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1139,7 +1168,7 @@ func (s *MTLSAuthCredentials) ListMtlsAuth(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1147,13 +1176,13 @@ func (s *MTLSAuthCredentials) ListMtlsAuth(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1166,17 +1195,17 @@ func (s *MTLSAuthCredentials) ListMtlsAuth(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1288,11 +1317,13 @@ func (s *MTLSAuthCredentials) GetMtlsAuth(ctx context.Context, mtlsAuthID string } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-mtls-auth", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-mtls-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1341,15 +1372,17 @@ func (s *MTLSAuthCredentials) GetMtlsAuth(ctx context.Context, mtlsAuthID string "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1366,7 +1399,7 @@ func (s *MTLSAuthCredentials) GetMtlsAuth(ctx context.Context, mtlsAuthID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1374,13 +1407,13 @@ func (s *MTLSAuthCredentials) GetMtlsAuth(ctx context.Context, mtlsAuthID string if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1393,17 +1426,17 @@ func (s *MTLSAuthCredentials) GetMtlsAuth(ctx context.Context, mtlsAuthID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/notifications.go b/notifications.go index 1ded942d..eeaced5a 100644 --- a/notifications.go +++ b/notifications.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -18,12 +19,16 @@ import ( // Notifications - Operations related to notifications type Notifications struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newNotifications(sdkConfig sdkConfiguration) *Notifications { +func newNotifications(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Notifications { return &Notifications{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -58,11 +63,13 @@ func (s *Notifications) ListUserConfigurations(ctx context.Context, filter *comp } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-user-configurations", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-user-configurations", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -115,15 +122,17 @@ func (s *Notifications) ListUserConfigurations(ctx context.Context, filter *comp "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -140,7 +149,7 @@ func (s *Notifications) ListUserConfigurations(ctx context.Context, filter *comp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -148,13 +157,13 @@ func (s *Notifications) ListUserConfigurations(ctx context.Context, filter *comp if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -167,17 +176,17 @@ func (s *Notifications) ListUserConfigurations(ctx context.Context, filter *comp err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -330,11 +339,13 @@ func (s *Notifications) ListEventSubscriptions(ctx context.Context, eventID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-event-subscriptions", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-event-subscriptions", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -383,15 +394,17 @@ func (s *Notifications) ListEventSubscriptions(ctx context.Context, eventID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -408,7 +421,7 @@ func (s *Notifications) ListEventSubscriptions(ctx context.Context, eventID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -416,13 +429,13 @@ func (s *Notifications) ListEventSubscriptions(ctx context.Context, eventID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -435,17 +448,17 @@ func (s *Notifications) ListEventSubscriptions(ctx context.Context, eventID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -599,11 +612,13 @@ func (s *Notifications) CreateEventSubscription(ctx context.Context, eventID str } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-event-subscription", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-event-subscription", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "EventSubscription", "json", `request:"mediaType=application/json"`) if err != nil { @@ -659,15 +674,17 @@ func (s *Notifications) CreateEventSubscription(ctx context.Context, eventID str "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -684,7 +701,7 @@ func (s *Notifications) CreateEventSubscription(ctx context.Context, eventID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -692,13 +709,13 @@ func (s *Notifications) CreateEventSubscription(ctx context.Context, eventID str if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -711,17 +728,17 @@ func (s *Notifications) CreateEventSubscription(ctx context.Context, eventID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -896,11 +913,13 @@ func (s *Notifications) GetEventSubscription(ctx context.Context, eventID string } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-event-subscription", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-event-subscription", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -949,15 +968,17 @@ func (s *Notifications) GetEventSubscription(ctx context.Context, eventID string "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -974,7 +995,7 @@ func (s *Notifications) GetEventSubscription(ctx context.Context, eventID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -982,13 +1003,13 @@ func (s *Notifications) GetEventSubscription(ctx context.Context, eventID string if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1001,17 +1022,17 @@ func (s *Notifications) GetEventSubscription(ctx context.Context, eventID string err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1181,11 +1202,13 @@ func (s *Notifications) UpdateEventSubscription(ctx context.Context, request ope } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-event-subscription", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-event-subscription", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "EventSubscription", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1241,15 +1264,17 @@ func (s *Notifications) UpdateEventSubscription(ctx context.Context, request ope "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1266,7 +1291,7 @@ func (s *Notifications) UpdateEventSubscription(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1274,13 +1299,13 @@ func (s *Notifications) UpdateEventSubscription(ctx context.Context, request ope if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1293,17 +1318,17 @@ func (s *Notifications) UpdateEventSubscription(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1478,11 +1503,13 @@ func (s *Notifications) DeleteEventSubscription(ctx context.Context, eventID str } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-event-subscription", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-event-subscription", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1531,15 +1558,17 @@ func (s *Notifications) DeleteEventSubscription(ctx context.Context, eventID str "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1556,7 +1585,7 @@ func (s *Notifications) DeleteEventSubscription(ctx context.Context, eventID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1564,13 +1593,13 @@ func (s *Notifications) DeleteEventSubscription(ctx context.Context, eventID str if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1583,17 +1612,17 @@ func (s *Notifications) DeleteEventSubscription(ctx context.Context, eventID str err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1722,11 +1751,13 @@ func (s *Notifications) ListNotifications(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-notifications", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-notifications", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1779,15 +1810,17 @@ func (s *Notifications) ListNotifications(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1804,7 +1837,7 @@ func (s *Notifications) ListNotifications(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1812,13 +1845,13 @@ func (s *Notifications) ListNotifications(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1831,17 +1864,17 @@ func (s *Notifications) ListNotifications(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1994,11 +2027,13 @@ func (s *Notifications) GetNotificationDetails(ctx context.Context, notification } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-notification-details", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-notification-details", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2047,15 +2082,17 @@ func (s *Notifications) GetNotificationDetails(ctx context.Context, notification "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2072,7 +2109,7 @@ func (s *Notifications) GetNotificationDetails(ctx context.Context, notification err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2080,13 +2117,13 @@ func (s *Notifications) GetNotificationDetails(ctx context.Context, notification if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2099,17 +2136,17 @@ func (s *Notifications) GetNotificationDetails(ctx context.Context, notification err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2263,11 +2300,13 @@ func (s *Notifications) UpdateNotification(ctx context.Context, notificationID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-notification", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-notification", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "NotificationUpdatePayload", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2323,15 +2362,17 @@ func (s *Notifications) UpdateNotification(ctx context.Context, notificationID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2348,7 +2389,7 @@ func (s *Notifications) UpdateNotification(ctx context.Context, notificationID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2356,13 +2397,13 @@ func (s *Notifications) UpdateNotification(ctx context.Context, notificationID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2375,17 +2416,17 @@ func (s *Notifications) UpdateNotification(ctx context.Context, notificationID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2559,11 +2600,13 @@ func (s *Notifications) DeleteNotification(ctx context.Context, notificationID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-notification", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-notification", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2612,15 +2655,17 @@ func (s *Notifications) DeleteNotification(ctx context.Context, notificationID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2637,7 +2682,7 @@ func (s *Notifications) DeleteNotification(ctx context.Context, notificationID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2645,13 +2690,13 @@ func (s *Notifications) DeleteNotification(ctx context.Context, notificationID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2664,17 +2709,17 @@ func (s *Notifications) DeleteNotification(ctx context.Context, notificationID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2803,11 +2848,13 @@ func (s *Notifications) BulkNotifications(ctx context.Context, request *componen } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "bulk-notifications", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "bulk-notifications", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2863,15 +2910,17 @@ func (s *Notifications) BulkNotifications(ctx context.Context, request *componen "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2888,7 +2937,7 @@ func (s *Notifications) BulkNotifications(ctx context.Context, request *componen err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2896,13 +2945,13 @@ func (s *Notifications) BulkNotifications(ctx context.Context, request *componen if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2915,17 +2964,17 @@ func (s *Notifications) BulkNotifications(ctx context.Context, request *componen err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/partiallinks.go b/partiallinks.go index 2309e012..6178cec1 100644 --- a/partiallinks.go +++ b/partiallinks.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/operations" @@ -15,12 +16,16 @@ import ( ) type PartialLinks struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newPartialLinks(sdkConfig sdkConfiguration) *PartialLinks { +func newPartialLinks(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *PartialLinks { return &PartialLinks{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -51,11 +56,13 @@ func (s *PartialLinks) ListPartialLink(ctx context.Context, request operations.L } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-partial-link", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-partial-link", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -108,15 +115,17 @@ func (s *PartialLinks) ListPartialLink(ctx context.Context, request operations.L "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -133,7 +142,7 @@ func (s *PartialLinks) ListPartialLink(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -141,13 +150,13 @@ func (s *PartialLinks) ListPartialLink(ctx context.Context, request operations.L if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -160,17 +169,17 @@ func (s *PartialLinks) ListPartialLink(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/partials.go b/partials.go index 70edba60..68b9f9e2 100644 --- a/partials.go +++ b/partials.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type Partials struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newPartials(sdkConfig sdkConfiguration) *Partials { +func newPartials(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Partials { return &Partials{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Partials) ListPartial(ctx context.Context, request operations.ListParti } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-partial", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-partial", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *Partials) ListPartial(ctx context.Context, request operations.ListParti "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *Partials) ListPartial(ctx context.Context, request operations.ListParti err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *Partials) ListPartial(ctx context.Context, request operations.ListParti if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *Partials) ListPartial(ctx context.Context, request operations.ListParti err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -283,11 +292,13 @@ func (s *Partials) CreatePartial(ctx context.Context, controlPlaneID string, par } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-partial", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-partial", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Partial", "json", `request:"mediaType=application/json"`) if err != nil { @@ -343,15 +354,17 @@ func (s *Partials) CreatePartial(ctx context.Context, controlPlaneID string, par "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -368,7 +381,7 @@ func (s *Partials) CreatePartial(ctx context.Context, controlPlaneID string, par err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -376,13 +389,13 @@ func (s *Partials) CreatePartial(ctx context.Context, controlPlaneID string, par if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -395,17 +408,17 @@ func (s *Partials) CreatePartial(ctx context.Context, controlPlaneID string, par err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -517,11 +530,13 @@ func (s *Partials) DeletePartial(ctx context.Context, controlPlaneID string, par } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-partial", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-partial", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -570,15 +585,17 @@ func (s *Partials) DeletePartial(ctx context.Context, controlPlaneID string, par "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -595,7 +612,7 @@ func (s *Partials) DeletePartial(ctx context.Context, controlPlaneID string, par err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -603,13 +620,13 @@ func (s *Partials) DeletePartial(ctx context.Context, controlPlaneID string, par if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -622,17 +639,17 @@ func (s *Partials) DeletePartial(ctx context.Context, controlPlaneID string, par err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -724,11 +741,13 @@ func (s *Partials) GetPartial(ctx context.Context, partialID string, controlPlan } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-partial", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-partial", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -777,15 +796,17 @@ func (s *Partials) GetPartial(ctx context.Context, partialID string, controlPlan "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -802,7 +823,7 @@ func (s *Partials) GetPartial(ctx context.Context, partialID string, controlPlan err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -810,13 +831,13 @@ func (s *Partials) GetPartial(ctx context.Context, partialID string, controlPlan if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -829,17 +850,17 @@ func (s *Partials) GetPartial(ctx context.Context, partialID string, controlPlan err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -948,11 +969,13 @@ func (s *Partials) UpsertPartial(ctx context.Context, request operations.UpsertP } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-partial", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-partial", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Partial", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1008,15 +1031,17 @@ func (s *Partials) UpsertPartial(ctx context.Context, request operations.UpsertP "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1033,7 +1058,7 @@ func (s *Partials) UpsertPartial(ctx context.Context, request operations.UpsertP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1041,13 +1066,13 @@ func (s *Partials) UpsertPartial(ctx context.Context, request operations.UpsertP if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1060,17 +1085,17 @@ func (s *Partials) UpsertPartial(ctx context.Context, request operations.UpsertP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/plugins.go b/plugins.go index 2f63052a..401032bc 100644 --- a/plugins.go +++ b/plugins.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -22,12 +23,16 @@ import ( //

// Plugins can be both [tagged and filtered by tags](https://docs.konghq.com/gateway/latest/admin-api/#tags). type Plugins struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newPlugins(sdkConfig sdkConfiguration) *Plugins { +func newPlugins(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Plugins { return &Plugins{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -58,11 +63,13 @@ func (s *Plugins) ListPluginWithConsumerGroup(ctx context.Context, request opera } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-plugin-with-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-plugin-with-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -115,15 +122,17 @@ func (s *Plugins) ListPluginWithConsumerGroup(ctx context.Context, request opera "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -140,7 +149,7 @@ func (s *Plugins) ListPluginWithConsumerGroup(ctx context.Context, request opera err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -148,13 +157,13 @@ func (s *Plugins) ListPluginWithConsumerGroup(ctx context.Context, request opera if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -167,17 +176,17 @@ func (s *Plugins) ListPluginWithConsumerGroup(ctx context.Context, request opera err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -263,11 +272,13 @@ func (s *Plugins) CreatePluginWithConsumerGroup(ctx context.Context, request ope } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-plugin-with-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-plugin-with-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -323,15 +334,17 @@ func (s *Plugins) CreatePluginWithConsumerGroup(ctx context.Context, request ope "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -348,7 +361,7 @@ func (s *Plugins) CreatePluginWithConsumerGroup(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -356,13 +369,13 @@ func (s *Plugins) CreatePluginWithConsumerGroup(ctx context.Context, request ope if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -375,17 +388,17 @@ func (s *Plugins) CreatePluginWithConsumerGroup(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -471,11 +484,13 @@ func (s *Plugins) DeletePluginWithConsumerGroup(ctx context.Context, request ope } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-plugin-with-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-plugin-with-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -524,15 +539,17 @@ func (s *Plugins) DeletePluginWithConsumerGroup(ctx context.Context, request ope "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -549,7 +566,7 @@ func (s *Plugins) DeletePluginWithConsumerGroup(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -557,13 +574,13 @@ func (s *Plugins) DeletePluginWithConsumerGroup(ctx context.Context, request ope if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -576,17 +593,17 @@ func (s *Plugins) DeletePluginWithConsumerGroup(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -652,11 +669,13 @@ func (s *Plugins) GetPluginWithConsumerGroup(ctx context.Context, request operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-plugin-with-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-plugin-with-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -705,15 +724,17 @@ func (s *Plugins) GetPluginWithConsumerGroup(ctx context.Context, request operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -730,7 +751,7 @@ func (s *Plugins) GetPluginWithConsumerGroup(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -738,13 +759,13 @@ func (s *Plugins) GetPluginWithConsumerGroup(ctx context.Context, request operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -757,17 +778,17 @@ func (s *Plugins) GetPluginWithConsumerGroup(ctx context.Context, request operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -855,11 +876,13 @@ func (s *Plugins) UpsertPluginWithConsumerGroup(ctx context.Context, request ope } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-plugin-with-consumer_group", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-plugin-with-consumer_group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -915,15 +938,17 @@ func (s *Plugins) UpsertPluginWithConsumerGroup(ctx context.Context, request ope "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -940,7 +965,7 @@ func (s *Plugins) UpsertPluginWithConsumerGroup(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -948,13 +973,13 @@ func (s *Plugins) UpsertPluginWithConsumerGroup(ctx context.Context, request ope if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -967,17 +992,17 @@ func (s *Plugins) UpsertPluginWithConsumerGroup(ctx context.Context, request ope err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1063,11 +1088,13 @@ func (s *Plugins) ListPluginWithConsumer(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-plugin-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-plugin-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1120,15 +1147,17 @@ func (s *Plugins) ListPluginWithConsumer(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1145,7 +1174,7 @@ func (s *Plugins) ListPluginWithConsumer(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1153,13 +1182,13 @@ func (s *Plugins) ListPluginWithConsumer(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1172,17 +1201,17 @@ func (s *Plugins) ListPluginWithConsumer(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1268,11 +1297,13 @@ func (s *Plugins) CreatePluginWithConsumer(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-plugin-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-plugin-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1328,15 +1359,17 @@ func (s *Plugins) CreatePluginWithConsumer(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1353,7 +1386,7 @@ func (s *Plugins) CreatePluginWithConsumer(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1361,13 +1394,13 @@ func (s *Plugins) CreatePluginWithConsumer(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1380,17 +1413,17 @@ func (s *Plugins) CreatePluginWithConsumer(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1476,11 +1509,13 @@ func (s *Plugins) DeletePluginWithConsumer(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-plugin-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-plugin-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1529,15 +1564,17 @@ func (s *Plugins) DeletePluginWithConsumer(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1554,7 +1591,7 @@ func (s *Plugins) DeletePluginWithConsumer(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1562,13 +1599,13 @@ func (s *Plugins) DeletePluginWithConsumer(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1581,17 +1618,17 @@ func (s *Plugins) DeletePluginWithConsumer(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1657,11 +1694,13 @@ func (s *Plugins) GetPluginWithConsumer(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-plugin-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-plugin-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1710,15 +1749,17 @@ func (s *Plugins) GetPluginWithConsumer(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1735,7 +1776,7 @@ func (s *Plugins) GetPluginWithConsumer(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1743,13 +1784,13 @@ func (s *Plugins) GetPluginWithConsumer(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1762,17 +1803,17 @@ func (s *Plugins) GetPluginWithConsumer(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1860,11 +1901,13 @@ func (s *Plugins) UpsertPluginWithConsumer(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-plugin-with-consumer", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-plugin-with-consumer", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1920,15 +1963,17 @@ func (s *Plugins) UpsertPluginWithConsumer(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1945,7 +1990,7 @@ func (s *Plugins) UpsertPluginWithConsumer(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1953,13 +1998,13 @@ func (s *Plugins) UpsertPluginWithConsumer(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1972,17 +2017,17 @@ func (s *Plugins) UpsertPluginWithConsumer(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2068,11 +2113,13 @@ func (s *Plugins) ListPlugin(ctx context.Context, request operations.ListPluginR } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2125,15 +2172,17 @@ func (s *Plugins) ListPlugin(ctx context.Context, request operations.ListPluginR "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2150,7 +2199,7 @@ func (s *Plugins) ListPlugin(ctx context.Context, request operations.ListPluginR err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2158,13 +2207,13 @@ func (s *Plugins) ListPlugin(ctx context.Context, request operations.ListPluginR if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2177,17 +2226,17 @@ func (s *Plugins) ListPlugin(ctx context.Context, request operations.ListPluginR err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2299,11 +2348,13 @@ func (s *Plugins) CreatePlugin(ctx context.Context, controlPlaneID string, plugi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Plugin", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2359,15 +2410,17 @@ func (s *Plugins) CreatePlugin(ctx context.Context, controlPlaneID string, plugi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2384,7 +2437,7 @@ func (s *Plugins) CreatePlugin(ctx context.Context, controlPlaneID string, plugi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2392,13 +2445,13 @@ func (s *Plugins) CreatePlugin(ctx context.Context, controlPlaneID string, plugi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2411,17 +2464,17 @@ func (s *Plugins) CreatePlugin(ctx context.Context, controlPlaneID string, plugi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2533,11 +2586,13 @@ func (s *Plugins) DeletePlugin(ctx context.Context, controlPlaneID string, plugi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2586,15 +2641,17 @@ func (s *Plugins) DeletePlugin(ctx context.Context, controlPlaneID string, plugi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2611,7 +2668,7 @@ func (s *Plugins) DeletePlugin(ctx context.Context, controlPlaneID string, plugi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2619,13 +2676,13 @@ func (s *Plugins) DeletePlugin(ctx context.Context, controlPlaneID string, plugi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2638,17 +2695,17 @@ func (s *Plugins) DeletePlugin(ctx context.Context, controlPlaneID string, plugi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2740,11 +2797,13 @@ func (s *Plugins) GetPlugin(ctx context.Context, pluginID string, controlPlaneID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -2793,15 +2852,17 @@ func (s *Plugins) GetPlugin(ctx context.Context, pluginID string, controlPlaneID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2818,7 +2879,7 @@ func (s *Plugins) GetPlugin(ctx context.Context, pluginID string, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2826,13 +2887,13 @@ func (s *Plugins) GetPlugin(ctx context.Context, pluginID string, controlPlaneID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2845,17 +2906,17 @@ func (s *Plugins) GetPlugin(ctx context.Context, pluginID string, controlPlaneID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -2964,11 +3025,13 @@ func (s *Plugins) UpsertPlugin(ctx context.Context, request operations.UpsertPlu } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-plugin", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-plugin", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Plugin", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3024,15 +3087,17 @@ func (s *Plugins) UpsertPlugin(ctx context.Context, request operations.UpsertPlu "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3049,7 +3114,7 @@ func (s *Plugins) UpsertPlugin(ctx context.Context, request operations.UpsertPlu err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3057,13 +3122,13 @@ func (s *Plugins) UpsertPlugin(ctx context.Context, request operations.UpsertPlu if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3076,17 +3141,17 @@ func (s *Plugins) UpsertPlugin(ctx context.Context, request operations.UpsertPlu err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3193,11 +3258,13 @@ func (s *Plugins) ListPluginWithRoute(ctx context.Context, request operations.Li } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-plugin-with-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-plugin-with-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3250,15 +3317,17 @@ func (s *Plugins) ListPluginWithRoute(ctx context.Context, request operations.Li "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3275,7 +3344,7 @@ func (s *Plugins) ListPluginWithRoute(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3283,13 +3352,13 @@ func (s *Plugins) ListPluginWithRoute(ctx context.Context, request operations.Li if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3302,17 +3371,17 @@ func (s *Plugins) ListPluginWithRoute(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3398,11 +3467,13 @@ func (s *Plugins) CreatePluginWithRoute(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-plugin-with-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-plugin-with-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -3458,15 +3529,17 @@ func (s *Plugins) CreatePluginWithRoute(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3483,7 +3556,7 @@ func (s *Plugins) CreatePluginWithRoute(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3491,13 +3564,13 @@ func (s *Plugins) CreatePluginWithRoute(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3510,17 +3583,17 @@ func (s *Plugins) CreatePluginWithRoute(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3606,11 +3679,13 @@ func (s *Plugins) DeletePluginWithRoute(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-plugin-with-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-plugin-with-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3659,15 +3734,17 @@ func (s *Plugins) DeletePluginWithRoute(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3684,7 +3761,7 @@ func (s *Plugins) DeletePluginWithRoute(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3692,13 +3769,13 @@ func (s *Plugins) DeletePluginWithRoute(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3711,17 +3788,17 @@ func (s *Plugins) DeletePluginWithRoute(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3787,11 +3864,13 @@ func (s *Plugins) GetPluginWithRoute(ctx context.Context, request operations.Get } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-plugin-with-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-plugin-with-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -3840,15 +3919,17 @@ func (s *Plugins) GetPluginWithRoute(ctx context.Context, request operations.Get "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -3865,7 +3946,7 @@ func (s *Plugins) GetPluginWithRoute(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -3873,13 +3954,13 @@ func (s *Plugins) GetPluginWithRoute(ctx context.Context, request operations.Get if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -3892,17 +3973,17 @@ func (s *Plugins) GetPluginWithRoute(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -3990,11 +4071,13 @@ func (s *Plugins) UpsertPluginWithRoute(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-plugin-with-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-plugin-with-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -4050,15 +4133,17 @@ func (s *Plugins) UpsertPluginWithRoute(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4075,7 +4160,7 @@ func (s *Plugins) UpsertPluginWithRoute(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4083,13 +4168,13 @@ func (s *Plugins) UpsertPluginWithRoute(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4102,17 +4187,17 @@ func (s *Plugins) UpsertPluginWithRoute(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4203,11 +4288,13 @@ func (s *Plugins) FetchPluginSchema(ctx context.Context, pluginName string, cont } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "fetch-plugin-schema", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "fetch-plugin-schema", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4256,15 +4343,17 @@ func (s *Plugins) FetchPluginSchema(ctx context.Context, pluginName string, cont "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4281,7 +4370,7 @@ func (s *Plugins) FetchPluginSchema(ctx context.Context, pluginName string, cont err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4289,13 +4378,13 @@ func (s *Plugins) FetchPluginSchema(ctx context.Context, pluginName string, cont if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4308,17 +4397,17 @@ func (s *Plugins) FetchPluginSchema(ctx context.Context, pluginName string, cont err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4404,11 +4493,13 @@ func (s *Plugins) ListPluginWithService(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-plugin-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-plugin-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4461,15 +4552,17 @@ func (s *Plugins) ListPluginWithService(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4486,7 +4579,7 @@ func (s *Plugins) ListPluginWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4494,13 +4587,13 @@ func (s *Plugins) ListPluginWithService(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4513,17 +4606,17 @@ func (s *Plugins) ListPluginWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4609,11 +4702,13 @@ func (s *Plugins) CreatePluginWithService(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-plugin-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-plugin-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -4669,15 +4764,17 @@ func (s *Plugins) CreatePluginWithService(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4694,7 +4791,7 @@ func (s *Plugins) CreatePluginWithService(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4702,13 +4799,13 @@ func (s *Plugins) CreatePluginWithService(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4721,17 +4818,17 @@ func (s *Plugins) CreatePluginWithService(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4817,11 +4914,13 @@ func (s *Plugins) DeletePluginWithService(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-plugin-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-plugin-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -4870,15 +4969,17 @@ func (s *Plugins) DeletePluginWithService(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -4895,7 +4996,7 @@ func (s *Plugins) DeletePluginWithService(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -4903,13 +5004,13 @@ func (s *Plugins) DeletePluginWithService(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -4922,17 +5023,17 @@ func (s *Plugins) DeletePluginWithService(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -4998,11 +5099,13 @@ func (s *Plugins) GetPluginWithService(ctx context.Context, request operations.G } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-plugin-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-plugin-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -5051,15 +5154,17 @@ func (s *Plugins) GetPluginWithService(ctx context.Context, request operations.G "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -5076,7 +5181,7 @@ func (s *Plugins) GetPluginWithService(ctx context.Context, request operations.G err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -5084,13 +5189,13 @@ func (s *Plugins) GetPluginWithService(ctx context.Context, request operations.G if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -5103,17 +5208,17 @@ func (s *Plugins) GetPluginWithService(ctx context.Context, request operations.G err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -5201,11 +5306,13 @@ func (s *Plugins) UpsertPluginWithService(ctx context.Context, request operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-plugin-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-plugin-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "PluginWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -5261,15 +5368,17 @@ func (s *Plugins) UpsertPluginWithService(ctx context.Context, request operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -5286,7 +5395,7 @@ func (s *Plugins) UpsertPluginWithService(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -5294,13 +5403,13 @@ func (s *Plugins) UpsertPluginWithService(ctx context.Context, request operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -5313,17 +5422,17 @@ func (s *Plugins) UpsertPluginWithService(ctx context.Context, request operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/roles.go b/roles.go index d4ba03be..9b6f8227 100644 --- a/roles.go +++ b/roles.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type Roles struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newRoles(sdkConfig sdkConfiguration) *Roles { +func newRoles(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Roles { return &Roles{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Roles) GetPredefinedRoles(ctx context.Context, opts ...operations.Optio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-predefined-roles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-predefined-roles", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -105,15 +112,17 @@ func (s *Roles) GetPredefinedRoles(ctx context.Context, opts ...operations.Optio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -130,7 +139,7 @@ func (s *Roles) GetPredefinedRoles(ctx context.Context, opts ...operations.Optio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -138,13 +147,13 @@ func (s *Roles) GetPredefinedRoles(ctx context.Context, opts ...operations.Optio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -157,17 +166,17 @@ func (s *Roles) GetPredefinedRoles(ctx context.Context, opts ...operations.Optio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -299,11 +308,13 @@ func (s *Roles) ListTeamRoles(ctx context.Context, teamID string, filter *operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-team-roles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-team-roles", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -356,15 +367,17 @@ func (s *Roles) ListTeamRoles(ctx context.Context, teamID string, filter *operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -381,7 +394,7 @@ func (s *Roles) ListTeamRoles(ctx context.Context, teamID string, filter *operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -389,13 +402,13 @@ func (s *Roles) ListTeamRoles(ctx context.Context, teamID string, filter *operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -408,17 +421,17 @@ func (s *Roles) ListTeamRoles(ctx context.Context, teamID string, filter *operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -592,11 +605,13 @@ func (s *Roles) TeamsAssignRole(ctx context.Context, teamID string, assignRole * } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "teams-assign-role", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "teams-assign-role", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "AssignRole", "json", `request:"mediaType=application/json"`) if err != nil { @@ -652,15 +667,17 @@ func (s *Roles) TeamsAssignRole(ctx context.Context, teamID string, assignRole * "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -677,7 +694,7 @@ func (s *Roles) TeamsAssignRole(ctx context.Context, teamID string, assignRole * err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -685,13 +702,13 @@ func (s *Roles) TeamsAssignRole(ctx context.Context, teamID string, assignRole * if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -704,17 +721,17 @@ func (s *Roles) TeamsAssignRole(ctx context.Context, teamID string, assignRole * err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -909,11 +926,13 @@ func (s *Roles) TeamsRemoveRole(ctx context.Context, teamID string, roleID strin } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "teams-remove-role", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "teams-remove-role", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -962,15 +981,17 @@ func (s *Roles) TeamsRemoveRole(ctx context.Context, teamID string, roleID strin "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -987,7 +1008,7 @@ func (s *Roles) TeamsRemoveRole(ctx context.Context, teamID string, roleID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -995,13 +1016,13 @@ func (s *Roles) TeamsRemoveRole(ctx context.Context, teamID string, roleID strin if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1014,17 +1035,17 @@ func (s *Roles) TeamsRemoveRole(ctx context.Context, teamID string, roleID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1178,11 +1199,13 @@ func (s *Roles) ListUserRoles(ctx context.Context, userID string, filter *operat } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-user-roles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-user-roles", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1235,15 +1258,17 @@ func (s *Roles) ListUserRoles(ctx context.Context, userID string, filter *operat "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1260,7 +1285,7 @@ func (s *Roles) ListUserRoles(ctx context.Context, userID string, filter *operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1268,13 +1293,13 @@ func (s *Roles) ListUserRoles(ctx context.Context, userID string, filter *operat if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1287,17 +1312,17 @@ func (s *Roles) ListUserRoles(ctx context.Context, userID string, filter *operat err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1429,11 +1454,13 @@ func (s *Roles) UsersAssignRole(ctx context.Context, userID string, assignRole * } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "users-assign-role", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "users-assign-role", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "AssignRole", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1489,15 +1516,17 @@ func (s *Roles) UsersAssignRole(ctx context.Context, userID string, assignRole * "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1514,7 +1543,7 @@ func (s *Roles) UsersAssignRole(ctx context.Context, userID string, assignRole * err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1522,13 +1551,13 @@ func (s *Roles) UsersAssignRole(ctx context.Context, userID string, assignRole * if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1541,17 +1570,17 @@ func (s *Roles) UsersAssignRole(ctx context.Context, userID string, assignRole * err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1746,11 +1775,13 @@ func (s *Roles) UsersRemoveRole(ctx context.Context, userID string, roleID strin } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "users-remove-role", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "users-remove-role", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1799,15 +1830,17 @@ func (s *Roles) UsersRemoveRole(ctx context.Context, userID string, roleID strin "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1824,7 +1857,7 @@ func (s *Roles) UsersRemoveRole(ctx context.Context, userID string, roleID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1832,13 +1865,13 @@ func (s *Roles) UsersRemoveRole(ctx context.Context, userID string, roleID strin if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1851,17 +1884,17 @@ func (s *Roles) UsersRemoveRole(ctx context.Context, userID string, roleID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/routes.go b/routes.go index 1b26b9e5..463573c1 100644 --- a/routes.go +++ b/routes.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -40,12 +41,16 @@ import ( // - [Configure routes using expressions](https://docs.konghq.com/gateway/latest/key-concepts/routes/expressions) // - [Router Expressions language reference](https://docs.konghq.com/gateway/latest/reference/router-expressions-language/) type Routes struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newRoutes(sdkConfig sdkConfiguration) *Routes { +func newRoutes(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Routes { return &Routes{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -76,11 +81,13 @@ func (s *Routes) ListRoute(ctx context.Context, request operations.ListRouteRequ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -133,15 +140,17 @@ func (s *Routes) ListRoute(ctx context.Context, request operations.ListRouteRequ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -158,7 +167,7 @@ func (s *Routes) ListRoute(ctx context.Context, request operations.ListRouteRequ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -166,13 +175,13 @@ func (s *Routes) ListRoute(ctx context.Context, request operations.ListRouteRequ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -185,17 +194,17 @@ func (s *Routes) ListRoute(ctx context.Context, request operations.ListRouteRequ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -307,11 +316,13 @@ func (s *Routes) CreateRoute(ctx context.Context, controlPlaneID string, route c } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Route", "json", `request:"mediaType=application/json"`) if err != nil { @@ -367,15 +378,17 @@ func (s *Routes) CreateRoute(ctx context.Context, controlPlaneID string, route c "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -392,7 +405,7 @@ func (s *Routes) CreateRoute(ctx context.Context, controlPlaneID string, route c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -400,13 +413,13 @@ func (s *Routes) CreateRoute(ctx context.Context, controlPlaneID string, route c if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -419,17 +432,17 @@ func (s *Routes) CreateRoute(ctx context.Context, controlPlaneID string, route c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -541,11 +554,13 @@ func (s *Routes) DeleteRoute(ctx context.Context, controlPlaneID string, routeID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -594,15 +609,17 @@ func (s *Routes) DeleteRoute(ctx context.Context, controlPlaneID string, routeID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -619,7 +636,7 @@ func (s *Routes) DeleteRoute(ctx context.Context, controlPlaneID string, routeID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -627,13 +644,13 @@ func (s *Routes) DeleteRoute(ctx context.Context, controlPlaneID string, routeID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -646,17 +663,17 @@ func (s *Routes) DeleteRoute(ctx context.Context, controlPlaneID string, routeID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -748,11 +765,13 @@ func (s *Routes) GetRoute(ctx context.Context, routeID string, controlPlaneID st } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -801,15 +820,17 @@ func (s *Routes) GetRoute(ctx context.Context, routeID string, controlPlaneID st "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -826,7 +847,7 @@ func (s *Routes) GetRoute(ctx context.Context, routeID string, controlPlaneID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -834,13 +855,13 @@ func (s *Routes) GetRoute(ctx context.Context, routeID string, controlPlaneID st if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -853,17 +874,17 @@ func (s *Routes) GetRoute(ctx context.Context, routeID string, controlPlaneID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -972,11 +993,13 @@ func (s *Routes) UpsertRoute(ctx context.Context, request operations.UpsertRoute } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-route", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-route", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Route", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1032,15 +1055,17 @@ func (s *Routes) UpsertRoute(ctx context.Context, request operations.UpsertRoute "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1057,7 +1082,7 @@ func (s *Routes) UpsertRoute(ctx context.Context, request operations.UpsertRoute err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1065,13 +1090,13 @@ func (s *Routes) UpsertRoute(ctx context.Context, request operations.UpsertRoute if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1084,17 +1109,17 @@ func (s *Routes) UpsertRoute(ctx context.Context, request operations.UpsertRoute err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1201,11 +1226,13 @@ func (s *Routes) ListRouteWithService(ctx context.Context, request operations.Li } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1258,15 +1285,17 @@ func (s *Routes) ListRouteWithService(ctx context.Context, request operations.Li "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1283,7 +1312,7 @@ func (s *Routes) ListRouteWithService(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1291,13 +1320,13 @@ func (s *Routes) ListRouteWithService(ctx context.Context, request operations.Li if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1310,17 +1339,17 @@ func (s *Routes) ListRouteWithService(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1406,11 +1435,13 @@ func (s *Routes) CreateRouteWithService(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RouteWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1466,15 +1497,17 @@ func (s *Routes) CreateRouteWithService(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1491,7 +1524,7 @@ func (s *Routes) CreateRouteWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1499,13 +1532,13 @@ func (s *Routes) CreateRouteWithService(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1518,17 +1551,17 @@ func (s *Routes) CreateRouteWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1614,11 +1647,13 @@ func (s *Routes) DeleteRouteWithService(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1667,15 +1702,17 @@ func (s *Routes) DeleteRouteWithService(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1692,7 +1729,7 @@ func (s *Routes) DeleteRouteWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1700,13 +1737,13 @@ func (s *Routes) DeleteRouteWithService(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1719,17 +1756,17 @@ func (s *Routes) DeleteRouteWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1795,11 +1832,13 @@ func (s *Routes) GetRouteWithService(ctx context.Context, request operations.Get } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1848,15 +1887,17 @@ func (s *Routes) GetRouteWithService(ctx context.Context, request operations.Get "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1873,7 +1914,7 @@ func (s *Routes) GetRouteWithService(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1881,13 +1922,13 @@ func (s *Routes) GetRouteWithService(ctx context.Context, request operations.Get if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1900,17 +1941,17 @@ func (s *Routes) GetRouteWithService(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1998,11 +2039,13 @@ func (s *Routes) UpsertRouteWithService(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-route-with-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-route-with-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "RouteWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2058,15 +2101,17 @@ func (s *Routes) UpsertRouteWithService(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2083,7 +2128,7 @@ func (s *Routes) UpsertRouteWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2091,13 +2136,13 @@ func (s *Routes) UpsertRouteWithService(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2110,17 +2155,17 @@ func (s *Routes) UpsertRouteWithService(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/sdk.go b/sdk.go index 78737363..7c2109b8 100644 --- a/sdk.go +++ b/sdk.go @@ -2,9 +2,12 @@ package sdkkonnectgo +// Generated from OpenAPI doc version 0.0.1 and generator version 2.638.5 + import ( "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -21,7 +24,7 @@ var ServerList = []string{ "https://au.api.konghq.com", } -// HTTPClient provides an interface for suplying the SDK with a custom HTTP client +// HTTPClient provides an interface for supplying the SDK with a custom HTTP client type HTTPClient interface { Do(req *http.Request) (*http.Response, error) } @@ -47,33 +50,11 @@ func Float64(f float64) *float64 { return &f } // Pointer provides a helper function to return a pointer to a type func Pointer[T any](v T) *T { return &v } -type sdkConfiguration struct { - Client HTTPClient - Security func(context.Context) (interface{}, error) - ServerURL string - ServerIndex int - Language string - OpenAPIDocVersion string - SDKVersion string - GenVersion string - UserAgent string - RetryConfig *retry.Config - Hooks *hooks.Hooks - Timeout *time.Duration -} - -func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { - if c.ServerURL != "" { - return c.ServerURL, nil - } - - return ServerList[c.ServerIndex], nil -} - // SDK - Konnect API - Go SDK: The Konnect platform API // // https://developer.konghq.com - Documentation for Kong Gateway and its APIs type SDK struct { + SDKVersion string // Operations related to notifications Notifications *Notifications // Application Auth Strategies are sets of plugin configurations that represent how the gateway will perform authentication and authorization for a Product Version. @@ -209,7 +190,8 @@ type SDK struct { TeamMembership *TeamMembership Users *Users - sdkConfiguration sdkConfiguration + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } type SDKOption func(*SDK) @@ -282,14 +264,12 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *SDK { sdk := &SDK{ - sdkConfiguration: sdkConfiguration{ - Language: "go", - OpenAPIDocVersion: "0.0.1", - SDKVersion: "0.3.1", - GenVersion: "2.605.6", - UserAgent: "speakeasy-sdk/go 0.3.1 2.605.6 0.0.1 github.com/Kong/sdk-konnect-go", - Hooks: hooks.New(), + SDKVersion: "0.3.2", + sdkConfiguration: config.SDKConfiguration{ + UserAgent: "speakeasy-sdk/go 0.3.2 2.638.5 0.0.1 github.com/Kong/sdk-konnect-go", + ServerList: ServerList, }, + hooks: hooks.New(), } for _, opt := range opts { opt(sdk) @@ -302,104 +282,58 @@ func New(opts ...SDKOption) *SDK { currentServerURL, _ := sdk.sdkConfiguration.GetServerDetails() serverURL := currentServerURL - serverURL, sdk.sdkConfiguration.Client = sdk.sdkConfiguration.Hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) - if serverURL != currentServerURL { + serverURL, sdk.sdkConfiguration.Client = sdk.hooks.SDKInit(currentServerURL, sdk.sdkConfiguration.Client) + if currentServerURL != serverURL { sdk.sdkConfiguration.ServerURL = serverURL } - sdk.Notifications = newNotifications(sdk.sdkConfiguration) - - sdk.AppAuthStrategies = newAppAuthStrategies(sdk.sdkConfiguration) - - sdk.CloudGateways = newCloudGateways(sdk.sdkConfiguration) - - 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) - - sdk.CACertificates = newCACertificates(sdk.sdkConfiguration) - - sdk.Certificates = newCertificates(sdk.sdkConfiguration) - - sdk.SNIs = newSNIs(sdk.sdkConfiguration) - - sdk.ConsumerGroups = newConsumerGroups(sdk.sdkConfiguration) - - sdk.Plugins = newPlugins(sdk.sdkConfiguration) - - sdk.Consumers = newConsumers(sdk.sdkConfiguration) - - sdk.HMACAuthCredentials = newHMACAuthCredentials(sdk.sdkConfiguration) - - sdk.JWTs = newJWTs(sdk.sdkConfiguration) - - sdk.APIKeys = newAPIKeys(sdk.sdkConfiguration) - - sdk.MTLSAuthCredentials = newMTLSAuthCredentials(sdk.sdkConfiguration) - - sdk.CustomPlugins = newCustomPlugins(sdk.sdkConfiguration) - - sdk.DegraphqlRoutes = newDegraphqlRoutes(sdk.sdkConfiguration) - - sdk.KeySets = newKeySets(sdk.sdkConfiguration) - - sdk.Keys = newKeys(sdk.sdkConfiguration) - - sdk.Partials = newPartials(sdk.sdkConfiguration) - - sdk.PartialLinks = newPartialLinks(sdk.sdkConfiguration) - - sdk.CustomPluginSchemas = newCustomPluginSchemas(sdk.sdkConfiguration) - - sdk.Routes = newRoutes(sdk.sdkConfiguration) - - sdk.Services = newServices(sdk.sdkConfiguration) - - sdk.Upstreams = newUpstreams(sdk.sdkConfiguration) - - sdk.Targets = newTargets(sdk.sdkConfiguration) - - sdk.Vaults = newVaults(sdk.sdkConfiguration) - - sdk.DPCertificates = newDPCertificates(sdk.sdkConfiguration) - - sdk.DPNodes = newDPNodes(sdk.sdkConfiguration) - - sdk.ControlPlaneGroups = newControlPlaneGroups(sdk.sdkConfiguration) - - sdk.DCRProviders = newDCRProviders(sdk.sdkConfiguration) - - sdk.Authentication = newAuthentication(sdk.sdkConfiguration) - - sdk.AuthSettings = newAuthSettings(sdk.sdkConfiguration) - - sdk.Invites = newInvites(sdk.sdkConfiguration) - - sdk.ImpersonationSettings = newImpersonationSettings(sdk.sdkConfiguration) - - sdk.Me = newMe(sdk.sdkConfiguration) - - sdk.Roles = newRoles(sdk.sdkConfiguration) - - sdk.SystemAccounts = newSystemAccounts(sdk.sdkConfiguration) - - sdk.SystemAccountsAccessTokens = newSystemAccountsAccessTokens(sdk.sdkConfiguration) - - sdk.SystemAccountsRoles = newSystemAccountsRoles(sdk.sdkConfiguration) - - sdk.SystemAccountsTeamMembership = newSystemAccountsTeamMembership(sdk.sdkConfiguration) - - sdk.Teams = newTeams(sdk.sdkConfiguration) - - sdk.TeamMembership = newTeamMembership(sdk.sdkConfiguration) - - sdk.Users = newUsers(sdk.sdkConfiguration) + sdk.Notifications = newNotifications(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.AppAuthStrategies = newAppAuthStrategies(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.CloudGateways = newCloudGateways(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ControlPlanes = newControlPlanes(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ConfigStores = newConfigStores(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ConfigStoreSecrets = newConfigStoreSecrets(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ACLs = newACLs(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.BasicAuthCredentials = newBasicAuthCredentials(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.CACertificates = newCACertificates(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Certificates = newCertificates(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.SNIs = newSNIs(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ConsumerGroups = newConsumerGroups(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Plugins = newPlugins(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Consumers = newConsumers(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.HMACAuthCredentials = newHMACAuthCredentials(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.JWTs = newJWTs(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.APIKeys = newAPIKeys(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.MTLSAuthCredentials = newMTLSAuthCredentials(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.CustomPlugins = newCustomPlugins(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.DegraphqlRoutes = newDegraphqlRoutes(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.KeySets = newKeySets(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Keys = newKeys(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Partials = newPartials(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.PartialLinks = newPartialLinks(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.CustomPluginSchemas = newCustomPluginSchemas(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Routes = newRoutes(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Services = newServices(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Upstreams = newUpstreams(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Targets = newTargets(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Vaults = newVaults(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.DPCertificates = newDPCertificates(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.DPNodes = newDPNodes(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ControlPlaneGroups = newControlPlaneGroups(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.DCRProviders = newDCRProviders(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Authentication = newAuthentication(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.AuthSettings = newAuthSettings(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Invites = newInvites(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.ImpersonationSettings = newImpersonationSettings(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Me = newMe(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Roles = newRoles(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.SystemAccounts = newSystemAccounts(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.SystemAccountsAccessTokens = newSystemAccountsAccessTokens(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.SystemAccountsRoles = newSystemAccountsRoles(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.SystemAccountsTeamMembership = newSystemAccountsTeamMembership(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Teams = newTeams(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.TeamMembership = newTeamMembership(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Users = newUsers(sdk, sdk.sdkConfiguration, sdk.hooks) return sdk } diff --git a/services.go b/services.go index eae37cee..4b07034e 100644 --- a/services.go +++ b/services.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -23,12 +24,16 @@ import ( //

// Services can be both [tagged and filtered by tags](https://docs.konghq.com/gateway/latest/admin-api/#tags). type Services struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newServices(sdkConfig sdkConfiguration) *Services { +func newServices(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Services { return &Services{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -59,11 +64,13 @@ func (s *Services) ListService(ctx context.Context, request operations.ListServi } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -116,15 +123,17 @@ func (s *Services) ListService(ctx context.Context, request operations.ListServi "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -141,7 +150,7 @@ func (s *Services) ListService(ctx context.Context, request operations.ListServi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -149,13 +158,13 @@ func (s *Services) ListService(ctx context.Context, request operations.ListServi if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -168,17 +177,17 @@ func (s *Services) ListService(ctx context.Context, request operations.ListServi err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -290,11 +299,13 @@ func (s *Services) CreateService(ctx context.Context, controlPlaneID string, ser } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Service", "json", `request:"mediaType=application/json"`) if err != nil { @@ -350,15 +361,17 @@ func (s *Services) CreateService(ctx context.Context, controlPlaneID string, ser "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -375,7 +388,7 @@ func (s *Services) CreateService(ctx context.Context, controlPlaneID string, ser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -383,13 +396,13 @@ func (s *Services) CreateService(ctx context.Context, controlPlaneID string, ser if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -402,17 +415,17 @@ func (s *Services) CreateService(ctx context.Context, controlPlaneID string, ser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -524,11 +537,13 @@ func (s *Services) DeleteService(ctx context.Context, controlPlaneID string, ser } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -577,15 +592,17 @@ func (s *Services) DeleteService(ctx context.Context, controlPlaneID string, ser "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -602,7 +619,7 @@ func (s *Services) DeleteService(ctx context.Context, controlPlaneID string, ser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -610,13 +627,13 @@ func (s *Services) DeleteService(ctx context.Context, controlPlaneID string, ser if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -629,17 +646,17 @@ func (s *Services) DeleteService(ctx context.Context, controlPlaneID string, ser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -731,11 +748,13 @@ func (s *Services) GetService(ctx context.Context, serviceID string, controlPlan } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -784,15 +803,17 @@ func (s *Services) GetService(ctx context.Context, serviceID string, controlPlan "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -809,7 +830,7 @@ func (s *Services) GetService(ctx context.Context, serviceID string, controlPlan err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -817,13 +838,13 @@ func (s *Services) GetService(ctx context.Context, serviceID string, controlPlan if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -836,17 +857,17 @@ func (s *Services) GetService(ctx context.Context, serviceID string, controlPlan err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -955,11 +976,13 @@ func (s *Services) UpsertService(ctx context.Context, request operations.UpsertS } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-service", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-service", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Service", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1015,15 +1038,17 @@ func (s *Services) UpsertService(ctx context.Context, request operations.UpsertS "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1040,7 +1065,7 @@ func (s *Services) UpsertService(ctx context.Context, request operations.UpsertS err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1048,13 +1073,13 @@ func (s *Services) UpsertService(ctx context.Context, request operations.UpsertS if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1067,17 +1092,17 @@ func (s *Services) UpsertService(ctx context.Context, request operations.UpsertS err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/snis.go b/snis.go index 9670de3f..fb70492e 100644 --- a/snis.go +++ b/snis.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -19,12 +20,16 @@ import ( //

// A certificate object can have many hostnames associated with it. When Kong Gateway receives an SSL request, it uses the SNI field in the Client Hello to look up the certificate object based on the SNI associated with the certificate. type SNIs struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSNIs(sdkConfig sdkConfiguration) *SNIs { +func newSNIs(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *SNIs { return &SNIs{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -55,11 +60,13 @@ func (s *SNIs) ListSniWithCertificate(ctx context.Context, request operations.Li } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-sni-with-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-sni-with-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -112,15 +119,17 @@ func (s *SNIs) ListSniWithCertificate(ctx context.Context, request operations.Li "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -137,7 +146,7 @@ func (s *SNIs) ListSniWithCertificate(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -145,13 +154,13 @@ func (s *SNIs) ListSniWithCertificate(ctx context.Context, request operations.Li if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -164,17 +173,17 @@ func (s *SNIs) ListSniWithCertificate(ctx context.Context, request operations.Li err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -260,11 +269,13 @@ func (s *SNIs) CreateSniWithCertificate(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-sni-with-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-sni-with-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "SNIWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -320,15 +331,17 @@ func (s *SNIs) CreateSniWithCertificate(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -345,7 +358,7 @@ func (s *SNIs) CreateSniWithCertificate(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -353,13 +366,13 @@ func (s *SNIs) CreateSniWithCertificate(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -372,17 +385,17 @@ func (s *SNIs) CreateSniWithCertificate(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -468,11 +481,13 @@ func (s *SNIs) DeleteSniWithCertificate(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-sni-with-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-sni-with-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -521,15 +536,17 @@ func (s *SNIs) DeleteSniWithCertificate(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -546,7 +563,7 @@ func (s *SNIs) DeleteSniWithCertificate(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -554,13 +571,13 @@ func (s *SNIs) DeleteSniWithCertificate(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -573,17 +590,17 @@ func (s *SNIs) DeleteSniWithCertificate(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -649,11 +666,13 @@ func (s *SNIs) GetSniWithCertificate(ctx context.Context, request operations.Get } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-sni-with-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-sni-with-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -702,15 +721,17 @@ func (s *SNIs) GetSniWithCertificate(ctx context.Context, request operations.Get "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -727,7 +748,7 @@ func (s *SNIs) GetSniWithCertificate(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -735,13 +756,13 @@ func (s *SNIs) GetSniWithCertificate(ctx context.Context, request operations.Get if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -754,17 +775,17 @@ func (s *SNIs) GetSniWithCertificate(ctx context.Context, request operations.Get err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -852,11 +873,13 @@ func (s *SNIs) UpsertSniWithCertificate(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-sni-with-certificate", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-sni-with-certificate", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "SNIWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -912,15 +935,17 @@ func (s *SNIs) UpsertSniWithCertificate(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -937,7 +962,7 @@ func (s *SNIs) UpsertSniWithCertificate(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -945,13 +970,13 @@ func (s *SNIs) UpsertSniWithCertificate(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -964,17 +989,17 @@ func (s *SNIs) UpsertSniWithCertificate(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1060,11 +1085,13 @@ func (s *SNIs) ListSni(ctx context.Context, request operations.ListSniRequest, o } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-sni", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-sni", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1117,15 +1144,17 @@ func (s *SNIs) ListSni(ctx context.Context, request operations.ListSniRequest, o "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1142,7 +1171,7 @@ func (s *SNIs) ListSni(ctx context.Context, request operations.ListSniRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1150,13 +1179,13 @@ func (s *SNIs) ListSni(ctx context.Context, request operations.ListSniRequest, o if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1169,17 +1198,17 @@ func (s *SNIs) ListSni(ctx context.Context, request operations.ListSniRequest, o err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1291,11 +1320,13 @@ func (s *SNIs) CreateSni(ctx context.Context, controlPlaneID string, sni compone } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-sni", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-sni", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Sni", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1351,15 +1382,17 @@ func (s *SNIs) CreateSni(ctx context.Context, controlPlaneID string, sni compone "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1376,7 +1409,7 @@ func (s *SNIs) CreateSni(ctx context.Context, controlPlaneID string, sni compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1384,13 +1417,13 @@ func (s *SNIs) CreateSni(ctx context.Context, controlPlaneID string, sni compone if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1403,17 +1436,17 @@ func (s *SNIs) CreateSni(ctx context.Context, controlPlaneID string, sni compone err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1525,11 +1558,13 @@ func (s *SNIs) DeleteSni(ctx context.Context, controlPlaneID string, sniID strin } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-sni", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-sni", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1578,15 +1613,17 @@ func (s *SNIs) DeleteSni(ctx context.Context, controlPlaneID string, sniID strin "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1603,7 +1640,7 @@ func (s *SNIs) DeleteSni(ctx context.Context, controlPlaneID string, sniID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1611,13 +1648,13 @@ func (s *SNIs) DeleteSni(ctx context.Context, controlPlaneID string, sniID strin if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1630,17 +1667,17 @@ func (s *SNIs) DeleteSni(ctx context.Context, controlPlaneID string, sniID strin err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1732,11 +1769,13 @@ func (s *SNIs) GetSni(ctx context.Context, sniID string, controlPlaneID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-sni", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-sni", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1785,15 +1824,17 @@ func (s *SNIs) GetSni(ctx context.Context, sniID string, controlPlaneID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1810,7 +1851,7 @@ func (s *SNIs) GetSni(ctx context.Context, sniID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1818,13 +1859,13 @@ func (s *SNIs) GetSni(ctx context.Context, sniID string, controlPlaneID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1837,17 +1878,17 @@ func (s *SNIs) GetSni(ctx context.Context, sniID string, controlPlaneID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1956,11 +1997,13 @@ func (s *SNIs) UpsertSni(ctx context.Context, request operations.UpsertSniReques } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-sni", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-sni", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Sni", "json", `request:"mediaType=application/json"`) if err != nil { @@ -2016,15 +2059,17 @@ func (s *SNIs) UpsertSni(ctx context.Context, request operations.UpsertSniReques "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -2041,7 +2086,7 @@ func (s *SNIs) UpsertSni(ctx context.Context, request operations.UpsertSniReques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -2049,13 +2094,13 @@ func (s *SNIs) UpsertSni(ctx context.Context, request operations.UpsertSniReques if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -2068,17 +2113,17 @@ func (s *SNIs) UpsertSni(ctx context.Context, request operations.UpsertSniReques err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/systemaccounts.go b/systemaccounts.go index dca4b53b..d8390b99 100644 --- a/systemaccounts.go +++ b/systemaccounts.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type SystemAccounts struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSystemAccounts(sdkConfig sdkConfiguration) *SystemAccounts { +func newSystemAccounts(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *SystemAccounts { return &SystemAccounts{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *SystemAccounts) GetSystemAccounts(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-system-accounts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-system-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *SystemAccounts) GetSystemAccounts(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *SystemAccounts) GetSystemAccounts(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *SystemAccounts) GetSystemAccounts(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *SystemAccounts) GetSystemAccounts(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -300,11 +309,13 @@ func (s *SystemAccounts) PostSystemAccounts(ctx context.Context, request *compon } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "post-system-accounts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "post-system-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -360,15 +371,17 @@ func (s *SystemAccounts) PostSystemAccounts(ctx context.Context, request *compon "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -385,7 +398,7 @@ func (s *SystemAccounts) PostSystemAccounts(ctx context.Context, request *compon err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -393,13 +406,13 @@ func (s *SystemAccounts) PostSystemAccounts(ctx context.Context, request *compon if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -412,17 +425,17 @@ func (s *SystemAccounts) PostSystemAccounts(ctx context.Context, request *compon err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -555,11 +568,13 @@ func (s *SystemAccounts) GetSystemAccountsID(ctx context.Context, accountID stri } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-system-accounts-id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-system-accounts-id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -608,15 +623,17 @@ func (s *SystemAccounts) GetSystemAccountsID(ctx context.Context, accountID stri "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -633,7 +650,7 @@ func (s *SystemAccounts) GetSystemAccountsID(ctx context.Context, accountID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -641,13 +658,13 @@ func (s *SystemAccounts) GetSystemAccountsID(ctx context.Context, accountID stri if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -660,17 +677,17 @@ func (s *SystemAccounts) GetSystemAccountsID(ctx context.Context, accountID stri err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -804,11 +821,13 @@ func (s *SystemAccounts) PatchSystemAccountsID(ctx context.Context, accountID st } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "patch-system-accounts-id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "patch-system-accounts-id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateSystemAccount", "json", `request:"mediaType=application/json"`) if err != nil { @@ -864,15 +883,17 @@ func (s *SystemAccounts) PatchSystemAccountsID(ctx context.Context, accountID st "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -889,7 +910,7 @@ func (s *SystemAccounts) PatchSystemAccountsID(ctx context.Context, accountID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -897,13 +918,13 @@ func (s *SystemAccounts) PatchSystemAccountsID(ctx context.Context, accountID st if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -916,17 +937,17 @@ func (s *SystemAccounts) PatchSystemAccountsID(ctx context.Context, accountID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1080,11 +1101,13 @@ func (s *SystemAccounts) DeleteSystemAccountsID(ctx context.Context, accountID s } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-system-accounts-id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-system-accounts-id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1133,15 +1156,17 @@ func (s *SystemAccounts) DeleteSystemAccountsID(ctx context.Context, accountID s "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1158,7 +1183,7 @@ func (s *SystemAccounts) DeleteSystemAccountsID(ctx context.Context, accountID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1166,13 +1191,13 @@ func (s *SystemAccounts) DeleteSystemAccountsID(ctx context.Context, accountID s if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1185,17 +1210,17 @@ func (s *SystemAccounts) DeleteSystemAccountsID(ctx context.Context, accountID s err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/systemaccountsaccesstokens.go b/systemaccountsaccesstokens.go index 85d41ae9..c6272753 100644 --- a/systemaccountsaccesstokens.go +++ b/systemaccountsaccesstokens.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type SystemAccountsAccessTokens struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSystemAccountsAccessTokens(sdkConfig sdkConfiguration) *SystemAccountsAccessTokens { +func newSystemAccountsAccessTokens(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *SystemAccountsAccessTokens { return &SystemAccountsAccessTokens{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -51,11 +56,13 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountIDAccessTokens(ctx context. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-system-account-id-access-tokens", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-system-account-id-access-tokens", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -108,15 +115,17 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountIDAccessTokens(ctx context. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -133,7 +142,7 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountIDAccessTokens(ctx context. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -141,13 +150,13 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountIDAccessTokens(ctx context. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -160,17 +169,17 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountIDAccessTokens(ctx context. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -325,11 +334,13 @@ func (s *SystemAccountsAccessTokens) PostSystemAccountsIDAccessTokens(ctx contex } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "post-system-accounts-id-access-tokens", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "post-system-accounts-id-access-tokens", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreateSystemAccountAccessToken", "json", `request:"mediaType=application/json"`) if err != nil { @@ -385,15 +396,17 @@ func (s *SystemAccountsAccessTokens) PostSystemAccountsIDAccessTokens(ctx contex "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -410,7 +423,7 @@ func (s *SystemAccountsAccessTokens) PostSystemAccountsIDAccessTokens(ctx contex err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -418,13 +431,13 @@ func (s *SystemAccountsAccessTokens) PostSystemAccountsIDAccessTokens(ctx contex if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -437,17 +450,17 @@ func (s *SystemAccountsAccessTokens) PostSystemAccountsIDAccessTokens(ctx contex err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -602,11 +615,13 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountsIDAccessTokensID(ctx conte } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-system-accounts-id-access-tokens-id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-system-accounts-id-access-tokens-id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -655,15 +670,17 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountsIDAccessTokensID(ctx conte "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -680,7 +697,7 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountsIDAccessTokensID(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -688,13 +705,13 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountsIDAccessTokensID(ctx conte if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -707,17 +724,17 @@ func (s *SystemAccountsAccessTokens) GetSystemAccountsIDAccessTokensID(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -846,11 +863,13 @@ func (s *SystemAccountsAccessTokens) PatchSystemAccountsIDAccessTokensID(ctx con } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "patch-system-accounts-id-access-tokens-id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "patch-system-accounts-id-access-tokens-id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateSystemAccountAccessToken", "json", `request:"mediaType=application/json"`) if err != nil { @@ -906,15 +925,17 @@ func (s *SystemAccountsAccessTokens) PatchSystemAccountsIDAccessTokensID(ctx con "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -931,7 +952,7 @@ func (s *SystemAccountsAccessTokens) PatchSystemAccountsIDAccessTokensID(ctx con err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -939,13 +960,13 @@ func (s *SystemAccountsAccessTokens) PatchSystemAccountsIDAccessTokensID(ctx con if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -958,17 +979,17 @@ func (s *SystemAccountsAccessTokens) PatchSystemAccountsIDAccessTokensID(ctx con err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1123,11 +1144,13 @@ func (s *SystemAccountsAccessTokens) DeleteSystemAccountsIDAccessTokensID(ctx co } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-system-accounts-id-access-tokens-id", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-system-accounts-id-access-tokens-id", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1176,15 +1199,17 @@ func (s *SystemAccountsAccessTokens) DeleteSystemAccountsIDAccessTokensID(ctx co "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1201,7 +1226,7 @@ func (s *SystemAccountsAccessTokens) DeleteSystemAccountsIDAccessTokensID(ctx co err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1209,13 +1234,13 @@ func (s *SystemAccountsAccessTokens) DeleteSystemAccountsIDAccessTokensID(ctx co if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1228,17 +1253,17 @@ func (s *SystemAccountsAccessTokens) DeleteSystemAccountsIDAccessTokensID(ctx co err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/systemaccountsroles.go b/systemaccountsroles.go index 7f52282c..5fa48a68 100644 --- a/systemaccountsroles.go +++ b/systemaccountsroles.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type SystemAccountsRoles struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSystemAccountsRoles(sdkConfig sdkConfiguration) *SystemAccountsRoles { +func newSystemAccountsRoles(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *SystemAccountsRoles { return &SystemAccountsRoles{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -56,11 +61,13 @@ func (s *SystemAccountsRoles) GetSystemAccountsAccountIDAssignedRoles(ctx contex } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-system-accounts-accountId-assigned-roles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-system-accounts-accountId-assigned-roles", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -113,15 +120,17 @@ func (s *SystemAccountsRoles) GetSystemAccountsAccountIDAssignedRoles(ctx contex "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -138,7 +147,7 @@ func (s *SystemAccountsRoles) GetSystemAccountsAccountIDAssignedRoles(ctx contex err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -146,13 +155,13 @@ func (s *SystemAccountsRoles) GetSystemAccountsAccountIDAssignedRoles(ctx contex if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -165,17 +174,17 @@ func (s *SystemAccountsRoles) GetSystemAccountsAccountIDAssignedRoles(ctx contex err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -330,11 +339,13 @@ func (s *SystemAccountsRoles) PostSystemAccountsAccountIDAssignedRoles(ctx conte } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "post-system-accounts-accountId-assigned-roles", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "post-system-accounts-accountId-assigned-roles", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "AssignRole", "json", `request:"mediaType=application/json"`) if err != nil { @@ -390,15 +401,17 @@ func (s *SystemAccountsRoles) PostSystemAccountsAccountIDAssignedRoles(ctx conte "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -415,7 +428,7 @@ func (s *SystemAccountsRoles) PostSystemAccountsAccountIDAssignedRoles(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -423,13 +436,13 @@ func (s *SystemAccountsRoles) PostSystemAccountsAccountIDAssignedRoles(ctx conte if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -442,17 +455,17 @@ func (s *SystemAccountsRoles) PostSystemAccountsAccountIDAssignedRoles(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -607,11 +620,13 @@ func (s *SystemAccountsRoles) DeleteSystemAccountsAccountIDAssignedRolesRoleID(c } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-system-accounts-accountId-assigned-roles-roleId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-system-accounts-accountId-assigned-roles-roleId", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -660,15 +675,17 @@ func (s *SystemAccountsRoles) DeleteSystemAccountsAccountIDAssignedRolesRoleID(c "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -685,7 +702,7 @@ func (s *SystemAccountsRoles) DeleteSystemAccountsAccountIDAssignedRolesRoleID(c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -693,13 +710,13 @@ func (s *SystemAccountsRoles) DeleteSystemAccountsAccountIDAssignedRolesRoleID(c if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -712,17 +729,17 @@ func (s *SystemAccountsRoles) DeleteSystemAccountsAccountIDAssignedRolesRoleID(c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/systemaccountsteammembership.go b/systemaccountsteammembership.go index 7ca0f068..85aa460b 100644 --- a/systemaccountsteammembership.go +++ b/systemaccountsteammembership.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type SystemAccountsTeamMembership struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newSystemAccountsTeamMembership(sdkConfig sdkConfiguration) *SystemAccountsTeamMembership { +func newSystemAccountsTeamMembership(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *SystemAccountsTeamMembership { return &SystemAccountsTeamMembership{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -51,11 +56,13 @@ func (s *SystemAccountsTeamMembership) GetSystemAccountsAccountIDTeams(ctx conte } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-system-accounts-accountId-teams", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-system-accounts-accountId-teams", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -108,15 +115,17 @@ func (s *SystemAccountsTeamMembership) GetSystemAccountsAccountIDTeams(ctx conte "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -133,7 +142,7 @@ func (s *SystemAccountsTeamMembership) GetSystemAccountsAccountIDTeams(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -141,13 +150,13 @@ func (s *SystemAccountsTeamMembership) GetSystemAccountsAccountIDTeams(ctx conte if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -160,17 +169,17 @@ func (s *SystemAccountsTeamMembership) GetSystemAccountsAccountIDTeams(ctx conte err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -299,11 +308,13 @@ func (s *SystemAccountsTeamMembership) GetTeamsTeamIDSystemAccounts(ctx context. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-teams-teamId-system-accounts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-teams-teamId-system-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -356,15 +367,17 @@ func (s *SystemAccountsTeamMembership) GetTeamsTeamIDSystemAccounts(ctx context. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -381,7 +394,7 @@ func (s *SystemAccountsTeamMembership) GetTeamsTeamIDSystemAccounts(ctx context. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -389,13 +402,13 @@ func (s *SystemAccountsTeamMembership) GetTeamsTeamIDSystemAccounts(ctx context. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -408,17 +421,17 @@ func (s *SystemAccountsTeamMembership) GetTeamsTeamIDSystemAccounts(ctx context. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -552,11 +565,13 @@ func (s *SystemAccountsTeamMembership) PostTeamsTeamIDSystemAccounts(ctx context } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "post-teams-teamId-system-accounts", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "post-teams-teamId-system-accounts", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "AddSystemAccountToTeam", "json", `request:"mediaType=application/json"`) if err != nil { @@ -612,15 +627,17 @@ func (s *SystemAccountsTeamMembership) PostTeamsTeamIDSystemAccounts(ctx context "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -637,7 +654,7 @@ func (s *SystemAccountsTeamMembership) PostTeamsTeamIDSystemAccounts(ctx context err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -645,13 +662,13 @@ func (s *SystemAccountsTeamMembership) PostTeamsTeamIDSystemAccounts(ctx context if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -664,17 +681,17 @@ func (s *SystemAccountsTeamMembership) PostTeamsTeamIDSystemAccounts(ctx context err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "403", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -809,11 +826,13 @@ func (s *SystemAccountsTeamMembership) DeleteTeamsTeamIDSystemAccountsAccountID( } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-teams-teamId-system-accounts-accountId", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-teams-teamId-system-accounts-accountId", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -862,15 +881,17 @@ func (s *SystemAccountsTeamMembership) DeleteTeamsTeamIDSystemAccountsAccountID( "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -887,7 +908,7 @@ func (s *SystemAccountsTeamMembership) DeleteTeamsTeamIDSystemAccountsAccountID( err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -895,13 +916,13 @@ func (s *SystemAccountsTeamMembership) DeleteTeamsTeamIDSystemAccountsAccountID( if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -914,17 +935,17 @@ func (s *SystemAccountsTeamMembership) DeleteTeamsTeamIDSystemAccountsAccountID( err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/targets.go b/targets.go index 40d45731..deffe7d2 100644 --- a/targets.go +++ b/targets.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type Targets struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newTargets(sdkConfig sdkConfiguration) *Targets { +func newTargets(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Targets { return &Targets{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Targets) ListTargetWithUpstream(ctx context.Context, request operations } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-target-with-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-target-with-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *Targets) ListTargetWithUpstream(ctx context.Context, request operations "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *Targets) ListTargetWithUpstream(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *Targets) ListTargetWithUpstream(ctx context.Context, request operations if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *Targets) ListTargetWithUpstream(ctx context.Context, request operations err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -257,11 +266,13 @@ func (s *Targets) CreateTargetWithUpstream(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-target-with-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-target-with-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "TargetWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -317,15 +328,17 @@ func (s *Targets) CreateTargetWithUpstream(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -342,7 +355,7 @@ func (s *Targets) CreateTargetWithUpstream(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -350,13 +363,13 @@ func (s *Targets) CreateTargetWithUpstream(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -369,17 +382,17 @@ func (s *Targets) CreateTargetWithUpstream(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -465,11 +478,13 @@ func (s *Targets) DeleteTargetWithUpstream(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-target-with-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-target-with-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -518,15 +533,17 @@ func (s *Targets) DeleteTargetWithUpstream(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -543,7 +560,7 @@ func (s *Targets) DeleteTargetWithUpstream(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -551,13 +568,13 @@ func (s *Targets) DeleteTargetWithUpstream(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -570,17 +587,17 @@ func (s *Targets) DeleteTargetWithUpstream(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -646,11 +663,13 @@ func (s *Targets) GetTargetWithUpstream(ctx context.Context, request operations. } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-target-with-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-target-with-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -699,15 +718,17 @@ func (s *Targets) GetTargetWithUpstream(ctx context.Context, request operations. "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -724,7 +745,7 @@ func (s *Targets) GetTargetWithUpstream(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -732,13 +753,13 @@ func (s *Targets) GetTargetWithUpstream(ctx context.Context, request operations. if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -751,17 +772,17 @@ func (s *Targets) GetTargetWithUpstream(ctx context.Context, request operations. err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -849,11 +870,13 @@ func (s *Targets) UpsertTargetWithUpstream(ctx context.Context, request operatio } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-target-with-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-target-with-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "TargetWithoutParents", "json", `request:"mediaType=application/json"`) if err != nil { @@ -909,15 +932,17 @@ func (s *Targets) UpsertTargetWithUpstream(ctx context.Context, request operatio "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -934,7 +959,7 @@ func (s *Targets) UpsertTargetWithUpstream(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -942,13 +967,13 @@ func (s *Targets) UpsertTargetWithUpstream(ctx context.Context, request operatio if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -961,17 +986,17 @@ func (s *Targets) UpsertTargetWithUpstream(ctx context.Context, request operatio err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/teammembership.go b/teammembership.go index 390e87d8..d4a5912b 100644 --- a/teammembership.go +++ b/teammembership.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -16,12 +17,16 @@ import ( ) type TeamMembership struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newTeamMembership(sdkConfig sdkConfiguration) *TeamMembership { +func newTeamMembership(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *TeamMembership { return &TeamMembership{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -51,11 +56,13 @@ func (s *TeamMembership) ListTeamUsers(ctx context.Context, request operations.L } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-team-users", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-team-users", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -108,15 +115,17 @@ func (s *TeamMembership) ListTeamUsers(ctx context.Context, request operations.L "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -133,7 +142,7 @@ func (s *TeamMembership) ListTeamUsers(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -141,13 +150,13 @@ func (s *TeamMembership) ListTeamUsers(ctx context.Context, request operations.L if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -160,17 +169,17 @@ func (s *TeamMembership) ListTeamUsers(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -302,11 +311,13 @@ func (s *TeamMembership) AddUserToTeam(ctx context.Context, teamID string, addUs } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "add-user-to-team", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "add-user-to-team", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "AddUserToTeam", "json", `request:"mediaType=application/json"`) if err != nil { @@ -362,15 +373,17 @@ func (s *TeamMembership) AddUserToTeam(ctx context.Context, teamID string, addUs "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -387,7 +400,7 @@ func (s *TeamMembership) AddUserToTeam(ctx context.Context, teamID string, addUs err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -395,13 +408,13 @@ func (s *TeamMembership) AddUserToTeam(ctx context.Context, teamID string, addUs if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -414,17 +427,17 @@ func (s *TeamMembership) AddUserToTeam(ctx context.Context, teamID string, addUs err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "409", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -558,11 +571,13 @@ func (s *TeamMembership) RemoveUserFromTeam(ctx context.Context, userID string, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "remove-user-from-team", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "remove-user-from-team", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -611,15 +626,17 @@ func (s *TeamMembership) RemoveUserFromTeam(ctx context.Context, userID string, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -636,7 +653,7 @@ func (s *TeamMembership) RemoveUserFromTeam(ctx context.Context, userID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -644,13 +661,13 @@ func (s *TeamMembership) RemoveUserFromTeam(ctx context.Context, userID string, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -663,17 +680,17 @@ func (s *TeamMembership) RemoveUserFromTeam(ctx context.Context, userID string, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -780,11 +797,13 @@ func (s *TeamMembership) ListUserTeams(ctx context.Context, request operations.L } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-user-teams", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-user-teams", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -837,15 +856,17 @@ func (s *TeamMembership) ListUserTeams(ctx context.Context, request operations.L "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -862,7 +883,7 @@ func (s *TeamMembership) ListUserTeams(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -870,13 +891,13 @@ func (s *TeamMembership) ListUserTeams(ctx context.Context, request operations.L if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -889,17 +910,17 @@ func (s *TeamMembership) ListUserTeams(ctx context.Context, request operations.L err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/teams.go b/teams.go index e85e50c6..48369944 100644 --- a/teams.go +++ b/teams.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type Teams struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newTeams(sdkConfig sdkConfiguration) *Teams { +func newTeams(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Teams { return &Teams{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Teams) ListTeams(ctx context.Context, request operations.ListTeamsReque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-teams", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-teams", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *Teams) ListTeams(ctx context.Context, request operations.ListTeamsReque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *Teams) ListTeams(ctx context.Context, request operations.ListTeamsReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *Teams) ListTeams(ctx context.Context, request operations.ListTeamsReque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *Teams) ListTeams(ctx context.Context, request operations.ListTeamsReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -298,11 +307,13 @@ func (s *Teams) CreateTeam(ctx context.Context, request *components.CreateTeam, } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-team", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-team", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { @@ -358,15 +369,17 @@ func (s *Teams) CreateTeam(ctx context.Context, request *components.CreateTeam, "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -383,7 +396,7 @@ func (s *Teams) CreateTeam(ctx context.Context, request *components.CreateTeam, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -391,13 +404,13 @@ func (s *Teams) CreateTeam(ctx context.Context, request *components.CreateTeam, if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -410,17 +423,17 @@ func (s *Teams) CreateTeam(ctx context.Context, request *components.CreateTeam, err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "403", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -551,11 +564,13 @@ func (s *Teams) GetTeam(ctx context.Context, teamID string, opts ...operations.O } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-team", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-team", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -604,15 +619,17 @@ func (s *Teams) GetTeam(ctx context.Context, teamID string, opts ...operations.O "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -629,7 +646,7 @@ func (s *Teams) GetTeam(ctx context.Context, teamID string, opts ...operations.O err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -637,13 +654,13 @@ func (s *Teams) GetTeam(ctx context.Context, teamID string, opts ...operations.O if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -656,17 +673,17 @@ func (s *Teams) GetTeam(ctx context.Context, teamID string, opts ...operations.O err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -798,11 +815,13 @@ func (s *Teams) UpdateTeam(ctx context.Context, teamID string, updateTeam *compo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-team", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-team", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateTeam", "json", `request:"mediaType=application/json"`) if err != nil { @@ -858,15 +877,17 @@ func (s *Teams) UpdateTeam(ctx context.Context, teamID string, updateTeam *compo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -883,7 +904,7 @@ func (s *Teams) UpdateTeam(ctx context.Context, teamID string, updateTeam *compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -891,13 +912,13 @@ func (s *Teams) UpdateTeam(ctx context.Context, teamID string, updateTeam *compo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -910,17 +931,17 @@ func (s *Teams) UpdateTeam(ctx context.Context, teamID string, updateTeam *compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -1051,11 +1072,13 @@ func (s *Teams) DeleteTeam(ctx context.Context, teamID string, opts ...operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-team", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-team", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -1104,15 +1127,17 @@ func (s *Teams) DeleteTeam(ctx context.Context, teamID string, opts ...operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1129,7 +1154,7 @@ func (s *Teams) DeleteTeam(ctx context.Context, teamID string, opts ...operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1137,13 +1162,13 @@ func (s *Teams) DeleteTeam(ctx context.Context, teamID string, opts ...operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1156,17 +1181,17 @@ func (s *Teams) DeleteTeam(ctx context.Context, teamID string, opts ...operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/tests/mockserver/.gitignore b/tests/mockserver/.gitignore new file mode 100644 index 00000000..9544318b --- /dev/null +++ b/tests/mockserver/.gitignore @@ -0,0 +1 @@ +_debug diff --git a/tests/mockserver/Dockerfile b/tests/mockserver/Dockerfile new file mode 100644 index 00000000..efdea18c --- /dev/null +++ b/tests/mockserver/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.23 + +WORKDIR /usr/src/app + +COPY go.mod go.sum ./ +RUN go mod download && go mod verify +COPY . . +COPY *testdata /usr/local/bin/testdata +RUN go build -v -o /usr/local/bin/mockserver . +EXPOSE 18080 +ENTRYPOINT ["mockserver"] diff --git a/tests/mockserver/Makefile b/tests/mockserver/Makefile new file mode 100644 index 00000000..2ae6a36c --- /dev/null +++ b/tests/mockserver/Makefile @@ -0,0 +1,18 @@ +.PHONY: start + +start: + @if command -v docker >/dev/null 2>&1; then \ + echo "Starting mock server with Docker..."; \ + docker build -t mockserver . && \ + docker run -i -p 18080:18080 -t --rm mockserver; \ + elif command -v go >/dev/null 2>&1; then \ + echo "Docker not found. Starting mock server with Go..."; \ + go run .; \ + else \ + echo "Neither Docker nor Go found. To run the mock server:"; \ + echo "\nOption 1 - Using Docker:"; \ + echo " docker build -t mockserver ."; \ + echo " docker run -i -p 18080:18080 -t --rm mockserver"; \ + echo "\nOption 2 - Using Go:"; \ + echo " go run ."; \ + fi diff --git a/tests/mockserver/README.md b/tests/mockserver/README.md new file mode 100644 index 00000000..c8424fd3 --- /dev/null +++ b/tests/mockserver/README.md @@ -0,0 +1,52 @@ +# Mock Server + +A generated HTTP mock server based on your OpenAPI Specification (OAS). Use this mock server for integration and contract testing. + +## Usage + +The server can be built and started via the [Go programming language toolchain](https://go.dev/) or [Docker](https://www.docker.com/). + +If you have Go installed, start the server directly via: + +```shell +go run . +``` + +Otherwise, if you have Docker installed, build and run the server via: + +```shell +docker build -t mockserver . +docker run -i -p 18080:18080 -t --rm mockserver +``` + +By default, the server runs on port `18080`. + +### Server Paths + +The server contains generated paths from the OAS and the following additional built-in paths. + +| Path | Description | +|---|---| +| [`/_mockserver/health`](https://localhost:18080/_mockserver/health) | verify server is running | +| [`/_mockserver/log`](https://localhost:18080/_mockserver/log) | view per-OAS-operation logs | + +Any request outside the generated and built-in paths will return a `404 Not Found` response. + +### Server Customization + +The server supports the following flags for customization. + +| Flag | Default | Description | +|---|---|---| +| `-address` | `:18080` | server listen address | +| `-log-format` | `text` | logging format (supported: `JSON`, `text`) | +| `-log-level` | `INFO` | logging level (supported: `DEBUG`, `INFO`, `WARN`, `ERROR`) | + +For example, enabling server debug logging: + +```shell +# via `go run` +go run . -log-level=DEBUG +# via `docker run` +docker run -i -p 18080:18080 -t --rm mockserver -log-level=DEBUG +``` diff --git a/tests/mockserver/go.mod b/tests/mockserver/go.mod new file mode 100644 index 00000000..38b2d5e8 --- /dev/null +++ b/tests/mockserver/go.mod @@ -0,0 +1,15 @@ +module mockserver + +go 1.22 + +require ( + github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 + github.com/go-pkgz/expirable-cache/v3 v3.0.0 + github.com/gorilla/mux v1.8.1 +) + +require ( + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/stretchr/testify v1.9.0 // indirect +) diff --git a/tests/mockserver/go.sum b/tests/mockserver/go.sum new file mode 100644 index 00000000..fa86a5fc --- /dev/null +++ b/tests/mockserver/go.sum @@ -0,0 +1,16 @@ +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= +github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= +github.com/go-pkgz/expirable-cache/v3 v3.0.0 h1:u3/gcu3sabLYiTCevoRKv+WzjIn5oo7P8XtiXBeRDLw= +github.com/go-pkgz/expirable-cache/v3 v3.0.0/go.mod h1:2OQiDyEGQalYecLWmXprm3maPXeVb5/6/X7yRPYTzec= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tests/mockserver/internal/handler/assert/contenttype.go b/tests/mockserver/internal/handler/assert/contenttype.go new file mode 100644 index 00000000..42afbd06 --- /dev/null +++ b/tests/mockserver/internal/handler/assert/contenttype.go @@ -0,0 +1,99 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package assert + +import ( + "fmt" + "mime" + "net/http" + "strings" +) + +func ContentType(req *http.Request, expected string, isRequired bool) error { + got := req.Header.Get("Content-Type") + + if got == "" { + if isRequired { + return fmt.Errorf("expected Content-Type to be set, got: %s", got) + } + return nil + } + + mimeType, _, err := mime.ParseMediaType(got) + if err != nil { + return fmt.Errorf("got Content-Type %s is invalid: %w", got, err) + } + + expectedMimeType, _, err := mime.ParseMediaType(expected) + if err != nil { + return fmt.Errorf("expected Content-Type %s is invalid: %w", expected, err) + } + + if mimeType != expectedMimeType { + return fmt.Errorf( + "expected Content-Type to be %s, got: %s", + expected, + got, + ) + } + + return nil +} + +func AcceptHeader(req *http.Request, expectedValues []string) error { + if len(expectedValues) == 0 { + return nil + } + + gotAccept := req.Header.Get("Accept") + + gotValues := strings.Split(gotAccept, ",") + + for i, gotValue := range gotValues { + mimeType := strings.Split(strings.TrimSpace(gotValue), ";")[0] + + gotMimeType, _, err := mime.ParseMediaType(mimeType) + if err != nil { + return fmt.Errorf("got Accept value %s is invalid: %w", gotValue, err) + } + + gotValues[i] = gotMimeType + } + + allFound := true + + parsedExpectedValues := make([]string, len(expectedValues)) + + for i, expected := range expectedValues { + mimeType := strings.Split(expected, ";")[0] + + expectedMimeType, _, err := mime.ParseMediaType(mimeType) + if err != nil { + return fmt.Errorf("expected Accept value %s is invalid: %w", expected, err) + } + + parsedExpectedValues[i] = expectedMimeType + } + + for _, gotValue := range gotValues { + found := false + + for _, expected := range parsedExpectedValues { + if expected == gotValue { + found = true + break + } + } + + if !found { + allFound = false + break + } + } + + if !allFound { + return fmt.Errorf("expected Accept value to be one of %s, got: %s", strings.Join(parsedExpectedValues, ", "), gotAccept) + } + + return nil +} diff --git a/tests/mockserver/internal/handler/assert/header.go b/tests/mockserver/internal/handler/assert/header.go new file mode 100644 index 00000000..50f910d9 --- /dev/null +++ b/tests/mockserver/internal/handler/assert/header.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package assert + +import ( + "fmt" + "net/http" +) + +// HeaderExists generically verifies the given request header name exists with +// a single, non-empty value. If an unexpected value is found, it will return an +// error with a diagnostic text body and which should cause the handler to return +// immediately. +func HeaderExists(req *http.Request, name string) error { + values := req.Header.Values(name) + + if len(values) == 0 { + return fmt.Errorf("missing expected header %s", name) + } + + if len(values) > 1 { + return fmt.Errorf("expected single header for %s, got %d values", name, len(values)) + } + + got := values[0] + + if got == "" { + return fmt.Errorf("expected non-empty header %s", name) + } + + return nil +} + +// HeaderValues generically verifies the given request header name has the +// expected values. If an unexpected value is found, it will return an error +// with a diagnostic text body and which should cause the handler to return +// immediately. +func HeaderValues(req *http.Request, name string, expected []string) error { + got := req.Header.Values(name) + + if len(got) == 0 { + return fmt.Errorf( + "missing expected header %s which should be %v", + name, + expected, + ) + } + + if len(got) != len(expected) { + return fmt.Errorf( + "expected header %s to be %v, got: %v", + name, + expected, + got, + ) + } + + for index, expectedValue := range expected { + if got[index] != expectedValue { + return fmt.Errorf( + "expected header %s to be %v, got: %v", + name, + expected, + got, + ) + } + } + + return nil +} diff --git a/tests/mockserver/internal/handler/assert/parameter.go b/tests/mockserver/internal/handler/assert/parameter.go new file mode 100644 index 00000000..f8a5e45a --- /dev/null +++ b/tests/mockserver/internal/handler/assert/parameter.go @@ -0,0 +1,110 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package assert + +import ( + "fmt" + "net/http" + "net/url" +) + +// ParameterHeaderValues verifies the request header parameter key has the +// expected multiple values. If an unexpected value is found, it will return an +// error with a diagnostic text body and which should cause the handler to +// return immediately. +func ParameterHeaderValues(req *http.Request, key string, expected []string) error { + got := req.Header.Values(key) + + if len(got) == 0 { + return fmt.Errorf( + "missing expected header parameter %s which should be %v", + key, + expected, + ) + } + + if len(got) != len(expected) { + return fmt.Errorf( + "expected header parameter %s to be %s, got: %v", + key, + expected, + got, + ) + } + + for index, expectedValue := range expected { + if got[index] != expectedValue { + return fmt.Errorf( + "expected header parameter %s to be %v, got: %v", + key, + expected, + got, + ) + } + } + + return nil +} + +// ParameterPathValue verifies the request path parameter key has the expected +// value. If an unexpected value is found, it will return an error with +// a diagnostic text body and which should cause the handler to +// return immediately. +func ParameterPathValue(req *http.Request, key string, expected string) error { + got := req.PathValue(key) + + if got != expected { + return fmt.Errorf( + "expected path parameter %s to be %s, got: %s", + key, + expected, + got, + ) + } + + return nil +} + +// ParameterQueryValues verifies the request query parameter key has the +// expected multiple values. If an unexpected value is found, it will return an +// error with a diagnostic text body and which should cause the handler to +// return immediately. +func ParameterQueryValues(req *http.Request, key string, expected []string) error { + queryValues, err := url.ParseQuery(req.URL.RawQuery) + + if err != nil { + return fmt.Errorf("error parsing query parameters: %w", err) + } + + got, ok := queryValues[key] + + if !ok || len(got) == 0 { + return fmt.Errorf( + "missing expected query parameter %s which should be %v", + key, + expected, + ) + } + + if len(got) != len(expected) { + return fmt.Errorf( + "expected query parameter %s to be %s, got: %v", + key, + expected, + got, + ) + } + + for index, expectedValue := range expected { + if got[index] != expectedValue { + return fmt.Errorf( + "expected query parameter %s to be %v, got: %v", + key, + expected, + got, + ) + } + } + + return nil +} diff --git a/tests/mockserver/internal/handler/assert/pointer.go b/tests/mockserver/internal/handler/assert/pointer.go new file mode 100644 index 00000000..fa03e4c8 --- /dev/null +++ b/tests/mockserver/internal/handler/assert/pointer.go @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package assert + +// Pointer returns a pointer to the given value. +// +// This is intended to simplify inline builtin value expressions that are not +// implemented in the Go language specification, such as a hypothetical +// &"example". +func Pointer[T any](v T) *T { + return &v +} diff --git a/tests/mockserver/internal/handler/assert/security.go b/tests/mockserver/internal/handler/assert/security.go new file mode 100644 index 00000000..7d0a714a --- /dev/null +++ b/tests/mockserver/internal/handler/assert/security.go @@ -0,0 +1,75 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package assert + +import ( + "errors" + "fmt" + "net/http" + "strings" +) + +// SecurityAuthorizationHeader verifies the request security Authorization +// header is present and has the expected HTTP Authorization scheme with a value +// if required. If a missing value or multiple values are found, it will +// return an error with a diagnostic text body and which should cause the +// handler to return immediately. +func SecurityAuthorizationHeader(req *http.Request, optional bool, httpAuthorizationScheme string) error { + values := req.Header.Values("Authorization") + + if len(values) == 0 { + if optional { + return nil + } + + return errors.New("missing expected Authorization header") + } + + if len(values) > 1 { + return fmt.Errorf("expected single Authorization header, got %d values", len(values)) + } + + got := values[0] + + if got == "" { + // Should return error, even if optional, as that represents an errant + // client implementation. + return errors.New("expected non-empty Authorization header") + } + + if httpAuthorizationScheme != "" && !strings.HasPrefix(got, httpAuthorizationScheme+" ") { + return fmt.Errorf("expected HTTP Authorization scheme %s, got: %s", httpAuthorizationScheme, got) + } + + return nil +} + +// SecurityHeader verifies the request security header name is present and has +// a value if required. If a missing value or multiple values are found, it will +// return an error with a diagnostic text body and which should cause the +// handler to return immediately. +func SecurityHeader(req *http.Request, name string, optional bool) error { + values := req.Header.Values(name) + + if len(values) == 0 { + if optional { + return nil + } + + return fmt.Errorf("missing expected security header %s", name) + } + + if len(values) > 1 { + return fmt.Errorf("expected single security header for %s, got %d values", name, len(values)) + } + + got := values[0] + + if got == "" { + // Should return error, even if optional, as that represents an errant + // client implementation. + return fmt.Errorf("expected non-empty security header %s", name) + } + + return nil +} diff --git a/tests/mockserver/internal/handler/doc.go b/tests/mockserver/internal/handler/doc.go new file mode 100644 index 00000000..a4e60c89 --- /dev/null +++ b/tests/mockserver/internal/handler/doc.go @@ -0,0 +1,5 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +// Package handlers contains all generated HTTP handlers for the server. They +// are listed via the generated GeneratedHandlers() function. +package handler diff --git a/tests/mockserver/internal/handler/generated_handler.go b/tests/mockserver/internal/handler/generated_handler.go new file mode 100644 index 00000000..929558ef --- /dev/null +++ b/tests/mockserver/internal/handler/generated_handler.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "context" + "net/http" +) + +// GeneratedHandler is the type that encapsulates a generated handler. +type GeneratedHandler struct { + // HTTP request handler function. + handlerFunc http.HandlerFunc + + // HTTP method, such as GET. + Method string + + // URL path, such as /path. + Path string +} + +// NewGeneratedHandler creates a generated handler via method, path, and handler +// function. +func NewGeneratedHandler(ctx context.Context, method string, path string, handlerFunc http.HandlerFunc) *GeneratedHandler { + return &GeneratedHandler{ + handlerFunc: handlerFunc, + Method: method, + Path: path, + } +} + +// HandlerFunc returns the underlying HTTP handler function. +func (h GeneratedHandler) HandlerFunc() http.HandlerFunc { + return h.handlerFunc +} diff --git a/tests/mockserver/internal/handler/generated_handlers.go b/tests/mockserver/internal/handler/generated_handlers.go new file mode 100644 index 00000000..83390871 --- /dev/null +++ b/tests/mockserver/internal/handler/generated_handlers.go @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "context" + "mockserver/internal/logging" + "mockserver/internal/tracking" +) + +// GeneratedHandlers returns all generated handlers. +func GeneratedHandlers(ctx context.Context, dir *logging.HTTPFileDirectory, rt *tracking.RequestTracker) []*GeneratedHandler { + return []*GeneratedHandler{} +} diff --git a/tests/mockserver/internal/handler/values/files.go b/tests/mockserver/internal/handler/values/files.go new file mode 100644 index 00000000..6eca8858 --- /dev/null +++ b/tests/mockserver/internal/handler/values/files.go @@ -0,0 +1,40 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package values + +import ( + "io" + "os" +) + +func ReadFileToStream(fileName string) io.Reader { + s, err := os.Open(fileName) + if err != nil { + panic(err) + } + return s +} + +func ReadFileToBytes(fileName string) []byte { + data, err := os.ReadFile(fileName) + if err != nil { + panic(err) + } + return data +} + +func ReadFileToString(fileName string) string { + data, err := os.ReadFile(fileName) + if err != nil { + panic(err) + } + return string(data) +} + +func ReadBytes(r io.Reader) []byte { + data, err := io.ReadAll(r) + if err != nil { + panic(err) + } + return data +} diff --git a/tests/mockserver/internal/logging/doc.go b/tests/mockserver/internal/logging/doc.go new file mode 100644 index 00000000..8835f1cc --- /dev/null +++ b/tests/mockserver/internal/logging/doc.go @@ -0,0 +1,4 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +// Package logging contains the implementation and helpers for logging. +package logging diff --git a/tests/mockserver/internal/logging/formats.go b/tests/mockserver/internal/logging/formats.go new file mode 100644 index 00000000..d6ab53c8 --- /dev/null +++ b/tests/mockserver/internal/logging/formats.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import ( + "fmt" + "strings" +) + +const ( + // JSON log format. + FormatJSON = "JSON" + + // Plaintext log format. + FormatText = "text" + + // Default log format. + DefaultFormat = FormatText +) + +// Formats returns all supported formats. +func Formats() []string { + return []string{ + FormatJSON, + FormatText, + } +} + +func formatFromString(format string) (string, error) { + switch format { + case FormatJSON: + return format, nil + case FormatText: + return format, nil + default: + return "", fmt.Errorf("unsupported log format (%s), supported formats: %s", format, strings.Join(Formats(), ", ")) + } +} diff --git a/tests/mockserver/internal/logging/http_file.go b/tests/mockserver/internal/logging/http_file.go new file mode 100644 index 00000000..d690d915 --- /dev/null +++ b/tests/mockserver/internal/logging/http_file.go @@ -0,0 +1,310 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import ( + "bufio" + "bytes" + "errors" + "fmt" + "io/fs" + "log" + "net/http" + "net/http/httptest" + "net/http/httputil" + "os" + "path/filepath" + "strconv" + "strings" + "sync" +) + +const ( + // DefaultHTTPFileDirectory is the default directory used for raw HTTP + // request and response files. + DefaultHTTPFileDirectory = "_debug" +) + +// HTTPFileDirectory is the directory where raw HTTP request and response files +// are written. +type HTTPFileDirectory struct { + // Filesystem at path. + filesystem fs.FS + + // Mapping of operations to call count. Used to sequentially increment file + // names and return current count. + operationCalls map[string]int64 + + // Mutex to protect operationCalls. + operationCallsMutex *sync.RWMutex + + // Absolute path to directory. + path string +} + +// NewHTTPFileDirectory will create a HTTPFileDirectory which exists and is a +// directory or will return an error. +func NewHTTPFileDirectory(explicitPath string) (*HTTPFileDirectory, error) { + path, err := filepath.Abs(DefaultHTTPFileDirectory) + if err != nil { + return nil, fmt.Errorf("error getting absolute path of HTTP file directory (%s): %w", DefaultHTTPFileDirectory, err) + } + + if explicitPath != "" { + absExplicitPath, err := filepath.Abs(explicitPath) + if err != nil { + return nil, fmt.Errorf("error getting absolute path of HTTP file directory (%s): %w", explicitPath, err) + } + + path = absExplicitPath + } + + result := &HTTPFileDirectory{ + filesystem: os.DirFS(path), + operationCalls: make(map[string]int64), + operationCallsMutex: new(sync.RWMutex), + path: path, + } + + fileInfo, err := os.Stat(path) + + if errors.Is(err, os.ErrNotExist) { + err := os.Mkdir(path, 0o2777) + if err != nil { + return nil, fmt.Errorf("error making HTTP file directory (%s): %w", path, err) + } + + return result, nil + } + + if err != nil { + return nil, fmt.Errorf("error reading HTTP file directory (%s): %w", path, err) + } + + if !fileInfo.IsDir() { + return nil, fmt.Errorf("error using HTTP file directory (%s): not a directory", path) + } + + return result, nil +} + +// Clean will remove all files from HTTPFileDirectory. +func (d *HTTPFileDirectory) Clean() error { + walkDirFunc := func(path string, entry fs.DirEntry, err error) error { + if err != nil { + return fmt.Errorf("error walking %s: %w", d.path, err) + } + + if path == "." { + return nil + } + + if entry.IsDir() { + return fs.SkipDir + } + + absPath := filepath.Join(d.path, path) + + err = os.Remove(absPath) + if err != nil { + return fmt.Errorf("error removing %s: %w", absPath, err) + } + + return nil + } + + return fs.WalkDir(d.filesystem, ".", walkDirFunc) +} + +// HandlerFunc is a HTTP handler that automatically writes the raw HTTP +// request and response to {path}/{operationId}_{call}_request and +// {path}/{operationId}_{call}_response files respectively. +func (d *HTTPFileDirectory) HandlerFunc(operationId string, next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + call := d.nextOperationCall(operationId) + + dump, err := httputil.DumpRequest(req, true) + if err != nil { + log.Printf("error dumping HTTP request: %s", err) + } + + if len(dump) > 0 { + requestPath := filepath.Join(d.path, d.operationCallRequestFilename(operationId, call)) + + err = os.WriteFile(requestPath, dump, 0o644) + if err != nil { + log.Printf("error writing HTTP request file (%s): %s", requestPath, err) + } + } + + recorder := httptest.NewRecorder() + + next(recorder, req) + + dump, err = httputil.DumpResponse(recorder.Result(), true) + if err != nil { + log.Printf("error dumping HTTP response: %s", err) + } + + if len(dump) > 0 { + responsePath := filepath.Join(d.path, d.operationCallResponseFilename(operationId, call)) + err = os.WriteFile(responsePath, dump, 0o644) + if err != nil { + log.Printf("error writing HTTP response file (%s): %s", responsePath, err) + } + } + + recorderToWriter(recorder, w) + } +} + +// Operation will return a new OASOperation from HTTPFileDirectory. +func (d *HTTPFileDirectory) Operation(operationId string) (*OASOperation, error) { + request, err := d.Request(operationId, 1) + if err != nil { + return nil, err + } + + result := NewOASOperation(d, operationId, request.Method, request.URL.Path) + + return result, nil +} + +// Operations will return all detected OASOperation from HTTPFileDirectory. +func (d *HTTPFileDirectory) Operations() ([]*OASOperation, error) { + var result []*OASOperation + + walkDirFunc := func(path string, entry fs.DirEntry, err error) error { + if err != nil { + return fmt.Errorf("error walking %s: %w", d.path, err) + } + + if !strings.HasSuffix(path, "_1_request") { + return nil + } + + operationId := strings.TrimSuffix(path, "_1_request") + operation, err := d.Operation(operationId) + if err != nil { + return err + } + + result = append(result, operation) + + return nil + } + + err := fs.WalkDir(d.filesystem, ".", walkDirFunc) + + return result, err +} + +// OperationCallCount will return the number of detected calls for an +// OASOperation. +func (d *HTTPFileDirectory) OperationCallCount(operationId string) int64 { + d.operationCallsMutex.RLock() + defer d.operationCallsMutex.RUnlock() + + result, ok := d.operationCalls[operationId] + + if ok { + return result + } + + return 0 +} + +// RawRequest returns the raw HTTP request contents as dumped by +// [httputil.DumpRequest]. +func (d *HTTPFileDirectory) RawRequest(operationId string, call int64) ([]byte, error) { + filename := d.operationCallRequestFilename(operationId, call) + file, err := fs.ReadFile(d.filesystem, filename) + if err != nil { + return nil, fmt.Errorf("error reading HTTP request file (%s): %w", filename, err) + } + + return file, nil +} + +// RawResponse returns the raw HTTP response contents as dumped by +// [httputil.DumpResponse]. +func (d *HTTPFileDirectory) RawResponse(operationId string, call int64) ([]byte, error) { + filename := d.operationCallResponseFilename(operationId, call) + file, err := fs.ReadFile(d.filesystem, d.operationCallResponseFilename(operationId, call)) + if err != nil { + return nil, fmt.Errorf("error reading HTTP response file (%s): %w", filename, err) + } + + return file, nil +} + +// Request returns the parsed HTTP request contents. +func (d *HTTPFileDirectory) Request(operationId string, call int64) (*http.Request, error) { + rawRequest, err := d.RawRequest(operationId, call) + if err != nil { + return nil, err + } + + result, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(rawRequest))) + if err != nil { + return nil, fmt.Errorf("error converting HTTP request for operation %s call %d: %w", operationId, call, err) + } + + return result, nil +} + +// Response returns the parsed HTTP response contents. +func (d *HTTPFileDirectory) Response(operationId string, call int64) (*http.Response, error) { + rawResponse, err := d.RawResponse(operationId, call) + if err != nil { + return nil, err + } + + result, err := http.ReadResponse(bufio.NewReader(bytes.NewReader(rawResponse)), nil) + if err != nil { + return nil, fmt.Errorf("error converting HTTP response for operation %s call %d: %w", operationId, call, err) + } + + return result, nil +} + +// nextOperationCall returns the incremented call number for an operation. +func (d *HTTPFileDirectory) nextOperationCall(operationId string) int64 { + d.operationCallsMutex.Lock() + defer d.operationCallsMutex.Unlock() + + var result int64 + + priorCalls, ok := d.operationCalls[operationId] + + if ok { + result = priorCalls + 1 + } else { + // Start call counts at 1 for human consumption. + result = 1 + } + + d.operationCalls[operationId] = result + + return result +} + +// operationCallRequestFilename returns the raw HTTP request file name for the +// given operation and call. +func (d *HTTPFileDirectory) operationCallRequestFilename(operationId string, call int64) string { + return sanitizeOperationIdForFilename(operationId) + "_" + strconv.FormatInt(call, 10) + "_request" +} + +// operationCallResponseFilename returns the raw HTTP response file name for the +// given operation and call. +func (d *HTTPFileDirectory) operationCallResponseFilename(operationId string, call int64) string { + return sanitizeOperationIdForFilename(operationId) + "_" + strconv.FormatInt(call, 10) + "_response" +} + +func sanitizeOperationIdForFilename(operationId string) string { + operationId = strings.ReplaceAll(operationId, "{", "_") + operationId = strings.ReplaceAll(operationId, "}", "_") + operationId = strings.ReplaceAll(operationId, "/", "_") + operationId = strings.ReplaceAll(operationId, " ", "_") + return operationId +} diff --git a/tests/mockserver/internal/logging/http_logger.go b/tests/mockserver/internal/logging/http_logger.go new file mode 100644 index 00000000..fdd5d058 --- /dev/null +++ b/tests/mockserver/internal/logging/http_logger.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import ( + "context" + "fmt" + "log/slog" + "net/http" + "net/http/httptest" + "net/http/httputil" +) + +// HTTPLoggerHandler wraps another [http.Handler] with logging output using the +// provided logger. +func HTTPLoggerHandler(logger *slog.Logger, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + httpLogger := logger.WithGroup("http") + recorder := httptest.NewRecorder() + reqAttr := slog.Group( + "request", + slog.String("method", req.Method), + slog.String("url", req.URL.RequestURI()), + ) + + if !logger.Enabled(context.Background(), slog.LevelDebug) { + httpLogger.With(reqAttr).Info("received request") + next.ServeHTTP(recorder, req) + + resp := recorder.Result() + respAttr := slog.Group( + "response", + slog.String("status", resp.Status), + ) + + httpLogger.With(reqAttr).With(respAttr).Info("serving response") + + recorderToWriter(recorder, w) + + return + } + + dump, err := httputil.DumpRequest(req, true) + + if err != nil { + http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) + + return + } + + rawReqAttr := slog.Group( + "request", + slog.String("method", req.Method), + slog.String("url", req.URL.RequestURI()), + slog.String("raw", string(dump)), + ) + + httpLogger.With(rawReqAttr).Debug("received request") + + next.ServeHTTP(recorder, req) + + dump, err = httputil.DumpResponse(recorder.Result(), true) + + if err != nil { + http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) + + return + } + + rawRespAttr := slog.Group( + "response", + slog.String("raw", string(dump)), + ) + + // Intentionally use simpler request log attributes + httpLogger.With(reqAttr).With(rawRespAttr).Debug("serving response") + + recorderToWriter(recorder, w) + }) +} + +// recorderToWriter copies the recorded response back to the writer. +func recorderToWriter(recorder *httptest.ResponseRecorder, w http.ResponseWriter) { + for k, v := range recorder.Result().Header { + w.Header()[k] = v + } + + w.WriteHeader(recorder.Code) + _, _ = recorder.Body.WriteTo(w) +} diff --git a/tests/mockserver/internal/logging/levels.go b/tests/mockserver/internal/logging/levels.go new file mode 100644 index 00000000..d2a8e93c --- /dev/null +++ b/tests/mockserver/internal/logging/levels.go @@ -0,0 +1,55 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import ( + "fmt" + "log/slog" + "strings" +) + +const ( + // Debug log level. + LevelDebug = "DEBUG" + + // Info log level. + LevelInfo = "INFO" + + // Warning log level. + LevelWarn = "WARN" + + // Error log level. + LevelError = "ERROR" + + // Default log level. + DefaultLevel = LevelInfo +) + +// Levels returns all supported levels. +func Levels() []string { + return []string{ + LevelDebug, + LevelInfo, + LevelWarn, + LevelError, + } +} + +func levelFromString(level string) (*slog.LevelVar, error) { + result := new(slog.LevelVar) + + switch strings.ToUpper(level) { + case "DEBUG": + result.Set(slog.LevelDebug) + case "INFO": + result.Set(slog.LevelInfo) + case "WARN": + result.Set(slog.LevelWarn) + case "ERROR": + result.Set(slog.LevelError) + default: + return nil, fmt.Errorf("unsupported log level (%s), supported levels: %s", level, strings.Join(Levels(), ", ")) + } + + return result, nil +} diff --git a/tests/mockserver/internal/logging/logger.go b/tests/mockserver/internal/logging/logger.go new file mode 100644 index 00000000..bfd6dc78 --- /dev/null +++ b/tests/mockserver/internal/logging/logger.go @@ -0,0 +1,40 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import ( + "fmt" + "io" + "log/slog" +) + +func NewLogger(w io.Writer, formatStr string, levelStr string) (*slog.Logger, error) { + level, err := levelFromString(levelStr) + + if err != nil { + return nil, err + } + + format, err := formatFromString(formatStr) + + if err != nil { + return nil, err + } + + handlerOpts := &slog.HandlerOptions{ + Level: level, + } + + var handler slog.Handler + + switch format { + case FormatJSON: + handler = slog.NewJSONHandler(w, handlerOpts) + case FormatText: + handler = slog.NewTextHandler(w, handlerOpts) + default: + return nil, fmt.Errorf("unimplemented format: %s", format) + } + + return slog.New(handler), nil +} diff --git a/tests/mockserver/internal/logging/oas_operation.go b/tests/mockserver/internal/logging/oas_operation.go new file mode 100644 index 00000000..d4f2af7b --- /dev/null +++ b/tests/mockserver/internal/logging/oas_operation.go @@ -0,0 +1,87 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import "net/http" + +// OASOperation contains a singular OAS operation. An operation can have one or +// more calls. +type OASOperation struct { + // Underlying HTTP calls for the operation. + calls []*OASOperationCall + + // Directory that contains HTTP request and response logs. + dir *HTTPFileDirectory + + // Operation identifier as defined in OAS. + id string + + // HTTP method for the operation, such as GET. + method string + + // URL path for the operation, such as /path. + path string + + // TODO: Add group +} + +// NewOASOperation creates a new OASOperation. +func NewOASOperation(dir *HTTPFileDirectory, operationId string, method string, path string) *OASOperation { + operationCalls := dir.OperationCallCount(operationId) + result := &OASOperation{ + calls: make([]*OASOperationCall, 0, operationCalls), + dir: dir, + id: operationId, + method: method, + path: path, + } + + for i := range operationCalls { + // Start at 1 for human consumption. + result.calls = append(result.calls, NewOASOperationCall(result, i+1)) + } + + return result +} + +// CallCount returns the number of calls to an operation. +func (o *OASOperation) CallCount() int64 { + return int64(len(o.calls)) +} + +// Id returns the operation identifier as defined in OAS. +func (o *OASOperation) Id() string { + return o.id +} + +// Method returns the HTTP method for the operation, such as GET. +func (o *OASOperation) Method() string { + return o.method +} + +// Path returns the URL path for the operation, such as /path. +func (o *OASOperation) Path() string { + return o.path +} + +// RawRequest returns the raw HTTP request contents as dumped by +// [httputil.DumpRequest]. +func (o *OASOperation) RawRequest(call int64) ([]byte, error) { + return o.dir.RawRequest(o.id, call) +} + +// RawResponse returns the raw HTTP response contents as dumped by +// [httputil.DumpResponse]. +func (o *OASOperation) RawResponse(call int64) ([]byte, error) { + return o.dir.RawResponse(o.id, call) +} + +// Request returns the parsed HTTP request contents. +func (o *OASOperation) Request(call int64) (*http.Request, error) { + return o.dir.Request(o.id, call) +} + +// Response returns the parsed HTTP response contents. +func (o *OASOperation) Response(call int64) (*http.Response, error) { + return o.dir.Response(o.id, call) +} diff --git a/tests/mockserver/internal/logging/oas_operation_call.go b/tests/mockserver/internal/logging/oas_operation_call.go new file mode 100644 index 00000000..beb05908 --- /dev/null +++ b/tests/mockserver/internal/logging/oas_operation_call.go @@ -0,0 +1,123 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package logging + +import ( + "bufio" + "bytes" + "net/http" +) + +// OASOperationCall contains a singular OAS operation HTTP call. +type OASOperationCall struct { + // The HTTP call number, as determined by the HTTP server. Starts at 1 and + // incremented. + call int64 + + // The associated OAS operation to this call. + operation *OASOperation + + // Parsed HTTP request contents. Cached on first use. + request *http.Request + + // Raw HTTP request contents. Cached on first use. + requestRaw []byte + + // Parsed HTTP response contents. Cached on first use. + response *http.Response + + // Raw HTTP response contents. Cached on first use. + responseRaw []byte + + // TODO: Add test identifier +} + +// NewOASOperationCall creates a new OASOperationCall. +func NewOASOperationCall(operation *OASOperation, call int64) *OASOperationCall { + return &OASOperationCall{ + call: call, + operation: operation, + } +} + +// RawRequest returns the raw HTTP request contents as dumped by +// [httputil.DumpRequest]. +func (c *OASOperationCall) RawRequest() ([]byte, error) { + if c.requestRaw != nil { + return c.requestRaw, nil + } + + requestRaw, err := c.operation.RawRequest(c.call) + + if err != nil { + return nil, err + } + + c.requestRaw = requestRaw + + return c.requestRaw, nil +} + +// RawResponse returns the raw HTTP response contents as dumped by +// [httputil.DumpResponse]. +func (c *OASOperationCall) RawResponse() ([]byte, error) { + if c.responseRaw != nil { + return c.responseRaw, nil + } + + responseRaw, err := c.operation.RawResponse(c.call) + + if err != nil { + return nil, err + } + + c.responseRaw = responseRaw + + return c.responseRaw, nil +} + +// Request returns the parsed HTTP request contents. +func (c *OASOperationCall) Request() (*http.Request, error) { + if c.request != nil { + return c.request, nil + } + + requestRaw, err := c.RawRequest() + + if err != nil { + return nil, err + } + + request, err := http.ReadRequest(bufio.NewReader(bytes.NewReader(requestRaw))) + + if err != nil { + return nil, err + } + + c.request = request + + return c.request, nil +} + +// Response returns the parsed HTTP response contents. +func (c *OASOperationCall) Response() (*http.Response, error) { + if c.response != nil { + return c.response, nil + } + + responseRaw, err := c.RawResponse() + + if err != nil { + return nil, err + } + + response, err := http.ReadResponse(bufio.NewReader(bytes.NewReader(responseRaw)), nil) + + if err != nil { + return nil, err + } + + c.response = response + + return c.response, nil +} diff --git a/tests/mockserver/internal/sdk/models/components/acl.go b/tests/mockserver/internal/sdk/models/components/acl.go new file mode 100644 index 00000000..1745346c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/acl.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ACLConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *ACLConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type ACL struct { + Consumer *ACLConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + Group string `json:"group"` + ID *string `json:"id,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +func (o *ACL) GetConsumer() *ACLConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *ACL) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ACL) GetGroup() string { + if o == nil { + return "" + } + return o.Group +} + +func (o *ACL) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ACL) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} diff --git a/tests/mockserver/internal/sdk/models/components/aclwithoutparents.go b/tests/mockserver/internal/sdk/models/components/aclwithoutparents.go new file mode 100644 index 00000000..c39aa91f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/aclwithoutparents.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ACLWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *ACLWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type ACLWithoutParents struct { + Consumer *ACLWithoutParentsConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + Group string `json:"group"` + ID *string `json:"id,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +func (o *ACLWithoutParents) GetConsumer() *ACLWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *ACLWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ACLWithoutParents) GetGroup() string { + if o == nil { + return "" + } + return o.Group +} + +func (o *ACLWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ACLWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} diff --git a/tests/mockserver/internal/sdk/models/components/addsystemaccounttoteam.go b/tests/mockserver/internal/sdk/models/components/addsystemaccounttoteam.go new file mode 100644 index 00000000..e4dc9227 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/addsystemaccounttoteam.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// AddSystemAccountToTeam - The request schema for adding a system account to a team. +type AddSystemAccountToTeam struct { + // ID of the system account. + AccountID *string `json:"id,omitempty"` +} + +func (o *AddSystemAccountToTeam) GetAccountID() *string { + if o == nil { + return nil + } + return o.AccountID +} diff --git a/tests/mockserver/internal/sdk/models/components/addusertoteam.go b/tests/mockserver/internal/sdk/models/components/addusertoteam.go new file mode 100644 index 00000000..6cf726ed --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/addusertoteam.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// AddUserToTeam - The request schema for adding a user to a team. +type AddUserToTeam struct { + // The user ID for the user being added to a team. + UserID string `json:"id"` +} + +func (o *AddUserToTeam) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} diff --git a/tests/mockserver/internal/sdk/models/components/apiaccess.go b/tests/mockserver/internal/sdk/models/components/apiaccess.go new file mode 100644 index 00000000..3346bb9f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/apiaccess.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// APIAccess - Type of API access data-plane groups will support for a configuration. +type APIAccess string + +const ( + APIAccessPrivate APIAccess = "private" + APIAccessPublic APIAccess = "public" + APIAccessPrivatePlusPublic APIAccess = "private+public" +) + +func (e APIAccess) ToPointer() *APIAccess { + return &e +} +func (e *APIAccess) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "private": + fallthrough + case "public": + fallthrough + case "private+public": + *e = APIAccess(v) + return nil + default: + return fmt.Errorf("invalid value for APIAccess: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/appauthstrategy.go b/tests/mockserver/internal/sdk/models/components/appauthstrategy.go new file mode 100644 index 00000000..f3d6716a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/appauthstrategy.go @@ -0,0 +1,470 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +type AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType string + +const ( + AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyTypeOpenidConnect AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType = "openid_connect" +) + +func (e AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType) ToPointer() *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType { + return &e +} +func (e *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "openid_connect": + *e = AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType(v) + return nil + default: + return fmt.Errorf("invalid value for AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType: %v", v) + } +} + +// AppAuthStrategyAppAuthStrategyOpenIDConnectResponseConfigs - JSON-B object containing the configuration for the OIDC strategy +type AppAuthStrategyAppAuthStrategyOpenIDConnectResponseConfigs struct { + // A more advanced mode to configure an API Product Version’s Application Auth Strategy. + // Using this mode will allow developers to use API credentials issued from an external IdP that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for the same Auth Strategy. + // An OIDC strategy may be used in conjunction with a DCR provider to automatically create the IdP application. + // + OpenidConnect AppAuthStrategyConfigOpenIDConnect `json:"openid-connect"` +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseConfigs) GetOpenidConnect() AppAuthStrategyConfigOpenIDConnect { + if o == nil { + return AppAuthStrategyConfigOpenIDConnect{} + } + return o.OpenidConnect +} + +type AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType DcrProviderType `json:"provider_type"` +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider) GetProviderType() DcrProviderType { + if o == nil { + return DcrProviderType("") + } + return o.ProviderType +} + +// AppAuthStrategyAppAuthStrategyOpenIDConnectResponse - Response payload from creating an OIDC Application Auth Strategy +type AppAuthStrategyAppAuthStrategyOpenIDConnectResponse struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name string `json:"name"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName string `json:"display_name"` + StrategyType AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType `json:"strategy_type"` + // JSON-B object containing the configuration for the OIDC strategy + Configs AppAuthStrategyAppAuthStrategyOpenIDConnectResponseConfigs `json:"configs"` + // At least one published product version is using this auth strategy. + Active bool `json:"active"` + DcrProvider *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider `json:"dcr_provider"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (a AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetStrategyType() AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType { + if o == nil { + return AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType("") + } + return o.StrategyType +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetConfigs() AppAuthStrategyAppAuthStrategyOpenIDConnectResponseConfigs { + if o == nil { + return AppAuthStrategyAppAuthStrategyOpenIDConnectResponseConfigs{} + } + return o.Configs +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetDcrProvider() *AppAuthStrategyAppAuthStrategyOpenIDConnectResponseDcrProvider { + if o == nil { + return nil + } + return o.DcrProvider +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetLabels() map[string]string { + if o == nil { + return map[string]string{} + } + return o.Labels +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +type AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType string + +const ( + AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyTypeKeyAuth AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType = "key_auth" +) + +func (e AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType) ToPointer() *AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType { + return &e +} +func (e *AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "key_auth": + *e = AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType(v) + return nil + default: + return fmt.Errorf("invalid value for AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType: %v", v) + } +} + +// AppAuthStrategyAppAuthStrategyKeyAuthResponseConfigs - JSON-B object containing the configuration for the Key Auth strategy +type AppAuthStrategyAppAuthStrategyKeyAuthResponseConfigs struct { + // The most basic mode to configure an Application Auth Strategy for an API Product Version. + // Using this mode will allow developers to generate API keys that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for Key Auth. + // + KeyAuth AppAuthStrategyConfigKeyAuth `json:"key-auth"` +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponseConfigs) GetKeyAuth() AppAuthStrategyConfigKeyAuth { + if o == nil { + return AppAuthStrategyConfigKeyAuth{} + } + return o.KeyAuth +} + +type AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType DcrProviderType `json:"provider_type"` +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider) GetProviderType() DcrProviderType { + if o == nil { + return DcrProviderType("") + } + return o.ProviderType +} + +// AppAuthStrategyAppAuthStrategyKeyAuthResponse - Response payload from creating or updating a Key Auth Application Auth Strategy +type AppAuthStrategyAppAuthStrategyKeyAuthResponse struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name string `json:"name"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName string `json:"display_name"` + StrategyType AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType `json:"strategy_type"` + // JSON-B object containing the configuration for the Key Auth strategy + Configs AppAuthStrategyAppAuthStrategyKeyAuthResponseConfigs `json:"configs"` + // At least one published product version is using this auth strategy. + Active bool `json:"active"` + DcrProvider *AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider `json:"dcr_provider"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (a AppAuthStrategyAppAuthStrategyKeyAuthResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AppAuthStrategyAppAuthStrategyKeyAuthResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetStrategyType() AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType { + if o == nil { + return AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType("") + } + return o.StrategyType +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetConfigs() AppAuthStrategyAppAuthStrategyKeyAuthResponseConfigs { + if o == nil { + return AppAuthStrategyAppAuthStrategyKeyAuthResponseConfigs{} + } + return o.Configs +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetDcrProvider() *AppAuthStrategyAppAuthStrategyKeyAuthResponseDcrProvider { + if o == nil { + return nil + } + return o.DcrProvider +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetLabels() map[string]string { + if o == nil { + return map[string]string{} + } + return o.Labels +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *AppAuthStrategyAppAuthStrategyKeyAuthResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +type AppAuthStrategyType string + +const ( + AppAuthStrategyTypeKeyAuth AppAuthStrategyType = "key_auth" + AppAuthStrategyTypeOpenidConnect AppAuthStrategyType = "openid_connect" +) + +// AppAuthStrategy - A set of plugin configurations that represent how the gateway will perform authentication and authorization for a Product Version. Called “Auth Strategy” for short in the context of portals/applications. The plugins are synced to any Gateway Service that is currently linked or becomes linked to the Product Version. +type AppAuthStrategy struct { + AppAuthStrategyAppAuthStrategyKeyAuthResponse *AppAuthStrategyAppAuthStrategyKeyAuthResponse `queryParam:"inline"` + AppAuthStrategyAppAuthStrategyOpenIDConnectResponse *AppAuthStrategyAppAuthStrategyOpenIDConnectResponse `queryParam:"inline"` + + Type AppAuthStrategyType +} + +func CreateAppAuthStrategyKeyAuth(keyAuth AppAuthStrategyAppAuthStrategyKeyAuthResponse) AppAuthStrategy { + typ := AppAuthStrategyTypeKeyAuth + + typStr := AppAuthStrategyAppAuthStrategyKeyAuthResponseStrategyType(typ) + keyAuth.StrategyType = typStr + + return AppAuthStrategy{ + AppAuthStrategyAppAuthStrategyKeyAuthResponse: &keyAuth, + Type: typ, + } +} + +func CreateAppAuthStrategyOpenidConnect(openidConnect AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) AppAuthStrategy { + typ := AppAuthStrategyTypeOpenidConnect + + typStr := AppAuthStrategyAppAuthStrategyOpenIDConnectResponseStrategyType(typ) + openidConnect.StrategyType = typStr + + return AppAuthStrategy{ + AppAuthStrategyAppAuthStrategyOpenIDConnectResponse: &openidConnect, + Type: typ, + } +} + +func (u *AppAuthStrategy) UnmarshalJSON(data []byte) error { + + type discriminator struct { + StrategyType string `json:"strategy_type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.StrategyType { + case "key_auth": + appAuthStrategyAppAuthStrategyKeyAuthResponse := new(AppAuthStrategyAppAuthStrategyKeyAuthResponse) + if err := utils.UnmarshalJSON(data, &appAuthStrategyAppAuthStrategyKeyAuthResponse, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (StrategyType == key_auth) type AppAuthStrategyAppAuthStrategyKeyAuthResponse within AppAuthStrategy: %w", string(data), err) + } + + u.AppAuthStrategyAppAuthStrategyKeyAuthResponse = appAuthStrategyAppAuthStrategyKeyAuthResponse + u.Type = AppAuthStrategyTypeKeyAuth + return nil + case "openid_connect": + appAuthStrategyAppAuthStrategyOpenIDConnectResponse := new(AppAuthStrategyAppAuthStrategyOpenIDConnectResponse) + if err := utils.UnmarshalJSON(data, &appAuthStrategyAppAuthStrategyOpenIDConnectResponse, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (StrategyType == openid_connect) type AppAuthStrategyAppAuthStrategyOpenIDConnectResponse within AppAuthStrategy: %w", string(data), err) + } + + u.AppAuthStrategyAppAuthStrategyOpenIDConnectResponse = appAuthStrategyAppAuthStrategyOpenIDConnectResponse + u.Type = AppAuthStrategyTypeOpenidConnect + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for AppAuthStrategy", string(data)) +} + +func (u AppAuthStrategy) MarshalJSON() ([]byte, error) { + if u.AppAuthStrategyAppAuthStrategyKeyAuthResponse != nil { + return utils.MarshalJSON(u.AppAuthStrategyAppAuthStrategyKeyAuthResponse, "", true) + } + + if u.AppAuthStrategyAppAuthStrategyOpenIDConnectResponse != nil { + return utils.MarshalJSON(u.AppAuthStrategyAppAuthStrategyOpenIDConnectResponse, "", true) + } + + return nil, errors.New("could not marshal union type AppAuthStrategy: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/appauthstrategyconfigkeyauth.go b/tests/mockserver/internal/sdk/models/components/appauthstrategyconfigkeyauth.go new file mode 100644 index 00000000..56afdc46 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/appauthstrategyconfigkeyauth.go @@ -0,0 +1,18 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// AppAuthStrategyConfigKeyAuth - The most basic mode to configure an Application Auth Strategy for an API Product Version. +// Using this mode will allow developers to generate API keys that will authenticate their application requests. +// Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for Key Auth. +type AppAuthStrategyConfigKeyAuth struct { + // The names of the headers containing the API key. You can specify multiple header names. + KeyNames []string `json:"key_names,omitempty"` +} + +func (o *AppAuthStrategyConfigKeyAuth) GetKeyNames() []string { + if o == nil { + return nil + } + return o.KeyNames +} diff --git a/tests/mockserver/internal/sdk/models/components/appauthstrategyconfigopenidconnect.go b/tests/mockserver/internal/sdk/models/components/appauthstrategyconfigopenidconnect.go new file mode 100644 index 00000000..8613e053 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/appauthstrategyconfigopenidconnect.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" +) + +// AppAuthStrategyConfigOpenIDConnect - A more advanced mode to configure an API Product Version’s Application Auth Strategy. +// Using this mode will allow developers to use API credentials issued from an external IdP that will authenticate their application requests. +// Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for the same Auth Strategy. +// An OIDC strategy may be used in conjunction with a DCR provider to automatically create the IdP application. +type AppAuthStrategyConfigOpenIDConnect struct { + Issuer string `json:"issuer"` + CredentialClaim []string `json:"credential_claim"` + Scopes []string `json:"scopes"` + AuthMethods []string `json:"auth_methods"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + AdditionalProperties map[string]any `additionalProperties:"true" json:"-"` +} + +func (a AppAuthStrategyConfigOpenIDConnect) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AppAuthStrategyConfigOpenIDConnect) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AppAuthStrategyConfigOpenIDConnect) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *AppAuthStrategyConfigOpenIDConnect) GetCredentialClaim() []string { + if o == nil { + return []string{} + } + return o.CredentialClaim +} + +func (o *AppAuthStrategyConfigOpenIDConnect) GetScopes() []string { + if o == nil { + return []string{} + } + return o.Scopes +} + +func (o *AppAuthStrategyConfigOpenIDConnect) GetAuthMethods() []string { + if o == nil { + return []string{} + } + return o.AuthMethods +} + +func (o *AppAuthStrategyConfigOpenIDConnect) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *AppAuthStrategyConfigOpenIDConnect) GetAdditionalProperties() map[string]any { + if o == nil { + return nil + } + return o.AdditionalProperties +} diff --git a/tests/mockserver/internal/sdk/models/components/assignedrole.go b/tests/mockserver/internal/sdk/models/components/assignedrole.go new file mode 100644 index 00000000..60eab47f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/assignedrole.go @@ -0,0 +1,96 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// AssignedRoleEntityRegion - Region of the entity. +type AssignedRoleEntityRegion string + +const ( + AssignedRoleEntityRegionUs AssignedRoleEntityRegion = "us" + AssignedRoleEntityRegionEu AssignedRoleEntityRegion = "eu" + AssignedRoleEntityRegionAu AssignedRoleEntityRegion = "au" + AssignedRoleEntityRegionMe AssignedRoleEntityRegion = "me" + AssignedRoleEntityRegionIn AssignedRoleEntityRegion = "in" + AssignedRoleEntityRegionWildcard AssignedRoleEntityRegion = "*" +) + +func (e AssignedRoleEntityRegion) ToPointer() *AssignedRoleEntityRegion { + return &e +} +func (e *AssignedRoleEntityRegion) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "us": + fallthrough + case "eu": + fallthrough + case "au": + fallthrough + case "me": + fallthrough + case "in": + fallthrough + case "*": + *e = AssignedRoleEntityRegion(v) + return nil + default: + return fmt.Errorf("invalid value for AssignedRoleEntityRegion: %v", v) + } +} + +// AssignedRole - An assigned role is a role that has been assigned to a user or team. +type AssignedRole struct { + // The ID of the role assignment. + ID *string `json:"id,omitempty"` + // Name of the role being assigned. + RoleName *string `json:"role_name,omitempty"` + // A RBAC entity ID. + EntityID *string `json:"entity_id,omitempty"` + // Name of the entity type the role is being assigned to. + EntityTypeName *string `json:"entity_type_name,omitempty"` + // Region of the entity. + EntityRegion *AssignedRoleEntityRegion `json:"entity_region,omitempty"` +} + +func (o *AssignedRole) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AssignedRole) GetRoleName() *string { + if o == nil { + return nil + } + return o.RoleName +} + +func (o *AssignedRole) GetEntityID() *string { + if o == nil { + return nil + } + return o.EntityID +} + +func (o *AssignedRole) GetEntityTypeName() *string { + if o == nil { + return nil + } + return o.EntityTypeName +} + +func (o *AssignedRole) GetEntityRegion() *AssignedRoleEntityRegion { + if o == nil { + return nil + } + return o.EntityRegion +} diff --git a/tests/mockserver/internal/sdk/models/components/assignedrolecollection.go b/tests/mockserver/internal/sdk/models/components/assignedrolecollection.go new file mode 100644 index 00000000..f2d1897b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/assignedrolecollection.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// AssignedRoleCollection - A paginated list response for a collection of assigned roles. +type AssignedRoleCollection struct { + // returns the pagination information + Meta *PaginatedMeta `json:"meta,omitempty"` + // An Array + Data []AssignedRole `json:"data,omitempty"` +} + +func (o *AssignedRoleCollection) GetMeta() *PaginatedMeta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *AssignedRoleCollection) GetData() []AssignedRole { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/assignrole.go b/tests/mockserver/internal/sdk/models/components/assignrole.go new file mode 100644 index 00000000..5b42e6d3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/assignrole.go @@ -0,0 +1,258 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// RoleName - The desired role. +type RoleName string + +const ( + RoleNameAdmin RoleName = "Admin" + RoleNameAppearanceMaintainer RoleName = "Appearance Maintainer" + RoleNameApplicationRegistration RoleName = "Application Registration" + RoleNameCertificateAdmin RoleName = "Certificate Admin" + RoleNameCloudGatewayClusterAdmin RoleName = "Cloud Gateway Cluster Admin" + RoleNameCloudGatewayClusterViewer RoleName = "Cloud Gateway Cluster Viewer" + RoleNameConsumerAdmin RoleName = "Consumer Admin" + RoleNameConnector RoleName = "Connector" + RoleNameCreator RoleName = "Creator" + RoleNameDeployer RoleName = "Deployer" + RoleNameDiscoveryAdmin RoleName = "Discovery Admin" + RoleNameDiscoveryViewer RoleName = "Discovery Viewer" + RoleNameGatewayServiceAdmin RoleName = "Gateway Service Admin" + RoleNameIntegrationAdmin RoleName = "Integration Admin" + RoleNameIntegrationViewer RoleName = "Integration Viewer" + RoleNameKeyAdmin RoleName = "Key Admin" + RoleNameMaintainer RoleName = "Maintainer" + RoleNameNetworkAdmin RoleName = "Network Admin" + RoleNameNetworkCreator RoleName = "Network Creator" + RoleNameNetworkViewer RoleName = "Network Viewer" + RoleNamePluginAdmin RoleName = "Plugin Admin" + RoleNamePluginsAdmin RoleName = "Plugins Admin" + RoleNameProductPublisher RoleName = "Product Publisher" + RoleNamePublisher RoleName = "Publisher" + RoleNameRouteAdmin RoleName = "Route Admin" + RoleNameSniAdmin RoleName = "SNI Admin" + RoleNameServiceAdmin RoleName = "Service Admin" + RoleNameServiceCreator RoleName = "Service Creator" + RoleNameServiceViewer RoleName = "Service Viewer" + RoleNameUpstreamAdmin RoleName = "Upstream Admin" + RoleNameVaultAdmin RoleName = "Vault Admin" + RoleNameViewer RoleName = "Viewer" +) + +func (e RoleName) ToPointer() *RoleName { + return &e +} +func (e *RoleName) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Admin": + fallthrough + case "Appearance Maintainer": + fallthrough + case "Application Registration": + fallthrough + case "Certificate Admin": + fallthrough + case "Cloud Gateway Cluster Admin": + fallthrough + case "Cloud Gateway Cluster Viewer": + fallthrough + case "Consumer Admin": + fallthrough + case "Connector": + fallthrough + case "Creator": + fallthrough + case "Deployer": + fallthrough + case "Discovery Admin": + fallthrough + case "Discovery Viewer": + fallthrough + case "Gateway Service Admin": + fallthrough + case "Integration Admin": + fallthrough + case "Integration Viewer": + fallthrough + case "Key Admin": + fallthrough + case "Maintainer": + fallthrough + case "Network Admin": + fallthrough + case "Network Creator": + fallthrough + case "Network Viewer": + fallthrough + case "Plugin Admin": + fallthrough + case "Plugins Admin": + fallthrough + case "Product Publisher": + fallthrough + case "Publisher": + fallthrough + case "Route Admin": + fallthrough + case "SNI Admin": + fallthrough + case "Service Admin": + fallthrough + case "Service Creator": + fallthrough + case "Service Viewer": + fallthrough + case "Upstream Admin": + fallthrough + case "Vault Admin": + fallthrough + case "Viewer": + *e = RoleName(v) + return nil + default: + return fmt.Errorf("invalid value for RoleName: %v", v) + } +} + +// EntityTypeName - The type of entity. +type EntityTypeName string + +const ( + EntityTypeNameApIs EntityTypeName = "APIs" + EntityTypeNameAPIProducts EntityTypeName = "API Products" + EntityTypeNameApplicationAuthStrategies EntityTypeName = "Application Auth Strategies" + EntityTypeNameAuditLogs EntityTypeName = "Audit Logs" + EntityTypeNameControlPlanes EntityTypeName = "Control Planes" + EntityTypeNameDcrProviders EntityTypeName = "DCR Providers" + EntityTypeNameIdentity EntityTypeName = "Identity" + EntityTypeNameMeshControlPlanes EntityTypeName = "Mesh Control Planes" + EntityTypeNameNetworks EntityTypeName = "Networks" + EntityTypeNamePortals EntityTypeName = "Portals" + EntityTypeNameServiceHub EntityTypeName = "Service Hub" +) + +func (e EntityTypeName) ToPointer() *EntityTypeName { + return &e +} +func (e *EntityTypeName) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "APIs": + fallthrough + case "API Products": + fallthrough + case "Application Auth Strategies": + fallthrough + case "Audit Logs": + fallthrough + case "Control Planes": + fallthrough + case "DCR Providers": + fallthrough + case "Identity": + fallthrough + case "Mesh Control Planes": + fallthrough + case "Networks": + fallthrough + case "Portals": + fallthrough + case "Service Hub": + *e = EntityTypeName(v) + return nil + default: + return fmt.Errorf("invalid value for EntityTypeName: %v", v) + } +} + +// EntityRegionRequestBody - Region of the team. +type EntityRegionRequestBody string + +const ( + EntityRegionRequestBodyUs EntityRegionRequestBody = "us" + EntityRegionRequestBodyEu EntityRegionRequestBody = "eu" + EntityRegionRequestBodyAu EntityRegionRequestBody = "au" + EntityRegionRequestBodyMe EntityRegionRequestBody = "me" + EntityRegionRequestBodyIn EntityRegionRequestBody = "in" + EntityRegionRequestBodyWildcard EntityRegionRequestBody = "*" +) + +func (e EntityRegionRequestBody) ToPointer() *EntityRegionRequestBody { + return &e +} +func (e *EntityRegionRequestBody) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "us": + fallthrough + case "eu": + fallthrough + case "au": + fallthrough + case "me": + fallthrough + case "in": + fallthrough + case "*": + *e = EntityRegionRequestBody(v) + return nil + default: + return fmt.Errorf("invalid value for EntityRegionRequestBody: %v", v) + } +} + +// AssignRole - An assigned role is a role that has been assigned to a user or team. +type AssignRole struct { + // The desired role. + RoleName *RoleName `json:"role_name,omitempty"` + // The ID of the entity. + EntityID *string `json:"entity_id,omitempty"` + // The type of entity. + EntityTypeName *EntityTypeName `json:"entity_type_name,omitempty"` + // Region of the team. + EntityRegion *EntityRegionRequestBody `json:"entity_region,omitempty"` +} + +func (o *AssignRole) GetRoleName() *RoleName { + if o == nil { + return nil + } + return o.RoleName +} + +func (o *AssignRole) GetEntityID() *string { + if o == nil { + return nil + } + return o.EntityID +} + +func (o *AssignRole) GetEntityTypeName() *EntityTypeName { + if o == nil { + return nil + } + return o.EntityTypeName +} + +func (o *AssignRole) GetEntityRegion() *EntityRegionRequestBody { + if o == nil { + return nil + } + return o.EntityRegion +} diff --git a/tests/mockserver/internal/sdk/models/components/authenticationsettings.go b/tests/mockserver/internal/sdk/models/components/authenticationsettings.go new file mode 100644 index 00000000..c969c70b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/authenticationsettings.go @@ -0,0 +1,52 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// AuthenticationSettings - Response for authentication settings endpoint +type AuthenticationSettings struct { + // The organization has basic auth enabled. + BasicAuthEnabled *bool `json:"basic_auth_enabled,omitempty"` + // The organization has OIDC disabled. + OidcAuthEnabled *bool `json:"oidc_auth_enabled,omitempty"` + // The organization has SAML disabled. + SamlAuthEnabled *bool `json:"saml_auth_enabled,omitempty"` + // IdP groups determine the Konnect teams a user has. + IdpMappingEnabled *bool `json:"idp_mapping_enabled,omitempty"` + // A Konnect Identity Admin assigns teams to a user. + KonnectMappingEnabled *bool `json:"konnect_mapping_enabled,omitempty"` +} + +func (o *AuthenticationSettings) GetBasicAuthEnabled() *bool { + if o == nil { + return nil + } + return o.BasicAuthEnabled +} + +func (o *AuthenticationSettings) GetOidcAuthEnabled() *bool { + if o == nil { + return nil + } + return o.OidcAuthEnabled +} + +func (o *AuthenticationSettings) GetSamlAuthEnabled() *bool { + if o == nil { + return nil + } + return o.SamlAuthEnabled +} + +func (o *AuthenticationSettings) GetIdpMappingEnabled() *bool { + if o == nil { + return nil + } + return o.IdpMappingEnabled +} + +func (o *AuthenticationSettings) GetKonnectMappingEnabled() *bool { + if o == nil { + return nil + } + return o.KonnectMappingEnabled +} diff --git a/tests/mockserver/internal/sdk/models/components/availabilitydocument.go b/tests/mockserver/internal/sdk/models/components/availabilitydocument.go new file mode 100644 index 00000000..fe8f84b0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/availabilitydocument.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// AvailabilityDocument - Document containing availability information for configurations. +type AvailabilityDocument struct { + // List of supported gateway versions for cloud gateways. + Versions []string `json:"versions"` + // List of supported instance types, along with their associated resource parameters and pricing. + InstanceTypes []InstanceType `json:"instance_types"` + // List of supported cloud providers that run cloud gateway instances. + Providers []Provider `json:"providers"` +} + +func (o *AvailabilityDocument) GetVersions() []string { + if o == nil { + return []string{} + } + return o.Versions +} + +func (o *AvailabilityDocument) GetInstanceTypes() []InstanceType { + if o == nil { + return []InstanceType{} + } + return o.InstanceTypes +} + +func (o *AvailabilityDocument) GetProviders() []Provider { + if o == nil { + return []Provider{} + } + return o.Providers +} diff --git a/tests/mockserver/internal/sdk/models/components/awstransitgateway.go b/tests/mockserver/internal/sdk/models/components/awstransitgateway.go new file mode 100644 index 00000000..7111195c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/awstransitgateway.go @@ -0,0 +1,45 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type AWSTransitGateway struct { + // Human-readable name of the transit gateway. + Name string `json:"name"` + // List of mappings from remote DNS server IP address sets to proxied internal domains, for a transit gateway + // attachment. + // + DNSConfig []TransitGatewayDNSConfig `json:"dns_config,omitempty"` + // CIDR blocks for constructing a route table for the transit gateway, when attaching to the owning + // network. + // + CidrBlocks []string `json:"cidr_blocks"` + TransitGatewayAttachmentConfig AwsTransitGatewayAttachmentConfig `json:"transit_gateway_attachment_config"` +} + +func (o *AWSTransitGateway) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AWSTransitGateway) GetDNSConfig() []TransitGatewayDNSConfig { + if o == nil { + return nil + } + return o.DNSConfig +} + +func (o *AWSTransitGateway) GetCidrBlocks() []string { + if o == nil { + return []string{} + } + return o.CidrBlocks +} + +func (o *AWSTransitGateway) GetTransitGatewayAttachmentConfig() AwsTransitGatewayAttachmentConfig { + if o == nil { + return AwsTransitGatewayAttachmentConfig{} + } + return o.TransitGatewayAttachmentConfig +} diff --git a/tests/mockserver/internal/sdk/models/components/awstransitgatewayattachmentconfig.go b/tests/mockserver/internal/sdk/models/components/awstransitgatewayattachmentconfig.go new file mode 100644 index 00000000..1455edce --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/awstransitgatewayattachmentconfig.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type AWSTransitGatewayAttachmentType string + +const ( + AWSTransitGatewayAttachmentTypeAwsTransitGatewayAttachment AWSTransitGatewayAttachmentType = "aws-transit-gateway-attachment" +) + +func (e AWSTransitGatewayAttachmentType) ToPointer() *AWSTransitGatewayAttachmentType { + return &e +} +func (e *AWSTransitGatewayAttachmentType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "aws-transit-gateway-attachment": + *e = AWSTransitGatewayAttachmentType(v) + return nil + default: + return fmt.Errorf("invalid value for AWSTransitGatewayAttachmentType: %v", v) + } +} + +type AwsTransitGatewayAttachmentConfig struct { + Kind AWSTransitGatewayAttachmentType `json:"kind"` + // AWS Transit Gateway ID to create attachment to. + TransitGatewayID string `json:"transit_gateway_id"` + // Resource Share ARN to verify request to create transit gateway attachment. + RAMShareArn string `json:"ram_share_arn"` +} + +func (o *AwsTransitGatewayAttachmentConfig) GetKind() AWSTransitGatewayAttachmentType { + if o == nil { + return AWSTransitGatewayAttachmentType("") + } + return o.Kind +} + +func (o *AwsTransitGatewayAttachmentConfig) GetTransitGatewayID() string { + if o == nil { + return "" + } + return o.TransitGatewayID +} + +func (o *AwsTransitGatewayAttachmentConfig) GetRAMShareArn() string { + if o == nil { + return "" + } + return o.RAMShareArn +} diff --git a/tests/mockserver/internal/sdk/models/components/awstransitgatewayresponse.go b/tests/mockserver/internal/sdk/models/components/awstransitgatewayresponse.go new file mode 100644 index 00000000..8bdd9c70 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/awstransitgatewayresponse.go @@ -0,0 +1,147 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// AwsTransitGatewayResponseTransitGatewayStateMetadata - Metadata describing the backing state of the transit gateway and why it may be in an erroneous state. +type AwsTransitGatewayResponseTransitGatewayStateMetadata struct { + // Reported status of the transit gateway from backing infrastructure. + ReportedStatus *string `json:"reported_status,omitempty"` + // Reason why the transit gateway may be in an erroneous state, reported from backing infrastructure. + // + Reason *string `json:"reason,omitempty"` +} + +func (o *AwsTransitGatewayResponseTransitGatewayStateMetadata) GetReportedStatus() *string { + if o == nil { + return nil + } + return o.ReportedStatus +} + +func (o *AwsTransitGatewayResponseTransitGatewayStateMetadata) GetReason() *string { + if o == nil { + return nil + } + return o.Reason +} + +type AwsTransitGatewayResponse struct { + // Human-readable name of the transit gateway. + Name string `json:"name"` + // List of mappings from remote DNS server IP address sets to proxied internal domains, for a transit gateway + // attachment. + // + DNSConfig []TransitGatewayDNSConfig `json:"dns_config"` + // CIDR blocks for constructing a route table for the transit gateway, when attaching to the owning + // network. + // + CidrBlocks []string `json:"cidr_blocks"` + TransitGatewayAttachmentConfig AwsTransitGatewayAttachmentConfig `json:"transit_gateway_attachment_config"` + ID string `json:"id"` + // The current state of the Transit Gateway. Possible values: + // - `created` - The attachment has been created but is not attached to transit gateway. + // - `initializing` - The attachment is in the process of being initialized and is setting up necessary resources. + // - `pending-acceptance` The attachment request is awaiting acceptance in customer VPC. + // - `ready` - The transit gateway attachment is fully operational and can route traffic as configured. + // - `terminating` - The attachment is in the process of being deleted and is no longer accepting new traffic. + // - `terminated` - The attachment has been fully deleted and is no longer available. + // + State TransitGatewayState `json:"state"` + // Metadata describing the backing state of the transit gateway and why it may be in an erroneous state. + // + StateMetadata *AwsTransitGatewayResponseTransitGatewayStateMetadata `json:"state_metadata,omitempty"` + // Monotonically-increasing version count of the transit gateway, to indicate the order of updates to the + // transit gateway. + // + EntityVersion int64 `json:"entity_version"` + // An RFC-3339 timestamp representation of transit gateway creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of transit gateway update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (a AwsTransitGatewayResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AwsTransitGatewayResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, true); err != nil { + return err + } + return nil +} + +func (o *AwsTransitGatewayResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AwsTransitGatewayResponse) GetDNSConfig() []TransitGatewayDNSConfig { + if o == nil { + return []TransitGatewayDNSConfig{} + } + return o.DNSConfig +} + +func (o *AwsTransitGatewayResponse) GetCidrBlocks() []string { + if o == nil { + return []string{} + } + return o.CidrBlocks +} + +func (o *AwsTransitGatewayResponse) GetTransitGatewayAttachmentConfig() AwsTransitGatewayAttachmentConfig { + if o == nil { + return AwsTransitGatewayAttachmentConfig{} + } + return o.TransitGatewayAttachmentConfig +} + +func (o *AwsTransitGatewayResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AwsTransitGatewayResponse) GetState() TransitGatewayState { + if o == nil { + return TransitGatewayState("") + } + return o.State +} + +func (o *AwsTransitGatewayResponse) GetStateMetadata() *AwsTransitGatewayResponseTransitGatewayStateMetadata { + if o == nil { + return nil + } + return o.StateMetadata +} + +func (o *AwsTransitGatewayResponse) GetEntityVersion() int64 { + if o == nil { + return 0 + } + return o.EntityVersion +} + +func (o *AwsTransitGatewayResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *AwsTransitGatewayResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgateway.go b/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgateway.go new file mode 100644 index 00000000..47f8651d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgateway.go @@ -0,0 +1,45 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type AWSVpcPeeringGateway struct { + // Human-readable name of the transit gateway. + Name string `json:"name"` + // List of mappings from remote DNS server IP address sets to proxied internal domains, for a transit gateway + // attachment. + // + DNSConfig []TransitGatewayDNSConfig `json:"dns_config,omitempty"` + // CIDR blocks for constructing a route table for the transit gateway, when attaching to the owning + // network. + // + CidrBlocks []string `json:"cidr_blocks"` + TransitGatewayAttachmentConfig AwsVpcPeeringGatewayAttachmentConfig `json:"transit_gateway_attachment_config"` +} + +func (o *AWSVpcPeeringGateway) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AWSVpcPeeringGateway) GetDNSConfig() []TransitGatewayDNSConfig { + if o == nil { + return nil + } + return o.DNSConfig +} + +func (o *AWSVpcPeeringGateway) GetCidrBlocks() []string { + if o == nil { + return []string{} + } + return o.CidrBlocks +} + +func (o *AWSVpcPeeringGateway) GetTransitGatewayAttachmentConfig() AwsVpcPeeringGatewayAttachmentConfig { + if o == nil { + return AwsVpcPeeringGatewayAttachmentConfig{} + } + return o.TransitGatewayAttachmentConfig +} diff --git a/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayattachmentconfig.go b/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayattachmentconfig.go new file mode 100644 index 00000000..c059705b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayattachmentconfig.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type AWSVPCPeeringAttachmentConfig string + +const ( + AWSVPCPeeringAttachmentConfigAwsVpcPeeringAttachment AWSVPCPeeringAttachmentConfig = "aws-vpc-peering-attachment" +) + +func (e AWSVPCPeeringAttachmentConfig) ToPointer() *AWSVPCPeeringAttachmentConfig { + return &e +} +func (e *AWSVPCPeeringAttachmentConfig) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "aws-vpc-peering-attachment": + *e = AWSVPCPeeringAttachmentConfig(v) + return nil + default: + return fmt.Errorf("invalid value for AWSVPCPeeringAttachmentConfig: %v", v) + } +} + +type AwsVpcPeeringGatewayAttachmentConfig struct { + Kind AWSVPCPeeringAttachmentConfig `json:"kind"` + PeerAccountID string `json:"peer_account_id"` + PeerVpcID string `json:"peer_vpc_id"` + PeerVpcRegion string `json:"peer_vpc_region"` +} + +func (o *AwsVpcPeeringGatewayAttachmentConfig) GetKind() AWSVPCPeeringAttachmentConfig { + if o == nil { + return AWSVPCPeeringAttachmentConfig("") + } + return o.Kind +} + +func (o *AwsVpcPeeringGatewayAttachmentConfig) GetPeerAccountID() string { + if o == nil { + return "" + } + return o.PeerAccountID +} + +func (o *AwsVpcPeeringGatewayAttachmentConfig) GetPeerVpcID() string { + if o == nil { + return "" + } + return o.PeerVpcID +} + +func (o *AwsVpcPeeringGatewayAttachmentConfig) GetPeerVpcRegion() string { + if o == nil { + return "" + } + return o.PeerVpcRegion +} diff --git a/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayresponse.go b/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayresponse.go new file mode 100644 index 00000000..5073d47e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/awsvpcpeeringgatewayresponse.go @@ -0,0 +1,147 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// AwsVpcPeeringGatewayResponseTransitGatewayStateMetadata - Metadata describing the backing state of the transit gateway and why it may be in an erroneous state. +type AwsVpcPeeringGatewayResponseTransitGatewayStateMetadata struct { + // Reported status of the transit gateway from backing infrastructure. + ReportedStatus *string `json:"reported_status,omitempty"` + // Reason why the transit gateway may be in an erroneous state, reported from backing infrastructure. + // + Reason *string `json:"reason,omitempty"` +} + +func (o *AwsVpcPeeringGatewayResponseTransitGatewayStateMetadata) GetReportedStatus() *string { + if o == nil { + return nil + } + return o.ReportedStatus +} + +func (o *AwsVpcPeeringGatewayResponseTransitGatewayStateMetadata) GetReason() *string { + if o == nil { + return nil + } + return o.Reason +} + +type AwsVpcPeeringGatewayResponse struct { + // Human-readable name of the transit gateway. + Name string `json:"name"` + // List of mappings from remote DNS server IP address sets to proxied internal domains, for a transit gateway + // attachment. + // + DNSConfig []TransitGatewayDNSConfig `json:"dns_config"` + // CIDR blocks for constructing a route table for the transit gateway, when attaching to the owning + // network. + // + CidrBlocks []string `json:"cidr_blocks"` + TransitGatewayAttachmentConfig AwsVpcPeeringGatewayAttachmentConfig `json:"transit_gateway_attachment_config"` + ID string `json:"id"` + // The current state of the Transit Gateway. Possible values: + // - `created` - The attachment has been created but is not attached to transit gateway. + // - `initializing` - The attachment is in the process of being initialized and is setting up necessary resources. + // - `pending-acceptance` The attachment request is awaiting acceptance in customer VPC. + // - `ready` - The transit gateway attachment is fully operational and can route traffic as configured. + // - `terminating` - The attachment is in the process of being deleted and is no longer accepting new traffic. + // - `terminated` - The attachment has been fully deleted and is no longer available. + // + State TransitGatewayState `json:"state"` + // Metadata describing the backing state of the transit gateway and why it may be in an erroneous state. + // + StateMetadata *AwsVpcPeeringGatewayResponseTransitGatewayStateMetadata `json:"state_metadata,omitempty"` + // Monotonically-increasing version count of the transit gateway, to indicate the order of updates to the + // transit gateway. + // + EntityVersion int64 `json:"entity_version"` + // An RFC-3339 timestamp representation of transit gateway creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of transit gateway update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (a AwsVpcPeeringGatewayResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AwsVpcPeeringGatewayResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, true); err != nil { + return err + } + return nil +} + +func (o *AwsVpcPeeringGatewayResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AwsVpcPeeringGatewayResponse) GetDNSConfig() []TransitGatewayDNSConfig { + if o == nil { + return []TransitGatewayDNSConfig{} + } + return o.DNSConfig +} + +func (o *AwsVpcPeeringGatewayResponse) GetCidrBlocks() []string { + if o == nil { + return []string{} + } + return o.CidrBlocks +} + +func (o *AwsVpcPeeringGatewayResponse) GetTransitGatewayAttachmentConfig() AwsVpcPeeringGatewayAttachmentConfig { + if o == nil { + return AwsVpcPeeringGatewayAttachmentConfig{} + } + return o.TransitGatewayAttachmentConfig +} + +func (o *AwsVpcPeeringGatewayResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AwsVpcPeeringGatewayResponse) GetState() TransitGatewayState { + if o == nil { + return TransitGatewayState("") + } + return o.State +} + +func (o *AwsVpcPeeringGatewayResponse) GetStateMetadata() *AwsVpcPeeringGatewayResponseTransitGatewayStateMetadata { + if o == nil { + return nil + } + return o.StateMetadata +} + +func (o *AwsVpcPeeringGatewayResponse) GetEntityVersion() int64 { + if o == nil { + return 0 + } + return o.EntityVersion +} + +func (o *AwsVpcPeeringGatewayResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *AwsVpcPeeringGatewayResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/azuretransitgateway.go b/tests/mockserver/internal/sdk/models/components/azuretransitgateway.go new file mode 100644 index 00000000..1299d988 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/azuretransitgateway.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type AzureTransitGateway struct { + // Human-readable name of the transit gateway. + Name string `json:"name"` + // List of mappings from remote DNS server IP address sets to proxied internal domains, for a transit gateway + // attachment. + // + DNSConfig []TransitGatewayDNSConfig `json:"dns_config,omitempty"` + TransitGatewayAttachmentConfig AzureVNETPeeringAttachmentConfig `json:"transit_gateway_attachment_config"` +} + +func (o *AzureTransitGateway) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AzureTransitGateway) GetDNSConfig() []TransitGatewayDNSConfig { + if o == nil { + return nil + } + return o.DNSConfig +} + +func (o *AzureTransitGateway) GetTransitGatewayAttachmentConfig() AzureVNETPeeringAttachmentConfig { + if o == nil { + return AzureVNETPeeringAttachmentConfig{} + } + return o.TransitGatewayAttachmentConfig +} diff --git a/tests/mockserver/internal/sdk/models/components/azuretransitgatewayresponse.go b/tests/mockserver/internal/sdk/models/components/azuretransitgatewayresponse.go new file mode 100644 index 00000000..331123d6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/azuretransitgatewayresponse.go @@ -0,0 +1,136 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// AzureTransitGatewayResponseTransitGatewayStateMetadata - Metadata describing the backing state of the transit gateway and why it may be in an erroneous state. +type AzureTransitGatewayResponseTransitGatewayStateMetadata struct { + // Reported status of the transit gateway from backing infrastructure. + ReportedStatus *string `json:"reported_status,omitempty"` + // Reason why the transit gateway may be in an erroneous state, reported from backing infrastructure. + // + Reason *string `json:"reason,omitempty"` +} + +func (o *AzureTransitGatewayResponseTransitGatewayStateMetadata) GetReportedStatus() *string { + if o == nil { + return nil + } + return o.ReportedStatus +} + +func (o *AzureTransitGatewayResponseTransitGatewayStateMetadata) GetReason() *string { + if o == nil { + return nil + } + return o.Reason +} + +type AzureTransitGatewayResponse struct { + // Human-readable name of the transit gateway. + Name string `json:"name"` + // List of mappings from remote DNS server IP address sets to proxied internal domains, for a transit gateway + // attachment. + // + DNSConfig []TransitGatewayDNSConfig `json:"dns_config"` + TransitGatewayAttachmentConfig AzureVNETPeeringAttachmentConfig `json:"transit_gateway_attachment_config"` + ID string `json:"id"` + // The current state of the Transit Gateway. Possible values: + // - `created` - The attachment has been created but is not attached to transit gateway. + // - `initializing` - The attachment is in the process of being initialized and is setting up necessary resources. + // - `pending-acceptance` The attachment request is awaiting acceptance in customer VPC. + // - `ready` - The transit gateway attachment is fully operational and can route traffic as configured. + // - `terminating` - The attachment is in the process of being deleted and is no longer accepting new traffic. + // - `terminated` - The attachment has been fully deleted and is no longer available. + // + State TransitGatewayState `json:"state"` + // Metadata describing the backing state of the transit gateway and why it may be in an erroneous state. + // + StateMetadata *AzureTransitGatewayResponseTransitGatewayStateMetadata `json:"state_metadata,omitempty"` + // Monotonically-increasing version count of the transit gateway, to indicate the order of updates to the + // transit gateway. + // + EntityVersion int64 `json:"entity_version"` + // An RFC-3339 timestamp representation of transit gateway creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of transit gateway update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (a AzureTransitGatewayResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AzureTransitGatewayResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, true); err != nil { + return err + } + return nil +} + +func (o *AzureTransitGatewayResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AzureTransitGatewayResponse) GetDNSConfig() []TransitGatewayDNSConfig { + if o == nil { + return []TransitGatewayDNSConfig{} + } + return o.DNSConfig +} + +func (o *AzureTransitGatewayResponse) GetTransitGatewayAttachmentConfig() AzureVNETPeeringAttachmentConfig { + if o == nil { + return AzureVNETPeeringAttachmentConfig{} + } + return o.TransitGatewayAttachmentConfig +} + +func (o *AzureTransitGatewayResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AzureTransitGatewayResponse) GetState() TransitGatewayState { + if o == nil { + return TransitGatewayState("") + } + return o.State +} + +func (o *AzureTransitGatewayResponse) GetStateMetadata() *AzureTransitGatewayResponseTransitGatewayStateMetadata { + if o == nil { + return nil + } + return o.StateMetadata +} + +func (o *AzureTransitGatewayResponse) GetEntityVersion() int64 { + if o == nil { + return 0 + } + return o.EntityVersion +} + +func (o *AzureTransitGatewayResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *AzureTransitGatewayResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/azurevnetpeeringattachmentconfig.go b/tests/mockserver/internal/sdk/models/components/azurevnetpeeringattachmentconfig.go new file mode 100644 index 00000000..36008b7b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/azurevnetpeeringattachmentconfig.go @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type AzureVNETPeeringAttachmentType string + +const ( + AzureVNETPeeringAttachmentTypeAzureVnetPeeringAttachment AzureVNETPeeringAttachmentType = "azure-vnet-peering-attachment" +) + +func (e AzureVNETPeeringAttachmentType) ToPointer() *AzureVNETPeeringAttachmentType { + return &e +} +func (e *AzureVNETPeeringAttachmentType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "azure-vnet-peering-attachment": + *e = AzureVNETPeeringAttachmentType(v) + return nil + default: + return fmt.Errorf("invalid value for AzureVNETPeeringAttachmentType: %v", v) + } +} + +type AzureVNETPeeringAttachmentConfig struct { + Kind AzureVNETPeeringAttachmentType `json:"kind"` + // Tenant ID for the Azure VNET Peering attachment. + TenantID string `json:"tenant_id"` + // Subscription ID for the Azure VNET Peering attachment. + SubscriptionID string `json:"subscription_id"` + // Resource Group Name for the Azure VNET Peering attachment. + ResourceGroupName string `json:"resource_group_name"` + // VNET Name for the Azure VNET Peering attachment. + VnetName string `json:"vnet_name"` +} + +func (o *AzureVNETPeeringAttachmentConfig) GetKind() AzureVNETPeeringAttachmentType { + if o == nil { + return AzureVNETPeeringAttachmentType("") + } + return o.Kind +} + +func (o *AzureVNETPeeringAttachmentConfig) GetTenantID() string { + if o == nil { + return "" + } + return o.TenantID +} + +func (o *AzureVNETPeeringAttachmentConfig) GetSubscriptionID() string { + if o == nil { + return "" + } + return o.SubscriptionID +} + +func (o *AzureVNETPeeringAttachmentConfig) GetResourceGroupName() string { + if o == nil { + return "" + } + return o.ResourceGroupName +} + +func (o *AzureVNETPeeringAttachmentConfig) GetVnetName() string { + if o == nil { + return "" + } + return o.VnetName +} diff --git a/tests/mockserver/internal/sdk/models/components/basicauth.go b/tests/mockserver/internal/sdk/models/components/basicauth.go new file mode 100644 index 00000000..651469ee --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/basicauth.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type BasicAuthConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *BasicAuthConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type BasicAuth struct { + Consumer *BasicAuthConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Password string `json:"password"` + Tags []string `json:"tags,omitempty"` + Username string `json:"username"` +} + +func (o *BasicAuth) GetConsumer() *BasicAuthConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *BasicAuth) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *BasicAuth) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *BasicAuth) GetPassword() string { + if o == nil { + return "" + } + return o.Password +} + +func (o *BasicAuth) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *BasicAuth) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} diff --git a/tests/mockserver/internal/sdk/models/components/basicauthwithoutparents.go b/tests/mockserver/internal/sdk/models/components/basicauthwithoutparents.go new file mode 100644 index 00000000..fb51adee --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/basicauthwithoutparents.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type BasicAuthWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *BasicAuthWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type BasicAuthWithoutParents struct { + Consumer *BasicAuthWithoutParentsConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Password string `json:"password"` + Tags []string `json:"tags,omitempty"` + Username string `json:"username"` +} + +func (o *BasicAuthWithoutParents) GetConsumer() *BasicAuthWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *BasicAuthWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *BasicAuthWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *BasicAuthWithoutParents) GetPassword() string { + if o == nil { + return "" + } + return o.Password +} + +func (o *BasicAuthWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *BasicAuthWithoutParents) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} diff --git a/tests/mockserver/internal/sdk/models/components/bulkpayload.go b/tests/mockserver/internal/sdk/models/components/bulkpayload.go new file mode 100644 index 00000000..e2746914 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/bulkpayload.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// BulkPayload - Request body schema for bulk status update. +type BulkPayload struct { + Ids []string `json:"ids"` + // Status of the notification. + Status NotificationStatus `json:"status"` +} + +func (o *BulkPayload) GetIds() []string { + if o == nil { + return []string{} + } + return o.Ids +} + +func (o *BulkPayload) GetStatus() NotificationStatus { + if o == nil { + return NotificationStatus("") + } + return o.Status +} diff --git a/tests/mockserver/internal/sdk/models/components/cacertificate.go b/tests/mockserver/internal/sdk/models/components/cacertificate.go new file mode 100644 index 00000000..3d2b8dee --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/cacertificate.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CACertificate - A CA certificate object represents a trusted CA. These objects are used by Kong to verify the validity of a client or server certificate. +type CACertificate struct { + // PEM-encoded public certificate of the CA. + Cert string `json:"cert"` + // SHA256 hex digest of the public certificate. This field is read-only and it cannot be set by the caller, the value is automatically computed. + CertDigest *string `json:"cert_digest,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // An optional set of strings associated with the Certificate for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *CACertificate) GetCert() string { + if o == nil { + return "" + } + return o.Cert +} + +func (o *CACertificate) GetCertDigest() *string { + if o == nil { + return nil + } + return o.CertDigest +} + +func (o *CACertificate) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *CACertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *CACertificate) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *CACertificate) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/certificate.go b/tests/mockserver/internal/sdk/models/components/certificate.go new file mode 100644 index 00000000..b73d3897 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/certificate.go @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// Certificate - A certificate object represents a public certificate, and can be optionally paired with the corresponding private key. These objects are used by Kong to handle SSL/TLS termination for encrypted requests, or for use as a trusted CA store when validating peer certificate of client/service. Certificates are optionally associated with SNI objects to tie a cert/key pair to one or more hostnames. If intermediate certificates are required in addition to the main certificate, they should be concatenated together into one string according to the following order: main certificate on the top, followed by any intermediates. +type Certificate struct { + // PEM-encoded public certificate chain of the SSL key pair. This field is _referenceable_, which means it can be securely stored as a [secret](/gateway/latest/plan-and-deploy/security/secrets-management/getting-started) in a vault. References must follow a [specific format](/gateway/latest/plan-and-deploy/security/secrets-management/reference-format). + Cert string `json:"cert"` + // PEM-encoded public certificate chain of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is _referenceable_, which means it can be securely stored as a [secret](/gateway/latest/plan-and-deploy/security/secrets-management/getting-started) in a vault. References must follow a [specific format](/gateway/latest/plan-and-deploy/security/secrets-management/reference-format). + CertAlt *string `json:"cert_alt,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // PEM-encoded private key of the SSL key pair. This field is _referenceable_, which means it can be securely stored as a [secret](/gateway/latest/plan-and-deploy/security/secrets-management/getting-started) in a vault. References must follow a [specific format](/gateway/latest/plan-and-deploy/security/secrets-management/reference-format). + Key string `json:"key"` + // PEM-encoded private key of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is _referenceable_, which means it can be securely stored as a [secret](/gateway/latest/plan-and-deploy/security/secrets-management/getting-started) in a vault. References must follow a [specific format](/gateway/latest/plan-and-deploy/security/secrets-management/reference-format). + KeyAlt *string `json:"key_alt,omitempty"` + Snis []string `json:"snis,omitempty"` + // An optional set of strings associated with the Certificate for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *Certificate) GetCert() string { + if o == nil { + return "" + } + return o.Cert +} + +func (o *Certificate) GetCertAlt() *string { + if o == nil { + return nil + } + return o.CertAlt +} + +func (o *Certificate) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Certificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Certificate) GetKey() string { + if o == nil { + return "" + } + return o.Key +} + +func (o *Certificate) GetKeyAlt() *string { + if o == nil { + return nil + } + return o.KeyAlt +} + +func (o *Certificate) GetSnis() []string { + if o == nil { + return nil + } + return o.Snis +} + +func (o *Certificate) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Certificate) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldequalsfilteroverride.go b/tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldequalsfilteroverride.go new file mode 100644 index 00000000..679d86b6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldequalsfilteroverride.go @@ -0,0 +1,84 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type StringFieldEqualsComparison struct { + Eq string `queryParam:"name=eq"` +} + +func (o *StringFieldEqualsComparison) GetEq() string { + if o == nil { + return "" + } + return o.Eq +} + +type CloudGatewaysStringFieldEqualsFilterOverrideType string + +const ( + CloudGatewaysStringFieldEqualsFilterOverrideTypeStr CloudGatewaysStringFieldEqualsFilterOverrideType = "str" + CloudGatewaysStringFieldEqualsFilterOverrideTypeStringFieldEqualsComparison CloudGatewaysStringFieldEqualsFilterOverrideType = "StringFieldEqualsComparison" +) + +// CloudGatewaysStringFieldEqualsFilterOverride - Filters on the given string field value by exact match. +type CloudGatewaysStringFieldEqualsFilterOverride struct { + Str *string `queryParam:"inline"` + StringFieldEqualsComparison *StringFieldEqualsComparison `queryParam:"inline"` + + Type CloudGatewaysStringFieldEqualsFilterOverrideType +} + +func CreateCloudGatewaysStringFieldEqualsFilterOverrideStr(str string) CloudGatewaysStringFieldEqualsFilterOverride { + typ := CloudGatewaysStringFieldEqualsFilterOverrideTypeStr + + return CloudGatewaysStringFieldEqualsFilterOverride{ + Str: &str, + Type: typ, + } +} + +func CreateCloudGatewaysStringFieldEqualsFilterOverrideStringFieldEqualsComparison(stringFieldEqualsComparison StringFieldEqualsComparison) CloudGatewaysStringFieldEqualsFilterOverride { + typ := CloudGatewaysStringFieldEqualsFilterOverrideTypeStringFieldEqualsComparison + + return CloudGatewaysStringFieldEqualsFilterOverride{ + StringFieldEqualsComparison: &stringFieldEqualsComparison, + Type: typ, + } +} + +func (u *CloudGatewaysStringFieldEqualsFilterOverride) UnmarshalJSON(data []byte) error { + + var stringFieldEqualsComparison StringFieldEqualsComparison = StringFieldEqualsComparison{} + if err := utils.UnmarshalJSON(data, &stringFieldEqualsComparison, "", true, true); err == nil { + u.StringFieldEqualsComparison = &stringFieldEqualsComparison + u.Type = CloudGatewaysStringFieldEqualsFilterOverrideTypeStringFieldEqualsComparison + return nil + } + + var str string = "" + if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil { + u.Str = &str + u.Type = CloudGatewaysStringFieldEqualsFilterOverrideTypeStr + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CloudGatewaysStringFieldEqualsFilterOverride", string(data)) +} + +func (u CloudGatewaysStringFieldEqualsFilterOverride) MarshalJSON() ([]byte, error) { + if u.Str != nil { + return utils.MarshalJSON(u.Str, "", true) + } + + if u.StringFieldEqualsComparison != nil { + return utils.MarshalJSON(u.StringFieldEqualsComparison, "", true) + } + + return nil, errors.New("could not marshal union type CloudGatewaysStringFieldEqualsFilterOverride: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldfilteroverride.go b/tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldfilteroverride.go new file mode 100644 index 00000000..3aec608a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/cloudgatewaysstringfieldfilteroverride.go @@ -0,0 +1,138 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type CloudGatewaysStringFieldFilterOverrideType string + +const ( + CloudGatewaysStringFieldFilterOverrideTypeCloudGatewaysStringFieldEqualsFilterOverride CloudGatewaysStringFieldFilterOverrideType = "CloudGatewaysStringFieldEqualsFilterOverride" + CloudGatewaysStringFieldFilterOverrideTypeStringFieldContainsFilter CloudGatewaysStringFieldFilterOverrideType = "StringFieldContainsFilter" + CloudGatewaysStringFieldFilterOverrideTypeStringFieldNEQFilter CloudGatewaysStringFieldFilterOverrideType = "StringFieldNEQFilter" + CloudGatewaysStringFieldFilterOverrideTypeStringFieldOEQFilter CloudGatewaysStringFieldFilterOverrideType = "StringFieldOEQFilter" + CloudGatewaysStringFieldFilterOverrideTypeStringFieldOContainsFilter CloudGatewaysStringFieldFilterOverrideType = "StringFieldOContainsFilter" +) + +type CloudGatewaysStringFieldFilterOverride struct { + CloudGatewaysStringFieldEqualsFilterOverride *CloudGatewaysStringFieldEqualsFilterOverride `queryParam:"inline"` + StringFieldContainsFilter *StringFieldContainsFilter `queryParam:"inline"` + StringFieldNEQFilter *StringFieldNEQFilter `queryParam:"inline"` + StringFieldOEQFilter *StringFieldOEQFilter `queryParam:"inline"` + StringFieldOContainsFilter *StringFieldOContainsFilter `queryParam:"inline"` + + Type CloudGatewaysStringFieldFilterOverrideType +} + +func CreateCloudGatewaysStringFieldFilterOverrideCloudGatewaysStringFieldEqualsFilterOverride(cloudGatewaysStringFieldEqualsFilterOverride CloudGatewaysStringFieldEqualsFilterOverride) CloudGatewaysStringFieldFilterOverride { + typ := CloudGatewaysStringFieldFilterOverrideTypeCloudGatewaysStringFieldEqualsFilterOverride + + return CloudGatewaysStringFieldFilterOverride{ + CloudGatewaysStringFieldEqualsFilterOverride: &cloudGatewaysStringFieldEqualsFilterOverride, + Type: typ, + } +} + +func CreateCloudGatewaysStringFieldFilterOverrideStringFieldContainsFilter(stringFieldContainsFilter StringFieldContainsFilter) CloudGatewaysStringFieldFilterOverride { + typ := CloudGatewaysStringFieldFilterOverrideTypeStringFieldContainsFilter + + return CloudGatewaysStringFieldFilterOverride{ + StringFieldContainsFilter: &stringFieldContainsFilter, + Type: typ, + } +} + +func CreateCloudGatewaysStringFieldFilterOverrideStringFieldNEQFilter(stringFieldNEQFilter StringFieldNEQFilter) CloudGatewaysStringFieldFilterOverride { + typ := CloudGatewaysStringFieldFilterOverrideTypeStringFieldNEQFilter + + return CloudGatewaysStringFieldFilterOverride{ + StringFieldNEQFilter: &stringFieldNEQFilter, + Type: typ, + } +} + +func CreateCloudGatewaysStringFieldFilterOverrideStringFieldOEQFilter(stringFieldOEQFilter StringFieldOEQFilter) CloudGatewaysStringFieldFilterOverride { + typ := CloudGatewaysStringFieldFilterOverrideTypeStringFieldOEQFilter + + return CloudGatewaysStringFieldFilterOverride{ + StringFieldOEQFilter: &stringFieldOEQFilter, + Type: typ, + } +} + +func CreateCloudGatewaysStringFieldFilterOverrideStringFieldOContainsFilter(stringFieldOContainsFilter StringFieldOContainsFilter) CloudGatewaysStringFieldFilterOverride { + typ := CloudGatewaysStringFieldFilterOverrideTypeStringFieldOContainsFilter + + return CloudGatewaysStringFieldFilterOverride{ + StringFieldOContainsFilter: &stringFieldOContainsFilter, + Type: typ, + } +} + +func (u *CloudGatewaysStringFieldFilterOverride) UnmarshalJSON(data []byte) error { + + var stringFieldContainsFilter StringFieldContainsFilter = StringFieldContainsFilter{} + if err := utils.UnmarshalJSON(data, &stringFieldContainsFilter, "", true, true); err == nil { + u.StringFieldContainsFilter = &stringFieldContainsFilter + u.Type = CloudGatewaysStringFieldFilterOverrideTypeStringFieldContainsFilter + return nil + } + + var stringFieldNEQFilter StringFieldNEQFilter = StringFieldNEQFilter{} + if err := utils.UnmarshalJSON(data, &stringFieldNEQFilter, "", true, true); err == nil { + u.StringFieldNEQFilter = &stringFieldNEQFilter + u.Type = CloudGatewaysStringFieldFilterOverrideTypeStringFieldNEQFilter + return nil + } + + var stringFieldOEQFilter StringFieldOEQFilter = StringFieldOEQFilter{} + if err := utils.UnmarshalJSON(data, &stringFieldOEQFilter, "", true, true); err == nil { + u.StringFieldOEQFilter = &stringFieldOEQFilter + u.Type = CloudGatewaysStringFieldFilterOverrideTypeStringFieldOEQFilter + return nil + } + + var stringFieldOContainsFilter StringFieldOContainsFilter = StringFieldOContainsFilter{} + if err := utils.UnmarshalJSON(data, &stringFieldOContainsFilter, "", true, true); err == nil { + u.StringFieldOContainsFilter = &stringFieldOContainsFilter + u.Type = CloudGatewaysStringFieldFilterOverrideTypeStringFieldOContainsFilter + return nil + } + + var cloudGatewaysStringFieldEqualsFilterOverride CloudGatewaysStringFieldEqualsFilterOverride = CloudGatewaysStringFieldEqualsFilterOverride{} + if err := utils.UnmarshalJSON(data, &cloudGatewaysStringFieldEqualsFilterOverride, "", true, true); err == nil { + u.CloudGatewaysStringFieldEqualsFilterOverride = &cloudGatewaysStringFieldEqualsFilterOverride + u.Type = CloudGatewaysStringFieldFilterOverrideTypeCloudGatewaysStringFieldEqualsFilterOverride + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CloudGatewaysStringFieldFilterOverride", string(data)) +} + +func (u CloudGatewaysStringFieldFilterOverride) MarshalJSON() ([]byte, error) { + if u.CloudGatewaysStringFieldEqualsFilterOverride != nil { + return utils.MarshalJSON(u.CloudGatewaysStringFieldEqualsFilterOverride, "", true) + } + + if u.StringFieldContainsFilter != nil { + return utils.MarshalJSON(u.StringFieldContainsFilter, "", true) + } + + if u.StringFieldNEQFilter != nil { + return utils.MarshalJSON(u.StringFieldNEQFilter, "", true) + } + + if u.StringFieldOEQFilter != nil { + return utils.MarshalJSON(u.StringFieldOEQFilter, "", true) + } + + if u.StringFieldOContainsFilter != nil { + return utils.MarshalJSON(u.StringFieldOContainsFilter, "", true) + } + + return nil, errors.New("could not marshal union type CloudGatewaysStringFieldFilterOverride: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/configstore.go b/tests/mockserver/internal/sdk/models/components/configstore.go new file mode 100644 index 00000000..84785159 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configstore.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/configstoresecret.go b/tests/mockserver/internal/sdk/models/components/configstoresecret.go new file mode 100644 index 00000000..05b8d67c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configstoresecret.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/configurationdataplanegroup.go b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroup.go new file mode 100644 index 00000000..3c0dc157 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroup.go @@ -0,0 +1,193 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// ConfigurationDataPlaneGroupState - State of the data-plane group. +type ConfigurationDataPlaneGroupState string + +const ( + ConfigurationDataPlaneGroupStateCreated ConfigurationDataPlaneGroupState = "created" + ConfigurationDataPlaneGroupStateInitializing ConfigurationDataPlaneGroupState = "initializing" + ConfigurationDataPlaneGroupStateReady ConfigurationDataPlaneGroupState = "ready" + ConfigurationDataPlaneGroupStateTerminating ConfigurationDataPlaneGroupState = "terminating" + ConfigurationDataPlaneGroupStateTerminated ConfigurationDataPlaneGroupState = "terminated" +) + +func (e ConfigurationDataPlaneGroupState) ToPointer() *ConfigurationDataPlaneGroupState { + return &e +} +func (e *ConfigurationDataPlaneGroupState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "created": + fallthrough + case "initializing": + fallthrough + case "ready": + fallthrough + case "terminating": + fallthrough + case "terminated": + *e = ConfigurationDataPlaneGroupState(v) + return nil + default: + return fmt.Errorf("invalid value for ConfigurationDataPlaneGroupState: %v", v) + } +} + +// StateMetadata - Metadata describing the backing state of the dataplane group and why it may be in an erroneous state. +type StateMetadata struct { + // Reported status of the dataplane group from backing infrastructure. + ReportedStatus *string `json:"reported_status,omitempty"` + // Reason why the dataplane group may be in an erroneous state, reported from backing infrastructure. + // + Reason *string `json:"reason,omitempty"` +} + +func (o *StateMetadata) GetReportedStatus() *string { + if o == nil { + return nil + } + return o.ReportedStatus +} + +func (o *StateMetadata) GetReason() *string { + if o == nil { + return nil + } + return o.Reason +} + +// ConfigurationDataPlaneGroup - Object that describes the set of data-plane groups currently pointed to this configuration. +type ConfigurationDataPlaneGroup struct { + // ID of the data-plane group that represents a deployment target for a set of data-planes. + ID string `json:"id"` + // Name of cloud provider. + Provider ProviderName `json:"provider"` + // Region ID for cloud provider region. + Region string `json:"region"` + Autoscale ConfigurationDataPlaneGroupAutoscale `json:"autoscale"` + // Array of environment variables to set for a data-plane group. + Environment []ConfigurationDataPlaneGroupEnvironmentField `json:"environment,omitempty"` + CloudGatewayNetworkID string `json:"cloud_gateway_network_id"` + // State of the data-plane group. + State ConfigurationDataPlaneGroupState `json:"state"` + // Metadata describing the backing state of the dataplane group and why it may be in an erroneous state. + // + StateMetadata *StateMetadata `json:"state_metadata,omitempty"` + // List of private IP addresses of the internal load balancer that proxies traffic to this data-plane group. + // + PrivateIPAddresses []string `json:"private_ip_addresses,omitempty"` + // List of egress IP addresses for the network that this data-plane group runs on. + // + EgressIPAddresses []string `json:"egress_ip_addresses,omitempty"` + // An RFC-3339 timestamp representation of data-plane group creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of data-plane group update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c ConfigurationDataPlaneGroup) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConfigurationDataPlaneGroup) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConfigurationDataPlaneGroup) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *ConfigurationDataPlaneGroup) GetProvider() ProviderName { + if o == nil { + return ProviderName("") + } + return o.Provider +} + +func (o *ConfigurationDataPlaneGroup) GetRegion() string { + if o == nil { + return "" + } + return o.Region +} + +func (o *ConfigurationDataPlaneGroup) GetAutoscale() ConfigurationDataPlaneGroupAutoscale { + if o == nil { + return ConfigurationDataPlaneGroupAutoscale{} + } + return o.Autoscale +} + +func (o *ConfigurationDataPlaneGroup) GetEnvironment() []ConfigurationDataPlaneGroupEnvironmentField { + if o == nil { + return nil + } + return o.Environment +} + +func (o *ConfigurationDataPlaneGroup) GetCloudGatewayNetworkID() string { + if o == nil { + return "" + } + return o.CloudGatewayNetworkID +} + +func (o *ConfigurationDataPlaneGroup) GetState() ConfigurationDataPlaneGroupState { + if o == nil { + return ConfigurationDataPlaneGroupState("") + } + return o.State +} + +func (o *ConfigurationDataPlaneGroup) GetStateMetadata() *StateMetadata { + if o == nil { + return nil + } + return o.StateMetadata +} + +func (o *ConfigurationDataPlaneGroup) GetPrivateIPAddresses() []string { + if o == nil { + return nil + } + return o.PrivateIPAddresses +} + +func (o *ConfigurationDataPlaneGroup) GetEgressIPAddresses() []string { + if o == nil { + return nil + } + return o.EgressIPAddresses +} + +func (o *ConfigurationDataPlaneGroup) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *ConfigurationDataPlaneGroup) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscale.go b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscale.go new file mode 100644 index 00000000..85eda13e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscale.go @@ -0,0 +1,72 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type ConfigurationDataPlaneGroupAutoscaleType string + +const ( + ConfigurationDataPlaneGroupAutoscaleTypeConfigurationDataPlaneGroupAutoscaleStatic ConfigurationDataPlaneGroupAutoscaleType = "ConfigurationDataPlaneGroupAutoscaleStatic" + ConfigurationDataPlaneGroupAutoscaleTypeConfigurationDataPlaneGroupAutoscaleAutopilot ConfigurationDataPlaneGroupAutoscaleType = "ConfigurationDataPlaneGroupAutoscaleAutopilot" +) + +type ConfigurationDataPlaneGroupAutoscale struct { + ConfigurationDataPlaneGroupAutoscaleStatic *ConfigurationDataPlaneGroupAutoscaleStatic `queryParam:"inline"` + ConfigurationDataPlaneGroupAutoscaleAutopilot *ConfigurationDataPlaneGroupAutoscaleAutopilot `queryParam:"inline"` + + Type ConfigurationDataPlaneGroupAutoscaleType +} + +func CreateConfigurationDataPlaneGroupAutoscaleConfigurationDataPlaneGroupAutoscaleStatic(configurationDataPlaneGroupAutoscaleStatic ConfigurationDataPlaneGroupAutoscaleStatic) ConfigurationDataPlaneGroupAutoscale { + typ := ConfigurationDataPlaneGroupAutoscaleTypeConfigurationDataPlaneGroupAutoscaleStatic + + return ConfigurationDataPlaneGroupAutoscale{ + ConfigurationDataPlaneGroupAutoscaleStatic: &configurationDataPlaneGroupAutoscaleStatic, + Type: typ, + } +} + +func CreateConfigurationDataPlaneGroupAutoscaleConfigurationDataPlaneGroupAutoscaleAutopilot(configurationDataPlaneGroupAutoscaleAutopilot ConfigurationDataPlaneGroupAutoscaleAutopilot) ConfigurationDataPlaneGroupAutoscale { + typ := ConfigurationDataPlaneGroupAutoscaleTypeConfigurationDataPlaneGroupAutoscaleAutopilot + + return ConfigurationDataPlaneGroupAutoscale{ + ConfigurationDataPlaneGroupAutoscaleAutopilot: &configurationDataPlaneGroupAutoscaleAutopilot, + Type: typ, + } +} + +func (u *ConfigurationDataPlaneGroupAutoscale) UnmarshalJSON(data []byte) error { + + var configurationDataPlaneGroupAutoscaleStatic ConfigurationDataPlaneGroupAutoscaleStatic = ConfigurationDataPlaneGroupAutoscaleStatic{} + if err := utils.UnmarshalJSON(data, &configurationDataPlaneGroupAutoscaleStatic, "", true, true); err == nil { + u.ConfigurationDataPlaneGroupAutoscaleStatic = &configurationDataPlaneGroupAutoscaleStatic + u.Type = ConfigurationDataPlaneGroupAutoscaleTypeConfigurationDataPlaneGroupAutoscaleStatic + return nil + } + + var configurationDataPlaneGroupAutoscaleAutopilot ConfigurationDataPlaneGroupAutoscaleAutopilot = ConfigurationDataPlaneGroupAutoscaleAutopilot{} + if err := utils.UnmarshalJSON(data, &configurationDataPlaneGroupAutoscaleAutopilot, "", true, true); err == nil { + u.ConfigurationDataPlaneGroupAutoscaleAutopilot = &configurationDataPlaneGroupAutoscaleAutopilot + u.Type = ConfigurationDataPlaneGroupAutoscaleTypeConfigurationDataPlaneGroupAutoscaleAutopilot + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for ConfigurationDataPlaneGroupAutoscale", string(data)) +} + +func (u ConfigurationDataPlaneGroupAutoscale) MarshalJSON() ([]byte, error) { + if u.ConfigurationDataPlaneGroupAutoscaleStatic != nil { + return utils.MarshalJSON(u.ConfigurationDataPlaneGroupAutoscaleStatic, "", true) + } + + if u.ConfigurationDataPlaneGroupAutoscaleAutopilot != nil { + return utils.MarshalJSON(u.ConfigurationDataPlaneGroupAutoscaleAutopilot, "", true) + } + + return nil, errors.New("could not marshal union type ConfigurationDataPlaneGroupAutoscale: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscaleautopilot.go b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscaleautopilot.go new file mode 100644 index 00000000..ed600d8a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscaleautopilot.go @@ -0,0 +1,63 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type ConfigurationDataPlaneGroupAutoscaleAutopilotKind string + +const ( + ConfigurationDataPlaneGroupAutoscaleAutopilotKindAutopilot ConfigurationDataPlaneGroupAutoscaleAutopilotKind = "autopilot" +) + +func (e ConfigurationDataPlaneGroupAutoscaleAutopilotKind) ToPointer() *ConfigurationDataPlaneGroupAutoscaleAutopilotKind { + return &e +} +func (e *ConfigurationDataPlaneGroupAutoscaleAutopilotKind) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "autopilot": + *e = ConfigurationDataPlaneGroupAutoscaleAutopilotKind(v) + return nil + default: + return fmt.Errorf("invalid value for ConfigurationDataPlaneGroupAutoscaleAutopilotKind: %v", v) + } +} + +// ConfigurationDataPlaneGroupAutoscaleAutopilot - Object that describes the autopilot autoscaling strategy. +type ConfigurationDataPlaneGroupAutoscaleAutopilot struct { + Kind ConfigurationDataPlaneGroupAutoscaleAutopilotKind `json:"kind"` + // Base number of requests per second that the deployment target should support. + BaseRps int64 `json:"base_rps"` + // Max number of requests per second that the deployment target should support. If not set, this defaults to 10x base_rps. This field is deprecated and shouldn't be used in new configurations as it will be removed in a future version. max_rps is now calculated as 10x base_rps. + // + // Deprecated: This will be removed in a future release, please migrate away from it as soon as possible. + MaxRps *int64 `json:"max_rps,omitempty"` +} + +func (o *ConfigurationDataPlaneGroupAutoscaleAutopilot) GetKind() ConfigurationDataPlaneGroupAutoscaleAutopilotKind { + if o == nil { + return ConfigurationDataPlaneGroupAutoscaleAutopilotKind("") + } + return o.Kind +} + +func (o *ConfigurationDataPlaneGroupAutoscaleAutopilot) GetBaseRps() int64 { + if o == nil { + return 0 + } + return o.BaseRps +} + +func (o *ConfigurationDataPlaneGroupAutoscaleAutopilot) GetMaxRps() *int64 { + if o == nil { + return nil + } + return o.MaxRps +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscalestatic.go b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscalestatic.go new file mode 100644 index 00000000..319ce9da --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupautoscalestatic.go @@ -0,0 +1,61 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type ConfigurationDataPlaneGroupAutoscaleStaticKind string + +const ( + ConfigurationDataPlaneGroupAutoscaleStaticKindStatic ConfigurationDataPlaneGroupAutoscaleStaticKind = "static" +) + +func (e ConfigurationDataPlaneGroupAutoscaleStaticKind) ToPointer() *ConfigurationDataPlaneGroupAutoscaleStaticKind { + return &e +} +func (e *ConfigurationDataPlaneGroupAutoscaleStaticKind) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "static": + *e = ConfigurationDataPlaneGroupAutoscaleStaticKind(v) + return nil + default: + return fmt.Errorf("invalid value for ConfigurationDataPlaneGroupAutoscaleStaticKind: %v", v) + } +} + +// ConfigurationDataPlaneGroupAutoscaleStatic - Object that describes the static autoscaling strategy. +type ConfigurationDataPlaneGroupAutoscaleStatic struct { + Kind ConfigurationDataPlaneGroupAutoscaleStaticKind `json:"kind"` + // Instance type name to indicate capacity. + InstanceType InstanceTypeName `json:"instance_type"` + // Number of data-planes the deployment target will contain. + RequestedInstances int64 `json:"requested_instances"` +} + +func (o *ConfigurationDataPlaneGroupAutoscaleStatic) GetKind() ConfigurationDataPlaneGroupAutoscaleStaticKind { + if o == nil { + return ConfigurationDataPlaneGroupAutoscaleStaticKind("") + } + return o.Kind +} + +func (o *ConfigurationDataPlaneGroupAutoscaleStatic) GetInstanceType() InstanceTypeName { + if o == nil { + return InstanceTypeName("") + } + return o.InstanceType +} + +func (o *ConfigurationDataPlaneGroupAutoscaleStatic) GetRequestedInstances() int64 { + if o == nil { + return 0 + } + return o.RequestedInstances +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupconfig.go b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupconfig.go new file mode 100644 index 00000000..a928e9e2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupconfig.go @@ -0,0 +1,50 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ConfigurationDataPlaneGroupConfig - Object that describes where a data-plane group will be deployed to, along with how many instances. +type ConfigurationDataPlaneGroupConfig struct { + // Name of cloud provider. + Provider ProviderName `json:"provider"` + // Region ID for cloud provider region. + Region string `json:"region"` + CloudGatewayNetworkID string `json:"cloud_gateway_network_id"` + Autoscale ConfigurationDataPlaneGroupAutoscale `json:"autoscale"` + // Array of environment variables to set for a data-plane group. + Environment []ConfigurationDataPlaneGroupEnvironmentField `json:"environment,omitempty"` +} + +func (o *ConfigurationDataPlaneGroupConfig) GetProvider() ProviderName { + if o == nil { + return ProviderName("") + } + return o.Provider +} + +func (o *ConfigurationDataPlaneGroupConfig) GetRegion() string { + if o == nil { + return "" + } + return o.Region +} + +func (o *ConfigurationDataPlaneGroupConfig) GetCloudGatewayNetworkID() string { + if o == nil { + return "" + } + return o.CloudGatewayNetworkID +} + +func (o *ConfigurationDataPlaneGroupConfig) GetAutoscale() ConfigurationDataPlaneGroupAutoscale { + if o == nil { + return ConfigurationDataPlaneGroupAutoscale{} + } + return o.Autoscale +} + +func (o *ConfigurationDataPlaneGroupConfig) GetEnvironment() []ConfigurationDataPlaneGroupEnvironmentField { + if o == nil { + return nil + } + return o.Environment +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupenvironmentfield.go b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupenvironmentfield.go new file mode 100644 index 00000000..0b6da413 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationdataplanegroupenvironmentfield.go @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ConfigurationDataPlaneGroupEnvironmentField - Environment variable name and value to set for a data-plane group. +type ConfigurationDataPlaneGroupEnvironmentField struct { + // Name of the environment variable field to set for the data-plane group. Must be prefixed by KONG_. + // + Name string `json:"name"` + // Value assigned to the environment variable field for the data-plane group. + Value string `json:"value"` +} + +func (o *ConfigurationDataPlaneGroupEnvironmentField) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ConfigurationDataPlaneGroupEnvironmentField) GetValue() string { + if o == nil { + return "" + } + return o.Value +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationfilterparameters.go b/tests/mockserver/internal/sdk/models/components/configurationfilterparameters.go new file mode 100644 index 00000000..dcba79bf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationfilterparameters.go @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ConfigurationFilterParameters struct { + // Filters on the given string field value by exact match inequality. + EventTitle *StringFieldFilter `queryParam:"name=event_title"` + // Filters on the given string field value by exact match inequality. + EventDescription *StringFieldFilter `queryParam:"name=event_description"` + // Filters on the given string field value by exact match inequality. + EventNamespace *StringFieldFilter `queryParam:"name=event_namespace"` + // Filters on the given string field value by exact match inequality. + Region *StringFieldFilter `queryParam:"name=region"` +} + +func (o *ConfigurationFilterParameters) GetEventTitle() *StringFieldFilter { + if o == nil { + return nil + } + return o.EventTitle +} + +func (o *ConfigurationFilterParameters) GetEventDescription() *StringFieldFilter { + if o == nil { + return nil + } + return o.EventDescription +} + +func (o *ConfigurationFilterParameters) GetEventNamespace() *StringFieldFilter { + if o == nil { + return nil + } + return o.EventNamespace +} + +func (o *ConfigurationFilterParameters) GetRegion() *StringFieldFilter { + if o == nil { + return nil + } + return o.Region +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationmanifest.go b/tests/mockserver/internal/sdk/models/components/configurationmanifest.go new file mode 100644 index 00000000..d1a4b81b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationmanifest.go @@ -0,0 +1,114 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// ConfigurationManifest - Object containing information about a control-plane's cloud-gateways configuration. +type ConfigurationManifest struct { + ID string `json:"id"` + // Supported gateway version. + Version string `json:"version"` + // Type of API access data-plane groups will support for a configuration. + APIAccess *APIAccess `default:"private+public" json:"api_access"` + // Object that describes where data-planes will be deployed to, along with how many instances. + DataplaneGroupConfig []ConfigurationDataPlaneGroupConfig `json:"dataplane_group_config"` + // List of data-plane groups that describe where data-planes will be deployed to, along with how many + // instances. + // + DataplaneGroups []ConfigurationDataPlaneGroup `json:"dataplane_groups"` + // Positive, monotonically increasing version integer, to serialize configuration changes. + // + EntityVersion float64 `json:"entity_version"` + // An RFC-3339 timestamp representation of configuration creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of configuration update date. + UpdatedAt time.Time `json:"updated_at"` + ControlPlaneID string `json:"control_plane_id"` + // Set of control-plane geos supported for deploying cloud-gateways configurations. + ControlPlaneGeo ControlPlaneGeo `json:"control_plane_geo"` +} + +func (c ConfigurationManifest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConfigurationManifest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConfigurationManifest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *ConfigurationManifest) GetVersion() string { + if o == nil { + return "" + } + return o.Version +} + +func (o *ConfigurationManifest) GetAPIAccess() *APIAccess { + if o == nil { + return nil + } + return o.APIAccess +} + +func (o *ConfigurationManifest) GetDataplaneGroupConfig() []ConfigurationDataPlaneGroupConfig { + if o == nil { + return []ConfigurationDataPlaneGroupConfig{} + } + return o.DataplaneGroupConfig +} + +func (o *ConfigurationManifest) GetDataplaneGroups() []ConfigurationDataPlaneGroup { + if o == nil { + return []ConfigurationDataPlaneGroup{} + } + return o.DataplaneGroups +} + +func (o *ConfigurationManifest) GetEntityVersion() float64 { + if o == nil { + return 0.0 + } + return o.EntityVersion +} + +func (o *ConfigurationManifest) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *ConfigurationManifest) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +func (o *ConfigurationManifest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ConfigurationManifest) GetControlPlaneGeo() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.ControlPlaneGeo +} diff --git a/tests/mockserver/internal/sdk/models/components/configurationsfilterparameters.go b/tests/mockserver/internal/sdk/models/components/configurationsfilterparameters.go new file mode 100644 index 00000000..0a912db8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configurationsfilterparameters.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ConfigurationsFilterParameters struct { + // Returns entities that exact match any of the comma-delimited phrases in the filter string. + ControlPlaneID *IDFieldFilter `queryParam:"name=control_plane_id"` + ControlPlaneGeo *ControlPlaneGeoFieldFilter `queryParam:"name=control_plane_geo"` +} + +func (o *ConfigurationsFilterParameters) GetControlPlaneID() *IDFieldFilter { + if o == nil { + return nil + } + return o.ControlPlaneID +} + +func (o *ConfigurationsFilterParameters) GetControlPlaneGeo() *ControlPlaneGeoFieldFilter { + if o == nil { + return nil + } + return o.ControlPlaneGeo +} diff --git a/tests/mockserver/internal/sdk/models/components/configureoidcidentityproviderconfig.go b/tests/mockserver/internal/sdk/models/components/configureoidcidentityproviderconfig.go new file mode 100644 index 00000000..2cd76906 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/configureoidcidentityproviderconfig.go @@ -0,0 +1,54 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ConfigureOIDCIdentityProviderConfig - The identity provider that contains configuration data for the OIDC authentication integration. +type ConfigureOIDCIdentityProviderConfig struct { + // The issuer URI of the identity provider. This is the URL where the provider's metadata can be obtained. + IssuerURL string `json:"issuer_url"` + // The client ID assigned to your application by the identity provider. + ClientID string `json:"client_id"` + // The Client Secret assigned to your application by the identity provider. + ClientSecret *string `json:"client_secret,omitempty"` + // The scopes requested by your application when authenticating with the identity provider. + Scopes []string `json:"scopes,omitempty"` + // Defines the mappings between OpenID Connect (OIDC) claims and local claims used by your application for + // authentication. + // + ClaimMappings *OIDCIdentityProviderClaimMappings `json:"claim_mappings,omitempty"` +} + +func (o *ConfigureOIDCIdentityProviderConfig) GetIssuerURL() string { + if o == nil { + return "" + } + return o.IssuerURL +} + +func (o *ConfigureOIDCIdentityProviderConfig) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *ConfigureOIDCIdentityProviderConfig) GetClientSecret() *string { + if o == nil { + return nil + } + return o.ClientSecret +} + +func (o *ConfigureOIDCIdentityProviderConfig) GetScopes() []string { + if o == nil { + return nil + } + return o.Scopes +} + +func (o *ConfigureOIDCIdentityProviderConfig) GetClaimMappings() *OIDCIdentityProviderClaimMappings { + if o == nil { + return nil + } + return o.ClaimMappings +} diff --git a/tests/mockserver/internal/sdk/models/components/consumer.go b/tests/mockserver/internal/sdk/models/components/consumer.go new file mode 100644 index 00000000..af075637 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/consumer.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// The Consumer object represents a consumer - or a user - of a Service. You can either rely on Kong as the primary datastore, or you can map the consumer list with your database to keep consistency between Kong and your existing primary datastore. +type Consumer struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Field for storing an existing unique ID for the Consumer - useful for mapping Kong with users in your existing database. You must send either this field or `username` with the request. + CustomID *string `json:"custom_id,omitempty"` + ID *string `json:"id,omitempty"` + // An optional set of strings associated with the Consumer for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + // The unique username of the Consumer. You must send either this field or `custom_id` with the request. + Username *string `json:"username,omitempty"` +} + +func (o *Consumer) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Consumer) GetCustomID() *string { + if o == nil { + return nil + } + return o.CustomID +} + +func (o *Consumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Consumer) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Consumer) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *Consumer) GetUsername() *string { + if o == nil { + return nil + } + return o.Username +} diff --git a/tests/mockserver/internal/sdk/models/components/consumergroup.go b/tests/mockserver/internal/sdk/models/components/consumergroup.go new file mode 100644 index 00000000..6543027c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/consumergroup.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ConsumerGroup struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Name string `json:"name"` + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *ConsumerGroup) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ConsumerGroup) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ConsumerGroup) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ConsumerGroup) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *ConsumerGroup) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/consumergroupinsidewrapper.go b/tests/mockserver/internal/sdk/models/components/consumergroupinsidewrapper.go new file mode 100644 index 00000000..206633fc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/consumergroupinsidewrapper.go @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ConsumerGroupInsideWrapper struct { + ConsumerGroup *ConsumerGroup `json:"consumer_group,omitempty"` +} + +func (o *ConsumerGroupInsideWrapper) GetConsumerGroup() *ConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroup +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplane.go b/tests/mockserver/internal/sdk/models/components/controlplane.go new file mode 100644 index 00000000..52dfb5b3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplane.go @@ -0,0 +1,212 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// ControlPlaneClusterType - The ClusterType value of the cluster associated with the Control Plane. +type ControlPlaneClusterType string + +const ( + ControlPlaneClusterTypeClusterTypeControlPlane ControlPlaneClusterType = "CLUSTER_TYPE_CONTROL_PLANE" + ControlPlaneClusterTypeClusterTypeK8SIngressController ControlPlaneClusterType = "CLUSTER_TYPE_K8S_INGRESS_CONTROLLER" + ControlPlaneClusterTypeClusterTypeControlPlaneGroup ControlPlaneClusterType = "CLUSTER_TYPE_CONTROL_PLANE_GROUP" + ControlPlaneClusterTypeClusterTypeServerless ControlPlaneClusterType = "CLUSTER_TYPE_SERVERLESS" + ControlPlaneClusterTypeClusterTypeKafkaNativeEventProxy ControlPlaneClusterType = "CLUSTER_TYPE_KAFKA_NATIVE_EVENT_PROXY" +) + +func (e ControlPlaneClusterType) ToPointer() *ControlPlaneClusterType { + return &e +} +func (e *ControlPlaneClusterType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "CLUSTER_TYPE_CONTROL_PLANE": + fallthrough + case "CLUSTER_TYPE_K8S_INGRESS_CONTROLLER": + fallthrough + case "CLUSTER_TYPE_CONTROL_PLANE_GROUP": + fallthrough + case "CLUSTER_TYPE_SERVERLESS": + fallthrough + case "CLUSTER_TYPE_KAFKA_NATIVE_EVENT_PROXY": + *e = ControlPlaneClusterType(v) + return nil + default: + return fmt.Errorf("invalid value for ControlPlaneClusterType: %v", v) + } +} + +// ControlPlaneAuthType - The auth type value of the cluster associated with the Runtime Group. +type ControlPlaneAuthType string + +const ( + ControlPlaneAuthTypePinnedClientCerts ControlPlaneAuthType = "pinned_client_certs" + ControlPlaneAuthTypePkiClientCerts ControlPlaneAuthType = "pki_client_certs" +) + +func (e ControlPlaneAuthType) ToPointer() *ControlPlaneAuthType { + return &e +} +func (e *ControlPlaneAuthType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "pinned_client_certs": + fallthrough + case "pki_client_certs": + *e = ControlPlaneAuthType(v) + return nil + default: + return fmt.Errorf("invalid value for ControlPlaneAuthType: %v", v) + } +} + +// ControlPlaneConfig - CP configuration object for related access endpoints. +type ControlPlaneConfig struct { + // Control Plane Endpoint. + ControlPlaneEndpoint string `json:"control_plane_endpoint"` + // Telemetry Endpoint. + TelemetryEndpoint string `json:"telemetry_endpoint"` + // The ClusterType value of the cluster associated with the Control Plane. + ClusterType ControlPlaneClusterType `json:"cluster_type"` + // The auth type value of the cluster associated with the Runtime Group. + AuthType ControlPlaneAuthType `json:"auth_type"` + // Whether the Control Plane can be used for cloud-gateways. + CloudGateway bool `json:"cloud_gateway"` + // Array of proxy URLs associated with reaching the data-planes connected to a control-plane. + ProxyUrls []ProxyURL `json:"proxy_urls,omitempty"` +} + +func (o *ControlPlaneConfig) GetControlPlaneEndpoint() string { + if o == nil { + return "" + } + return o.ControlPlaneEndpoint +} + +func (o *ControlPlaneConfig) GetTelemetryEndpoint() string { + if o == nil { + return "" + } + return o.TelemetryEndpoint +} + +func (o *ControlPlaneConfig) GetClusterType() ControlPlaneClusterType { + if o == nil { + return ControlPlaneClusterType("") + } + return o.ClusterType +} + +func (o *ControlPlaneConfig) GetAuthType() ControlPlaneAuthType { + if o == nil { + return ControlPlaneAuthType("") + } + return o.AuthType +} + +func (o *ControlPlaneConfig) GetCloudGateway() bool { + if o == nil { + return false + } + return o.CloudGateway +} + +func (o *ControlPlaneConfig) GetProxyUrls() []ProxyURL { + if o == nil { + return nil + } + return o.ProxyUrls +} + +// ControlPlane - The control plane object contains information about a Kong control plane. +type ControlPlane struct { + // The control plane ID. + ID string `json:"id"` + // The name of the control plane. + Name string `json:"name"` + // The description of the control plane in Konnect. + Description *string `json:"description,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // CP configuration object for related access endpoints. + Config ControlPlaneConfig `json:"config"` + // An ISO-8604 timestamp representation of control plane creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8604 timestamp representation of control plane update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c ControlPlane) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ControlPlane) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ControlPlane) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *ControlPlane) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ControlPlane) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *ControlPlane) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *ControlPlane) GetConfig() ControlPlaneConfig { + if o == nil { + return ControlPlaneConfig{} + } + return o.Config +} + +func (o *ControlPlane) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *ControlPlane) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplanefilterparameters.go b/tests/mockserver/internal/sdk/models/components/controlplanefilterparameters.go new file mode 100644 index 00000000..5357e977 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplanefilterparameters.go @@ -0,0 +1,110 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ID - Returns entities that exact match any of the comma-delimited phrases in the filter string. +type ID struct { + Eq *string `queryParam:"name=eq"` + Oeq *string `queryParam:"name=oeq"` +} + +func (o *ID) GetEq() *string { + if o == nil { + return nil + } + return o.Eq +} + +func (o *ID) GetOeq() *string { + if o == nil { + return nil + } + return o.Oeq +} + +// ControlPlaneFilterParametersName - Filters on the given string field value by exact match inequality. +type ControlPlaneFilterParametersName struct { + Eq *string `queryParam:"name=eq"` + Contains *string `queryParam:"name=contains"` + Neq *string `queryParam:"name=neq"` +} + +func (o *ControlPlaneFilterParametersName) GetEq() *string { + if o == nil { + return nil + } + return o.Eq +} + +func (o *ControlPlaneFilterParametersName) GetContains() *string { + if o == nil { + return nil + } + return o.Contains +} + +func (o *ControlPlaneFilterParametersName) GetNeq() *string { + if o == nil { + return nil + } + return o.Neq +} + +// ControlPlaneFilterParametersClusterType - Filters on the given string field value by exact match inequality. +type ControlPlaneFilterParametersClusterType struct { + Eq *string `queryParam:"name=eq"` + Neq *string `queryParam:"name=neq"` +} + +func (o *ControlPlaneFilterParametersClusterType) GetEq() *string { + if o == nil { + return nil + } + return o.Eq +} + +func (o *ControlPlaneFilterParametersClusterType) GetNeq() *string { + if o == nil { + return nil + } + return o.Neq +} + +type ControlPlaneFilterParameters struct { + // Returns entities that exact match any of the comma-delimited phrases in the filter string. + ID *ID `queryParam:"name=id"` + // Filters on the given string field value by exact match inequality. + Name *ControlPlaneFilterParametersName `queryParam:"name=name"` + // Filters on the given string field value by exact match inequality. + ClusterType *ControlPlaneFilterParametersClusterType `queryParam:"name=cluster_type"` + // Filter by a boolean value (true/false). + CloudGateway *bool `queryParam:"name=cloud_gateway"` +} + +func (o *ControlPlaneFilterParameters) GetID() *ID { + if o == nil { + return nil + } + return o.ID +} + +func (o *ControlPlaneFilterParameters) GetName() *ControlPlaneFilterParametersName { + if o == nil { + return nil + } + return o.Name +} + +func (o *ControlPlaneFilterParameters) GetClusterType() *ControlPlaneFilterParametersClusterType { + if o == nil { + return nil + } + return o.ClusterType +} + +func (o *ControlPlaneFilterParameters) GetCloudGateway() *bool { + if o == nil { + return nil + } + return o.CloudGateway +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplanegeo.go b/tests/mockserver/internal/sdk/models/components/controlplanegeo.go new file mode 100644 index 00000000..cbc6158f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplanegeo.go @@ -0,0 +1,44 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ControlPlaneGeo - Set of control-plane geos supported for deploying cloud-gateways configurations. +type ControlPlaneGeo string + +const ( + ControlPlaneGeoUs ControlPlaneGeo = "us" + ControlPlaneGeoEu ControlPlaneGeo = "eu" + ControlPlaneGeoAu ControlPlaneGeo = "au" + ControlPlaneGeoMe ControlPlaneGeo = "me" + ControlPlaneGeoIn ControlPlaneGeo = "in" +) + +func (e ControlPlaneGeo) ToPointer() *ControlPlaneGeo { + return &e +} +func (e *ControlPlaneGeo) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "us": + fallthrough + case "eu": + fallthrough + case "au": + fallthrough + case "me": + fallthrough + case "in": + *e = ControlPlaneGeo(v) + return nil + default: + return fmt.Errorf("invalid value for ControlPlaneGeo: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplanegeofieldequalsfilter.go b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldequalsfilter.go new file mode 100644 index 00000000..b11ca09f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldequalsfilter.go @@ -0,0 +1,85 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type ControlPlaneGeoFieldEqualsComparison struct { + // Set of control-plane geos supported for deploying cloud-gateways configurations. + Eq ControlPlaneGeo `queryParam:"name=eq"` +} + +func (o *ControlPlaneGeoFieldEqualsComparison) GetEq() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.Eq +} + +type ControlPlaneGeoFieldEqualsFilterType string + +const ( + ControlPlaneGeoFieldEqualsFilterTypeControlPlaneGeo ControlPlaneGeoFieldEqualsFilterType = "ControlPlaneGeo" + ControlPlaneGeoFieldEqualsFilterTypeControlPlaneGeoFieldEqualsComparison ControlPlaneGeoFieldEqualsFilterType = "ControlPlaneGeoFieldEqualsComparison" +) + +// ControlPlaneGeoFieldEqualsFilter - Filter a control-plane geo by exact match. +type ControlPlaneGeoFieldEqualsFilter struct { + ControlPlaneGeo *ControlPlaneGeo `queryParam:"inline"` + ControlPlaneGeoFieldEqualsComparison *ControlPlaneGeoFieldEqualsComparison `queryParam:"inline"` + + Type ControlPlaneGeoFieldEqualsFilterType +} + +func CreateControlPlaneGeoFieldEqualsFilterControlPlaneGeo(controlPlaneGeo ControlPlaneGeo) ControlPlaneGeoFieldEqualsFilter { + typ := ControlPlaneGeoFieldEqualsFilterTypeControlPlaneGeo + + return ControlPlaneGeoFieldEqualsFilter{ + ControlPlaneGeo: &controlPlaneGeo, + Type: typ, + } +} + +func CreateControlPlaneGeoFieldEqualsFilterControlPlaneGeoFieldEqualsComparison(controlPlaneGeoFieldEqualsComparison ControlPlaneGeoFieldEqualsComparison) ControlPlaneGeoFieldEqualsFilter { + typ := ControlPlaneGeoFieldEqualsFilterTypeControlPlaneGeoFieldEqualsComparison + + return ControlPlaneGeoFieldEqualsFilter{ + ControlPlaneGeoFieldEqualsComparison: &controlPlaneGeoFieldEqualsComparison, + Type: typ, + } +} + +func (u *ControlPlaneGeoFieldEqualsFilter) UnmarshalJSON(data []byte) error { + + var controlPlaneGeoFieldEqualsComparison ControlPlaneGeoFieldEqualsComparison = ControlPlaneGeoFieldEqualsComparison{} + if err := utils.UnmarshalJSON(data, &controlPlaneGeoFieldEqualsComparison, "", true, true); err == nil { + u.ControlPlaneGeoFieldEqualsComparison = &controlPlaneGeoFieldEqualsComparison + u.Type = ControlPlaneGeoFieldEqualsFilterTypeControlPlaneGeoFieldEqualsComparison + return nil + } + + var controlPlaneGeo ControlPlaneGeo = ControlPlaneGeo("") + if err := utils.UnmarshalJSON(data, &controlPlaneGeo, "", true, true); err == nil { + u.ControlPlaneGeo = &controlPlaneGeo + u.Type = ControlPlaneGeoFieldEqualsFilterTypeControlPlaneGeo + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for ControlPlaneGeoFieldEqualsFilter", string(data)) +} + +func (u ControlPlaneGeoFieldEqualsFilter) MarshalJSON() ([]byte, error) { + if u.ControlPlaneGeo != nil { + return utils.MarshalJSON(u.ControlPlaneGeo, "", true) + } + + if u.ControlPlaneGeoFieldEqualsComparison != nil { + return utils.MarshalJSON(u.ControlPlaneGeoFieldEqualsComparison, "", true) + } + + return nil, errors.New("could not marshal union type ControlPlaneGeoFieldEqualsFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplanegeofieldfilter.go b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldfilter.go new file mode 100644 index 00000000..555f37b7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldfilter.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type ControlPlaneGeoFieldFilterType string + +const ( + ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldEqualsFilter ControlPlaneGeoFieldFilterType = "ControlPlaneGeoFieldEqualsFilter" + ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldNotEqualsFilter ControlPlaneGeoFieldFilterType = "ControlPlaneGeoFieldNotEqualsFilter" + ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldOrEqualityFilter ControlPlaneGeoFieldFilterType = "ControlPlaneGeoFieldOrEqualityFilter" +) + +type ControlPlaneGeoFieldFilter struct { + ControlPlaneGeoFieldEqualsFilter *ControlPlaneGeoFieldEqualsFilter `queryParam:"inline"` + ControlPlaneGeoFieldNotEqualsFilter *ControlPlaneGeoFieldNotEqualsFilter `queryParam:"inline"` + ControlPlaneGeoFieldOrEqualityFilter *ControlPlaneGeoFieldOrEqualityFilter `queryParam:"inline"` + + Type ControlPlaneGeoFieldFilterType +} + +func CreateControlPlaneGeoFieldFilterControlPlaneGeoFieldEqualsFilter(controlPlaneGeoFieldEqualsFilter ControlPlaneGeoFieldEqualsFilter) ControlPlaneGeoFieldFilter { + typ := ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldEqualsFilter + + return ControlPlaneGeoFieldFilter{ + ControlPlaneGeoFieldEqualsFilter: &controlPlaneGeoFieldEqualsFilter, + Type: typ, + } +} + +func CreateControlPlaneGeoFieldFilterControlPlaneGeoFieldNotEqualsFilter(controlPlaneGeoFieldNotEqualsFilter ControlPlaneGeoFieldNotEqualsFilter) ControlPlaneGeoFieldFilter { + typ := ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldNotEqualsFilter + + return ControlPlaneGeoFieldFilter{ + ControlPlaneGeoFieldNotEqualsFilter: &controlPlaneGeoFieldNotEqualsFilter, + Type: typ, + } +} + +func CreateControlPlaneGeoFieldFilterControlPlaneGeoFieldOrEqualityFilter(controlPlaneGeoFieldOrEqualityFilter ControlPlaneGeoFieldOrEqualityFilter) ControlPlaneGeoFieldFilter { + typ := ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldOrEqualityFilter + + return ControlPlaneGeoFieldFilter{ + ControlPlaneGeoFieldOrEqualityFilter: &controlPlaneGeoFieldOrEqualityFilter, + Type: typ, + } +} + +func (u *ControlPlaneGeoFieldFilter) UnmarshalJSON(data []byte) error { + + var controlPlaneGeoFieldNotEqualsFilter ControlPlaneGeoFieldNotEqualsFilter = ControlPlaneGeoFieldNotEqualsFilter{} + if err := utils.UnmarshalJSON(data, &controlPlaneGeoFieldNotEqualsFilter, "", true, true); err == nil { + u.ControlPlaneGeoFieldNotEqualsFilter = &controlPlaneGeoFieldNotEqualsFilter + u.Type = ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldNotEqualsFilter + return nil + } + + var controlPlaneGeoFieldOrEqualityFilter ControlPlaneGeoFieldOrEqualityFilter = ControlPlaneGeoFieldOrEqualityFilter{} + if err := utils.UnmarshalJSON(data, &controlPlaneGeoFieldOrEqualityFilter, "", true, true); err == nil { + u.ControlPlaneGeoFieldOrEqualityFilter = &controlPlaneGeoFieldOrEqualityFilter + u.Type = ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldOrEqualityFilter + return nil + } + + var controlPlaneGeoFieldEqualsFilter ControlPlaneGeoFieldEqualsFilter = ControlPlaneGeoFieldEqualsFilter{} + if err := utils.UnmarshalJSON(data, &controlPlaneGeoFieldEqualsFilter, "", true, true); err == nil { + u.ControlPlaneGeoFieldEqualsFilter = &controlPlaneGeoFieldEqualsFilter + u.Type = ControlPlaneGeoFieldFilterTypeControlPlaneGeoFieldEqualsFilter + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for ControlPlaneGeoFieldFilter", string(data)) +} + +func (u ControlPlaneGeoFieldFilter) MarshalJSON() ([]byte, error) { + if u.ControlPlaneGeoFieldEqualsFilter != nil { + return utils.MarshalJSON(u.ControlPlaneGeoFieldEqualsFilter, "", true) + } + + if u.ControlPlaneGeoFieldNotEqualsFilter != nil { + return utils.MarshalJSON(u.ControlPlaneGeoFieldNotEqualsFilter, "", true) + } + + if u.ControlPlaneGeoFieldOrEqualityFilter != nil { + return utils.MarshalJSON(u.ControlPlaneGeoFieldOrEqualityFilter, "", true) + } + + return nil, errors.New("could not marshal union type ControlPlaneGeoFieldFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplanegeofieldnotequalsfilter.go b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldnotequalsfilter.go new file mode 100644 index 00000000..7ead7da6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldnotequalsfilter.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ControlPlaneGeoFieldNotEqualsFilter - Filter a control-plane geo by inequality match. +type ControlPlaneGeoFieldNotEqualsFilter struct { + // Set of control-plane geos supported for deploying cloud-gateways configurations. + Neq ControlPlaneGeo `queryParam:"name=neq"` +} + +func (o *ControlPlaneGeoFieldNotEqualsFilter) GetNeq() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.Neq +} diff --git a/tests/mockserver/internal/sdk/models/components/controlplanegeofieldorequalityfilter.go b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldorequalityfilter.go new file mode 100644 index 00000000..c9bfa3d8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/controlplanegeofieldorequalityfilter.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ControlPlaneGeoFieldOrEqualityFilter - Filter a control-plane geo by determining if the value is equal to any in a set of values, where the set is a +// comma-delimited list. +type ControlPlaneGeoFieldOrEqualityFilter struct { + Oeq string `queryParam:"name=oeq"` +} + +func (o *ControlPlaneGeoFieldOrEqualityFilter) GetOeq() string { + if o == nil { + return "" + } + return o.Oeq +} diff --git a/tests/mockserver/internal/sdk/models/components/createappauthstrategyrequest.go b/tests/mockserver/internal/sdk/models/components/createappauthstrategyrequest.go new file mode 100644 index 00000000..e4e803d2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createappauthstrategyrequest.go @@ -0,0 +1,289 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type AppAuthStrategyOpenIDConnectRequestStrategyType string + +const ( + AppAuthStrategyOpenIDConnectRequestStrategyTypeOpenidConnect AppAuthStrategyOpenIDConnectRequestStrategyType = "openid_connect" +) + +func (e AppAuthStrategyOpenIDConnectRequestStrategyType) ToPointer() *AppAuthStrategyOpenIDConnectRequestStrategyType { + return &e +} +func (e *AppAuthStrategyOpenIDConnectRequestStrategyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "openid_connect": + *e = AppAuthStrategyOpenIDConnectRequestStrategyType(v) + return nil + default: + return fmt.Errorf("invalid value for AppAuthStrategyOpenIDConnectRequestStrategyType: %v", v) + } +} + +// AppAuthStrategyOpenIDConnectRequestConfigs - JSON-B object containing the configuration for the OIDC strategy +type AppAuthStrategyOpenIDConnectRequestConfigs struct { + // A more advanced mode to configure an API Product Version’s Application Auth Strategy. + // Using this mode will allow developers to use API credentials issued from an external IdP that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for the same Auth Strategy. + // An OIDC strategy may be used in conjunction with a DCR provider to automatically create the IdP application. + // + OpenidConnect AppAuthStrategyConfigOpenIDConnect `json:"openid-connect"` +} + +func (o *AppAuthStrategyOpenIDConnectRequestConfigs) GetOpenidConnect() AppAuthStrategyConfigOpenIDConnect { + if o == nil { + return AppAuthStrategyConfigOpenIDConnect{} + } + return o.OpenidConnect +} + +// AppAuthStrategyOpenIDConnectRequest - Payload for creating an OIDC Application Auth Strategy +type AppAuthStrategyOpenIDConnectRequest struct { + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name string `json:"name"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName string `json:"display_name"` + StrategyType AppAuthStrategyOpenIDConnectRequestStrategyType `json:"strategy_type"` + // JSON-B object containing the configuration for the OIDC strategy + Configs AppAuthStrategyOpenIDConnectRequestConfigs `json:"configs"` + DcrProviderID *string `json:"dcr_provider_id,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *AppAuthStrategyOpenIDConnectRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AppAuthStrategyOpenIDConnectRequest) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *AppAuthStrategyOpenIDConnectRequest) GetStrategyType() AppAuthStrategyOpenIDConnectRequestStrategyType { + if o == nil { + return AppAuthStrategyOpenIDConnectRequestStrategyType("") + } + return o.StrategyType +} + +func (o *AppAuthStrategyOpenIDConnectRequest) GetConfigs() AppAuthStrategyOpenIDConnectRequestConfigs { + if o == nil { + return AppAuthStrategyOpenIDConnectRequestConfigs{} + } + return o.Configs +} + +func (o *AppAuthStrategyOpenIDConnectRequest) GetDcrProviderID() *string { + if o == nil { + return nil + } + return o.DcrProviderID +} + +func (o *AppAuthStrategyOpenIDConnectRequest) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +type AppAuthStrategyKeyAuthRequestStrategyType string + +const ( + AppAuthStrategyKeyAuthRequestStrategyTypeKeyAuth AppAuthStrategyKeyAuthRequestStrategyType = "key_auth" +) + +func (e AppAuthStrategyKeyAuthRequestStrategyType) ToPointer() *AppAuthStrategyKeyAuthRequestStrategyType { + return &e +} +func (e *AppAuthStrategyKeyAuthRequestStrategyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "key_auth": + *e = AppAuthStrategyKeyAuthRequestStrategyType(v) + return nil + default: + return fmt.Errorf("invalid value for AppAuthStrategyKeyAuthRequestStrategyType: %v", v) + } +} + +// AppAuthStrategyKeyAuthRequestConfigs - JSON-B object containing the configuration for the Key Auth strategy +type AppAuthStrategyKeyAuthRequestConfigs struct { + // The most basic mode to configure an Application Auth Strategy for an API Product Version. + // Using this mode will allow developers to generate API keys that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for Key Auth. + // + KeyAuth AppAuthStrategyConfigKeyAuth `json:"key-auth"` +} + +func (o *AppAuthStrategyKeyAuthRequestConfigs) GetKeyAuth() AppAuthStrategyConfigKeyAuth { + if o == nil { + return AppAuthStrategyConfigKeyAuth{} + } + return o.KeyAuth +} + +// AppAuthStrategyKeyAuthRequest - Request for creating a Key Auth Application Auth Strategy +type AppAuthStrategyKeyAuthRequest struct { + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name string `json:"name"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName string `json:"display_name"` + StrategyType AppAuthStrategyKeyAuthRequestStrategyType `json:"strategy_type"` + // JSON-B object containing the configuration for the Key Auth strategy + Configs AppAuthStrategyKeyAuthRequestConfigs `json:"configs"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *AppAuthStrategyKeyAuthRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AppAuthStrategyKeyAuthRequest) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *AppAuthStrategyKeyAuthRequest) GetStrategyType() AppAuthStrategyKeyAuthRequestStrategyType { + if o == nil { + return AppAuthStrategyKeyAuthRequestStrategyType("") + } + return o.StrategyType +} + +func (o *AppAuthStrategyKeyAuthRequest) GetConfigs() AppAuthStrategyKeyAuthRequestConfigs { + if o == nil { + return AppAuthStrategyKeyAuthRequestConfigs{} + } + return o.Configs +} + +func (o *AppAuthStrategyKeyAuthRequest) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +type CreateAppAuthStrategyRequestType string + +const ( + CreateAppAuthStrategyRequestTypeKeyAuth CreateAppAuthStrategyRequestType = "key_auth" + CreateAppAuthStrategyRequestTypeOpenidConnect CreateAppAuthStrategyRequestType = "openid_connect" +) + +// CreateAppAuthStrategyRequest - Request body for creating an Application Auth Strategy +type CreateAppAuthStrategyRequest struct { + AppAuthStrategyKeyAuthRequest *AppAuthStrategyKeyAuthRequest `queryParam:"inline"` + AppAuthStrategyOpenIDConnectRequest *AppAuthStrategyOpenIDConnectRequest `queryParam:"inline"` + + Type CreateAppAuthStrategyRequestType +} + +func CreateCreateAppAuthStrategyRequestKeyAuth(keyAuth AppAuthStrategyKeyAuthRequest) CreateAppAuthStrategyRequest { + typ := CreateAppAuthStrategyRequestTypeKeyAuth + + typStr := AppAuthStrategyKeyAuthRequestStrategyType(typ) + keyAuth.StrategyType = typStr + + return CreateAppAuthStrategyRequest{ + AppAuthStrategyKeyAuthRequest: &keyAuth, + Type: typ, + } +} + +func CreateCreateAppAuthStrategyRequestOpenidConnect(openidConnect AppAuthStrategyOpenIDConnectRequest) CreateAppAuthStrategyRequest { + typ := CreateAppAuthStrategyRequestTypeOpenidConnect + + typStr := AppAuthStrategyOpenIDConnectRequestStrategyType(typ) + openidConnect.StrategyType = typStr + + return CreateAppAuthStrategyRequest{ + AppAuthStrategyOpenIDConnectRequest: &openidConnect, + Type: typ, + } +} + +func (u *CreateAppAuthStrategyRequest) UnmarshalJSON(data []byte) error { + + type discriminator struct { + StrategyType string `json:"strategy_type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.StrategyType { + case "key_auth": + appAuthStrategyKeyAuthRequest := new(AppAuthStrategyKeyAuthRequest) + if err := utils.UnmarshalJSON(data, &appAuthStrategyKeyAuthRequest, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (StrategyType == key_auth) type AppAuthStrategyKeyAuthRequest within CreateAppAuthStrategyRequest: %w", string(data), err) + } + + u.AppAuthStrategyKeyAuthRequest = appAuthStrategyKeyAuthRequest + u.Type = CreateAppAuthStrategyRequestTypeKeyAuth + return nil + case "openid_connect": + appAuthStrategyOpenIDConnectRequest := new(AppAuthStrategyOpenIDConnectRequest) + if err := utils.UnmarshalJSON(data, &appAuthStrategyOpenIDConnectRequest, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (StrategyType == openid_connect) type AppAuthStrategyOpenIDConnectRequest within CreateAppAuthStrategyRequest: %w", string(data), err) + } + + u.AppAuthStrategyOpenIDConnectRequest = appAuthStrategyOpenIDConnectRequest + u.Type = CreateAppAuthStrategyRequestTypeOpenidConnect + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreateAppAuthStrategyRequest", string(data)) +} + +func (u CreateAppAuthStrategyRequest) MarshalJSON() ([]byte, error) { + if u.AppAuthStrategyKeyAuthRequest != nil { + return utils.MarshalJSON(u.AppAuthStrategyKeyAuthRequest, "", true) + } + + if u.AppAuthStrategyOpenIDConnectRequest != nil { + return utils.MarshalJSON(u.AppAuthStrategyOpenIDConnectRequest, "", true) + } + + return nil, errors.New("could not marshal union type CreateAppAuthStrategyRequest: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/createappauthstrategyresponse.go b/tests/mockserver/internal/sdk/models/components/createappauthstrategyresponse.go new file mode 100644 index 00000000..0edf3f31 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createappauthstrategyresponse.go @@ -0,0 +1,470 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +type CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType string + +const ( + CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyTypeOpenidConnect CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType = "openid_connect" +) + +func (e CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType) ToPointer() *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType { + return &e +} +func (e *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "openid_connect": + *e = CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType: %v", v) + } +} + +// CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseConfigs - JSON-B object containing the configuration for the OIDC strategy +type CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseConfigs struct { + // A more advanced mode to configure an API Product Version’s Application Auth Strategy. + // Using this mode will allow developers to use API credentials issued from an external IdP that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for the same Auth Strategy. + // An OIDC strategy may be used in conjunction with a DCR provider to automatically create the IdP application. + // + OpenidConnect AppAuthStrategyConfigOpenIDConnect `json:"openid-connect"` +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseConfigs) GetOpenidConnect() AppAuthStrategyConfigOpenIDConnect { + if o == nil { + return AppAuthStrategyConfigOpenIDConnect{} + } + return o.OpenidConnect +} + +type CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType DcrProviderType `json:"provider_type"` +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider) GetProviderType() DcrProviderType { + if o == nil { + return DcrProviderType("") + } + return o.ProviderType +} + +// CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse - Response payload from creating an OIDC Application Auth Strategy +type CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name string `json:"name"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName string `json:"display_name"` + StrategyType CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType `json:"strategy_type"` + // JSON-B object containing the configuration for the OIDC strategy + Configs CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseConfigs `json:"configs"` + // At least one published product version is using this auth strategy. + Active bool `json:"active"` + DcrProvider *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider `json:"dcr_provider"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetStrategyType() CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType { + if o == nil { + return CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType("") + } + return o.StrategyType +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetConfigs() CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseConfigs { + if o == nil { + return CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseConfigs{} + } + return o.Configs +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetDcrProvider() *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseDcrProvider { + if o == nil { + return nil + } + return o.DcrProvider +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetLabels() map[string]string { + if o == nil { + return map[string]string{} + } + return o.Labels +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +type CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType string + +const ( + CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyTypeKeyAuth CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType = "key_auth" +) + +func (e CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType) ToPointer() *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType { + return &e +} +func (e *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "key_auth": + *e = CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType: %v", v) + } +} + +// CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseConfigs - JSON-B object containing the configuration for the Key Auth strategy +type CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseConfigs struct { + // The most basic mode to configure an Application Auth Strategy for an API Product Version. + // Using this mode will allow developers to generate API keys that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for Key Auth. + // + KeyAuth AppAuthStrategyConfigKeyAuth `json:"key-auth"` +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseConfigs) GetKeyAuth() AppAuthStrategyConfigKeyAuth { + if o == nil { + return AppAuthStrategyConfigKeyAuth{} + } + return o.KeyAuth +} + +type CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType DcrProviderType `json:"provider_type"` +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider) GetProviderType() DcrProviderType { + if o == nil { + return DcrProviderType("") + } + return o.ProviderType +} + +// CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse - Response payload from creating or updating a Key Auth Application Auth Strategy +type CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name string `json:"name"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName string `json:"display_name"` + StrategyType CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType `json:"strategy_type"` + // JSON-B object containing the configuration for the Key Auth strategy + Configs CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseConfigs `json:"configs"` + // At least one published product version is using this auth strategy. + Active bool `json:"active"` + DcrProvider *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider `json:"dcr_provider"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetStrategyType() CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType { + if o == nil { + return CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType("") + } + return o.StrategyType +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetConfigs() CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseConfigs { + if o == nil { + return CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseConfigs{} + } + return o.Configs +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetDcrProvider() *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseDcrProvider { + if o == nil { + return nil + } + return o.DcrProvider +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetLabels() map[string]string { + if o == nil { + return map[string]string{} + } + return o.Labels +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +type CreateAppAuthStrategyResponseType string + +const ( + CreateAppAuthStrategyResponseTypeKeyAuth CreateAppAuthStrategyResponseType = "key_auth" + CreateAppAuthStrategyResponseTypeOpenidConnect CreateAppAuthStrategyResponseType = "openid_connect" +) + +// CreateAppAuthStrategyResponse - A set of plugin configurations that represent how the gateway will perform authentication and authorization for a Product Version. Called “Auth Strategy” for short in the context of portals/applications. The plugins are synced to any Gateway Service that is currently linked or becomes linked to the Product Version. +type CreateAppAuthStrategyResponse struct { + CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse *CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse `queryParam:"inline"` + CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse *CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse `queryParam:"inline"` + + Type CreateAppAuthStrategyResponseType +} + +func CreateCreateAppAuthStrategyResponseKeyAuth(keyAuth CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) CreateAppAuthStrategyResponse { + typ := CreateAppAuthStrategyResponseTypeKeyAuth + + typStr := CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponseStrategyType(typ) + keyAuth.StrategyType = typStr + + return CreateAppAuthStrategyResponse{ + CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse: &keyAuth, + Type: typ, + } +} + +func CreateCreateAppAuthStrategyResponseOpenidConnect(openidConnect CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) CreateAppAuthStrategyResponse { + typ := CreateAppAuthStrategyResponseTypeOpenidConnect + + typStr := CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponseStrategyType(typ) + openidConnect.StrategyType = typStr + + return CreateAppAuthStrategyResponse{ + CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse: &openidConnect, + Type: typ, + } +} + +func (u *CreateAppAuthStrategyResponse) UnmarshalJSON(data []byte) error { + + type discriminator struct { + StrategyType string `json:"strategy_type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.StrategyType { + case "key_auth": + createAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse := new(CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse) + if err := utils.UnmarshalJSON(data, &createAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (StrategyType == key_auth) type CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse within CreateAppAuthStrategyResponse: %w", string(data), err) + } + + u.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse = createAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse + u.Type = CreateAppAuthStrategyResponseTypeKeyAuth + return nil + case "openid_connect": + createAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse := new(CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse) + if err := utils.UnmarshalJSON(data, &createAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (StrategyType == openid_connect) type CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse within CreateAppAuthStrategyResponse: %w", string(data), err) + } + + u.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse = createAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse + u.Type = CreateAppAuthStrategyResponseTypeOpenidConnect + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreateAppAuthStrategyResponse", string(data)) +} + +func (u CreateAppAuthStrategyResponse) MarshalJSON() ([]byte, error) { + if u.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse != nil { + return utils.MarshalJSON(u.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse, "", true) + } + + if u.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse != nil { + return utils.MarshalJSON(u.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse, "", true) + } + + return nil, errors.New("could not marshal union type CreateAppAuthStrategyResponse: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/createconfigstore.go b/tests/mockserver/internal/sdk/models/components/createconfigstore.go new file mode 100644 index 00000000..46a70250 --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/createconfigstoresecret.go b/tests/mockserver/internal/sdk/models/components/createconfigstoresecret.go new file mode 100644 index 00000000..d10fefff --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/createconfigurationdataplanegroup.go b/tests/mockserver/internal/sdk/models/components/createconfigurationdataplanegroup.go new file mode 100644 index 00000000..ddf539f9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createconfigurationdataplanegroup.go @@ -0,0 +1,50 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateConfigurationDataPlaneGroup - Object that describes where to deploy a data-plane group, along with how many instances. +type CreateConfigurationDataPlaneGroup struct { + // Name of cloud provider. + Provider ProviderName `json:"provider"` + // Region ID for cloud provider region. + Region string `json:"region"` + CloudGatewayNetworkID string `json:"cloud_gateway_network_id"` + Autoscale ConfigurationDataPlaneGroupAutoscale `json:"autoscale"` + // Array of environment variables to set for a data-plane group. + Environment []ConfigurationDataPlaneGroupEnvironmentField `json:"environment,omitempty"` +} + +func (o *CreateConfigurationDataPlaneGroup) GetProvider() ProviderName { + if o == nil { + return ProviderName("") + } + return o.Provider +} + +func (o *CreateConfigurationDataPlaneGroup) GetRegion() string { + if o == nil { + return "" + } + return o.Region +} + +func (o *CreateConfigurationDataPlaneGroup) GetCloudGatewayNetworkID() string { + if o == nil { + return "" + } + return o.CloudGatewayNetworkID +} + +func (o *CreateConfigurationDataPlaneGroup) GetAutoscale() ConfigurationDataPlaneGroupAutoscale { + if o == nil { + return ConfigurationDataPlaneGroupAutoscale{} + } + return o.Autoscale +} + +func (o *CreateConfigurationDataPlaneGroup) GetEnvironment() []ConfigurationDataPlaneGroupEnvironmentField { + if o == nil { + return nil + } + return o.Environment +} diff --git a/tests/mockserver/internal/sdk/models/components/createconfigurationrequest.go b/tests/mockserver/internal/sdk/models/components/createconfigurationrequest.go new file mode 100644 index 00000000..3f8c94b2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createconfigurationrequest.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" +) + +// CreateConfigurationRequest - Request schema for creating a configuration. +type CreateConfigurationRequest struct { + ControlPlaneID string `json:"control_plane_id"` + // Set of control-plane geos supported for deploying cloud-gateways configurations. + ControlPlaneGeo ControlPlaneGeo `json:"control_plane_geo"` + // Supported gateway version. + Version string `json:"version"` + // List of data-plane groups that describe where to deploy instances, along with how many instances. + DataplaneGroups []CreateConfigurationDataPlaneGroup `json:"dataplane_groups"` + // Type of API access data-plane groups will support for a configuration. + APIAccess *APIAccess `default:"private+public" json:"api_access"` +} + +func (c CreateConfigurationRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateConfigurationRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateConfigurationRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateConfigurationRequest) GetControlPlaneGeo() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.ControlPlaneGeo +} + +func (o *CreateConfigurationRequest) GetVersion() string { + if o == nil { + return "" + } + return o.Version +} + +func (o *CreateConfigurationRequest) GetDataplaneGroups() []CreateConfigurationDataPlaneGroup { + if o == nil { + return []CreateConfigurationDataPlaneGroup{} + } + return o.DataplaneGroups +} + +func (o *CreateConfigurationRequest) GetAPIAccess() *APIAccess { + if o == nil { + return nil + } + return o.APIAccess +} diff --git a/tests/mockserver/internal/sdk/models/components/createcontrolplanerequest.go b/tests/mockserver/internal/sdk/models/components/createcontrolplanerequest.go new file mode 100644 index 00000000..ab0d9d4a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createcontrolplanerequest.go @@ -0,0 +1,141 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// CreateControlPlaneRequestClusterType - The ClusterType value of the cluster associated with the Control Plane. +type CreateControlPlaneRequestClusterType string + +const ( + CreateControlPlaneRequestClusterTypeClusterTypeControlPlane CreateControlPlaneRequestClusterType = "CLUSTER_TYPE_CONTROL_PLANE" + CreateControlPlaneRequestClusterTypeClusterTypeK8SIngressController CreateControlPlaneRequestClusterType = "CLUSTER_TYPE_K8S_INGRESS_CONTROLLER" + CreateControlPlaneRequestClusterTypeClusterTypeControlPlaneGroup CreateControlPlaneRequestClusterType = "CLUSTER_TYPE_CONTROL_PLANE_GROUP" + CreateControlPlaneRequestClusterTypeClusterTypeServerless CreateControlPlaneRequestClusterType = "CLUSTER_TYPE_SERVERLESS" + CreateControlPlaneRequestClusterTypeClusterTypeKafkaNativeEventProxy CreateControlPlaneRequestClusterType = "CLUSTER_TYPE_KAFKA_NATIVE_EVENT_PROXY" +) + +func (e CreateControlPlaneRequestClusterType) ToPointer() *CreateControlPlaneRequestClusterType { + return &e +} +func (e *CreateControlPlaneRequestClusterType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "CLUSTER_TYPE_CONTROL_PLANE": + fallthrough + case "CLUSTER_TYPE_K8S_INGRESS_CONTROLLER": + fallthrough + case "CLUSTER_TYPE_CONTROL_PLANE_GROUP": + fallthrough + case "CLUSTER_TYPE_SERVERLESS": + fallthrough + case "CLUSTER_TYPE_KAFKA_NATIVE_EVENT_PROXY": + *e = CreateControlPlaneRequestClusterType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateControlPlaneRequestClusterType: %v", v) + } +} + +// CreateControlPlaneRequestAuthType - The auth type value of the cluster associated with the Runtime Group. +type CreateControlPlaneRequestAuthType string + +const ( + CreateControlPlaneRequestAuthTypePinnedClientCerts CreateControlPlaneRequestAuthType = "pinned_client_certs" + CreateControlPlaneRequestAuthTypePkiClientCerts CreateControlPlaneRequestAuthType = "pki_client_certs" +) + +func (e CreateControlPlaneRequestAuthType) ToPointer() *CreateControlPlaneRequestAuthType { + return &e +} +func (e *CreateControlPlaneRequestAuthType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "pinned_client_certs": + fallthrough + case "pki_client_certs": + *e = CreateControlPlaneRequestAuthType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateControlPlaneRequestAuthType: %v", v) + } +} + +// CreateControlPlaneRequest - The request schema for the create control plane request. +type CreateControlPlaneRequest struct { + // The name of the control plane. + Name string `json:"name"` + // The description of the control plane in Konnect. + Description *string `json:"description,omitempty"` + // The ClusterType value of the cluster associated with the Control Plane. + ClusterType *CreateControlPlaneRequestClusterType `json:"cluster_type,omitempty"` + // The auth type value of the cluster associated with the Runtime Group. + AuthType *CreateControlPlaneRequestAuthType `json:"auth_type,omitempty"` + // Whether this control-plane can be used for cloud-gateways. + CloudGateway *bool `json:"cloud_gateway,omitempty"` + // Array of proxy URLs associated with reaching the data-planes connected to a control-plane. + ProxyUrls []ProxyURL `json:"proxy_urls,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateControlPlaneRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateControlPlaneRequest) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *CreateControlPlaneRequest) GetClusterType() *CreateControlPlaneRequestClusterType { + if o == nil { + return nil + } + return o.ClusterType +} + +func (o *CreateControlPlaneRequest) GetAuthType() *CreateControlPlaneRequestAuthType { + if o == nil { + return nil + } + return o.AuthType +} + +func (o *CreateControlPlaneRequest) GetCloudGateway() *bool { + if o == nil { + return nil + } + return o.CloudGateway +} + +func (o *CreateControlPlaneRequest) GetProxyUrls() []ProxyURL { + if o == nil { + return nil + } + return o.ProxyUrls +} + +func (o *CreateControlPlaneRequest) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createcustomdomainrequest.go b/tests/mockserver/internal/sdk/models/components/createcustomdomainrequest.go new file mode 100644 index 00000000..3339104d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createcustomdomainrequest.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateCustomDomainRequest - Request schema for creating a custom domain in the global API. +type CreateCustomDomainRequest struct { + ControlPlaneID string `json:"control_plane_id"` + // Set of control-plane geos supported for deploying cloud-gateways configurations. + ControlPlaneGeo ControlPlaneGeo `json:"control_plane_geo"` + // Domain name of the custom domain. + Domain string `json:"domain"` +} + +func (o *CreateCustomDomainRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateCustomDomainRequest) GetControlPlaneGeo() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.ControlPlaneGeo +} + +func (o *CreateCustomDomainRequest) GetDomain() string { + if o == nil { + return "" + } + return o.Domain +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrconfigauth0inrequest.go b/tests/mockserver/internal/sdk/models/components/createdcrconfigauth0inrequest.go new file mode 100644 index 00000000..1bccac54 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrconfigauth0inrequest.go @@ -0,0 +1,49 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateDcrConfigAuth0InRequest - Payload to create an Auth0 DCR provider. +type CreateDcrConfigAuth0InRequest struct { + // This ID should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientID string `json:"initial_client_id"` + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientSecret string `json:"initial_client_secret"` + // This is the audience value used for the initial client. + // If using a custom domain on Auth0, this must be set as to the Auth0 Management API audience value. + // If left blank, the issuer will be used instead. + // + InitialClientAudience *string `json:"initial_client_audience,omitempty"` + UseDeveloperManagedScopes *bool `json:"use_developer_managed_scopes,omitempty"` +} + +func (o *CreateDcrConfigAuth0InRequest) GetInitialClientID() string { + if o == nil { + return "" + } + return o.InitialClientID +} + +func (o *CreateDcrConfigAuth0InRequest) GetInitialClientSecret() string { + if o == nil { + return "" + } + return o.InitialClientSecret +} + +func (o *CreateDcrConfigAuth0InRequest) GetInitialClientAudience() *string { + if o == nil { + return nil + } + return o.InitialClientAudience +} + +func (o *CreateDcrConfigAuth0InRequest) GetUseDeveloperManagedScopes() *bool { + if o == nil { + return nil + } + return o.UseDeveloperManagedScopes +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrconfigazureadinrequest.go b/tests/mockserver/internal/sdk/models/components/createdcrconfigazureadinrequest.go new file mode 100644 index 00000000..a865ba41 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrconfigazureadinrequest.go @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateDcrConfigAzureAdInRequest - Payload to create an Azure AD DCR provider. +type CreateDcrConfigAzureAdInRequest struct { + // This ID should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientID string `json:"initial_client_id"` + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientSecret string `json:"initial_client_secret"` +} + +func (o *CreateDcrConfigAzureAdInRequest) GetInitialClientID() string { + if o == nil { + return "" + } + return o.InitialClientID +} + +func (o *CreateDcrConfigAzureAdInRequest) GetInitialClientSecret() string { + if o == nil { + return "" + } + return o.InitialClientSecret +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrconfigcurityinrequest.go b/tests/mockserver/internal/sdk/models/components/createdcrconfigcurityinrequest.go new file mode 100644 index 00000000..fd4417b1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrconfigcurityinrequest.go @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateDcrConfigCurityInRequest - Payload to create a Curity DCR provider. +type CreateDcrConfigCurityInRequest struct { + // This ID should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientID string `json:"initial_client_id"` + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientSecret string `json:"initial_client_secret"` +} + +func (o *CreateDcrConfigCurityInRequest) GetInitialClientID() string { + if o == nil { + return "" + } + return o.InitialClientID +} + +func (o *CreateDcrConfigCurityInRequest) GetInitialClientSecret() string { + if o == nil { + return "" + } + return o.InitialClientSecret +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrconfighttpinrequest.go b/tests/mockserver/internal/sdk/models/components/createdcrconfighttpinrequest.go new file mode 100644 index 00000000..c8ff8b1b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrconfighttpinrequest.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateDcrConfigHTTPInRequest - Payload to create an HTTP DCR provider. +type CreateDcrConfigHTTPInRequest struct { + // The base URL of the DCR server. This is the URL that will be used to make the HTTP requests from Konnect to the DCR provider. + // This URL must be accessible from the Konnect service. + // + DcrBaseURL string `json:"dcr_base_url"` + // This is the API Key that will be sent with each HTTP request to the custom DCR server. It can be + // verified on the server to ensure that incoming requests are coming from Konnect. + // + APIKey string `json:"api_key"` + // This flag disables all the event-hooks on the application flow for the DCR provider. + DisableEventHooks *bool `json:"disable_event_hooks,omitempty"` + // This flag disable the refresh-secret endpoint on the application flow for the DCR provider. + DisableRefreshSecret *bool `json:"disable_refresh_secret,omitempty"` +} + +func (o *CreateDcrConfigHTTPInRequest) GetDcrBaseURL() string { + if o == nil { + return "" + } + return o.DcrBaseURL +} + +func (o *CreateDcrConfigHTTPInRequest) GetAPIKey() string { + if o == nil { + return "" + } + return o.APIKey +} + +func (o *CreateDcrConfigHTTPInRequest) GetDisableEventHooks() *bool { + if o == nil { + return nil + } + return o.DisableEventHooks +} + +func (o *CreateDcrConfigHTTPInRequest) GetDisableRefreshSecret() *bool { + if o == nil { + return nil + } + return o.DisableRefreshSecret +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrconfigoktainrequest.go b/tests/mockserver/internal/sdk/models/components/createdcrconfigoktainrequest.go new file mode 100644 index 00000000..556297c1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrconfigoktainrequest.go @@ -0,0 +1,18 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateDcrConfigOktaInRequest - Payload to create an Okta DCR provider. +type CreateDcrConfigOktaInRequest struct { + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + DcrToken string `json:"dcr_token"` +} + +func (o *CreateDcrConfigOktaInRequest) GetDcrToken() string { + if o == nil { + return "" + } + return o.DcrToken +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderrequest.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequest.go new file mode 100644 index 00000000..734bf3d4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequest.go @@ -0,0 +1,177 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type CreateDcrProviderRequestType string + +const ( + CreateDcrProviderRequestTypeAuth0 CreateDcrProviderRequestType = "auth0" + CreateDcrProviderRequestTypeAzureAd CreateDcrProviderRequestType = "azureAd" + CreateDcrProviderRequestTypeCurity CreateDcrProviderRequestType = "curity" + CreateDcrProviderRequestTypeOkta CreateDcrProviderRequestType = "okta" + CreateDcrProviderRequestTypeHTTP CreateDcrProviderRequestType = "http" +) + +// CreateDcrProviderRequest - Request body for creating a DCR provider. The provider_type cannot be updated after creation. +type CreateDcrProviderRequest struct { + CreateDcrProviderRequestAuth0 *CreateDcrProviderRequestAuth0 `queryParam:"inline"` + CreateDcrProviderRequestAzureAd *CreateDcrProviderRequestAzureAd `queryParam:"inline"` + CreateDcrProviderRequestCurity *CreateDcrProviderRequestCurity `queryParam:"inline"` + CreateDcrProviderRequestOkta *CreateDcrProviderRequestOkta `queryParam:"inline"` + CreateDcrProviderRequestHTTP *CreateDcrProviderRequestHTTP `queryParam:"inline"` + + Type CreateDcrProviderRequestType +} + +func CreateCreateDcrProviderRequestAuth0(auth0 CreateDcrProviderRequestAuth0) CreateDcrProviderRequest { + typ := CreateDcrProviderRequestTypeAuth0 + + typStr := CreateDcrProviderRequestAuth0ProviderType(typ) + auth0.ProviderType = typStr + + return CreateDcrProviderRequest{ + CreateDcrProviderRequestAuth0: &auth0, + Type: typ, + } +} + +func CreateCreateDcrProviderRequestAzureAd(azureAd CreateDcrProviderRequestAzureAd) CreateDcrProviderRequest { + typ := CreateDcrProviderRequestTypeAzureAd + + typStr := CreateDcrProviderRequestAzureAdProviderType(typ) + azureAd.ProviderType = typStr + + return CreateDcrProviderRequest{ + CreateDcrProviderRequestAzureAd: &azureAd, + Type: typ, + } +} + +func CreateCreateDcrProviderRequestCurity(curity CreateDcrProviderRequestCurity) CreateDcrProviderRequest { + typ := CreateDcrProviderRequestTypeCurity + + typStr := CreateDcrProviderRequestCurityProviderType(typ) + curity.ProviderType = typStr + + return CreateDcrProviderRequest{ + CreateDcrProviderRequestCurity: &curity, + Type: typ, + } +} + +func CreateCreateDcrProviderRequestOkta(okta CreateDcrProviderRequestOkta) CreateDcrProviderRequest { + typ := CreateDcrProviderRequestTypeOkta + + typStr := CreateDcrProviderRequestOktaProviderType(typ) + okta.ProviderType = typStr + + return CreateDcrProviderRequest{ + CreateDcrProviderRequestOkta: &okta, + Type: typ, + } +} + +func CreateCreateDcrProviderRequestHTTP(http CreateDcrProviderRequestHTTP) CreateDcrProviderRequest { + typ := CreateDcrProviderRequestTypeHTTP + + typStr := CreateDcrProviderRequestHTTPProviderType(typ) + http.ProviderType = typStr + + return CreateDcrProviderRequest{ + CreateDcrProviderRequestHTTP: &http, + Type: typ, + } +} + +func (u *CreateDcrProviderRequest) UnmarshalJSON(data []byte) error { + + type discriminator struct { + ProviderType string `json:"provider_type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.ProviderType { + case "auth0": + createDcrProviderRequestAuth0 := new(CreateDcrProviderRequestAuth0) + if err := utils.UnmarshalJSON(data, &createDcrProviderRequestAuth0, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == auth0) type CreateDcrProviderRequestAuth0 within CreateDcrProviderRequest: %w", string(data), err) + } + + u.CreateDcrProviderRequestAuth0 = createDcrProviderRequestAuth0 + u.Type = CreateDcrProviderRequestTypeAuth0 + return nil + case "azureAd": + createDcrProviderRequestAzureAd := new(CreateDcrProviderRequestAzureAd) + if err := utils.UnmarshalJSON(data, &createDcrProviderRequestAzureAd, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == azureAd) type CreateDcrProviderRequestAzureAd within CreateDcrProviderRequest: %w", string(data), err) + } + + u.CreateDcrProviderRequestAzureAd = createDcrProviderRequestAzureAd + u.Type = CreateDcrProviderRequestTypeAzureAd + return nil + case "curity": + createDcrProviderRequestCurity := new(CreateDcrProviderRequestCurity) + if err := utils.UnmarshalJSON(data, &createDcrProviderRequestCurity, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == curity) type CreateDcrProviderRequestCurity within CreateDcrProviderRequest: %w", string(data), err) + } + + u.CreateDcrProviderRequestCurity = createDcrProviderRequestCurity + u.Type = CreateDcrProviderRequestTypeCurity + return nil + case "okta": + createDcrProviderRequestOkta := new(CreateDcrProviderRequestOkta) + if err := utils.UnmarshalJSON(data, &createDcrProviderRequestOkta, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == okta) type CreateDcrProviderRequestOkta within CreateDcrProviderRequest: %w", string(data), err) + } + + u.CreateDcrProviderRequestOkta = createDcrProviderRequestOkta + u.Type = CreateDcrProviderRequestTypeOkta + return nil + case "http": + createDcrProviderRequestHTTP := new(CreateDcrProviderRequestHTTP) + if err := utils.UnmarshalJSON(data, &createDcrProviderRequestHTTP, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == http) type CreateDcrProviderRequestHTTP within CreateDcrProviderRequest: %w", string(data), err) + } + + u.CreateDcrProviderRequestHTTP = createDcrProviderRequestHTTP + u.Type = CreateDcrProviderRequestTypeHTTP + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreateDcrProviderRequest", string(data)) +} + +func (u CreateDcrProviderRequest) MarshalJSON() ([]byte, error) { + if u.CreateDcrProviderRequestAuth0 != nil { + return utils.MarshalJSON(u.CreateDcrProviderRequestAuth0, "", true) + } + + if u.CreateDcrProviderRequestAzureAd != nil { + return utils.MarshalJSON(u.CreateDcrProviderRequestAzureAd, "", true) + } + + if u.CreateDcrProviderRequestCurity != nil { + return utils.MarshalJSON(u.CreateDcrProviderRequestCurity, "", true) + } + + if u.CreateDcrProviderRequestOkta != nil { + return utils.MarshalJSON(u.CreateDcrProviderRequestOkta, "", true) + } + + if u.CreateDcrProviderRequestHTTP != nil { + return utils.MarshalJSON(u.CreateDcrProviderRequestHTTP, "", true) + } + + return nil, errors.New("could not marshal union type CreateDcrProviderRequest: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestauth0.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestauth0.go new file mode 100644 index 00000000..a4954f89 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestauth0.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type CreateDcrProviderRequestAuth0ProviderType string + +const ( + CreateDcrProviderRequestAuth0ProviderTypeAuth0 CreateDcrProviderRequestAuth0ProviderType = "auth0" +) + +func (e CreateDcrProviderRequestAuth0ProviderType) ToPointer() *CreateDcrProviderRequestAuth0ProviderType { + return &e +} +func (e *CreateDcrProviderRequestAuth0ProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "auth0": + *e = CreateDcrProviderRequestAuth0ProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateDcrProviderRequestAuth0ProviderType: %v", v) + } +} + +// CreateDcrProviderRequestAuth0 - Request body for creating an Auth0 DCR provider. +type CreateDcrProviderRequestAuth0 struct { + ProviderType CreateDcrProviderRequestAuth0ProviderType `json:"provider_type"` + // Payload to create an Auth0 DCR provider. + DcrConfig CreateDcrConfigAuth0InRequest `json:"dcr_config"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + Issuer string `json:"issuer"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateDcrProviderRequestAuth0) GetProviderType() CreateDcrProviderRequestAuth0ProviderType { + if o == nil { + return CreateDcrProviderRequestAuth0ProviderType("") + } + return o.ProviderType +} + +func (o *CreateDcrProviderRequestAuth0) GetDcrConfig() CreateDcrConfigAuth0InRequest { + if o == nil { + return CreateDcrConfigAuth0InRequest{} + } + return o.DcrConfig +} + +func (o *CreateDcrProviderRequestAuth0) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDcrProviderRequestAuth0) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDcrProviderRequestAuth0) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDcrProviderRequestAuth0) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestazuread.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestazuread.go new file mode 100644 index 00000000..68d9c4bf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestazuread.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type CreateDcrProviderRequestAzureAdProviderType string + +const ( + CreateDcrProviderRequestAzureAdProviderTypeAzureAd CreateDcrProviderRequestAzureAdProviderType = "azureAd" +) + +func (e CreateDcrProviderRequestAzureAdProviderType) ToPointer() *CreateDcrProviderRequestAzureAdProviderType { + return &e +} +func (e *CreateDcrProviderRequestAzureAdProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "azureAd": + *e = CreateDcrProviderRequestAzureAdProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateDcrProviderRequestAzureAdProviderType: %v", v) + } +} + +// CreateDcrProviderRequestAzureAd - Request body for creating an Azure AD DCR provider. +type CreateDcrProviderRequestAzureAd struct { + ProviderType CreateDcrProviderRequestAzureAdProviderType `json:"provider_type"` + // Payload to create an Azure AD DCR provider. + DcrConfig CreateDcrConfigAzureAdInRequest `json:"dcr_config"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + Issuer string `json:"issuer"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateDcrProviderRequestAzureAd) GetProviderType() CreateDcrProviderRequestAzureAdProviderType { + if o == nil { + return CreateDcrProviderRequestAzureAdProviderType("") + } + return o.ProviderType +} + +func (o *CreateDcrProviderRequestAzureAd) GetDcrConfig() CreateDcrConfigAzureAdInRequest { + if o == nil { + return CreateDcrConfigAzureAdInRequest{} + } + return o.DcrConfig +} + +func (o *CreateDcrProviderRequestAzureAd) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDcrProviderRequestAzureAd) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDcrProviderRequestAzureAd) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDcrProviderRequestAzureAd) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestcurity.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestcurity.go new file mode 100644 index 00000000..dfb6d069 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestcurity.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type CreateDcrProviderRequestCurityProviderType string + +const ( + CreateDcrProviderRequestCurityProviderTypeCurity CreateDcrProviderRequestCurityProviderType = "curity" +) + +func (e CreateDcrProviderRequestCurityProviderType) ToPointer() *CreateDcrProviderRequestCurityProviderType { + return &e +} +func (e *CreateDcrProviderRequestCurityProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "curity": + *e = CreateDcrProviderRequestCurityProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateDcrProviderRequestCurityProviderType: %v", v) + } +} + +// CreateDcrProviderRequestCurity - Request body for creating a Curity DCR provider. +type CreateDcrProviderRequestCurity struct { + ProviderType CreateDcrProviderRequestCurityProviderType `json:"provider_type"` + // Payload to create a Curity DCR provider. + DcrConfig CreateDcrConfigCurityInRequest `json:"dcr_config"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + Issuer string `json:"issuer"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateDcrProviderRequestCurity) GetProviderType() CreateDcrProviderRequestCurityProviderType { + if o == nil { + return CreateDcrProviderRequestCurityProviderType("") + } + return o.ProviderType +} + +func (o *CreateDcrProviderRequestCurity) GetDcrConfig() CreateDcrConfigCurityInRequest { + if o == nil { + return CreateDcrConfigCurityInRequest{} + } + return o.DcrConfig +} + +func (o *CreateDcrProviderRequestCurity) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDcrProviderRequestCurity) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDcrProviderRequestCurity) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDcrProviderRequestCurity) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderrequesthttp.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequesthttp.go new file mode 100644 index 00000000..83f4fec1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequesthttp.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type CreateDcrProviderRequestHTTPProviderType string + +const ( + CreateDcrProviderRequestHTTPProviderTypeHTTP CreateDcrProviderRequestHTTPProviderType = "http" +) + +func (e CreateDcrProviderRequestHTTPProviderType) ToPointer() *CreateDcrProviderRequestHTTPProviderType { + return &e +} +func (e *CreateDcrProviderRequestHTTPProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "http": + *e = CreateDcrProviderRequestHTTPProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateDcrProviderRequestHTTPProviderType: %v", v) + } +} + +// CreateDcrProviderRequestHTTP - Request body for creating an HTTP DCR provider. +type CreateDcrProviderRequestHTTP struct { + ProviderType CreateDcrProviderRequestHTTPProviderType `json:"provider_type"` + // Payload to create an HTTP DCR provider. + DcrConfig CreateDcrConfigHTTPInRequest `json:"dcr_config"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + Issuer string `json:"issuer"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateDcrProviderRequestHTTP) GetProviderType() CreateDcrProviderRequestHTTPProviderType { + if o == nil { + return CreateDcrProviderRequestHTTPProviderType("") + } + return o.ProviderType +} + +func (o *CreateDcrProviderRequestHTTP) GetDcrConfig() CreateDcrConfigHTTPInRequest { + if o == nil { + return CreateDcrConfigHTTPInRequest{} + } + return o.DcrConfig +} + +func (o *CreateDcrProviderRequestHTTP) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDcrProviderRequestHTTP) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDcrProviderRequestHTTP) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDcrProviderRequestHTTP) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestokta.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestokta.go new file mode 100644 index 00000000..d37d0102 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderrequestokta.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type CreateDcrProviderRequestOktaProviderType string + +const ( + CreateDcrProviderRequestOktaProviderTypeOkta CreateDcrProviderRequestOktaProviderType = "okta" +) + +func (e CreateDcrProviderRequestOktaProviderType) ToPointer() *CreateDcrProviderRequestOktaProviderType { + return &e +} +func (e *CreateDcrProviderRequestOktaProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "okta": + *e = CreateDcrProviderRequestOktaProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateDcrProviderRequestOktaProviderType: %v", v) + } +} + +// CreateDcrProviderRequestOkta - Request body for creating an Okta DCR provider. +type CreateDcrProviderRequestOkta struct { + ProviderType CreateDcrProviderRequestOktaProviderType `json:"provider_type"` + // Payload to create an Okta DCR provider. + DcrConfig CreateDcrConfigOktaInRequest `json:"dcr_config"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + Issuer string `json:"issuer"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateDcrProviderRequestOkta) GetProviderType() CreateDcrProviderRequestOktaProviderType { + if o == nil { + return CreateDcrProviderRequestOktaProviderType("") + } + return o.ProviderType +} + +func (o *CreateDcrProviderRequestOkta) GetDcrConfig() CreateDcrConfigOktaInRequest { + if o == nil { + return CreateDcrConfigOktaInRequest{} + } + return o.DcrConfig +} + +func (o *CreateDcrProviderRequestOkta) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDcrProviderRequestOkta) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDcrProviderRequestOkta) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDcrProviderRequestOkta) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createdcrproviderresponse.go b/tests/mockserver/internal/sdk/models/components/createdcrproviderresponse.go new file mode 100644 index 00000000..288439a0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createdcrproviderresponse.go @@ -0,0 +1,748 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// CreateDcrProviderResponseDcrProviderHTTPDcrConfig - The DCR configuration for this DCR provider. +type CreateDcrProviderResponseDcrProviderHTTPDcrConfig struct { +} + +// CreateDCRProviderResponseDCRProviderHTTP - A DCR provider for HTTP -- only properties not included in DcrProviderBase +type CreateDCRProviderResponseDCRProviderHTTP struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig CreateDcrProviderResponseDcrProviderHTTPDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateDCRProviderResponseDCRProviderHTTP) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateDCRProviderResponseDCRProviderHTTP) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetDcrConfig() CreateDcrProviderResponseDcrProviderHTTPDcrConfig { + if o == nil { + return CreateDcrProviderResponseDcrProviderHTTPDcrConfig{} + } + return o.DcrConfig +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateDCRProviderResponseDCRProviderHTTP) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// CreateDcrProviderResponseDcrProviderOktaDcrConfig - The DCR configuration for this DCR provider. +type CreateDcrProviderResponseDcrProviderOktaDcrConfig struct { +} + +// CreateDCRProviderResponseDCRProviderOKTA - A DCR provider for Okta -- only properties not included in DcrProviderBase +type CreateDCRProviderResponseDCRProviderOKTA struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig CreateDcrProviderResponseDcrProviderOktaDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateDCRProviderResponseDCRProviderOKTA) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateDCRProviderResponseDCRProviderOKTA) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetDcrConfig() CreateDcrProviderResponseDcrProviderOktaDcrConfig { + if o == nil { + return CreateDcrProviderResponseDcrProviderOktaDcrConfig{} + } + return o.DcrConfig +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateDCRProviderResponseDCRProviderOKTA) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// CreateDcrProviderResponseDcrProviderCurityDcrConfig - The DCR configuration for this DCR provider. +type CreateDcrProviderResponseDcrProviderCurityDcrConfig struct { +} + +// CreateDCRProviderResponseDCRProviderCurity - A DCR provider for Curity -- only properties not included in DcrProviderBase +type CreateDCRProviderResponseDCRProviderCurity struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig CreateDcrProviderResponseDcrProviderCurityDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateDCRProviderResponseDCRProviderCurity) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateDCRProviderResponseDCRProviderCurity) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetDcrConfig() CreateDcrProviderResponseDcrProviderCurityDcrConfig { + if o == nil { + return CreateDcrProviderResponseDcrProviderCurityDcrConfig{} + } + return o.DcrConfig +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateDCRProviderResponseDCRProviderCurity) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// CreateDcrProviderResponseDcrProviderAzureAdDcrConfig - The DCR configuration for this DCR provider. +type CreateDcrProviderResponseDcrProviderAzureAdDcrConfig struct { +} + +// CreateDCRProviderResponseDCRProviderAzureAD - A DCR provider for Azure AD -- only properties not included in DcrProviderBase +type CreateDCRProviderResponseDCRProviderAzureAD struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig CreateDcrProviderResponseDcrProviderAzureAdDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateDCRProviderResponseDCRProviderAzureAD) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateDCRProviderResponseDCRProviderAzureAD) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetDcrConfig() CreateDcrProviderResponseDcrProviderAzureAdDcrConfig { + if o == nil { + return CreateDcrProviderResponseDcrProviderAzureAdDcrConfig{} + } + return o.DcrConfig +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateDCRProviderResponseDCRProviderAzureAD) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// CreateDcrProviderResponseDcrProviderAuth0DcrConfig - The DCR configuration for this DCR provider. +type CreateDcrProviderResponseDcrProviderAuth0DcrConfig struct { +} + +// CreateDCRProviderResponseDCRProviderAuth0 - A DCR provider for Auth0 -- only properties not included in DcrProviderBase +type CreateDCRProviderResponseDCRProviderAuth0 struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig CreateDcrProviderResponseDcrProviderAuth0DcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CreateDCRProviderResponseDCRProviderAuth0) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateDCRProviderResponseDCRProviderAuth0) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetDcrConfig() CreateDcrProviderResponseDcrProviderAuth0DcrConfig { + if o == nil { + return CreateDcrProviderResponseDcrProviderAuth0DcrConfig{} + } + return o.DcrConfig +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CreateDCRProviderResponseDCRProviderAuth0) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +type CreateDcrProviderResponseType string + +const ( + CreateDcrProviderResponseTypeDcrProviderAuth0 CreateDcrProviderResponseType = "DcrProviderAuth0" + CreateDcrProviderResponseTypeDcrProviderAzureAd CreateDcrProviderResponseType = "DcrProviderAzureAd" + CreateDcrProviderResponseTypeDcrProviderCurity CreateDcrProviderResponseType = "DcrProviderCurity" + CreateDcrProviderResponseTypeDcrProviderOkta CreateDcrProviderResponseType = "DcrProviderOkta" + CreateDcrProviderResponseTypeDcrProviderHTTP CreateDcrProviderResponseType = "DcrProviderHttp" +) + +// CreateDcrProviderResponse - A response containing the newly created DCR provider object. +type CreateDcrProviderResponse struct { + CreateDCRProviderResponseDCRProviderAuth0 *CreateDCRProviderResponseDCRProviderAuth0 `queryParam:"inline"` + CreateDCRProviderResponseDCRProviderAzureAD *CreateDCRProviderResponseDCRProviderAzureAD `queryParam:"inline"` + CreateDCRProviderResponseDCRProviderCurity *CreateDCRProviderResponseDCRProviderCurity `queryParam:"inline"` + CreateDCRProviderResponseDCRProviderOKTA *CreateDCRProviderResponseDCRProviderOKTA `queryParam:"inline"` + CreateDCRProviderResponseDCRProviderHTTP *CreateDCRProviderResponseDCRProviderHTTP `queryParam:"inline"` + + Type CreateDcrProviderResponseType +} + +func CreateCreateDcrProviderResponseDcrProviderAuth0(dcrProviderAuth0 CreateDCRProviderResponseDCRProviderAuth0) CreateDcrProviderResponse { + typ := CreateDcrProviderResponseTypeDcrProviderAuth0 + + typStr := string(typ) + dcrProviderAuth0.ProviderType = typStr + + return CreateDcrProviderResponse{ + CreateDCRProviderResponseDCRProviderAuth0: &dcrProviderAuth0, + Type: typ, + } +} + +func CreateCreateDcrProviderResponseDcrProviderAzureAd(dcrProviderAzureAd CreateDCRProviderResponseDCRProviderAzureAD) CreateDcrProviderResponse { + typ := CreateDcrProviderResponseTypeDcrProviderAzureAd + + typStr := string(typ) + dcrProviderAzureAd.ProviderType = typStr + + return CreateDcrProviderResponse{ + CreateDCRProviderResponseDCRProviderAzureAD: &dcrProviderAzureAd, + Type: typ, + } +} + +func CreateCreateDcrProviderResponseDcrProviderCurity(dcrProviderCurity CreateDCRProviderResponseDCRProviderCurity) CreateDcrProviderResponse { + typ := CreateDcrProviderResponseTypeDcrProviderCurity + + typStr := string(typ) + dcrProviderCurity.ProviderType = typStr + + return CreateDcrProviderResponse{ + CreateDCRProviderResponseDCRProviderCurity: &dcrProviderCurity, + Type: typ, + } +} + +func CreateCreateDcrProviderResponseDcrProviderOkta(dcrProviderOkta CreateDCRProviderResponseDCRProviderOKTA) CreateDcrProviderResponse { + typ := CreateDcrProviderResponseTypeDcrProviderOkta + + typStr := string(typ) + dcrProviderOkta.ProviderType = typStr + + return CreateDcrProviderResponse{ + CreateDCRProviderResponseDCRProviderOKTA: &dcrProviderOkta, + Type: typ, + } +} + +func CreateCreateDcrProviderResponseDcrProviderHTTP(dcrProviderHTTP CreateDCRProviderResponseDCRProviderHTTP) CreateDcrProviderResponse { + typ := CreateDcrProviderResponseTypeDcrProviderHTTP + + typStr := string(typ) + dcrProviderHTTP.ProviderType = typStr + + return CreateDcrProviderResponse{ + CreateDCRProviderResponseDCRProviderHTTP: &dcrProviderHTTP, + Type: typ, + } +} + +func (u *CreateDcrProviderResponse) UnmarshalJSON(data []byte) error { + + type discriminator struct { + ProviderType string `json:"provider_type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.ProviderType { + case "DcrProviderAuth0": + createDCRProviderResponseDCRProviderAuth0 := new(CreateDCRProviderResponseDCRProviderAuth0) + if err := utils.UnmarshalJSON(data, &createDCRProviderResponseDCRProviderAuth0, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderAuth0) type CreateDCRProviderResponseDCRProviderAuth0 within CreateDcrProviderResponse: %w", string(data), err) + } + + u.CreateDCRProviderResponseDCRProviderAuth0 = createDCRProviderResponseDCRProviderAuth0 + u.Type = CreateDcrProviderResponseTypeDcrProviderAuth0 + return nil + case "DcrProviderAzureAd": + createDCRProviderResponseDCRProviderAzureAD := new(CreateDCRProviderResponseDCRProviderAzureAD) + if err := utils.UnmarshalJSON(data, &createDCRProviderResponseDCRProviderAzureAD, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderAzureAd) type CreateDCRProviderResponseDCRProviderAzureAD within CreateDcrProviderResponse: %w", string(data), err) + } + + u.CreateDCRProviderResponseDCRProviderAzureAD = createDCRProviderResponseDCRProviderAzureAD + u.Type = CreateDcrProviderResponseTypeDcrProviderAzureAd + return nil + case "DcrProviderCurity": + createDCRProviderResponseDCRProviderCurity := new(CreateDCRProviderResponseDCRProviderCurity) + if err := utils.UnmarshalJSON(data, &createDCRProviderResponseDCRProviderCurity, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderCurity) type CreateDCRProviderResponseDCRProviderCurity within CreateDcrProviderResponse: %w", string(data), err) + } + + u.CreateDCRProviderResponseDCRProviderCurity = createDCRProviderResponseDCRProviderCurity + u.Type = CreateDcrProviderResponseTypeDcrProviderCurity + return nil + case "DcrProviderOkta": + createDCRProviderResponseDCRProviderOKTA := new(CreateDCRProviderResponseDCRProviderOKTA) + if err := utils.UnmarshalJSON(data, &createDCRProviderResponseDCRProviderOKTA, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderOkta) type CreateDCRProviderResponseDCRProviderOKTA within CreateDcrProviderResponse: %w", string(data), err) + } + + u.CreateDCRProviderResponseDCRProviderOKTA = createDCRProviderResponseDCRProviderOKTA + u.Type = CreateDcrProviderResponseTypeDcrProviderOkta + return nil + case "DcrProviderHttp": + createDCRProviderResponseDCRProviderHTTP := new(CreateDCRProviderResponseDCRProviderHTTP) + if err := utils.UnmarshalJSON(data, &createDCRProviderResponseDCRProviderHTTP, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderHttp) type CreateDCRProviderResponseDCRProviderHTTP within CreateDcrProviderResponse: %w", string(data), err) + } + + u.CreateDCRProviderResponseDCRProviderHTTP = createDCRProviderResponseDCRProviderHTTP + u.Type = CreateDcrProviderResponseTypeDcrProviderHTTP + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreateDcrProviderResponse", string(data)) +} + +func (u CreateDcrProviderResponse) MarshalJSON() ([]byte, error) { + if u.CreateDCRProviderResponseDCRProviderAuth0 != nil { + return utils.MarshalJSON(u.CreateDCRProviderResponseDCRProviderAuth0, "", true) + } + + if u.CreateDCRProviderResponseDCRProviderAzureAD != nil { + return utils.MarshalJSON(u.CreateDCRProviderResponseDCRProviderAzureAD, "", true) + } + + if u.CreateDCRProviderResponseDCRProviderCurity != nil { + return utils.MarshalJSON(u.CreateDCRProviderResponseDCRProviderCurity, "", true) + } + + if u.CreateDCRProviderResponseDCRProviderOKTA != nil { + return utils.MarshalJSON(u.CreateDCRProviderResponseDCRProviderOKTA, "", true) + } + + if u.CreateDCRProviderResponseDCRProviderHTTP != nil { + return utils.MarshalJSON(u.CreateDCRProviderResponseDCRProviderHTTP, "", true) + } + + return nil, errors.New("could not marshal union type CreateDcrProviderResponse: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/createidentityprovider.go b/tests/mockserver/internal/sdk/models/components/createidentityprovider.go new file mode 100644 index 00000000..9ac6893a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createidentityprovider.go @@ -0,0 +1,102 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type CreateIdentityProviderConfigType string + +const ( + CreateIdentityProviderConfigTypeConfigureOIDCIdentityProviderConfig CreateIdentityProviderConfigType = "ConfigureOIDCIdentityProviderConfig" + CreateIdentityProviderConfigTypeSAMLIdentityProviderConfigInput CreateIdentityProviderConfigType = "SAMLIdentityProviderConfig_input" +) + +type CreateIdentityProviderConfig struct { + ConfigureOIDCIdentityProviderConfig *ConfigureOIDCIdentityProviderConfig `queryParam:"inline"` + SAMLIdentityProviderConfigInput *SAMLIdentityProviderConfigInput `queryParam:"inline"` + + Type CreateIdentityProviderConfigType +} + +func CreateCreateIdentityProviderConfigConfigureOIDCIdentityProviderConfig(configureOIDCIdentityProviderConfig ConfigureOIDCIdentityProviderConfig) CreateIdentityProviderConfig { + typ := CreateIdentityProviderConfigTypeConfigureOIDCIdentityProviderConfig + + return CreateIdentityProviderConfig{ + ConfigureOIDCIdentityProviderConfig: &configureOIDCIdentityProviderConfig, + Type: typ, + } +} + +func CreateCreateIdentityProviderConfigSAMLIdentityProviderConfigInput(samlIdentityProviderConfigInput SAMLIdentityProviderConfigInput) CreateIdentityProviderConfig { + typ := CreateIdentityProviderConfigTypeSAMLIdentityProviderConfigInput + + return CreateIdentityProviderConfig{ + SAMLIdentityProviderConfigInput: &samlIdentityProviderConfigInput, + Type: typ, + } +} + +func (u *CreateIdentityProviderConfig) UnmarshalJSON(data []byte) error { + + var samlIdentityProviderConfigInput SAMLIdentityProviderConfigInput = SAMLIdentityProviderConfigInput{} + if err := utils.UnmarshalJSON(data, &samlIdentityProviderConfigInput, "", true, true); err == nil { + u.SAMLIdentityProviderConfigInput = &samlIdentityProviderConfigInput + u.Type = CreateIdentityProviderConfigTypeSAMLIdentityProviderConfigInput + return nil + } + + var configureOIDCIdentityProviderConfig ConfigureOIDCIdentityProviderConfig = ConfigureOIDCIdentityProviderConfig{} + if err := utils.UnmarshalJSON(data, &configureOIDCIdentityProviderConfig, "", true, true); err == nil { + u.ConfigureOIDCIdentityProviderConfig = &configureOIDCIdentityProviderConfig + u.Type = CreateIdentityProviderConfigTypeConfigureOIDCIdentityProviderConfig + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreateIdentityProviderConfig", string(data)) +} + +func (u CreateIdentityProviderConfig) MarshalJSON() ([]byte, error) { + if u.ConfigureOIDCIdentityProviderConfig != nil { + return utils.MarshalJSON(u.ConfigureOIDCIdentityProviderConfig, "", true) + } + + if u.SAMLIdentityProviderConfigInput != nil { + return utils.MarshalJSON(u.SAMLIdentityProviderConfigInput, "", true) + } + + return nil, errors.New("could not marshal union type CreateIdentityProviderConfig: all fields are null") +} + +// CreateIdentityProvider - The identity provider that contains configuration data for creating an authentication integration. +type CreateIdentityProvider struct { + // Specifies the type of identity provider. + Type *IdentityProviderType `json:"type,omitempty"` + // The path used for initiating login requests with the identity provider. + LoginPath *string `json:"login_path,omitempty"` + Config *CreateIdentityProviderConfig `json:"config,omitempty"` +} + +func (o *CreateIdentityProvider) GetType() *IdentityProviderType { + if o == nil { + return nil + } + return o.Type +} + +func (o *CreateIdentityProvider) GetLoginPath() *string { + if o == nil { + return nil + } + return o.LoginPath +} + +func (o *CreateIdentityProvider) GetConfig() *CreateIdentityProviderConfig { + if o == nil { + return nil + } + return o.Config +} diff --git a/tests/mockserver/internal/sdk/models/components/createnetworkrequest.go b/tests/mockserver/internal/sdk/models/components/createnetworkrequest.go new file mode 100644 index 00000000..5b6b73d0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createnetworkrequest.go @@ -0,0 +1,75 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" +) + +// CreateNetworkRequest - Request schema for creating a network. +type CreateNetworkRequest struct { + // Human-readable name of the network. + Name string `json:"name"` + CloudGatewayProviderAccountID string `json:"cloud_gateway_provider_account_id"` + // Region ID for cloud provider region. + Region string `json:"region"` + // List of availability zones that the network is attached to. + AvailabilityZones []string `json:"availability_zones"` + // CIDR block configuration for the network. + CidrBlock string `json:"cidr_block"` + // Initial state for creating a network. + State *NetworkCreateState `default:"initializing" json:"state"` +} + +func (c CreateNetworkRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateNetworkRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateNetworkRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateNetworkRequest) GetCloudGatewayProviderAccountID() string { + if o == nil { + return "" + } + return o.CloudGatewayProviderAccountID +} + +func (o *CreateNetworkRequest) GetRegion() string { + if o == nil { + return "" + } + return o.Region +} + +func (o *CreateNetworkRequest) GetAvailabilityZones() []string { + if o == nil { + return []string{} + } + return o.AvailabilityZones +} + +func (o *CreateNetworkRequest) GetCidrBlock() string { + if o == nil { + return "" + } + return o.CidrBlock +} + +func (o *CreateNetworkRequest) GetState() *NetworkCreateState { + if o == nil { + return nil + } + return o.State +} diff --git a/tests/mockserver/internal/sdk/models/components/createpluginschemas.go b/tests/mockserver/internal/sdk/models/components/createpluginschemas.go new file mode 100644 index 00000000..dadb4988 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createpluginschemas.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CreatePluginSchemas struct { + // The custom plugin schema; `jq -Rs '.' schema.lua`. + // + LuaSchema string `json:"lua_schema"` +} + +func (o *CreatePluginSchemas) GetLuaSchema() string { + if o == nil { + return "" + } + return o.LuaSchema +} diff --git a/tests/mockserver/internal/sdk/models/components/createsystemaccount.go b/tests/mockserver/internal/sdk/models/components/createsystemaccount.go new file mode 100644 index 00000000..c6191eb4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createsystemaccount.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateSystemAccount - The request schema to create a system account. +type CreateSystemAccount struct { + // Name of the system account. + Name string `json:"name"` + // Description of the system account. Useful when the system account name is not sufficient to differentiate one system account from another. + Description string `json:"description"` + // The system account is managed by Konnect (true/false). + KonnectManaged *bool `json:"konnect_managed,omitempty"` +} + +func (o *CreateSystemAccount) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateSystemAccount) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *CreateSystemAccount) GetKonnectManaged() *bool { + if o == nil { + return nil + } + return o.KonnectManaged +} diff --git a/tests/mockserver/internal/sdk/models/components/createsystemaccountaccesstoken.go b/tests/mockserver/internal/sdk/models/components/createsystemaccountaccesstoken.go new file mode 100644 index 00000000..24b09458 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createsystemaccountaccesstoken.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// CreateSystemAccountAccessToken - The request body to create a system account access token. +type CreateSystemAccountAccessToken struct { + Name *string `json:"name,omitempty"` + ExpiresAt *time.Time `json:"expires_at,omitempty"` +} + +func (c CreateSystemAccountAccessToken) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateSystemAccountAccessToken) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateSystemAccountAccessToken) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *CreateSystemAccountAccessToken) GetExpiresAt() *time.Time { + if o == nil { + return nil + } + return o.ExpiresAt +} diff --git a/tests/mockserver/internal/sdk/models/components/createteam.go b/tests/mockserver/internal/sdk/models/components/createteam.go new file mode 100644 index 00000000..5ab62bef --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createteam.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CreateTeam - The request schema for the create team request. +// +// If you pass the same `name` and `description` of an existing team in the request, a team with the same `name` and `description` will be created. The two teams will have different `team_id` values to differentiate them. +type CreateTeam struct { + // A name for the team being created. + Name string `json:"name"` + // The description of the new team. + Description *string `json:"description,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *CreateTeam) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CreateTeam) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *CreateTeam) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/createtransitgatewayrequest.go b/tests/mockserver/internal/sdk/models/components/createtransitgatewayrequest.go new file mode 100644 index 00000000..aa453e4b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/createtransitgatewayrequest.go @@ -0,0 +1,95 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type CreateTransitGatewayRequestType string + +const ( + CreateTransitGatewayRequestTypeAWSTransitGateway CreateTransitGatewayRequestType = "AWSTransitGateway" + CreateTransitGatewayRequestTypeAWSVpcPeeringGateway CreateTransitGatewayRequestType = "AWSVpcPeeringGateway" + CreateTransitGatewayRequestTypeAzureTransitGateway CreateTransitGatewayRequestType = "AzureTransitGateway" +) + +// CreateTransitGatewayRequest - Request schema for creating a transit gateway. +type CreateTransitGatewayRequest struct { + AWSTransitGateway *AWSTransitGateway `queryParam:"inline"` + AWSVpcPeeringGateway *AWSVpcPeeringGateway `queryParam:"inline"` + AzureTransitGateway *AzureTransitGateway `queryParam:"inline"` + + Type CreateTransitGatewayRequestType +} + +func CreateCreateTransitGatewayRequestAWSTransitGateway(awsTransitGateway AWSTransitGateway) CreateTransitGatewayRequest { + typ := CreateTransitGatewayRequestTypeAWSTransitGateway + + return CreateTransitGatewayRequest{ + AWSTransitGateway: &awsTransitGateway, + Type: typ, + } +} + +func CreateCreateTransitGatewayRequestAWSVpcPeeringGateway(awsVpcPeeringGateway AWSVpcPeeringGateway) CreateTransitGatewayRequest { + typ := CreateTransitGatewayRequestTypeAWSVpcPeeringGateway + + return CreateTransitGatewayRequest{ + AWSVpcPeeringGateway: &awsVpcPeeringGateway, + Type: typ, + } +} + +func CreateCreateTransitGatewayRequestAzureTransitGateway(azureTransitGateway AzureTransitGateway) CreateTransitGatewayRequest { + typ := CreateTransitGatewayRequestTypeAzureTransitGateway + + return CreateTransitGatewayRequest{ + AzureTransitGateway: &azureTransitGateway, + Type: typ, + } +} + +func (u *CreateTransitGatewayRequest) UnmarshalJSON(data []byte) error { + + var azureTransitGateway AzureTransitGateway = AzureTransitGateway{} + if err := utils.UnmarshalJSON(data, &azureTransitGateway, "", true, true); err == nil { + u.AzureTransitGateway = &azureTransitGateway + u.Type = CreateTransitGatewayRequestTypeAzureTransitGateway + return nil + } + + var awsTransitGateway AWSTransitGateway = AWSTransitGateway{} + if err := utils.UnmarshalJSON(data, &awsTransitGateway, "", true, true); err == nil { + u.AWSTransitGateway = &awsTransitGateway + u.Type = CreateTransitGatewayRequestTypeAWSTransitGateway + return nil + } + + var awsVpcPeeringGateway AWSVpcPeeringGateway = AWSVpcPeeringGateway{} + if err := utils.UnmarshalJSON(data, &awsVpcPeeringGateway, "", true, true); err == nil { + u.AWSVpcPeeringGateway = &awsVpcPeeringGateway + u.Type = CreateTransitGatewayRequestTypeAWSVpcPeeringGateway + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreateTransitGatewayRequest", string(data)) +} + +func (u CreateTransitGatewayRequest) MarshalJSON() ([]byte, error) { + if u.AWSTransitGateway != nil { + return utils.MarshalJSON(u.AWSTransitGateway, "", true) + } + + if u.AWSVpcPeeringGateway != nil { + return utils.MarshalJSON(u.AWSVpcPeeringGateway, "", true) + } + + if u.AzureTransitGateway != nil { + return utils.MarshalJSON(u.AzureTransitGateway, "", true) + } + + return nil, errors.New("could not marshal union type CreateTransitGatewayRequest: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/cursormeta.go b/tests/mockserver/internal/sdk/models/components/cursormeta.go new file mode 100644 index 00000000..d5a726b0 --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/cursormetapage.go b/tests/mockserver/internal/sdk/models/components/cursormetapage.go new file mode 100644 index 00000000..f39ee2a1 --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/cursormetawithsizeandtotal.go b/tests/mockserver/internal/sdk/models/components/cursormetawithsizeandtotal.go new file mode 100644 index 00000000..0cf1edb3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/cursormetawithsizeandtotal.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CursorMetaWithSizeAndTotal struct { + // URI to the next page + Next *string `json:"next"` + // Requested page size + Size float64 `json:"size"` + // Total number of objects in the collection; will only be present on the first page + Total *float64 `json:"total"` +} + +func (o *CursorMetaWithSizeAndTotal) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *CursorMetaWithSizeAndTotal) GetSize() float64 { + if o == nil { + return 0.0 + } + return o.Size +} + +func (o *CursorMetaWithSizeAndTotal) GetTotal() *float64 { + if o == nil { + return nil + } + return o.Total +} diff --git a/tests/mockserver/internal/sdk/models/components/cursorpaginatedmetawithsizeandtotal.go b/tests/mockserver/internal/sdk/models/components/cursorpaginatedmetawithsizeandtotal.go new file mode 100644 index 00000000..d722ce4a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/cursorpaginatedmetawithsizeandtotal.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CursorPaginatedMetaWithSizeAndTotal - returns the pagination information +type CursorPaginatedMetaWithSizeAndTotal struct { + Page CursorMetaWithSizeAndTotal `json:"page"` +} + +func (o *CursorPaginatedMetaWithSizeAndTotal) GetPage() CursorMetaWithSizeAndTotal { + if o == nil { + return CursorMetaWithSizeAndTotal{} + } + return o.Page +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomain.go b/tests/mockserver/internal/sdk/models/components/customdomain.go new file mode 100644 index 00000000..9bf092d3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomain.go @@ -0,0 +1,150 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// CustomDomainStateMetadata - Metadata describing the backing state of the custom domain and why it may be in an erroneous state. +type CustomDomainStateMetadata struct { + // Reported status of the custom domain from backing infrastructure. + ReportedStatus *string `json:"reported_status,omitempty"` + // Reason why the custom domain may be in an erroneous state, reported from backing infrastructure. + // + Reason *string `json:"reason,omitempty"` +} + +func (o *CustomDomainStateMetadata) GetReportedStatus() *string { + if o == nil { + return nil + } + return o.ReportedStatus +} + +func (o *CustomDomainStateMetadata) GetReason() *string { + if o == nil { + return nil + } + return o.Reason +} + +// CustomDomain - Object containing information about a custom domain for a control-plane. +type CustomDomain struct { + ID string `json:"id"` + ControlPlaneID string `json:"control_plane_id"` + // Set of control-plane geos supported for deploying cloud-gateways configurations. + ControlPlaneGeo ControlPlaneGeo `json:"control_plane_geo"` + // Domain name of the custom domain. + Domain string `json:"domain"` + // Certificate ID for the certificate representing this domain and stored on data-planes for this + // control-plane. Can be retrieved via the control-planes API for this custom domain's control-plane. + // + CertificateID *string `json:"certificate_id,omitempty"` + // Server Name Indication ID for this domain and stored on data-planes for this control-plane. Can be retrieved + // via the control-planes API for this custom domain's control-plane. + // + SniID *string `json:"sni_id,omitempty"` + // State of the custom domain. + State CustomDomainState `json:"state"` + // Metadata describing the backing state of the custom domain and why it may be in an erroneous state. + // + StateMetadata CustomDomainStateMetadata `json:"state_metadata"` + // Monotonically-increasing version count of the custom domain, to indicate the order of updates to the custom + // domain. + // + EntityVersion int64 `json:"entity_version"` + // An RFC-3339 timestamp representation of custom domain creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of custom domain update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (c CustomDomain) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CustomDomain) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CustomDomain) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *CustomDomain) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CustomDomain) GetControlPlaneGeo() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.ControlPlaneGeo +} + +func (o *CustomDomain) GetDomain() string { + if o == nil { + return "" + } + return o.Domain +} + +func (o *CustomDomain) GetCertificateID() *string { + if o == nil { + return nil + } + return o.CertificateID +} + +func (o *CustomDomain) GetSniID() *string { + if o == nil { + return nil + } + return o.SniID +} + +func (o *CustomDomain) GetState() CustomDomainState { + if o == nil { + return CustomDomainState("") + } + return o.State +} + +func (o *CustomDomain) GetStateMetadata() CustomDomainStateMetadata { + if o == nil { + return CustomDomainStateMetadata{} + } + return o.StateMetadata +} + +func (o *CustomDomain) GetEntityVersion() int64 { + if o == nil { + return 0 + } + return o.EntityVersion +} + +func (o *CustomDomain) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *CustomDomain) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainonlinepropertystatus.go b/tests/mockserver/internal/sdk/models/components/customdomainonlinepropertystatus.go new file mode 100644 index 00000000..307c950f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainonlinepropertystatus.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// CustomDomainOnlinePropertyStatus - Set of available statuses for the online properties of a custom domain. +type CustomDomainOnlinePropertyStatus string + +const ( + CustomDomainOnlinePropertyStatusVerified CustomDomainOnlinePropertyStatus = "verified" + CustomDomainOnlinePropertyStatusUnverified CustomDomainOnlinePropertyStatus = "unverified" +) + +func (e CustomDomainOnlinePropertyStatus) ToPointer() *CustomDomainOnlinePropertyStatus { + return &e +} +func (e *CustomDomainOnlinePropertyStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "verified": + fallthrough + case "unverified": + *e = CustomDomainOnlinePropertyStatus(v) + return nil + default: + return fmt.Errorf("invalid value for CustomDomainOnlinePropertyStatus: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainonlinestatus.go b/tests/mockserver/internal/sdk/models/components/customdomainonlinestatus.go new file mode 100644 index 00000000..c4cfe999 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainonlinestatus.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CustomDomainOnlineStatus - Response format for retrieving the CNAME and SSL status of a custom domain. +type CustomDomainOnlineStatus struct { + // Set of available statuses for the online properties of a custom domain. + Cname CustomDomainOnlinePropertyStatus `json:"cname"` + // Set of available statuses for the online properties of a custom domain. + Ssl CustomDomainOnlinePropertyStatus `json:"ssl"` +} + +func (o *CustomDomainOnlineStatus) GetCname() CustomDomainOnlinePropertyStatus { + if o == nil { + return CustomDomainOnlinePropertyStatus("") + } + return o.Cname +} + +func (o *CustomDomainOnlineStatus) GetSsl() CustomDomainOnlinePropertyStatus { + if o == nil { + return CustomDomainOnlinePropertyStatus("") + } + return o.Ssl +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainsfilterparameters.go b/tests/mockserver/internal/sdk/models/components/customdomainsfilterparameters.go new file mode 100644 index 00000000..982e6c23 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainsfilterparameters.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CustomDomainsFilterParameters struct { + // Returns entities that exact match any of the comma-delimited phrases in the filter string. + ControlPlaneID *IDFieldFilter `queryParam:"name=control_plane_id"` + ControlPlaneGeo *ControlPlaneGeoFieldFilter `queryParam:"name=control_plane_geo"` + Domain *CloudGatewaysStringFieldFilterOverride `queryParam:"name=domain"` + State *CustomDomainStateFieldFilter `queryParam:"name=state"` +} + +func (o *CustomDomainsFilterParameters) GetControlPlaneID() *IDFieldFilter { + if o == nil { + return nil + } + return o.ControlPlaneID +} + +func (o *CustomDomainsFilterParameters) GetControlPlaneGeo() *ControlPlaneGeoFieldFilter { + if o == nil { + return nil + } + return o.ControlPlaneGeo +} + +func (o *CustomDomainsFilterParameters) GetDomain() *CloudGatewaysStringFieldFilterOverride { + if o == nil { + return nil + } + return o.Domain +} + +func (o *CustomDomainsFilterParameters) GetState() *CustomDomainStateFieldFilter { + if o == nil { + return nil + } + return o.State +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainstate.go b/tests/mockserver/internal/sdk/models/components/customdomainstate.go new file mode 100644 index 00000000..7fee830f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainstate.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// CustomDomainState - State of the custom domain. +type CustomDomainState string + +const ( + CustomDomainStateCreated CustomDomainState = "created" + CustomDomainStateInitializing CustomDomainState = "initializing" + CustomDomainStateReady CustomDomainState = "ready" + CustomDomainStateTerminating CustomDomainState = "terminating" + CustomDomainStateTerminated CustomDomainState = "terminated" + CustomDomainStateError CustomDomainState = "error" +) + +func (e CustomDomainState) ToPointer() *CustomDomainState { + return &e +} +func (e *CustomDomainState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "created": + fallthrough + case "initializing": + fallthrough + case "ready": + fallthrough + case "terminating": + fallthrough + case "terminated": + fallthrough + case "error": + *e = CustomDomainState(v) + return nil + default: + return fmt.Errorf("invalid value for CustomDomainState: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainstatefieldequalsfilter.go b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldequalsfilter.go new file mode 100644 index 00000000..62dcb51d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldequalsfilter.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type CustomDomainStateFieldEqualsComparison struct { +} + +type CustomDomainStateFieldEqualsFilterType string + +const ( + CustomDomainStateFieldEqualsFilterTypeCustomDomainState CustomDomainStateFieldEqualsFilterType = "CustomDomainState" + CustomDomainStateFieldEqualsFilterTypeCustomDomainStateFieldEqualsComparison CustomDomainStateFieldEqualsFilterType = "CustomDomainStateFieldEqualsComparison" +) + +// CustomDomainStateFieldEqualsFilter - Filter custom domain state by exact match. +type CustomDomainStateFieldEqualsFilter struct { + CustomDomainState *CustomDomainState `queryParam:"inline"` + CustomDomainStateFieldEqualsComparison *CustomDomainStateFieldEqualsComparison `queryParam:"inline"` + + Type CustomDomainStateFieldEqualsFilterType +} + +func CreateCustomDomainStateFieldEqualsFilterCustomDomainState(customDomainState CustomDomainState) CustomDomainStateFieldEqualsFilter { + typ := CustomDomainStateFieldEqualsFilterTypeCustomDomainState + + return CustomDomainStateFieldEqualsFilter{ + CustomDomainState: &customDomainState, + Type: typ, + } +} + +func CreateCustomDomainStateFieldEqualsFilterCustomDomainStateFieldEqualsComparison(customDomainStateFieldEqualsComparison CustomDomainStateFieldEqualsComparison) CustomDomainStateFieldEqualsFilter { + typ := CustomDomainStateFieldEqualsFilterTypeCustomDomainStateFieldEqualsComparison + + return CustomDomainStateFieldEqualsFilter{ + CustomDomainStateFieldEqualsComparison: &customDomainStateFieldEqualsComparison, + Type: typ, + } +} + +func (u *CustomDomainStateFieldEqualsFilter) UnmarshalJSON(data []byte) error { + + var customDomainStateFieldEqualsComparison CustomDomainStateFieldEqualsComparison = CustomDomainStateFieldEqualsComparison{} + if err := utils.UnmarshalJSON(data, &customDomainStateFieldEqualsComparison, "", true, true); err == nil { + u.CustomDomainStateFieldEqualsComparison = &customDomainStateFieldEqualsComparison + u.Type = CustomDomainStateFieldEqualsFilterTypeCustomDomainStateFieldEqualsComparison + return nil + } + + var customDomainState CustomDomainState = CustomDomainState("") + if err := utils.UnmarshalJSON(data, &customDomainState, "", true, true); err == nil { + u.CustomDomainState = &customDomainState + u.Type = CustomDomainStateFieldEqualsFilterTypeCustomDomainState + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CustomDomainStateFieldEqualsFilter", string(data)) +} + +func (u CustomDomainStateFieldEqualsFilter) MarshalJSON() ([]byte, error) { + if u.CustomDomainState != nil { + return utils.MarshalJSON(u.CustomDomainState, "", true) + } + + if u.CustomDomainStateFieldEqualsComparison != nil { + return utils.MarshalJSON(u.CustomDomainStateFieldEqualsComparison, "", true) + } + + return nil, errors.New("could not marshal union type CustomDomainStateFieldEqualsFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainstatefieldfilter.go b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldfilter.go new file mode 100644 index 00000000..84e8b715 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldfilter.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type CustomDomainStateFieldFilterType string + +const ( + CustomDomainStateFieldFilterTypeCustomDomainStateFieldEqualsFilter CustomDomainStateFieldFilterType = "CustomDomainStateFieldEqualsFilter" + CustomDomainStateFieldFilterTypeCustomDomainStateFieldNotEqualsFilter CustomDomainStateFieldFilterType = "CustomDomainStateFieldNotEqualsFilter" + CustomDomainStateFieldFilterTypeCustomDomainStateFieldOrEqualityFilter CustomDomainStateFieldFilterType = "CustomDomainStateFieldOrEqualityFilter" +) + +type CustomDomainStateFieldFilter struct { + CustomDomainStateFieldEqualsFilter *CustomDomainStateFieldEqualsFilter `queryParam:"inline"` + CustomDomainStateFieldNotEqualsFilter *CustomDomainStateFieldNotEqualsFilter `queryParam:"inline"` + CustomDomainStateFieldOrEqualityFilter *CustomDomainStateFieldOrEqualityFilter `queryParam:"inline"` + + Type CustomDomainStateFieldFilterType +} + +func CreateCustomDomainStateFieldFilterCustomDomainStateFieldEqualsFilter(customDomainStateFieldEqualsFilter CustomDomainStateFieldEqualsFilter) CustomDomainStateFieldFilter { + typ := CustomDomainStateFieldFilterTypeCustomDomainStateFieldEqualsFilter + + return CustomDomainStateFieldFilter{ + CustomDomainStateFieldEqualsFilter: &customDomainStateFieldEqualsFilter, + Type: typ, + } +} + +func CreateCustomDomainStateFieldFilterCustomDomainStateFieldNotEqualsFilter(customDomainStateFieldNotEqualsFilter CustomDomainStateFieldNotEqualsFilter) CustomDomainStateFieldFilter { + typ := CustomDomainStateFieldFilterTypeCustomDomainStateFieldNotEqualsFilter + + return CustomDomainStateFieldFilter{ + CustomDomainStateFieldNotEqualsFilter: &customDomainStateFieldNotEqualsFilter, + Type: typ, + } +} + +func CreateCustomDomainStateFieldFilterCustomDomainStateFieldOrEqualityFilter(customDomainStateFieldOrEqualityFilter CustomDomainStateFieldOrEqualityFilter) CustomDomainStateFieldFilter { + typ := CustomDomainStateFieldFilterTypeCustomDomainStateFieldOrEqualityFilter + + return CustomDomainStateFieldFilter{ + CustomDomainStateFieldOrEqualityFilter: &customDomainStateFieldOrEqualityFilter, + Type: typ, + } +} + +func (u *CustomDomainStateFieldFilter) UnmarshalJSON(data []byte) error { + + var customDomainStateFieldNotEqualsFilter CustomDomainStateFieldNotEqualsFilter = CustomDomainStateFieldNotEqualsFilter{} + if err := utils.UnmarshalJSON(data, &customDomainStateFieldNotEqualsFilter, "", true, true); err == nil { + u.CustomDomainStateFieldNotEqualsFilter = &customDomainStateFieldNotEqualsFilter + u.Type = CustomDomainStateFieldFilterTypeCustomDomainStateFieldNotEqualsFilter + return nil + } + + var customDomainStateFieldOrEqualityFilter CustomDomainStateFieldOrEqualityFilter = CustomDomainStateFieldOrEqualityFilter{} + if err := utils.UnmarshalJSON(data, &customDomainStateFieldOrEqualityFilter, "", true, true); err == nil { + u.CustomDomainStateFieldOrEqualityFilter = &customDomainStateFieldOrEqualityFilter + u.Type = CustomDomainStateFieldFilterTypeCustomDomainStateFieldOrEqualityFilter + return nil + } + + var customDomainStateFieldEqualsFilter CustomDomainStateFieldEqualsFilter = CustomDomainStateFieldEqualsFilter{} + if err := utils.UnmarshalJSON(data, &customDomainStateFieldEqualsFilter, "", true, true); err == nil { + u.CustomDomainStateFieldEqualsFilter = &customDomainStateFieldEqualsFilter + u.Type = CustomDomainStateFieldFilterTypeCustomDomainStateFieldEqualsFilter + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CustomDomainStateFieldFilter", string(data)) +} + +func (u CustomDomainStateFieldFilter) MarshalJSON() ([]byte, error) { + if u.CustomDomainStateFieldEqualsFilter != nil { + return utils.MarshalJSON(u.CustomDomainStateFieldEqualsFilter, "", true) + } + + if u.CustomDomainStateFieldNotEqualsFilter != nil { + return utils.MarshalJSON(u.CustomDomainStateFieldNotEqualsFilter, "", true) + } + + if u.CustomDomainStateFieldOrEqualityFilter != nil { + return utils.MarshalJSON(u.CustomDomainStateFieldOrEqualityFilter, "", true) + } + + return nil, errors.New("could not marshal union type CustomDomainStateFieldFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainstatefieldnotequalsfilter.go b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldnotequalsfilter.go new file mode 100644 index 00000000..6320db04 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldnotequalsfilter.go @@ -0,0 +1,7 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CustomDomainStateFieldNotEqualsFilter - Filter custom domain state by inequality match. +type CustomDomainStateFieldNotEqualsFilter struct { +} diff --git a/tests/mockserver/internal/sdk/models/components/customdomainstatefieldorequalityfilter.go b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldorequalityfilter.go new file mode 100644 index 00000000..769e0b1d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customdomainstatefieldorequalityfilter.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// CustomDomainStateFieldOrEqualityFilter - Filter custom domain state by determining if the value is equal to any in a set of values, where the set is a +// comma-delimited list. +type CustomDomainStateFieldOrEqualityFilter struct { + Oeq string `queryParam:"name=oeq"` +} + +func (o *CustomDomainStateFieldOrEqualityFilter) GetOeq() string { + if o == nil { + return "" + } + return o.Oeq +} diff --git a/tests/mockserver/internal/sdk/models/components/customplugin.go b/tests/mockserver/internal/sdk/models/components/customplugin.go new file mode 100644 index 00000000..37f0f1ae --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/customplugin.go @@ -0,0 +1,64 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type CustomPlugin struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + Handler string `json:"handler"` + ID *string `json:"id,omitempty"` + Name string `json:"name"` + Schema string `json:"schema"` + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *CustomPlugin) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *CustomPlugin) GetHandler() string { + if o == nil { + return "" + } + return o.Handler +} + +func (o *CustomPlugin) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *CustomPlugin) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *CustomPlugin) GetSchema() string { + if o == nil { + return "" + } + return o.Schema +} + +func (o *CustomPlugin) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *CustomPlugin) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificate.go b/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificate.go new file mode 100644 index 00000000..81b3061c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificate.go @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type DataPlaneClientCertificate struct { + // Unique ID of the certificate entity. + ID *string `json:"id,omitempty"` + // Date certificate was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Date certificate was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + // JSON escaped string of the certificate. + Cert *string `json:"cert,omitempty"` +} + +func (o *DataPlaneClientCertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *DataPlaneClientCertificate) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *DataPlaneClientCertificate) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *DataPlaneClientCertificate) GetCert() *string { + if o == nil { + return nil + } + return o.Cert +} diff --git a/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificaterequest.go b/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificaterequest.go new file mode 100644 index 00000000..54374f8a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificaterequest.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// DataPlaneClientCertificateRequest - Request body for creating a dp-client-certificate. +type DataPlaneClientCertificateRequest struct { + // JSON escaped string of the certificate. + Cert string `json:"cert"` +} + +func (o *DataPlaneClientCertificateRequest) GetCert() string { + if o == nil { + return "" + } + return o.Cert +} diff --git a/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificateresponse.go b/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificateresponse.go new file mode 100644 index 00000000..d1094813 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/dataplaneclientcertificateresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// DataPlaneClientCertificateResponse - Response body for retrieving a dp-client-certificate. +type DataPlaneClientCertificateResponse struct { + Item *DataPlaneClientCertificate `json:"item,omitempty"` +} + +func (o *DataPlaneClientCertificateResponse) GetItem() *DataPlaneClientCertificate { + if o == nil { + return nil + } + return o.Item +} diff --git a/tests/mockserver/internal/sdk/models/components/dcrproviderresponse.go b/tests/mockserver/internal/sdk/models/components/dcrproviderresponse.go new file mode 100644 index 00000000..d3259a0c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/dcrproviderresponse.go @@ -0,0 +1,748 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "errors" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// DcrProviderResponseDcrProviderHTTPDcrConfig - The DCR configuration for this DCR provider. +type DcrProviderResponseDcrProviderHTTPDcrConfig struct { +} + +// DCRProviderResponseDCRProviderHTTP - A DCR provider for HTTP -- only properties not included in DcrProviderBase +type DCRProviderResponseDCRProviderHTTP struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig DcrProviderResponseDcrProviderHTTPDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DCRProviderResponseDCRProviderHTTP) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DCRProviderResponseDCRProviderHTTP) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetDcrConfig() DcrProviderResponseDcrProviderHTTPDcrConfig { + if o == nil { + return DcrProviderResponseDcrProviderHTTPDcrConfig{} + } + return o.DcrConfig +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DCRProviderResponseDCRProviderHTTP) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// DcrProviderResponseDcrProviderOktaDcrConfig - The DCR configuration for this DCR provider. +type DcrProviderResponseDcrProviderOktaDcrConfig struct { +} + +// DCRProviderResponseDCRProviderOKTA - A DCR provider for Okta -- only properties not included in DcrProviderBase +type DCRProviderResponseDCRProviderOKTA struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig DcrProviderResponseDcrProviderOktaDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DCRProviderResponseDCRProviderOKTA) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DCRProviderResponseDCRProviderOKTA) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetDcrConfig() DcrProviderResponseDcrProviderOktaDcrConfig { + if o == nil { + return DcrProviderResponseDcrProviderOktaDcrConfig{} + } + return o.DcrConfig +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DCRProviderResponseDCRProviderOKTA) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// DcrProviderResponseDcrProviderCurityDcrConfig - The DCR configuration for this DCR provider. +type DcrProviderResponseDcrProviderCurityDcrConfig struct { +} + +// DCRProviderResponseDCRProviderCurity - A DCR provider for Curity -- only properties not included in DcrProviderBase +type DCRProviderResponseDCRProviderCurity struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig DcrProviderResponseDcrProviderCurityDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DCRProviderResponseDCRProviderCurity) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DCRProviderResponseDCRProviderCurity) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DCRProviderResponseDCRProviderCurity) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *DCRProviderResponseDCRProviderCurity) GetDcrConfig() DcrProviderResponseDcrProviderCurityDcrConfig { + if o == nil { + return DcrProviderResponseDcrProviderCurityDcrConfig{} + } + return o.DcrConfig +} + +func (o *DCRProviderResponseDCRProviderCurity) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DCRProviderResponseDCRProviderCurity) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DCRProviderResponseDCRProviderCurity) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *DCRProviderResponseDCRProviderCurity) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *DCRProviderResponseDCRProviderCurity) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *DCRProviderResponseDCRProviderCurity) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *DCRProviderResponseDCRProviderCurity) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DCRProviderResponseDCRProviderCurity) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// DcrProviderResponseDcrProviderAzureAdDcrConfig - The DCR configuration for this DCR provider. +type DcrProviderResponseDcrProviderAzureAdDcrConfig struct { +} + +// DCRProviderResponseDCRProviderAzureAD - A DCR provider for Azure AD -- only properties not included in DcrProviderBase +type DCRProviderResponseDCRProviderAzureAD struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig DcrProviderResponseDcrProviderAzureAdDcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DCRProviderResponseDCRProviderAzureAD) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DCRProviderResponseDCRProviderAzureAD) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetDcrConfig() DcrProviderResponseDcrProviderAzureAdDcrConfig { + if o == nil { + return DcrProviderResponseDcrProviderAzureAdDcrConfig{} + } + return o.DcrConfig +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DCRProviderResponseDCRProviderAzureAD) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +// DcrProviderResponseDcrProviderAuth0DcrConfig - The DCR configuration for this DCR provider. +type DcrProviderResponseDcrProviderAuth0DcrConfig struct { +} + +// DCRProviderResponseDCRProviderAuth0 - A DCR provider for Auth0 -- only properties not included in DcrProviderBase +type DCRProviderResponseDCRProviderAuth0 struct { + // The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http + ProviderType string `json:"provider_type"` + // The DCR configuration for this DCR provider. + DcrConfig DcrProviderResponseDcrProviderAuth0DcrConfig `json:"dcr_config"` + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name string `json:"name"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // The issuer of the DCR provider. + Issuer string `json:"issuer"` + // At least one active auth strategy is using this DCR provider. + Active bool `json:"active"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DCRProviderResponseDCRProviderAuth0) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DCRProviderResponseDCRProviderAuth0) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetProviderType() string { + if o == nil { + return "" + } + return o.ProviderType +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetDcrConfig() DcrProviderResponseDcrProviderAuth0DcrConfig { + if o == nil { + return DcrProviderResponseDcrProviderAuth0DcrConfig{} + } + return o.DcrConfig +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetIssuer() string { + if o == nil { + return "" + } + return o.Issuer +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetActive() bool { + if o == nil { + return false + } + return o.Active +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DCRProviderResponseDCRProviderAuth0) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +type DcrProviderResponseType string + +const ( + DcrProviderResponseTypeDcrProviderAuth0 DcrProviderResponseType = "DcrProviderAuth0" + DcrProviderResponseTypeDcrProviderAzureAd DcrProviderResponseType = "DcrProviderAzureAd" + DcrProviderResponseTypeDcrProviderCurity DcrProviderResponseType = "DcrProviderCurity" + DcrProviderResponseTypeDcrProviderOkta DcrProviderResponseType = "DcrProviderOkta" + DcrProviderResponseTypeDcrProviderHTTP DcrProviderResponseType = "DcrProviderHttp" +) + +// DcrProviderResponse - A response containing a single DCR provider object. Sensitive fields will be removed from the response. +type DcrProviderResponse struct { + DCRProviderResponseDCRProviderAuth0 *DCRProviderResponseDCRProviderAuth0 `queryParam:"inline"` + DCRProviderResponseDCRProviderAzureAD *DCRProviderResponseDCRProviderAzureAD `queryParam:"inline"` + DCRProviderResponseDCRProviderCurity *DCRProviderResponseDCRProviderCurity `queryParam:"inline"` + DCRProviderResponseDCRProviderOKTA *DCRProviderResponseDCRProviderOKTA `queryParam:"inline"` + DCRProviderResponseDCRProviderHTTP *DCRProviderResponseDCRProviderHTTP `queryParam:"inline"` + + Type DcrProviderResponseType +} + +func CreateDcrProviderResponseDcrProviderAuth0(dcrProviderAuth0 DCRProviderResponseDCRProviderAuth0) DcrProviderResponse { + typ := DcrProviderResponseTypeDcrProviderAuth0 + + typStr := string(typ) + dcrProviderAuth0.ProviderType = typStr + + return DcrProviderResponse{ + DCRProviderResponseDCRProviderAuth0: &dcrProviderAuth0, + Type: typ, + } +} + +func CreateDcrProviderResponseDcrProviderAzureAd(dcrProviderAzureAd DCRProviderResponseDCRProviderAzureAD) DcrProviderResponse { + typ := DcrProviderResponseTypeDcrProviderAzureAd + + typStr := string(typ) + dcrProviderAzureAd.ProviderType = typStr + + return DcrProviderResponse{ + DCRProviderResponseDCRProviderAzureAD: &dcrProviderAzureAd, + Type: typ, + } +} + +func CreateDcrProviderResponseDcrProviderCurity(dcrProviderCurity DCRProviderResponseDCRProviderCurity) DcrProviderResponse { + typ := DcrProviderResponseTypeDcrProviderCurity + + typStr := string(typ) + dcrProviderCurity.ProviderType = typStr + + return DcrProviderResponse{ + DCRProviderResponseDCRProviderCurity: &dcrProviderCurity, + Type: typ, + } +} + +func CreateDcrProviderResponseDcrProviderOkta(dcrProviderOkta DCRProviderResponseDCRProviderOKTA) DcrProviderResponse { + typ := DcrProviderResponseTypeDcrProviderOkta + + typStr := string(typ) + dcrProviderOkta.ProviderType = typStr + + return DcrProviderResponse{ + DCRProviderResponseDCRProviderOKTA: &dcrProviderOkta, + Type: typ, + } +} + +func CreateDcrProviderResponseDcrProviderHTTP(dcrProviderHTTP DCRProviderResponseDCRProviderHTTP) DcrProviderResponse { + typ := DcrProviderResponseTypeDcrProviderHTTP + + typStr := string(typ) + dcrProviderHTTP.ProviderType = typStr + + return DcrProviderResponse{ + DCRProviderResponseDCRProviderHTTP: &dcrProviderHTTP, + Type: typ, + } +} + +func (u *DcrProviderResponse) UnmarshalJSON(data []byte) error { + + type discriminator struct { + ProviderType string `json:"provider_type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.ProviderType { + case "DcrProviderAuth0": + dcrProviderResponseDCRProviderAuth0 := new(DCRProviderResponseDCRProviderAuth0) + if err := utils.UnmarshalJSON(data, &dcrProviderResponseDCRProviderAuth0, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderAuth0) type DCRProviderResponseDCRProviderAuth0 within DcrProviderResponse: %w", string(data), err) + } + + u.DCRProviderResponseDCRProviderAuth0 = dcrProviderResponseDCRProviderAuth0 + u.Type = DcrProviderResponseTypeDcrProviderAuth0 + return nil + case "DcrProviderAzureAd": + dcrProviderResponseDCRProviderAzureAD := new(DCRProviderResponseDCRProviderAzureAD) + if err := utils.UnmarshalJSON(data, &dcrProviderResponseDCRProviderAzureAD, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderAzureAd) type DCRProviderResponseDCRProviderAzureAD within DcrProviderResponse: %w", string(data), err) + } + + u.DCRProviderResponseDCRProviderAzureAD = dcrProviderResponseDCRProviderAzureAD + u.Type = DcrProviderResponseTypeDcrProviderAzureAd + return nil + case "DcrProviderCurity": + dcrProviderResponseDCRProviderCurity := new(DCRProviderResponseDCRProviderCurity) + if err := utils.UnmarshalJSON(data, &dcrProviderResponseDCRProviderCurity, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderCurity) type DCRProviderResponseDCRProviderCurity within DcrProviderResponse: %w", string(data), err) + } + + u.DCRProviderResponseDCRProviderCurity = dcrProviderResponseDCRProviderCurity + u.Type = DcrProviderResponseTypeDcrProviderCurity + return nil + case "DcrProviderOkta": + dcrProviderResponseDCRProviderOKTA := new(DCRProviderResponseDCRProviderOKTA) + if err := utils.UnmarshalJSON(data, &dcrProviderResponseDCRProviderOKTA, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderOkta) type DCRProviderResponseDCRProviderOKTA within DcrProviderResponse: %w", string(data), err) + } + + u.DCRProviderResponseDCRProviderOKTA = dcrProviderResponseDCRProviderOKTA + u.Type = DcrProviderResponseTypeDcrProviderOkta + return nil + case "DcrProviderHttp": + dcrProviderResponseDCRProviderHTTP := new(DCRProviderResponseDCRProviderHTTP) + if err := utils.UnmarshalJSON(data, &dcrProviderResponseDCRProviderHTTP, "", true, false); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (ProviderType == DcrProviderHttp) type DCRProviderResponseDCRProviderHTTP within DcrProviderResponse: %w", string(data), err) + } + + u.DCRProviderResponseDCRProviderHTTP = dcrProviderResponseDCRProviderHTTP + u.Type = DcrProviderResponseTypeDcrProviderHTTP + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for DcrProviderResponse", string(data)) +} + +func (u DcrProviderResponse) MarshalJSON() ([]byte, error) { + if u.DCRProviderResponseDCRProviderAuth0 != nil { + return utils.MarshalJSON(u.DCRProviderResponseDCRProviderAuth0, "", true) + } + + if u.DCRProviderResponseDCRProviderAzureAD != nil { + return utils.MarshalJSON(u.DCRProviderResponseDCRProviderAzureAD, "", true) + } + + if u.DCRProviderResponseDCRProviderCurity != nil { + return utils.MarshalJSON(u.DCRProviderResponseDCRProviderCurity, "", true) + } + + if u.DCRProviderResponseDCRProviderOKTA != nil { + return utils.MarshalJSON(u.DCRProviderResponseDCRProviderOKTA, "", true) + } + + if u.DCRProviderResponseDCRProviderHTTP != nil { + return utils.MarshalJSON(u.DCRProviderResponseDCRProviderHTTP, "", true) + } + + return nil, errors.New("could not marshal union type DcrProviderResponse: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/dcrprovidertype.go b/tests/mockserver/internal/sdk/models/components/dcrprovidertype.go new file mode 100644 index 00000000..8a308f8b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/dcrprovidertype.go @@ -0,0 +1,44 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// DcrProviderType - The type of DCR provider. Can be one of the following - auth0, azureAd, curity, okta, http +type DcrProviderType string + +const ( + DcrProviderTypeAuth0 DcrProviderType = "auth0" + DcrProviderTypeAzureAd DcrProviderType = "azureAd" + DcrProviderTypeCurity DcrProviderType = "curity" + DcrProviderTypeOkta DcrProviderType = "okta" + DcrProviderTypeHTTP DcrProviderType = "http" +) + +func (e DcrProviderType) ToPointer() *DcrProviderType { + return &e +} +func (e *DcrProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "auth0": + fallthrough + case "azureAd": + fallthrough + case "curity": + fallthrough + case "okta": + fallthrough + case "http": + *e = DcrProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for DcrProviderType: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/defaultresourceconfiguration.go b/tests/mockserver/internal/sdk/models/components/defaultresourceconfiguration.go new file mode 100644 index 00000000..89ca6176 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/defaultresourceconfiguration.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// DefaultResourceConfiguration - Object containing information about a default resource configurations, and any organizational overrides. +type DefaultResourceConfiguration struct { + ID string `json:"id"` + // Enumeration of configuration qualifiers available for organization-wide configuration. + Qualifier ResourceConfigurationQualifier `json:"qualifier"` + // The human-readable name of this resource configuration. + Name string `json:"name"` + // A more verbose description of what this resource configuration enforces. + Description string `json:"description"` + // The value of this resource configuration. + Value int64 `json:"value"` + // Organizational overrides for this default resource configuration. + Overrides []ResourceConfiguration `json:"overrides"` + // An RFC-3339 timestamp representation of default resource configuration creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of default resource configuration update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DefaultResourceConfiguration) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DefaultResourceConfiguration) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DefaultResourceConfiguration) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DefaultResourceConfiguration) GetQualifier() ResourceConfigurationQualifier { + if o == nil { + return ResourceConfigurationQualifier("") + } + return o.Qualifier +} + +func (o *DefaultResourceConfiguration) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DefaultResourceConfiguration) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *DefaultResourceConfiguration) GetValue() int64 { + if o == nil { + return 0 + } + return o.Value +} + +func (o *DefaultResourceConfiguration) GetOverrides() []ResourceConfiguration { + if o == nil { + return []ResourceConfiguration{} + } + return o.Overrides +} + +func (o *DefaultResourceConfiguration) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DefaultResourceConfiguration) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/defaultresourcequota.go b/tests/mockserver/internal/sdk/models/components/defaultresourcequota.go new file mode 100644 index 00000000..9888600f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/defaultresourcequota.go @@ -0,0 +1,95 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// DefaultResourceQuota - Object containing information about a default resource quota, and any organizational overrides. +type DefaultResourceQuota struct { + ID string `json:"id"` + // Enumeration of resources available for quota enforcement. + Resource ResourceQuotaQualifier `json:"resource"` + // The human-readable name of this resource quota. + Name string `json:"name"` + // A more verbose description of what this resource quota enforces. + Description string `json:"description"` + // The aggregate non-negative integer count of this resource that's allowed for the organization. + // + Value int64 `json:"value"` + // Organizational overrides for this default resource quota. + Overrides []ResourceQuota `json:"overrides"` + // An RFC-3339 timestamp representation of default resource quota creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of default resource quota update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (d DefaultResourceQuota) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DefaultResourceQuota) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DefaultResourceQuota) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *DefaultResourceQuota) GetResource() ResourceQuotaQualifier { + if o == nil { + return ResourceQuotaQualifier("") + } + return o.Resource +} + +func (o *DefaultResourceQuota) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DefaultResourceQuota) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *DefaultResourceQuota) GetValue() int64 { + if o == nil { + return 0 + } + return o.Value +} + +func (o *DefaultResourceQuota) GetOverrides() []ResourceQuota { + if o == nil { + return []ResourceQuota{} + } + return o.Overrides +} + +func (o *DefaultResourceQuota) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *DefaultResourceQuota) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/defaultsubscription.go b/tests/mockserver/internal/sdk/models/components/defaultsubscription.go new file mode 100644 index 00000000..03758cde --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/defaultsubscription.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type DefaultSubscription struct { + Channel NotificationChannelType `json:"channel"` + Enabled bool `json:"enabled"` +} + +func (o *DefaultSubscription) GetChannel() NotificationChannelType { + if o == nil { + return NotificationChannelType("") + } + return o.Channel +} + +func (o *DefaultSubscription) GetEnabled() bool { + if o == nil { + return false + } + return o.Enabled +} diff --git a/tests/mockserver/internal/sdk/models/components/degraphqlroute.go b/tests/mockserver/internal/sdk/models/components/degraphqlroute.go new file mode 100644 index 00000000..20dce388 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/degraphqlroute.go @@ -0,0 +1,75 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type DegraphqlRouteService struct { + ID *string `json:"id,omitempty"` +} + +func (o *DegraphqlRouteService) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type DegraphqlRoute struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Methods []string `json:"methods,omitempty"` + Query string `json:"query"` + Service *DegraphqlRouteService `json:"service"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + URI string `json:"uri"` +} + +func (o *DegraphqlRoute) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *DegraphqlRoute) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *DegraphqlRoute) GetMethods() []string { + if o == nil { + return nil + } + return o.Methods +} + +func (o *DegraphqlRoute) GetQuery() string { + if o == nil { + return "" + } + return o.Query +} + +func (o *DegraphqlRoute) GetService() *DegraphqlRouteService { + if o == nil { + return nil + } + return o.Service +} + +func (o *DegraphqlRoute) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *DegraphqlRoute) GetURI() string { + if o == nil { + return "" + } + return o.URI +} diff --git a/tests/mockserver/internal/sdk/models/components/degraphqlroutewithoutparents.go b/tests/mockserver/internal/sdk/models/components/degraphqlroutewithoutparents.go new file mode 100644 index 00000000..b4624390 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/degraphqlroutewithoutparents.go @@ -0,0 +1,75 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type DegraphqlRouteWithoutParentsService struct { + ID *string `json:"id,omitempty"` +} + +func (o *DegraphqlRouteWithoutParentsService) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type DegraphqlRouteWithoutParents struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Methods []string `json:"methods,omitempty"` + Query string `json:"query"` + Service *DegraphqlRouteWithoutParentsService `json:"service,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + URI string `json:"uri"` +} + +func (o *DegraphqlRouteWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *DegraphqlRouteWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *DegraphqlRouteWithoutParents) GetMethods() []string { + if o == nil { + return nil + } + return o.Methods +} + +func (o *DegraphqlRouteWithoutParents) GetQuery() string { + if o == nil { + return "" + } + return o.Query +} + +func (o *DegraphqlRouteWithoutParents) GetService() *DegraphqlRouteWithoutParentsService { + if o == nil { + return nil + } + return o.Service +} + +func (o *DegraphqlRouteWithoutParents) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *DegraphqlRouteWithoutParents) GetURI() string { + if o == nil { + return "" + } + return o.URI +} diff --git a/tests/mockserver/internal/sdk/models/components/entitytypes.go b/tests/mockserver/internal/sdk/models/components/entitytypes.go new file mode 100644 index 00000000..c0cc0d67 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/entitytypes.go @@ -0,0 +1,46 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type EntityTypes string + +const ( + EntityTypesBillingInvoice EntityTypes = "billing-invoice" + EntityTypesAccessToken EntityTypes = "access-token" + EntityTypesWebhook EntityTypes = "webhook" + EntityTypesDevPortal EntityTypes = "dev-portal" + EntityTypesDataplaneGroup EntityTypes = "dataplane-group" + EntityTypesDataplane EntityTypes = "dataplane" +) + +func (e EntityTypes) ToPointer() *EntityTypes { + return &e +} +func (e *EntityTypes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "billing-invoice": + fallthrough + case "access-token": + fallthrough + case "webhook": + fallthrough + case "dev-portal": + fallthrough + case "dataplane-group": + fallthrough + case "dataplane": + *e = EntityTypes(v) + return nil + default: + return fmt.Errorf("invalid value for EntityTypes: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/eventsubscription.go b/tests/mockserver/internal/sdk/models/components/eventsubscription.go new file mode 100644 index 00000000..64bd997a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/eventsubscription.go @@ -0,0 +1,49 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// EventSubscription - Properties associated with an event subscription. +type EventSubscription struct { + Regions []NotificationRegion `json:"regions"` + Entities []string `json:"entities"` + Channels []NotificationChannel `json:"channels"` + // Enable/Disable complete subscription within an event. + Enabled bool `json:"enabled"` + // User provided name of the subscription. + Name string `json:"name"` +} + +func (o *EventSubscription) GetRegions() []NotificationRegion { + if o == nil { + return []NotificationRegion{} + } + return o.Regions +} + +func (o *EventSubscription) GetEntities() []string { + if o == nil { + return []string{} + } + return o.Entities +} + +func (o *EventSubscription) GetChannels() []NotificationChannel { + if o == nil { + return []NotificationChannel{} + } + return o.Channels +} + +func (o *EventSubscription) GetEnabled() bool { + if o == nil { + return false + } + return o.Enabled +} + +func (o *EventSubscription) GetName() string { + if o == nil { + return "" + } + return o.Name +} diff --git a/tests/mockserver/internal/sdk/models/components/eventsubscriptionlistresponse.go b/tests/mockserver/internal/sdk/models/components/eventsubscriptionlistresponse.go new file mode 100644 index 00000000..b918d2d5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/eventsubscriptionlistresponse.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// EventSubscriptionListResponse - A paginated list response for all subscriptions associated with an event. +type EventSubscriptionListResponse struct { + Data []EventSubscriptionResponse `json:"data"` + Meta CursorMetaPage `json:"meta"` +} + +func (o *EventSubscriptionListResponse) GetData() []EventSubscriptionResponse { + if o == nil { + return []EventSubscriptionResponse{} + } + return o.Data +} + +func (o *EventSubscriptionListResponse) GetMeta() CursorMetaPage { + if o == nil { + return CursorMetaPage{} + } + return o.Meta +} diff --git a/tests/mockserver/internal/sdk/models/components/eventsubscriptionresponse.go b/tests/mockserver/internal/sdk/models/components/eventsubscriptionresponse.go new file mode 100644 index 00000000..1dca94df --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/eventsubscriptionresponse.go @@ -0,0 +1,100 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// EventSubscriptionResponse - Properties associated with an event subscription. +type EventSubscriptionResponse struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + EntityType EntityTypes `json:"entity_type"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` + Regions []NotificationRegion `json:"regions"` + Entities []string `json:"entities"` + Channels []NotificationChannel `json:"channels"` + // Enable/Disable complete subscription within an event. + Enabled bool `json:"enabled"` + // User provided name of the subscription. + Name string `json:"name"` +} + +func (e EventSubscriptionResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(e, "", false) +} + +func (e *EventSubscriptionResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &e, "", false, false); err != nil { + return err + } + return nil +} + +func (o *EventSubscriptionResponse) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *EventSubscriptionResponse) GetEntityType() EntityTypes { + if o == nil { + return EntityTypes("") + } + return o.EntityType +} + +func (o *EventSubscriptionResponse) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *EventSubscriptionResponse) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +func (o *EventSubscriptionResponse) GetRegions() []NotificationRegion { + if o == nil { + return []NotificationRegion{} + } + return o.Regions +} + +func (o *EventSubscriptionResponse) GetEntities() []string { + if o == nil { + return []string{} + } + return o.Entities +} + +func (o *EventSubscriptionResponse) GetChannels() []NotificationChannel { + if o == nil { + return []NotificationChannel{} + } + return o.Channels +} + +func (o *EventSubscriptionResponse) GetEnabled() bool { + if o == nil { + return false + } + return o.Enabled +} + +func (o *EventSubscriptionResponse) GetName() string { + if o == nil { + return "" + } + return o.Name +} diff --git a/tests/mockserver/internal/sdk/models/components/getexpectedconfighashresponse.go b/tests/mockserver/internal/sdk/models/components/getexpectedconfighashresponse.go new file mode 100644 index 00000000..05e506a9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/getexpectedconfighashresponse.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// GetExpectedConfigHashResponse - Response body for retrieving the expected config hash of the control plane. +type GetExpectedConfigHashResponse struct { + // The expected configuration hash. + ExpectedHash string `json:"expected_hash"` + // Date the control plane configuration was created. + CreatedAt int64 `json:"created_at"` + // Date the control plane configuration was last updated. + UpdatedAt int64 `json:"updated_at"` +} + +func (o *GetExpectedConfigHashResponse) GetExpectedHash() string { + if o == nil { + return "" + } + return o.ExpectedHash +} + +func (o *GetExpectedConfigHashResponse) GetCreatedAt() int64 { + if o == nil { + return 0 + } + return o.CreatedAt +} + +func (o *GetExpectedConfigHashResponse) GetUpdatedAt() int64 { + if o == nil { + return 0 + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/getgroupstatus.go b/tests/mockserver/internal/sdk/models/components/getgroupstatus.go new file mode 100644 index 00000000..4db89ebd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/getgroupstatus.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// GetGroupStatus - Status of a control plane group, including existing conflicts. +type GetGroupStatus struct { + // The Group Status object contains information about the status of a control plane group. + Item *GroupStatus `json:"item,omitempty"` +} + +func (o *GetGroupStatus) GetItem() *GroupStatus { + if o == nil { + return nil + } + return o.Item +} diff --git a/tests/mockserver/internal/sdk/models/components/getimpersonationsettingsresponse.go b/tests/mockserver/internal/sdk/models/components/getimpersonationsettingsresponse.go new file mode 100644 index 00000000..dc4d490d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/getimpersonationsettingsresponse.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// GetImpersonationSettingsResponse - Response for Get Impersonation Settings endpoint +type GetImpersonationSettingsResponse struct { + // The organization has user impersonation enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +func (o *GetImpersonationSettingsResponse) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} diff --git a/tests/mockserver/internal/sdk/models/components/getnode.go b/tests/mockserver/internal/sdk/models/components/getnode.go new file mode 100644 index 00000000..de4fadbb --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/getnode.go @@ -0,0 +1,101 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type GetNodeCompatibilityStatus struct { + State *string `json:"state,omitempty"` +} + +func (o *GetNodeCompatibilityStatus) GetState() *string { + if o == nil { + return nil + } + return o.State +} + +type GetNodeItem struct { + ID *string `json:"id,omitempty"` + Version *string `json:"version,omitempty"` + Hostname *string `json:"hostname,omitempty"` + LastPing *int64 `json:"last_ping,omitempty"` + Type *string `json:"type,omitempty"` + CreatedAt *int64 `json:"created_at,omitempty"` + UpdatedAt *int64 `json:"updated_at,omitempty"` + ConfigHash *string `json:"config_hash,omitempty"` + CompatibilityStatus *GetNodeCompatibilityStatus `json:"compatibility_status,omitempty"` +} + +func (o *GetNodeItem) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetNodeItem) GetVersion() *string { + if o == nil { + return nil + } + return o.Version +} + +func (o *GetNodeItem) GetHostname() *string { + if o == nil { + return nil + } + return o.Hostname +} + +func (o *GetNodeItem) GetLastPing() *int64 { + if o == nil { + return nil + } + return o.LastPing +} + +func (o *GetNodeItem) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *GetNodeItem) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *GetNodeItem) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *GetNodeItem) GetConfigHash() *string { + if o == nil { + return nil + } + return o.ConfigHash +} + +func (o *GetNodeItem) GetCompatibilityStatus() *GetNodeCompatibilityStatus { + if o == nil { + return nil + } + return o.CompatibilityStatus +} + +// GetNode - Example response +type GetNode struct { + Item *GetNodeItem `json:"item,omitempty"` +} + +func (o *GetNode) GetItem() *GetNodeItem { + if o == nil { + return nil + } + return o.Item +} diff --git a/tests/mockserver/internal/sdk/models/components/groupconflict.go b/tests/mockserver/internal/sdk/models/components/groupconflict.go new file mode 100644 index 00000000..68b99921 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/groupconflict.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// GroupConflict - The Group Conflict object contains information about a conflict in a control plane group. +type GroupConflict struct { + // The ID of a control plane member of a control plane group. + ClusterID string `json:"cluster_id"` + // The description of the conflict. + Description string `json:"description"` + // A resource causing a conflict in a control plane group. + Resource GroupConflictResource `json:"resource"` +} + +func (o *GroupConflict) GetClusterID() string { + if o == nil { + return "" + } + return o.ClusterID +} + +func (o *GroupConflict) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *GroupConflict) GetResource() GroupConflictResource { + if o == nil { + return GroupConflictResource{} + } + return o.Resource +} diff --git a/tests/mockserver/internal/sdk/models/components/groupconflictresource.go b/tests/mockserver/internal/sdk/models/components/groupconflictresource.go new file mode 100644 index 00000000..851f82fb --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/groupconflictresource.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// GroupConflictResource - A resource causing a conflict in a control plane group. +type GroupConflictResource struct { + // The ID of the resource. + ID string `json:"id"` + // The type of the resource. + Type string `json:"type"` +} + +func (o *GroupConflictResource) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *GroupConflictResource) GetType() string { + if o == nil { + return "" + } + return o.Type +} diff --git a/tests/mockserver/internal/sdk/models/components/groupmembership.go b/tests/mockserver/internal/sdk/models/components/groupmembership.go new file mode 100644 index 00000000..355825c7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/groupmembership.go @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type Member struct { + ID string `json:"id"` +} + +func (o *Member) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +// GroupMembership - Request body for upserting a list of child control planes to a control plane group membership. +type GroupMembership struct { + Members []Member `json:"members"` +} + +func (o *GroupMembership) GetMembers() []Member { + if o == nil { + return []Member{} + } + return o.Members +} diff --git a/tests/mockserver/internal/sdk/models/components/groupmemberstatus.go b/tests/mockserver/internal/sdk/models/components/groupmemberstatus.go new file mode 100644 index 00000000..e8c2ef74 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/groupmemberstatus.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// GroupMemberStatus - Object with information determining the group membership status of a control plane. +type GroupMemberStatus struct { + // Boolean indicating if a control plane is a member of a control plane group. + IsMember bool `json:"is_member"` +} + +func (o *GroupMemberStatus) GetIsMember() bool { + if o == nil { + return false + } + return o.IsMember +} diff --git a/tests/mockserver/internal/sdk/models/components/groupstatus.go b/tests/mockserver/internal/sdk/models/components/groupstatus.go new file mode 100644 index 00000000..1dc8da2e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/groupstatus.go @@ -0,0 +1,99 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// GroupStatusState - The state of the control plane group. +type GroupStatusState string + +const ( + GroupStatusStateOk GroupStatusState = "OK" + GroupStatusStateConflict GroupStatusState = "CONFLICT" + GroupStatusStateUnknown GroupStatusState = "UNKNOWN" +) + +func (e GroupStatusState) ToPointer() *GroupStatusState { + return &e +} +func (e *GroupStatusState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "OK": + fallthrough + case "CONFLICT": + fallthrough + case "UNKNOWN": + *e = GroupStatusState(v) + return nil + default: + return fmt.Errorf("invalid value for GroupStatusState: %v", v) + } +} + +// GroupStatus - The Group Status object contains information about the status of a control plane group. +type GroupStatus struct { + // The control plane group ID. + ID string `json:"id"` + // An ISO-8604 timestamp representation of control plane group status creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8604 timestamp representation of control plane group status update date. + UpdatedAt time.Time `json:"updated_at"` + Conflicts []GroupConflict `json:"conflicts,omitempty"` + // The state of the control plane group. + State GroupStatusState `json:"state"` +} + +func (g GroupStatus) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GroupStatus) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GroupStatus) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *GroupStatus) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *GroupStatus) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +func (o *GroupStatus) GetConflicts() []GroupConflict { + if o == nil { + return nil + } + return o.Conflicts +} + +func (o *GroupStatus) GetState() GroupStatusState { + if o == nil { + return GroupStatusState("") + } + return o.State +} diff --git a/tests/mockserver/internal/sdk/models/components/hmacauth.go b/tests/mockserver/internal/sdk/models/components/hmacauth.go new file mode 100644 index 00000000..8ce7d767 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/hmacauth.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type HMACAuthConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *HMACAuthConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type HMACAuth struct { + Consumer *HMACAuthConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Secret *string `json:"secret,omitempty"` + Tags []string `json:"tags,omitempty"` + Username string `json:"username"` +} + +func (o *HMACAuth) GetConsumer() *HMACAuthConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *HMACAuth) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *HMACAuth) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *HMACAuth) GetSecret() *string { + if o == nil { + return nil + } + return o.Secret +} + +func (o *HMACAuth) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *HMACAuth) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} diff --git a/tests/mockserver/internal/sdk/models/components/hmacauthwithoutparents.go b/tests/mockserver/internal/sdk/models/components/hmacauthwithoutparents.go new file mode 100644 index 00000000..81140264 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/hmacauthwithoutparents.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type HMACAuthWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *HMACAuthWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type HMACAuthWithoutParents struct { + Consumer *HMACAuthWithoutParentsConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Secret *string `json:"secret,omitempty"` + Tags []string `json:"tags,omitempty"` + Username string `json:"username"` +} + +func (o *HMACAuthWithoutParents) GetConsumer() *HMACAuthWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *HMACAuthWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *HMACAuthWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *HMACAuthWithoutParents) GetSecret() *string { + if o == nil { + return nil + } + return o.Secret +} + +func (o *HMACAuthWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *HMACAuthWithoutParents) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} diff --git a/tests/mockserver/internal/sdk/models/components/httpmetadata.go b/tests/mockserver/internal/sdk/models/components/httpmetadata.go new file mode 100644 index 00000000..e18bdc06 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/httpmetadata.go @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "net/http" +) + +type HTTPMetadata struct { + // Raw HTTP response; suitable for custom response parsing + Response *http.Response `json:"-"` + // Raw HTTP request; suitable for debugging + Request *http.Request `json:"-"` +} + +func (o *HTTPMetadata) GetResponse() *http.Response { + if o == nil { + return nil + } + return o.Response +} + +func (o *HTTPMetadata) GetRequest() *http.Request { + if o == nil { + return nil + } + return o.Request +} diff --git a/tests/mockserver/internal/sdk/models/components/identityprovider.go b/tests/mockserver/internal/sdk/models/components/identityprovider.go new file mode 100644 index 00000000..c8638bdf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/identityprovider.go @@ -0,0 +1,152 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +type IdentityProviderConfigType string + +const ( + IdentityProviderConfigTypeOIDCIdentityProviderConfig IdentityProviderConfigType = "OIDCIdentityProviderConfig" + IdentityProviderConfigTypeSAMLIdentityProviderConfig IdentityProviderConfigType = "SAMLIdentityProviderConfig" +) + +type IdentityProviderConfig struct { + OIDCIdentityProviderConfig *OIDCIdentityProviderConfig `queryParam:"inline"` + SAMLIdentityProviderConfig *SAMLIdentityProviderConfig `queryParam:"inline"` + + Type IdentityProviderConfigType +} + +func CreateIdentityProviderConfigOIDCIdentityProviderConfig(oidcIdentityProviderConfig OIDCIdentityProviderConfig) IdentityProviderConfig { + typ := IdentityProviderConfigTypeOIDCIdentityProviderConfig + + return IdentityProviderConfig{ + OIDCIdentityProviderConfig: &oidcIdentityProviderConfig, + Type: typ, + } +} + +func CreateIdentityProviderConfigSAMLIdentityProviderConfig(samlIdentityProviderConfig SAMLIdentityProviderConfig) IdentityProviderConfig { + typ := IdentityProviderConfigTypeSAMLIdentityProviderConfig + + return IdentityProviderConfig{ + SAMLIdentityProviderConfig: &samlIdentityProviderConfig, + Type: typ, + } +} + +func (u *IdentityProviderConfig) UnmarshalJSON(data []byte) error { + + var oidcIdentityProviderConfig OIDCIdentityProviderConfig = OIDCIdentityProviderConfig{} + if err := utils.UnmarshalJSON(data, &oidcIdentityProviderConfig, "", true, true); err == nil { + u.OIDCIdentityProviderConfig = &oidcIdentityProviderConfig + u.Type = IdentityProviderConfigTypeOIDCIdentityProviderConfig + return nil + } + + var samlIdentityProviderConfig SAMLIdentityProviderConfig = SAMLIdentityProviderConfig{} + if err := utils.UnmarshalJSON(data, &samlIdentityProviderConfig, "", true, true); err == nil { + u.SAMLIdentityProviderConfig = &samlIdentityProviderConfig + u.Type = IdentityProviderConfigTypeSAMLIdentityProviderConfig + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for IdentityProviderConfig", string(data)) +} + +func (u IdentityProviderConfig) MarshalJSON() ([]byte, error) { + if u.OIDCIdentityProviderConfig != nil { + return utils.MarshalJSON(u.OIDCIdentityProviderConfig, "", true) + } + + if u.SAMLIdentityProviderConfig != nil { + return utils.MarshalJSON(u.SAMLIdentityProviderConfig, "", true) + } + + return nil, errors.New("could not marshal union type IdentityProviderConfig: all fields are null") +} + +// IdentityProvider - The identity provider that contains configuration data for authentication integration. +type IdentityProvider struct { + // Contains a unique identifier used by the API for this resource. + ID *string `json:"id,omitempty"` + // Specifies the type of identity provider. + Type *IdentityProviderType `json:"type,omitempty"` + // Indicates whether the identity provider is enabled. + // Only one identity provider can be active at a time, such as SAML or OIDC. + // + Enabled *bool `default:"false" json:"enabled"` + // The path used for initiating login requests with the identity provider. + LoginPath *string `json:"login_path,omitempty"` + Config *IdentityProviderConfig `json:"config,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 (i IdentityProvider) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(i, "", false) +} + +func (i *IdentityProvider) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &i, "", false, false); err != nil { + return err + } + return nil +} + +func (o *IdentityProvider) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *IdentityProvider) GetType() *IdentityProviderType { + if o == nil { + return nil + } + return o.Type +} + +func (o *IdentityProvider) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *IdentityProvider) GetLoginPath() *string { + if o == nil { + return nil + } + return o.LoginPath +} + +func (o *IdentityProvider) GetConfig() *IdentityProviderConfig { + if o == nil { + return nil + } + return o.Config +} + +func (o *IdentityProvider) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *IdentityProvider) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/identityprovidertype.go b/tests/mockserver/internal/sdk/models/components/identityprovidertype.go new file mode 100644 index 00000000..0f58ea47 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/identityprovidertype.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// IdentityProviderType - Specifies the type of identity provider. +type IdentityProviderType string + +const ( + IdentityProviderTypeOidc IdentityProviderType = "oidc" + IdentityProviderTypeSaml IdentityProviderType = "saml" +) + +func (e IdentityProviderType) ToPointer() *IdentityProviderType { + return &e +} +func (e *IdentityProviderType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "oidc": + fallthrough + case "saml": + *e = IdentityProviderType(v) + return nil + default: + return fmt.Errorf("invalid value for IdentityProviderType: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/idfieldfilter.go b/tests/mockserver/internal/sdk/models/components/idfieldfilter.go new file mode 100644 index 00000000..efbe42b8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/idfieldfilter.go @@ -0,0 +1,31 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// IDFieldFilter - Returns entities that exact match any of the comma-delimited phrases in the filter string. +type IDFieldFilter struct { + Eq *string `queryParam:"name=eq"` + Neq *string `queryParam:"name=neq"` + Oeq *string `queryParam:"name=oeq"` +} + +func (o *IDFieldFilter) GetEq() *string { + if o == nil { + return nil + } + return o.Eq +} + +func (o *IDFieldFilter) GetNeq() *string { + if o == nil { + return nil + } + return o.Neq +} + +func (o *IDFieldFilter) GetOeq() *string { + if o == nil { + return nil + } + return o.Oeq +} diff --git a/tests/mockserver/internal/sdk/models/components/idp.go b/tests/mockserver/internal/sdk/models/components/idp.go new file mode 100644 index 00000000..d6c8a318 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/idp.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type IDPClaimMappings struct { + Name *string `json:"name,omitempty"` + Email *string `json:"email,omitempty"` + Groups *string `json:"groups,omitempty"` +} + +func (o *IDPClaimMappings) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *IDPClaimMappings) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *IDPClaimMappings) GetGroups() *string { + if o == nil { + return nil + } + return o.Groups +} + +// IDP - The IdP object contains the configuration data for the OIDC authentication integration. +// +// NOTE: The `openid` scope is required. Removing it could break the OIDC integration. +type IDP struct { + Issuer *string `json:"issuer,omitempty"` + LoginPath *string `json:"login_path,omitempty"` + ClientID *string `json:"client_id,omitempty"` + Scopes []string `json:"scopes,omitempty"` + ClaimMappings *IDPClaimMappings `json:"claim_mappings,omitempty"` +} + +func (o *IDP) GetIssuer() *string { + if o == nil { + return nil + } + return o.Issuer +} + +func (o *IDP) GetLoginPath() *string { + if o == nil { + return nil + } + return o.LoginPath +} + +func (o *IDP) GetClientID() *string { + if o == nil { + return nil + } + return o.ClientID +} + +func (o *IDP) GetScopes() []string { + if o == nil { + return nil + } + return o.Scopes +} + +func (o *IDP) GetClaimMappings() *IDPClaimMappings { + if o == nil { + return nil + } + return o.ClaimMappings +} diff --git a/tests/mockserver/internal/sdk/models/components/instancetype.go b/tests/mockserver/internal/sdk/models/components/instancetype.go new file mode 100644 index 00000000..dfae6e8c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/instancetype.go @@ -0,0 +1,43 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// InstanceType - Resource parameters and pricing of a given supported instance type. +type InstanceType struct { + // Instance type name to indicate capacity. + Name InstanceTypeName `json:"name"` + // Hourly cost to run a single cloud gateway instance of this instance type. + HourlyCost string `json:"hourly_cost"` + // Number of virtual CPUs available to a cloud gateway instance of this instance type. + VCPU string `json:"v_cpu"` + // Number of gigabytes of memory available to a cloud gateway instance of this instance type. + GbMemory string `json:"gb_memory"` +} + +func (o *InstanceType) GetName() InstanceTypeName { + if o == nil { + return InstanceTypeName("") + } + return o.Name +} + +func (o *InstanceType) GetHourlyCost() string { + if o == nil { + return "" + } + return o.HourlyCost +} + +func (o *InstanceType) GetVCPU() string { + if o == nil { + return "" + } + return o.VCPU +} + +func (o *InstanceType) GetGbMemory() string { + if o == nil { + return "" + } + return o.GbMemory +} diff --git a/tests/mockserver/internal/sdk/models/components/instancetypename.go b/tests/mockserver/internal/sdk/models/components/instancetypename.go new file mode 100644 index 00000000..7292d26d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/instancetypename.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InstanceTypeName - Instance type name to indicate capacity. +type InstanceTypeName string + +const ( + InstanceTypeNameSmall InstanceTypeName = "small" + InstanceTypeNameMedium InstanceTypeName = "medium" + InstanceTypeNameLarge InstanceTypeName = "large" +) + +func (e InstanceTypeName) ToPointer() *InstanceTypeName { + return &e +} +func (e *InstanceTypeName) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "small": + fallthrough + case "medium": + fallthrough + case "large": + *e = InstanceTypeName(v) + return nil + default: + return fmt.Errorf("invalid value for InstanceTypeName: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/internalservererror.go b/tests/mockserver/internal/sdk/models/components/internalservererror.go new file mode 100644 index 00000000..4de5ee6a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/internalservererror.go @@ -0,0 +1,32 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InternalServerErrorStatus - The HTTP status code. +type InternalServerErrorStatus int + +const ( + InternalServerErrorStatusFiveHundred InternalServerErrorStatus = 500 +) + +func (e InternalServerErrorStatus) ToPointer() *InternalServerErrorStatus { + return &e +} +func (e *InternalServerErrorStatus) UnmarshalJSON(data []byte) error { + var v int + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 500: + *e = InternalServerErrorStatus(v) + return nil + default: + return fmt.Errorf("invalid value for InternalServerErrorStatus: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidparameterchoiceitem.go b/tests/mockserver/internal/sdk/models/components/invalidparameterchoiceitem.go new file mode 100644 index 00000000..4deed22e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidparameterchoiceitem.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InvalidParameterChoiceItemRule - invalid parameters rules +type InvalidParameterChoiceItemRule string + +const ( + InvalidParameterChoiceItemRuleEnum InvalidParameterChoiceItemRule = "enum" +) + +func (e InvalidParameterChoiceItemRule) ToPointer() *InvalidParameterChoiceItemRule { + return &e +} +func (e *InvalidParameterChoiceItemRule) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "enum": + *e = InvalidParameterChoiceItemRule(v) + return nil + default: + return fmt.Errorf("invalid value for InvalidParameterChoiceItemRule: %v", v) + } +} + +type InvalidParameterChoiceItem struct { + Field string `json:"field"` + // invalid parameters rules + Rule InvalidParameterChoiceItemRule `json:"rule"` + Reason string `json:"reason"` + Choices []any `json:"choices"` + Source *string `json:"source,omitempty"` +} + +func (o *InvalidParameterChoiceItem) GetField() string { + if o == nil { + return "" + } + return o.Field +} + +func (o *InvalidParameterChoiceItem) GetRule() InvalidParameterChoiceItemRule { + if o == nil { + return InvalidParameterChoiceItemRule("") + } + return o.Rule +} + +func (o *InvalidParameterChoiceItem) GetReason() string { + if o == nil { + return "" + } + return o.Reason +} + +func (o *InvalidParameterChoiceItem) GetChoices() []any { + if o == nil { + return []any{} + } + return o.Choices +} + +func (o *InvalidParameterChoiceItem) GetSource() *string { + if o == nil { + return nil + } + return o.Source +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidparameterdependentitem.go b/tests/mockserver/internal/sdk/models/components/invalidparameterdependentitem.go new file mode 100644 index 00000000..62492a0e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidparameterdependentitem.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InvalidParameterDependentItemRule - invalid parameters rules +type InvalidParameterDependentItemRule string + +const ( + InvalidParameterDependentItemRuleDependentFields InvalidParameterDependentItemRule = "dependent_fields" +) + +func (e InvalidParameterDependentItemRule) ToPointer() *InvalidParameterDependentItemRule { + return &e +} +func (e *InvalidParameterDependentItemRule) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "dependent_fields": + *e = InvalidParameterDependentItemRule(v) + return nil + default: + return fmt.Errorf("invalid value for InvalidParameterDependentItemRule: %v", v) + } +} + +type InvalidParameterDependentItem struct { + Field string `json:"field"` + // invalid parameters rules + Rule *InvalidParameterDependentItemRule `json:"rule"` + Reason string `json:"reason"` + Dependents []any `json:"dependents"` + Source *string `json:"source,omitempty"` +} + +func (o *InvalidParameterDependentItem) GetField() string { + if o == nil { + return "" + } + return o.Field +} + +func (o *InvalidParameterDependentItem) GetRule() *InvalidParameterDependentItemRule { + if o == nil { + return nil + } + return o.Rule +} + +func (o *InvalidParameterDependentItem) GetReason() string { + if o == nil { + return "" + } + return o.Reason +} + +func (o *InvalidParameterDependentItem) GetDependents() []any { + if o == nil { + return nil + } + return o.Dependents +} + +func (o *InvalidParameterDependentItem) GetSource() *string { + if o == nil { + return nil + } + return o.Source +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidparametermaximumlength.go b/tests/mockserver/internal/sdk/models/components/invalidparametermaximumlength.go new file mode 100644 index 00000000..ebf81621 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidparametermaximumlength.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InvalidParameterMaximumLengthRule - invalid parameters rules +type InvalidParameterMaximumLengthRule string + +const ( + InvalidParameterMaximumLengthRuleMaxLength InvalidParameterMaximumLengthRule = "max_length" + InvalidParameterMaximumLengthRuleMaxItems InvalidParameterMaximumLengthRule = "max_items" + InvalidParameterMaximumLengthRuleMax InvalidParameterMaximumLengthRule = "max" +) + +func (e InvalidParameterMaximumLengthRule) ToPointer() *InvalidParameterMaximumLengthRule { + return &e +} +func (e *InvalidParameterMaximumLengthRule) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "max_length": + fallthrough + case "max_items": + fallthrough + case "max": + *e = InvalidParameterMaximumLengthRule(v) + return nil + default: + return fmt.Errorf("invalid value for InvalidParameterMaximumLengthRule: %v", v) + } +} + +type InvalidParameterMaximumLength struct { + Field string `json:"field"` + // invalid parameters rules + Rule InvalidParameterMaximumLengthRule `json:"rule"` + Maximum int64 `json:"maximum"` + Source *string `json:"source,omitempty"` + Reason string `json:"reason"` +} + +func (o *InvalidParameterMaximumLength) GetField() string { + if o == nil { + return "" + } + return o.Field +} + +func (o *InvalidParameterMaximumLength) GetRule() InvalidParameterMaximumLengthRule { + if o == nil { + return InvalidParameterMaximumLengthRule("") + } + return o.Rule +} + +func (o *InvalidParameterMaximumLength) GetMaximum() int64 { + if o == nil { + return 0 + } + return o.Maximum +} + +func (o *InvalidParameterMaximumLength) GetSource() *string { + if o == nil { + return nil + } + return o.Source +} + +func (o *InvalidParameterMaximumLength) GetReason() string { + if o == nil { + return "" + } + return o.Reason +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidparameterminimumlength.go b/tests/mockserver/internal/sdk/models/components/invalidparameterminimumlength.go new file mode 100644 index 00000000..7df89503 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidparameterminimumlength.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InvalidParameterMinimumLengthRule - invalid parameters rules +type InvalidParameterMinimumLengthRule string + +const ( + InvalidParameterMinimumLengthRuleMinLength InvalidParameterMinimumLengthRule = "min_length" + InvalidParameterMinimumLengthRuleMinDigits InvalidParameterMinimumLengthRule = "min_digits" + InvalidParameterMinimumLengthRuleMinLowercase InvalidParameterMinimumLengthRule = "min_lowercase" + InvalidParameterMinimumLengthRuleMinUppercase InvalidParameterMinimumLengthRule = "min_uppercase" + InvalidParameterMinimumLengthRuleMinSymbols InvalidParameterMinimumLengthRule = "min_symbols" + InvalidParameterMinimumLengthRuleMinItems InvalidParameterMinimumLengthRule = "min_items" + InvalidParameterMinimumLengthRuleMin InvalidParameterMinimumLengthRule = "min" +) + +func (e InvalidParameterMinimumLengthRule) ToPointer() *InvalidParameterMinimumLengthRule { + return &e +} +func (e *InvalidParameterMinimumLengthRule) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "min_length": + fallthrough + case "min_digits": + fallthrough + case "min_lowercase": + fallthrough + case "min_uppercase": + fallthrough + case "min_symbols": + fallthrough + case "min_items": + fallthrough + case "min": + *e = InvalidParameterMinimumLengthRule(v) + return nil + default: + return fmt.Errorf("invalid value for InvalidParameterMinimumLengthRule: %v", v) + } +} + +type InvalidParameterMinimumLength struct { + Field string `json:"field"` + // invalid parameters rules + Rule InvalidParameterMinimumLengthRule `json:"rule"` + Minimum int64 `json:"minimum"` + Source *string `json:"source,omitempty"` + Reason string `json:"reason"` +} + +func (o *InvalidParameterMinimumLength) GetField() string { + if o == nil { + return "" + } + return o.Field +} + +func (o *InvalidParameterMinimumLength) GetRule() InvalidParameterMinimumLengthRule { + if o == nil { + return InvalidParameterMinimumLengthRule("") + } + return o.Rule +} + +func (o *InvalidParameterMinimumLength) GetMinimum() int64 { + if o == nil { + return 0 + } + return o.Minimum +} + +func (o *InvalidParameterMinimumLength) GetSource() *string { + if o == nil { + return nil + } + return o.Source +} + +func (o *InvalidParameterMinimumLength) GetReason() string { + if o == nil { + return "" + } + return o.Reason +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidparameters.go b/tests/mockserver/internal/sdk/models/components/invalidparameters.go new file mode 100644 index 00000000..d49a887d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidparameters.go @@ -0,0 +1,138 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type InvalidParametersType string + +const ( + InvalidParametersTypeInvalidParameterStandard InvalidParametersType = "InvalidParameterStandard" + InvalidParametersTypeInvalidParameterMinimumLength InvalidParametersType = "InvalidParameterMinimumLength" + InvalidParametersTypeInvalidParameterMaximumLength InvalidParametersType = "InvalidParameterMaximumLength" + InvalidParametersTypeInvalidParameterChoiceItem InvalidParametersType = "InvalidParameterChoiceItem" + InvalidParametersTypeInvalidParameterDependentItem InvalidParametersType = "InvalidParameterDependentItem" +) + +type InvalidParameters struct { + InvalidParameterStandard *InvalidParameterStandard `queryParam:"inline"` + InvalidParameterMinimumLength *InvalidParameterMinimumLength `queryParam:"inline"` + InvalidParameterMaximumLength *InvalidParameterMaximumLength `queryParam:"inline"` + InvalidParameterChoiceItem *InvalidParameterChoiceItem `queryParam:"inline"` + InvalidParameterDependentItem *InvalidParameterDependentItem `queryParam:"inline"` + + Type InvalidParametersType +} + +func CreateInvalidParametersInvalidParameterStandard(invalidParameterStandard InvalidParameterStandard) InvalidParameters { + typ := InvalidParametersTypeInvalidParameterStandard + + return InvalidParameters{ + InvalidParameterStandard: &invalidParameterStandard, + Type: typ, + } +} + +func CreateInvalidParametersInvalidParameterMinimumLength(invalidParameterMinimumLength InvalidParameterMinimumLength) InvalidParameters { + typ := InvalidParametersTypeInvalidParameterMinimumLength + + return InvalidParameters{ + InvalidParameterMinimumLength: &invalidParameterMinimumLength, + Type: typ, + } +} + +func CreateInvalidParametersInvalidParameterMaximumLength(invalidParameterMaximumLength InvalidParameterMaximumLength) InvalidParameters { + typ := InvalidParametersTypeInvalidParameterMaximumLength + + return InvalidParameters{ + InvalidParameterMaximumLength: &invalidParameterMaximumLength, + Type: typ, + } +} + +func CreateInvalidParametersInvalidParameterChoiceItem(invalidParameterChoiceItem InvalidParameterChoiceItem) InvalidParameters { + typ := InvalidParametersTypeInvalidParameterChoiceItem + + return InvalidParameters{ + InvalidParameterChoiceItem: &invalidParameterChoiceItem, + Type: typ, + } +} + +func CreateInvalidParametersInvalidParameterDependentItem(invalidParameterDependentItem InvalidParameterDependentItem) InvalidParameters { + typ := InvalidParametersTypeInvalidParameterDependentItem + + return InvalidParameters{ + InvalidParameterDependentItem: &invalidParameterDependentItem, + Type: typ, + } +} + +func (u *InvalidParameters) UnmarshalJSON(data []byte) error { + + var invalidParameterStandard InvalidParameterStandard = InvalidParameterStandard{} + if err := utils.UnmarshalJSON(data, &invalidParameterStandard, "", true, true); err == nil { + u.InvalidParameterStandard = &invalidParameterStandard + u.Type = InvalidParametersTypeInvalidParameterStandard + return nil + } + + var invalidParameterMinimumLength InvalidParameterMinimumLength = InvalidParameterMinimumLength{} + if err := utils.UnmarshalJSON(data, &invalidParameterMinimumLength, "", true, true); err == nil { + u.InvalidParameterMinimumLength = &invalidParameterMinimumLength + u.Type = InvalidParametersTypeInvalidParameterMinimumLength + return nil + } + + var invalidParameterMaximumLength InvalidParameterMaximumLength = InvalidParameterMaximumLength{} + if err := utils.UnmarshalJSON(data, &invalidParameterMaximumLength, "", true, true); err == nil { + u.InvalidParameterMaximumLength = &invalidParameterMaximumLength + u.Type = InvalidParametersTypeInvalidParameterMaximumLength + return nil + } + + var invalidParameterChoiceItem InvalidParameterChoiceItem = InvalidParameterChoiceItem{} + if err := utils.UnmarshalJSON(data, &invalidParameterChoiceItem, "", true, true); err == nil { + u.InvalidParameterChoiceItem = &invalidParameterChoiceItem + u.Type = InvalidParametersTypeInvalidParameterChoiceItem + return nil + } + + var invalidParameterDependentItem InvalidParameterDependentItem = InvalidParameterDependentItem{} + if err := utils.UnmarshalJSON(data, &invalidParameterDependentItem, "", true, true); err == nil { + u.InvalidParameterDependentItem = &invalidParameterDependentItem + u.Type = InvalidParametersTypeInvalidParameterDependentItem + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for InvalidParameters", string(data)) +} + +func (u InvalidParameters) MarshalJSON() ([]byte, error) { + if u.InvalidParameterStandard != nil { + return utils.MarshalJSON(u.InvalidParameterStandard, "", true) + } + + if u.InvalidParameterMinimumLength != nil { + return utils.MarshalJSON(u.InvalidParameterMinimumLength, "", true) + } + + if u.InvalidParameterMaximumLength != nil { + return utils.MarshalJSON(u.InvalidParameterMaximumLength, "", true) + } + + if u.InvalidParameterChoiceItem != nil { + return utils.MarshalJSON(u.InvalidParameterChoiceItem, "", true) + } + + if u.InvalidParameterDependentItem != nil { + return utils.MarshalJSON(u.InvalidParameterDependentItem, "", true) + } + + return nil, errors.New("could not marshal union type InvalidParameters: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidparameterstandard.go b/tests/mockserver/internal/sdk/models/components/invalidparameterstandard.go new file mode 100644 index 00000000..b0e8daeb --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidparameterstandard.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type InvalidParameterStandard struct { + Field string `json:"field"` + // invalid parameters rules + Rule *InvalidRules `json:"rule,omitempty"` + Source *string `json:"source,omitempty"` + Reason string `json:"reason"` +} + +func (o *InvalidParameterStandard) GetField() string { + if o == nil { + return "" + } + return o.Field +} + +func (o *InvalidParameterStandard) GetRule() *InvalidRules { + if o == nil { + return nil + } + return o.Rule +} + +func (o *InvalidParameterStandard) GetSource() *string { + if o == nil { + return nil + } + return o.Source +} + +func (o *InvalidParameterStandard) GetReason() string { + if o == nil { + return "" + } + return o.Reason +} diff --git a/tests/mockserver/internal/sdk/models/components/invalidrules.go b/tests/mockserver/internal/sdk/models/components/invalidrules.go new file mode 100644 index 00000000..64d09675 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/invalidrules.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// InvalidRules - invalid parameters rules +type InvalidRules string + +const ( + InvalidRulesRequired InvalidRules = "required" + InvalidRulesIsArray InvalidRules = "is_array" + InvalidRulesIsBase64 InvalidRules = "is_base64" + InvalidRulesIsBoolean InvalidRules = "is_boolean" + InvalidRulesIsDateTime InvalidRules = "is_date_time" + InvalidRulesIsInteger InvalidRules = "is_integer" + InvalidRulesIsNull InvalidRules = "is_null" + InvalidRulesIsNumber InvalidRules = "is_number" + InvalidRulesIsObject InvalidRules = "is_object" + InvalidRulesIsString InvalidRules = "is_string" + InvalidRulesIsUUID InvalidRules = "is_uuid" + InvalidRulesIsFqdn InvalidRules = "is_fqdn" + InvalidRulesIsArn InvalidRules = "is_arn" + InvalidRulesUnknownProperty InvalidRules = "unknown_property" + InvalidRulesMissingReference InvalidRules = "missing_reference" + InvalidRulesIsLabel InvalidRules = "is_label" + InvalidRulesMatchesRegex InvalidRules = "matches_regex" + InvalidRulesInvalid InvalidRules = "invalid" + InvalidRulesIsSupportedNetworkAvailabilityZoneList InvalidRules = "is_supported_network_availability_zone_list" + InvalidRulesIsSupportedNetworkCidrBlock InvalidRules = "is_supported_network_cidr_block" + InvalidRulesIsSupportedProviderRegion InvalidRules = "is_supported_provider_region" +) + +func (e InvalidRules) ToPointer() *InvalidRules { + return &e +} +func (e *InvalidRules) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "required": + fallthrough + case "is_array": + fallthrough + case "is_base64": + fallthrough + case "is_boolean": + fallthrough + case "is_date_time": + fallthrough + case "is_integer": + fallthrough + case "is_null": + fallthrough + case "is_number": + fallthrough + case "is_object": + fallthrough + case "is_string": + fallthrough + case "is_uuid": + fallthrough + case "is_fqdn": + fallthrough + case "is_arn": + fallthrough + case "unknown_property": + fallthrough + case "missing_reference": + fallthrough + case "is_label": + fallthrough + case "matches_regex": + fallthrough + case "invalid": + fallthrough + case "is_supported_network_availability_zone_list": + fallthrough + case "is_supported_network_cidr_block": + fallthrough + case "is_supported_provider_region": + *e = InvalidRules(v) + return nil + default: + return fmt.Errorf("invalid value for InvalidRules: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/inviteuser.go b/tests/mockserver/internal/sdk/models/components/inviteuser.go new file mode 100644 index 00000000..73a3ee00 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/inviteuser.go @@ -0,0 +1,17 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// InviteUser - The request schema for the invite user request. +// +// If you pass an `email` that is not already an active user in the request, a fresh invitation email will be created and sent to the new user. +type InviteUser struct { + Email string `json:"email"` +} + +func (o *InviteUser) GetEmail() string { + if o == nil { + return "" + } + return o.Email +} diff --git a/tests/mockserver/internal/sdk/models/components/jwt.go b/tests/mockserver/internal/sdk/models/components/jwt.go new file mode 100644 index 00000000..c460f5d7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/jwt.go @@ -0,0 +1,146 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type JWTAlgorithm string + +const ( + JWTAlgorithmHs256 JWTAlgorithm = "HS256" + JWTAlgorithmHs384 JWTAlgorithm = "HS384" + JWTAlgorithmHs512 JWTAlgorithm = "HS512" + JWTAlgorithmRs256 JWTAlgorithm = "RS256" + JWTAlgorithmRs384 JWTAlgorithm = "RS384" + JWTAlgorithmRs512 JWTAlgorithm = "RS512" + JWTAlgorithmEs256 JWTAlgorithm = "ES256" + JWTAlgorithmEs384 JWTAlgorithm = "ES384" + JWTAlgorithmEs512 JWTAlgorithm = "ES512" + JWTAlgorithmPs256 JWTAlgorithm = "PS256" + JWTAlgorithmPs384 JWTAlgorithm = "PS384" + JWTAlgorithmPs512 JWTAlgorithm = "PS512" + JWTAlgorithmEdDsa JWTAlgorithm = "EdDSA" +) + +func (e JWTAlgorithm) ToPointer() *JWTAlgorithm { + return &e +} +func (e *JWTAlgorithm) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "HS256": + fallthrough + case "HS384": + fallthrough + case "HS512": + fallthrough + case "RS256": + fallthrough + case "RS384": + fallthrough + case "RS512": + fallthrough + case "ES256": + fallthrough + case "ES384": + fallthrough + case "ES512": + fallthrough + case "PS256": + fallthrough + case "PS384": + fallthrough + case "PS512": + fallthrough + case "EdDSA": + *e = JWTAlgorithm(v) + return nil + default: + return fmt.Errorf("invalid value for JWTAlgorithm: %v", v) + } +} + +type JWTConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *JWTConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type Jwt struct { + Algorithm *JWTAlgorithm `json:"algorithm,omitempty"` + Consumer *JWTConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + RsaPublicKey *string `json:"rsa_public_key,omitempty"` + Secret *string `json:"secret,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +func (o *Jwt) GetAlgorithm() *JWTAlgorithm { + if o == nil { + return nil + } + return o.Algorithm +} + +func (o *Jwt) GetConsumer() *JWTConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *Jwt) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Jwt) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Jwt) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *Jwt) GetRsaPublicKey() *string { + if o == nil { + return nil + } + return o.RsaPublicKey +} + +func (o *Jwt) GetSecret() *string { + if o == nil { + return nil + } + return o.Secret +} + +func (o *Jwt) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} diff --git a/tests/mockserver/internal/sdk/models/components/jwtwithoutparents.go b/tests/mockserver/internal/sdk/models/components/jwtwithoutparents.go new file mode 100644 index 00000000..87953965 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/jwtwithoutparents.go @@ -0,0 +1,146 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type JWTWithoutParentsAlgorithm string + +const ( + JWTWithoutParentsAlgorithmHs256 JWTWithoutParentsAlgorithm = "HS256" + JWTWithoutParentsAlgorithmHs384 JWTWithoutParentsAlgorithm = "HS384" + JWTWithoutParentsAlgorithmHs512 JWTWithoutParentsAlgorithm = "HS512" + JWTWithoutParentsAlgorithmRs256 JWTWithoutParentsAlgorithm = "RS256" + JWTWithoutParentsAlgorithmRs384 JWTWithoutParentsAlgorithm = "RS384" + JWTWithoutParentsAlgorithmRs512 JWTWithoutParentsAlgorithm = "RS512" + JWTWithoutParentsAlgorithmEs256 JWTWithoutParentsAlgorithm = "ES256" + JWTWithoutParentsAlgorithmEs384 JWTWithoutParentsAlgorithm = "ES384" + JWTWithoutParentsAlgorithmEs512 JWTWithoutParentsAlgorithm = "ES512" + JWTWithoutParentsAlgorithmPs256 JWTWithoutParentsAlgorithm = "PS256" + JWTWithoutParentsAlgorithmPs384 JWTWithoutParentsAlgorithm = "PS384" + JWTWithoutParentsAlgorithmPs512 JWTWithoutParentsAlgorithm = "PS512" + JWTWithoutParentsAlgorithmEdDsa JWTWithoutParentsAlgorithm = "EdDSA" +) + +func (e JWTWithoutParentsAlgorithm) ToPointer() *JWTWithoutParentsAlgorithm { + return &e +} +func (e *JWTWithoutParentsAlgorithm) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "HS256": + fallthrough + case "HS384": + fallthrough + case "HS512": + fallthrough + case "RS256": + fallthrough + case "RS384": + fallthrough + case "RS512": + fallthrough + case "ES256": + fallthrough + case "ES384": + fallthrough + case "ES512": + fallthrough + case "PS256": + fallthrough + case "PS384": + fallthrough + case "PS512": + fallthrough + case "EdDSA": + *e = JWTWithoutParentsAlgorithm(v) + return nil + default: + return fmt.Errorf("invalid value for JWTWithoutParentsAlgorithm: %v", v) + } +} + +type JWTWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *JWTWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type JWTWithoutParents struct { + Algorithm *JWTWithoutParentsAlgorithm `json:"algorithm,omitempty"` + Consumer *JWTWithoutParentsConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + RsaPublicKey *string `json:"rsa_public_key,omitempty"` + Secret *string `json:"secret,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +func (o *JWTWithoutParents) GetAlgorithm() *JWTWithoutParentsAlgorithm { + if o == nil { + return nil + } + return o.Algorithm +} + +func (o *JWTWithoutParents) GetConsumer() *JWTWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *JWTWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *JWTWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *JWTWithoutParents) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *JWTWithoutParents) GetRsaPublicKey() *string { + if o == nil { + return nil + } + return o.RsaPublicKey +} + +func (o *JWTWithoutParents) GetSecret() *string { + if o == nil { + return nil + } + return o.Secret +} + +func (o *JWTWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} diff --git a/tests/mockserver/internal/sdk/models/components/key.go b/tests/mockserver/internal/sdk/models/components/key.go new file mode 100644 index 00000000..53f59e36 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/key.go @@ -0,0 +1,127 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// KeyPem - A keypair in PEM format. +type KeyPem struct { + PrivateKey *string `json:"private_key,omitempty"` + PublicKey *string `json:"public_key,omitempty"` +} + +func (o *KeyPem) GetPrivateKey() *string { + if o == nil { + return nil + } + return o.PrivateKey +} + +func (o *KeyPem) GetPublicKey() *string { + if o == nil { + return nil + } + return o.PublicKey +} + +// KeySet1 - The id (an UUID) of the key-set with which to associate the key. +type KeySet1 struct { + ID *string `json:"id,omitempty"` +} + +func (o *KeySet1) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// A Key object holds a representation of asymmetric keys in various formats. When Kong or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity. +type Key struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // A JSON Web Key represented as a string. + Jwk *string `json:"jwk,omitempty"` + // A unique identifier for a key. + Kid string `json:"kid"` + // The name to associate with the given keys. + Name *string `json:"name,omitempty"` + // A keypair in PEM format. + Pem *KeyPem `json:"pem,omitempty"` + // The id (an UUID) of the key-set with which to associate the key. + Set *KeySet1 `json:"set,omitempty"` + // An optional set of strings associated with the Key for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + X5t *string `json:"x5t,omitempty"` +} + +func (o *Key) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Key) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Key) GetJwk() *string { + if o == nil { + return nil + } + return o.Jwk +} + +func (o *Key) GetKid() string { + if o == nil { + return "" + } + return o.Kid +} + +func (o *Key) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *Key) GetPem() *KeyPem { + if o == nil { + return nil + } + return o.Pem +} + +func (o *Key) GetSet() *KeySet1 { + if o == nil { + return nil + } + return o.Set +} + +func (o *Key) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Key) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *Key) GetX5t() *string { + if o == nil { + return nil + } + return o.X5t +} diff --git a/tests/mockserver/internal/sdk/models/components/keyauth.go b/tests/mockserver/internal/sdk/models/components/keyauth.go new file mode 100644 index 00000000..500bee48 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/keyauth.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type KeyAuthConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *KeyAuthConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type KeyAuth struct { + Consumer *KeyAuthConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Tags []string `json:"tags,omitempty"` + // key-auth ttl in seconds + TTL *int64 `json:"ttl,omitempty"` +} + +func (o *KeyAuth) GetConsumer() *KeyAuthConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *KeyAuth) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *KeyAuth) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *KeyAuth) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *KeyAuth) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *KeyAuth) GetTTL() *int64 { + if o == nil { + return nil + } + return o.TTL +} diff --git a/tests/mockserver/internal/sdk/models/components/keyauthwithoutparents.go b/tests/mockserver/internal/sdk/models/components/keyauthwithoutparents.go new file mode 100644 index 00000000..1f5cfb78 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/keyauthwithoutparents.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type KeyAuthWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *KeyAuthWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type KeyAuthWithoutParents struct { + Consumer *KeyAuthWithoutParentsConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Tags []string `json:"tags,omitempty"` + // key-auth ttl in seconds + TTL *int64 `json:"ttl,omitempty"` +} + +func (o *KeyAuthWithoutParents) GetConsumer() *KeyAuthWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *KeyAuthWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *KeyAuthWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *KeyAuthWithoutParents) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *KeyAuthWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *KeyAuthWithoutParents) GetTTL() *int64 { + if o == nil { + return nil + } + return o.TTL +} diff --git a/tests/mockserver/internal/sdk/models/components/keyset.go b/tests/mockserver/internal/sdk/models/components/keyset.go new file mode 100644 index 00000000..2e428524 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/keyset.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type KeySet struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *KeySet) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *KeySet) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *KeySet) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *KeySet) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *KeySet) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/keywithoutparents.go b/tests/mockserver/internal/sdk/models/components/keywithoutparents.go new file mode 100644 index 00000000..1688f17d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/keywithoutparents.go @@ -0,0 +1,127 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// KeyWithoutParentsPem - A keypair in PEM format. +type KeyWithoutParentsPem struct { + PrivateKey *string `json:"private_key,omitempty"` + PublicKey *string `json:"public_key,omitempty"` +} + +func (o *KeyWithoutParentsPem) GetPrivateKey() *string { + if o == nil { + return nil + } + return o.PrivateKey +} + +func (o *KeyWithoutParentsPem) GetPublicKey() *string { + if o == nil { + return nil + } + return o.PublicKey +} + +// KeyWithoutParentsSet - The id (an UUID) of the key-set with which to associate the key. +type KeyWithoutParentsSet struct { + ID *string `json:"id,omitempty"` +} + +func (o *KeyWithoutParentsSet) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// KeyWithoutParents - A Key object holds a representation of asymmetric keys in various formats. When Kong or a Kong plugin requires a specific public or private key to perform certain operations, it can use this entity. +type KeyWithoutParents struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // A JSON Web Key represented as a string. + Jwk *string `json:"jwk,omitempty"` + // A unique identifier for a key. + Kid string `json:"kid"` + // The name to associate with the given keys. + Name *string `json:"name,omitempty"` + // A keypair in PEM format. + Pem *KeyWithoutParentsPem `json:"pem,omitempty"` + // The id (an UUID) of the key-set with which to associate the key. + Set *KeyWithoutParentsSet `json:"set,omitempty"` + // An optional set of strings associated with the Key for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + X5t *string `json:"x5t,omitempty"` +} + +func (o *KeyWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *KeyWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *KeyWithoutParents) GetJwk() *string { + if o == nil { + return nil + } + return o.Jwk +} + +func (o *KeyWithoutParents) GetKid() string { + if o == nil { + return "" + } + return o.Kid +} + +func (o *KeyWithoutParents) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *KeyWithoutParents) GetPem() *KeyWithoutParentsPem { + if o == nil { + return nil + } + return o.Pem +} + +func (o *KeyWithoutParents) GetSet() *KeyWithoutParentsSet { + if o == nil { + return nil + } + return o.Set +} + +func (o *KeyWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *KeyWithoutParents) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *KeyWithoutParents) GetX5t() *string { + if o == nil { + return nil + } + return o.X5t +} diff --git a/tests/mockserver/internal/sdk/models/components/listappauthstrategiesresponse.go b/tests/mockserver/internal/sdk/models/components/listappauthstrategiesresponse.go new file mode 100644 index 00000000..5dbb6f53 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listappauthstrategiesresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListAppAuthStrategiesResponse - A paginated list response for a collection of Application Auth Strategies +type ListAppAuthStrategiesResponse struct { + Data []AppAuthStrategy `json:"data"` + // returns the pagination information + Meta PaginatedMeta `json:"meta"` +} + +func (o *ListAppAuthStrategiesResponse) GetData() []AppAuthStrategy { + if o == nil { + return []AppAuthStrategy{} + } + return o.Data +} + +func (o *ListAppAuthStrategiesResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} diff --git a/tests/mockserver/internal/sdk/models/components/listconfigstoresecretsresponse.go b/tests/mockserver/internal/sdk/models/components/listconfigstoresecretsresponse.go new file mode 100644 index 00000000..4b3b1beb --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/listconfigstoresresponse.go b/tests/mockserver/internal/sdk/models/components/listconfigstoresresponse.go new file mode 100644 index 00000000..24d9c5c0 --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/listconfigurationsresponse.go b/tests/mockserver/internal/sdk/models/components/listconfigurationsresponse.go new file mode 100644 index 00000000..ed15fb72 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listconfigurationsresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListConfigurationsResponse - A paginated list for a collection of configurations. +type ListConfigurationsResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []ConfigurationManifest `json:"data"` +} + +func (o *ListConfigurationsResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListConfigurationsResponse) GetData() []ConfigurationManifest { + if o == nil { + return []ConfigurationManifest{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listcontrolplanesresponse.go b/tests/mockserver/internal/sdk/models/components/listcontrolplanesresponse.go new file mode 100644 index 00000000..812a0a10 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listcontrolplanesresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListControlPlanesResponse - A paginated list response for a collection of control planes. +type ListControlPlanesResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []ControlPlane `json:"data"` +} + +func (o *ListControlPlanesResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListControlPlanesResponse) GetData() []ControlPlane { + if o == nil { + return []ControlPlane{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listcustomdomainsresponse.go b/tests/mockserver/internal/sdk/models/components/listcustomdomainsresponse.go new file mode 100644 index 00000000..3516784b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listcustomdomainsresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListCustomDomainsResponse - A paginated list for a collection of custom domains. +type ListCustomDomainsResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []CustomDomain `json:"data"` +} + +func (o *ListCustomDomainsResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListCustomDomainsResponse) GetData() []CustomDomain { + if o == nil { + return []CustomDomain{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listdataplanecertificatesresponse.go b/tests/mockserver/internal/sdk/models/components/listdataplanecertificatesresponse.go new file mode 100644 index 00000000..79385569 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listdataplanecertificatesresponse.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ListDataPlaneCertificatesResponsePage struct { + Total *int64 `json:"total,omitempty"` +} + +func (o *ListDataPlaneCertificatesResponsePage) GetTotal() *int64 { + if o == nil { + return nil + } + return o.Total +} + +// ListDataPlaneCertificatesResponse - Example response +type ListDataPlaneCertificatesResponse struct { + Items []DataPlaneClientCertificate `json:"items,omitempty"` + Page *ListDataPlaneCertificatesResponsePage `json:"page,omitempty"` +} + +func (o *ListDataPlaneCertificatesResponse) GetItems() []DataPlaneClientCertificate { + if o == nil { + return nil + } + return o.Items +} + +func (o *ListDataPlaneCertificatesResponse) GetPage() *ListDataPlaneCertificatesResponsePage { + if o == nil { + return nil + } + return o.Page +} diff --git a/tests/mockserver/internal/sdk/models/components/listdcrprovidersresponse.go b/tests/mockserver/internal/sdk/models/components/listdcrprovidersresponse.go new file mode 100644 index 00000000..003308be --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listdcrprovidersresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListDcrProvidersResponse - A paginated list response for a collection of DCR providers +type ListDcrProvidersResponse struct { + Data []DcrProviderResponse `json:"data"` + // returns the pagination information + Meta PaginatedMeta `json:"meta"` +} + +func (o *ListDcrProvidersResponse) GetData() []DcrProviderResponse { + if o == nil { + return []DcrProviderResponse{} + } + return o.Data +} + +func (o *ListDcrProvidersResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} diff --git a/tests/mockserver/internal/sdk/models/components/listdefaultresourceconfigurationsresponse.go b/tests/mockserver/internal/sdk/models/components/listdefaultresourceconfigurationsresponse.go new file mode 100644 index 00000000..44c0abcc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listdefaultresourceconfigurationsresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListDefaultResourceConfigurationsResponse - A paginated list for a collection of default resource configurations. +type ListDefaultResourceConfigurationsResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []DefaultResourceConfiguration `json:"data"` +} + +func (o *ListDefaultResourceConfigurationsResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListDefaultResourceConfigurationsResponse) GetData() []DefaultResourceConfiguration { + if o == nil { + return []DefaultResourceConfiguration{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listdefaultresourcequotasresponse.go b/tests/mockserver/internal/sdk/models/components/listdefaultresourcequotasresponse.go new file mode 100644 index 00000000..ae10c91f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listdefaultresourcequotasresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListDefaultResourceQuotasResponse - A paginated list for a collection of default resource quotas. +type ListDefaultResourceQuotasResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []DefaultResourceQuota `json:"data"` +} + +func (o *ListDefaultResourceQuotasResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListDefaultResourceQuotasResponse) GetData() []DefaultResourceQuota { + if o == nil { + return []DefaultResourceQuota{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listgroupmemberships.go b/tests/mockserver/internal/sdk/models/components/listgroupmemberships.go new file mode 100644 index 00000000..37b74b76 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listgroupmemberships.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListGroupMemberships - A paginated list response for a collection of control plane group memberships. +type ListGroupMemberships struct { + // returns the pagination information + Meta CursorPaginatedMetaWithSizeAndTotal `json:"meta"` + // Array of control planes summary who are a child to this control plane group. + Data []ControlPlane `json:"data"` +} + +func (o *ListGroupMemberships) GetMeta() CursorPaginatedMetaWithSizeAndTotal { + if o == nil { + return CursorPaginatedMetaWithSizeAndTotal{} + } + return o.Meta +} + +func (o *ListGroupMemberships) GetData() []ControlPlane { + if o == nil { + return []ControlPlane{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listnetworkconfigurationreferencesresponse.go b/tests/mockserver/internal/sdk/models/components/listnetworkconfigurationreferencesresponse.go new file mode 100644 index 00000000..8fd36829 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listnetworkconfigurationreferencesresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListNetworkConfigurationReferencesResponse - A paginated list for a collection of configurations that reference a network. +type ListNetworkConfigurationReferencesResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []NetworkConfigurationReference `json:"data"` +} + +func (o *ListNetworkConfigurationReferencesResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListNetworkConfigurationReferencesResponse) GetData() []NetworkConfigurationReference { + if o == nil { + return []NetworkConfigurationReference{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listnetworksresponse.go b/tests/mockserver/internal/sdk/models/components/listnetworksresponse.go new file mode 100644 index 00000000..51401759 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listnetworksresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListNetworksResponse - A paginated list for a collection of networks. +type ListNetworksResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []Network `json:"data"` +} + +func (o *ListNetworksResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListNetworksResponse) GetData() []Network { + if o == nil { + return []Network{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listnodes.go b/tests/mockserver/internal/sdk/models/components/listnodes.go new file mode 100644 index 00000000..4c4523ca --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listnodes.go @@ -0,0 +1,128 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ListNodesCompatibilityStatus struct { + State *string `json:"state,omitempty"` +} + +func (o *ListNodesCompatibilityStatus) GetState() *string { + if o == nil { + return nil + } + return o.State +} + +type ListNodesItem struct { + ID *string `json:"id,omitempty"` + Version *string `json:"version,omitempty"` + Hostname *string `json:"hostname,omitempty"` + LastPing *int64 `json:"last_ping,omitempty"` + Type *string `json:"type,omitempty"` + CreatedAt *int64 `json:"created_at,omitempty"` + UpdatedAt *int64 `json:"updated_at,omitempty"` + ConfigHash *string `json:"config_hash,omitempty"` + CompatibilityStatus *ListNodesCompatibilityStatus `json:"compatibility_status,omitempty"` +} + +func (o *ListNodesItem) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ListNodesItem) GetVersion() *string { + if o == nil { + return nil + } + return o.Version +} + +func (o *ListNodesItem) GetHostname() *string { + if o == nil { + return nil + } + return o.Hostname +} + +func (o *ListNodesItem) GetLastPing() *int64 { + if o == nil { + return nil + } + return o.LastPing +} + +func (o *ListNodesItem) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *ListNodesItem) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ListNodesItem) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *ListNodesItem) GetConfigHash() *string { + if o == nil { + return nil + } + return o.ConfigHash +} + +func (o *ListNodesItem) GetCompatibilityStatus() *ListNodesCompatibilityStatus { + if o == nil { + return nil + } + return o.CompatibilityStatus +} + +type ListNodesPage struct { + Total *int64 `json:"total,omitempty"` + Next *string `json:"next,omitempty"` +} + +func (o *ListNodesPage) GetTotal() *int64 { + if o == nil { + return nil + } + return o.Total +} + +func (o *ListNodesPage) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +// ListNodes - Example response +type ListNodes struct { + Items []ListNodesItem `json:"items,omitempty"` + Page *ListNodesPage `json:"page,omitempty"` +} + +func (o *ListNodes) GetItems() []ListNodesItem { + if o == nil { + return nil + } + return o.Items +} + +func (o *ListNodes) GetPage() *ListNodesPage { + if o == nil { + return nil + } + return o.Page +} diff --git a/tests/mockserver/internal/sdk/models/components/listnodeseol.go b/tests/mockserver/internal/sdk/models/components/listnodeseol.go new file mode 100644 index 00000000..4585ae6a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listnodeseol.go @@ -0,0 +1,61 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ListNodesEolItem struct { + NodeID *string `json:"node_id,omitempty"` + NodeVersion *string `json:"node_version,omitempty"` + Message *string `json:"message,omitempty"` +} + +func (o *ListNodesEolItem) GetNodeID() *string { + if o == nil { + return nil + } + return o.NodeID +} + +func (o *ListNodesEolItem) GetNodeVersion() *string { + if o == nil { + return nil + } + return o.NodeVersion +} + +func (o *ListNodesEolItem) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +type ListNodesEolPage struct { + Total *int64 `json:"total,omitempty"` +} + +func (o *ListNodesEolPage) GetTotal() *int64 { + if o == nil { + return nil + } + return o.Total +} + +// ListNodesEol - Example response +type ListNodesEol struct { + Items []ListNodesEolItem `json:"items,omitempty"` + Page *ListNodesEolPage `json:"page,omitempty"` +} + +func (o *ListNodesEol) GetItems() []ListNodesEolItem { + if o == nil { + return nil + } + return o.Items +} + +func (o *ListNodesEol) GetPage() *ListNodesEolPage { + if o == nil { + return nil + } + return o.Page +} diff --git a/tests/mockserver/internal/sdk/models/components/listpluginschemas.go b/tests/mockserver/internal/sdk/models/components/listpluginschemas.go new file mode 100644 index 00000000..748531ce --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listpluginschemas.go @@ -0,0 +1,73 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ListPluginSchemasItem struct { + // The custom plugin schema; `jq -Rs '.' schema.lua`. + LuaSchema *string `json:"lua_schema,omitempty"` + // The custom plugin name determined by the custom plugin schema. + Name *string `json:"name,omitempty"` + // An ISO-8604 timestamp representation of custom plugin schema creation date. + CreatedAt *int64 `json:"created_at,omitempty"` + // An ISO-8604 timestamp representation of custom plugin schema update date. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *ListPluginSchemasItem) GetLuaSchema() *string { + if o == nil { + return nil + } + return o.LuaSchema +} + +func (o *ListPluginSchemasItem) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ListPluginSchemasItem) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ListPluginSchemasItem) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +type ListPluginSchemasPage struct { + Total *int64 `json:"total,omitempty"` +} + +func (o *ListPluginSchemasPage) GetTotal() *int64 { + if o == nil { + return nil + } + return o.Total +} + +// ListPluginSchemas - A paginated list response for a collection of custom plugin schemas. +type ListPluginSchemas struct { + Items []ListPluginSchemasItem `json:"items,omitempty"` + Page *ListPluginSchemasPage `json:"page,omitempty"` +} + +func (o *ListPluginSchemas) GetItems() []ListPluginSchemasItem { + if o == nil { + return nil + } + return o.Items +} + +func (o *ListPluginSchemas) GetPage() *ListPluginSchemasPage { + if o == nil { + return nil + } + return o.Page +} diff --git a/tests/mockserver/internal/sdk/models/components/listprovideraccountsresponse.go b/tests/mockserver/internal/sdk/models/components/listprovideraccountsresponse.go new file mode 100644 index 00000000..9bb8130f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listprovideraccountsresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListProviderAccountsResponse - A paginated list for a collection of provider accounts. +type ListProviderAccountsResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []ProviderAccount `json:"data"` +} + +func (o *ListProviderAccountsResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListProviderAccountsResponse) GetData() []ProviderAccount { + if o == nil { + return []ProviderAccount{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listresourceconfigurationsresponse.go b/tests/mockserver/internal/sdk/models/components/listresourceconfigurationsresponse.go new file mode 100644 index 00000000..cc84b52b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listresourceconfigurationsresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListResourceConfigurationsResponse - A paginated list for a collection of resource configurations. +type ListResourceConfigurationsResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []ResourceConfiguration `json:"data"` +} + +func (o *ListResourceConfigurationsResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListResourceConfigurationsResponse) GetData() []ResourceConfiguration { + if o == nil { + return []ResourceConfiguration{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listresourcequotasresponse.go b/tests/mockserver/internal/sdk/models/components/listresourcequotasresponse.go new file mode 100644 index 00000000..fb33f00d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listresourcequotasresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListResourceQuotasResponse - A paginated list for a collection of resource quotas. +type ListResourceQuotasResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []ResourceQuota `json:"data"` +} + +func (o *ListResourceQuotasResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListResourceQuotasResponse) GetData() []ResourceQuota { + if o == nil { + return []ResourceQuota{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/listtransitgatewaysresponse.go b/tests/mockserver/internal/sdk/models/components/listtransitgatewaysresponse.go new file mode 100644 index 00000000..3bd30f11 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/listtransitgatewaysresponse.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ListTransitGatewaysResponse - A paginated list for a collection of transit gateways for a network. +type ListTransitGatewaysResponse struct { + // returns the pagination information + Meta PaginatedMeta `json:"meta"` + Data []TransitGatewayResponse `json:"data"` +} + +func (o *ListTransitGatewaysResponse) GetMeta() PaginatedMeta { + if o == nil { + return PaginatedMeta{} + } + return o.Meta +} + +func (o *ListTransitGatewaysResponse) GetData() []TransitGatewayResponse { + if o == nil { + return []TransitGatewayResponse{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/meorganization.go b/tests/mockserver/internal/sdk/models/components/meorganization.go new file mode 100644 index 00000000..e3ffee7a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/meorganization.go @@ -0,0 +1,130 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// StateResponse - State of the organization +type StateResponse string + +const ( + StateResponseActive StateResponse = "active" + StateResponseInactive StateResponse = "inactive" + StateResponseDeleting StateResponse = "deleting" + StateResponseDeleted StateResponse = "deleted" +) + +func (e StateResponse) ToPointer() *StateResponse { + return &e +} +func (e *StateResponse) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "active": + fallthrough + case "inactive": + fallthrough + case "deleting": + fallthrough + case "deleted": + *e = StateResponse(v) + return nil + default: + return fmt.Errorf("invalid value for StateResponse: %v", v) + } +} + +// MeOrganization - Me Organization +type MeOrganization struct { + // UUID of the organization. + ID *string `json:"id,omitempty"` + // Name of the organization. + Name *string `json:"name,omitempty"` + // Owner ID of the organization. + OwnerID *string `json:"owner_id,omitempty"` + // Path to organization-specific login when single sign on (SSO) is enabled. Blank otherwise. + LoginPath *string `json:"login_path,omitempty"` + // Date the organization was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Date the organization was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // State of the organization + State *StateResponse `json:"state,omitempty"` + // The number of days an organization spends inactive before being deleted. + RetentionPeriodDays *int64 `json:"retention_period_days,omitempty"` +} + +func (m MeOrganization) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(m, "", false) +} + +func (m *MeOrganization) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil { + return err + } + return nil +} + +func (o *MeOrganization) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *MeOrganization) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *MeOrganization) GetOwnerID() *string { + if o == nil { + return nil + } + return o.OwnerID +} + +func (o *MeOrganization) GetLoginPath() *string { + if o == nil { + return nil + } + return o.LoginPath +} + +func (o *MeOrganization) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *MeOrganization) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *MeOrganization) GetState() *StateResponse { + if o == nil { + return nil + } + return o.State +} + +func (o *MeOrganization) GetRetentionPeriodDays() *int64 { + if o == nil { + return nil + } + return o.RetentionPeriodDays +} diff --git a/tests/mockserver/internal/sdk/models/components/mtlsauth.go b/tests/mockserver/internal/sdk/models/components/mtlsauth.go new file mode 100644 index 00000000..73781392 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/mtlsauth.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type MTLSAuthCaCertificate struct { + ID *string `json:"id,omitempty"` +} + +func (o *MTLSAuthCaCertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type MTLSAuthConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *MTLSAuthConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type MTLSAuth struct { + CaCertificate *MTLSAuthCaCertificate `json:"ca_certificate,omitempty"` + Consumer *MTLSAuthConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + SubjectName string `json:"subject_name"` + Tags []string `json:"tags,omitempty"` +} + +func (o *MTLSAuth) GetCaCertificate() *MTLSAuthCaCertificate { + if o == nil { + return nil + } + return o.CaCertificate +} + +func (o *MTLSAuth) GetConsumer() *MTLSAuthConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *MTLSAuth) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *MTLSAuth) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *MTLSAuth) GetSubjectName() string { + if o == nil { + return "" + } + return o.SubjectName +} + +func (o *MTLSAuth) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} diff --git a/tests/mockserver/internal/sdk/models/components/mtlsauthwithoutparents.go b/tests/mockserver/internal/sdk/models/components/mtlsauthwithoutparents.go new file mode 100644 index 00000000..06512a11 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/mtlsauthwithoutparents.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type MTLSAuthWithoutParentsCaCertificate struct { + ID *string `json:"id,omitempty"` +} + +func (o *MTLSAuthWithoutParentsCaCertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type MTLSAuthWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *MTLSAuthWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type MTLSAuthWithoutParents struct { + CaCertificate *MTLSAuthWithoutParentsCaCertificate `json:"ca_certificate,omitempty"` + Consumer *MTLSAuthWithoutParentsConsumer `json:"consumer,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + SubjectName string `json:"subject_name"` + Tags []string `json:"tags,omitempty"` +} + +func (o *MTLSAuthWithoutParents) GetCaCertificate() *MTLSAuthWithoutParentsCaCertificate { + if o == nil { + return nil + } + return o.CaCertificate +} + +func (o *MTLSAuthWithoutParents) GetConsumer() *MTLSAuthWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *MTLSAuthWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *MTLSAuthWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *MTLSAuthWithoutParents) GetSubjectName() string { + if o == nil { + return "" + } + return o.SubjectName +} + +func (o *MTLSAuthWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} diff --git a/tests/mockserver/internal/sdk/models/components/network.go b/tests/mockserver/internal/sdk/models/components/network.go new file mode 100644 index 00000000..68552c61 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/network.go @@ -0,0 +1,160 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// Network - Object containing information about a network to be used in configurations. +type Network struct { + ID string `json:"id"` + // Human-readable name of the network. + Name string `json:"name"` + // Whether the network is a default network or not. Default networks are Networks that are created + // automatically by Konnect when an organization is linked to a provider account. + // + Default bool `json:"default"` + CloudGatewayProviderAccountID string `json:"cloud_gateway_provider_account_id"` + // Region ID for cloud provider region. + Region string `json:"region"` + // List of availability zones that the network is attached to. + AvailabilityZones []string `json:"availability_zones"` + // CIDR block configuration for the network. + CidrBlock string `json:"cidr_block"` + // State of the network. + State NetworkState `json:"state"` + // Metadata describing the backing state of the network and why it may be in an erroneous state. + // + StateMetadata *NetworkStateMetadata `json:"state_metadata,omitempty"` + // Metadata describing attributes returned by cloud-provider for the network. + ProviderMetadata NetworkProviderMetadata `json:"provider_metadata"` + // The number of transit gateways attached to this network. + TransitGatewayCount int64 `json:"transit_gateway_count"` + // The number of configurations that reference this network. + ConfigurationReferenceCount int64 `json:"configuration_reference_count"` + // Monotonically-increasing version count of the network, to indicate the order of updates to the network. + // + EntityVersion int64 `json:"entity_version"` + // An RFC-3339 timestamp representation of network creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of network update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (n Network) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(n, "", false) +} + +func (n *Network) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + return err + } + return nil +} + +func (o *Network) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *Network) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *Network) GetDefault() bool { + if o == nil { + return false + } + return o.Default +} + +func (o *Network) GetCloudGatewayProviderAccountID() string { + if o == nil { + return "" + } + return o.CloudGatewayProviderAccountID +} + +func (o *Network) GetRegion() string { + if o == nil { + return "" + } + return o.Region +} + +func (o *Network) GetAvailabilityZones() []string { + if o == nil { + return []string{} + } + return o.AvailabilityZones +} + +func (o *Network) GetCidrBlock() string { + if o == nil { + return "" + } + return o.CidrBlock +} + +func (o *Network) GetState() NetworkState { + if o == nil { + return NetworkState("") + } + return o.State +} + +func (o *Network) GetStateMetadata() *NetworkStateMetadata { + if o == nil { + return nil + } + return o.StateMetadata +} + +func (o *Network) GetProviderMetadata() NetworkProviderMetadata { + if o == nil { + return NetworkProviderMetadata{} + } + return o.ProviderMetadata +} + +func (o *Network) GetTransitGatewayCount() int64 { + if o == nil { + return 0 + } + return o.TransitGatewayCount +} + +func (o *Network) GetConfigurationReferenceCount() int64 { + if o == nil { + return 0 + } + return o.ConfigurationReferenceCount +} + +func (o *Network) GetEntityVersion() int64 { + if o == nil { + return 0 + } + return o.EntityVersion +} + +func (o *Network) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *Network) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/networkconfigurationreference.go b/tests/mockserver/internal/sdk/models/components/networkconfigurationreference.go new file mode 100644 index 00000000..162b0f2b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkconfigurationreference.go @@ -0,0 +1,114 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// NetworkConfigurationReference - Object containing information about a control-plane's cloud-gateways configuration. +type NetworkConfigurationReference struct { + ID string `json:"id"` + // Supported gateway version. + Version string `json:"version"` + // Type of API access data-plane groups will support for a configuration. + APIAccess *APIAccess `default:"private+public" json:"api_access"` + // Object that describes where data-planes will be deployed to, along with how many instances. + DataplaneGroupConfig []ConfigurationDataPlaneGroupConfig `json:"dataplane_group_config"` + // List of data-plane groups that describe where data-planes will be deployed to, along with how many + // instances. + // + DataplaneGroups []ConfigurationDataPlaneGroup `json:"dataplane_groups"` + // Positive, monotonically increasing version integer, to serialize configuration changes. + // + EntityVersion float64 `json:"entity_version"` + // An RFC-3339 timestamp representation of configuration creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of configuration update date. + UpdatedAt time.Time `json:"updated_at"` + ControlPlaneID string `json:"control_plane_id"` + // Set of control-plane geos supported for deploying cloud-gateways configurations. + ControlPlaneGeo ControlPlaneGeo `json:"control_plane_geo"` +} + +func (n NetworkConfigurationReference) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(n, "", false) +} + +func (n *NetworkConfigurationReference) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + return err + } + return nil +} + +func (o *NetworkConfigurationReference) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *NetworkConfigurationReference) GetVersion() string { + if o == nil { + return "" + } + return o.Version +} + +func (o *NetworkConfigurationReference) GetAPIAccess() *APIAccess { + if o == nil { + return nil + } + return o.APIAccess +} + +func (o *NetworkConfigurationReference) GetDataplaneGroupConfig() []ConfigurationDataPlaneGroupConfig { + if o == nil { + return []ConfigurationDataPlaneGroupConfig{} + } + return o.DataplaneGroupConfig +} + +func (o *NetworkConfigurationReference) GetDataplaneGroups() []ConfigurationDataPlaneGroup { + if o == nil { + return []ConfigurationDataPlaneGroup{} + } + return o.DataplaneGroups +} + +func (o *NetworkConfigurationReference) GetEntityVersion() float64 { + if o == nil { + return 0.0 + } + return o.EntityVersion +} + +func (o *NetworkConfigurationReference) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *NetworkConfigurationReference) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +func (o *NetworkConfigurationReference) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *NetworkConfigurationReference) GetControlPlaneGeo() ControlPlaneGeo { + if o == nil { + return ControlPlaneGeo("") + } + return o.ControlPlaneGeo +} diff --git a/tests/mockserver/internal/sdk/models/components/networkcreatestate.go b/tests/mockserver/internal/sdk/models/components/networkcreatestate.go new file mode 100644 index 00000000..aa8ab5e3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkcreatestate.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// NetworkCreateState - Initial state for creating a network. +type NetworkCreateState string + +const ( + NetworkCreateStateInitializing NetworkCreateState = "initializing" + NetworkCreateStateOffline NetworkCreateState = "offline" +) + +func (e NetworkCreateState) ToPointer() *NetworkCreateState { + return &e +} +func (e *NetworkCreateState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "initializing": + fallthrough + case "offline": + *e = NetworkCreateState(v) + return nil + default: + return fmt.Errorf("invalid value for NetworkCreateState: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/networkprovidermetadata.go b/tests/mockserver/internal/sdk/models/components/networkprovidermetadata.go new file mode 100644 index 00000000..f655794c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkprovidermetadata.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NetworkProviderMetadata - Metadata describing attributes returned by cloud-provider for the network. +type NetworkProviderMetadata struct { + VpcID *string `json:"vpc_id,omitempty"` + SubnetIds []string `json:"subnet_ids,omitempty"` +} + +func (o *NetworkProviderMetadata) GetVpcID() *string { + if o == nil { + return nil + } + return o.VpcID +} + +func (o *NetworkProviderMetadata) GetSubnetIds() []string { + if o == nil { + return nil + } + return o.SubnetIds +} diff --git a/tests/mockserver/internal/sdk/models/components/networksfilterparameters.go b/tests/mockserver/internal/sdk/models/components/networksfilterparameters.go new file mode 100644 index 00000000..cd52b375 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networksfilterparameters.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type NetworksFilterParameters struct { + Name *CloudGatewaysStringFieldFilterOverride `queryParam:"name=name"` + State *NetworkStateFieldFilter `queryParam:"name=state"` +} + +func (o *NetworksFilterParameters) GetName() *CloudGatewaysStringFieldFilterOverride { + if o == nil { + return nil + } + return o.Name +} + +func (o *NetworksFilterParameters) GetState() *NetworkStateFieldFilter { + if o == nil { + return nil + } + return o.State +} diff --git a/tests/mockserver/internal/sdk/models/components/networkstate.go b/tests/mockserver/internal/sdk/models/components/networkstate.go new file mode 100644 index 00000000..148b8516 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkstate.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// NetworkState - State of the network. +type NetworkState string + +const ( + NetworkStateCreated NetworkState = "created" + NetworkStateInitializing NetworkState = "initializing" + NetworkStateOffline NetworkState = "offline" + NetworkStateReady NetworkState = "ready" + NetworkStateTerminating NetworkState = "terminating" + NetworkStateTerminated NetworkState = "terminated" +) + +func (e NetworkState) ToPointer() *NetworkState { + return &e +} +func (e *NetworkState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "created": + fallthrough + case "initializing": + fallthrough + case "offline": + fallthrough + case "ready": + fallthrough + case "terminating": + fallthrough + case "terminated": + *e = NetworkState(v) + return nil + default: + return fmt.Errorf("invalid value for NetworkState: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/networkstatefieldequalsfilter.go b/tests/mockserver/internal/sdk/models/components/networkstatefieldequalsfilter.go new file mode 100644 index 00000000..6a4d934e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkstatefieldequalsfilter.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type NetworkStateFieldEqualsComparison struct { +} + +type NetworkStateFieldEqualsFilterType string + +const ( + NetworkStateFieldEqualsFilterTypeNetworkState NetworkStateFieldEqualsFilterType = "NetworkState" + NetworkStateFieldEqualsFilterTypeNetworkStateFieldEqualsComparison NetworkStateFieldEqualsFilterType = "NetworkStateFieldEqualsComparison" +) + +// NetworkStateFieldEqualsFilter - Filter a network state by exact match. +type NetworkStateFieldEqualsFilter struct { + NetworkState *NetworkState `queryParam:"inline"` + NetworkStateFieldEqualsComparison *NetworkStateFieldEqualsComparison `queryParam:"inline"` + + Type NetworkStateFieldEqualsFilterType +} + +func CreateNetworkStateFieldEqualsFilterNetworkState(networkState NetworkState) NetworkStateFieldEqualsFilter { + typ := NetworkStateFieldEqualsFilterTypeNetworkState + + return NetworkStateFieldEqualsFilter{ + NetworkState: &networkState, + Type: typ, + } +} + +func CreateNetworkStateFieldEqualsFilterNetworkStateFieldEqualsComparison(networkStateFieldEqualsComparison NetworkStateFieldEqualsComparison) NetworkStateFieldEqualsFilter { + typ := NetworkStateFieldEqualsFilterTypeNetworkStateFieldEqualsComparison + + return NetworkStateFieldEqualsFilter{ + NetworkStateFieldEqualsComparison: &networkStateFieldEqualsComparison, + Type: typ, + } +} + +func (u *NetworkStateFieldEqualsFilter) UnmarshalJSON(data []byte) error { + + var networkStateFieldEqualsComparison NetworkStateFieldEqualsComparison = NetworkStateFieldEqualsComparison{} + if err := utils.UnmarshalJSON(data, &networkStateFieldEqualsComparison, "", true, true); err == nil { + u.NetworkStateFieldEqualsComparison = &networkStateFieldEqualsComparison + u.Type = NetworkStateFieldEqualsFilterTypeNetworkStateFieldEqualsComparison + return nil + } + + var networkState NetworkState = NetworkState("") + if err := utils.UnmarshalJSON(data, &networkState, "", true, true); err == nil { + u.NetworkState = &networkState + u.Type = NetworkStateFieldEqualsFilterTypeNetworkState + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for NetworkStateFieldEqualsFilter", string(data)) +} + +func (u NetworkStateFieldEqualsFilter) MarshalJSON() ([]byte, error) { + if u.NetworkState != nil { + return utils.MarshalJSON(u.NetworkState, "", true) + } + + if u.NetworkStateFieldEqualsComparison != nil { + return utils.MarshalJSON(u.NetworkStateFieldEqualsComparison, "", true) + } + + return nil, errors.New("could not marshal union type NetworkStateFieldEqualsFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/networkstatefieldfilter.go b/tests/mockserver/internal/sdk/models/components/networkstatefieldfilter.go new file mode 100644 index 00000000..6ed39df2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkstatefieldfilter.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type NetworkStateFieldFilterType string + +const ( + NetworkStateFieldFilterTypeNetworkStateFieldEqualsFilter NetworkStateFieldFilterType = "NetworkStateFieldEqualsFilter" + NetworkStateFieldFilterTypeNetworkStateFieldNotEqualsFilter NetworkStateFieldFilterType = "NetworkStateFieldNotEqualsFilter" + NetworkStateFieldFilterTypeNetworkStateFieldOrEqualityFilter NetworkStateFieldFilterType = "NetworkStateFieldOrEqualityFilter" +) + +type NetworkStateFieldFilter struct { + NetworkStateFieldEqualsFilter *NetworkStateFieldEqualsFilter `queryParam:"inline"` + NetworkStateFieldNotEqualsFilter *NetworkStateFieldNotEqualsFilter `queryParam:"inline"` + NetworkStateFieldOrEqualityFilter *NetworkStateFieldOrEqualityFilter `queryParam:"inline"` + + Type NetworkStateFieldFilterType +} + +func CreateNetworkStateFieldFilterNetworkStateFieldEqualsFilter(networkStateFieldEqualsFilter NetworkStateFieldEqualsFilter) NetworkStateFieldFilter { + typ := NetworkStateFieldFilterTypeNetworkStateFieldEqualsFilter + + return NetworkStateFieldFilter{ + NetworkStateFieldEqualsFilter: &networkStateFieldEqualsFilter, + Type: typ, + } +} + +func CreateNetworkStateFieldFilterNetworkStateFieldNotEqualsFilter(networkStateFieldNotEqualsFilter NetworkStateFieldNotEqualsFilter) NetworkStateFieldFilter { + typ := NetworkStateFieldFilterTypeNetworkStateFieldNotEqualsFilter + + return NetworkStateFieldFilter{ + NetworkStateFieldNotEqualsFilter: &networkStateFieldNotEqualsFilter, + Type: typ, + } +} + +func CreateNetworkStateFieldFilterNetworkStateFieldOrEqualityFilter(networkStateFieldOrEqualityFilter NetworkStateFieldOrEqualityFilter) NetworkStateFieldFilter { + typ := NetworkStateFieldFilterTypeNetworkStateFieldOrEqualityFilter + + return NetworkStateFieldFilter{ + NetworkStateFieldOrEqualityFilter: &networkStateFieldOrEqualityFilter, + Type: typ, + } +} + +func (u *NetworkStateFieldFilter) UnmarshalJSON(data []byte) error { + + var networkStateFieldNotEqualsFilter NetworkStateFieldNotEqualsFilter = NetworkStateFieldNotEqualsFilter{} + if err := utils.UnmarshalJSON(data, &networkStateFieldNotEqualsFilter, "", true, true); err == nil { + u.NetworkStateFieldNotEqualsFilter = &networkStateFieldNotEqualsFilter + u.Type = NetworkStateFieldFilterTypeNetworkStateFieldNotEqualsFilter + return nil + } + + var networkStateFieldOrEqualityFilter NetworkStateFieldOrEqualityFilter = NetworkStateFieldOrEqualityFilter{} + if err := utils.UnmarshalJSON(data, &networkStateFieldOrEqualityFilter, "", true, true); err == nil { + u.NetworkStateFieldOrEqualityFilter = &networkStateFieldOrEqualityFilter + u.Type = NetworkStateFieldFilterTypeNetworkStateFieldOrEqualityFilter + return nil + } + + var networkStateFieldEqualsFilter NetworkStateFieldEqualsFilter = NetworkStateFieldEqualsFilter{} + if err := utils.UnmarshalJSON(data, &networkStateFieldEqualsFilter, "", true, true); err == nil { + u.NetworkStateFieldEqualsFilter = &networkStateFieldEqualsFilter + u.Type = NetworkStateFieldFilterTypeNetworkStateFieldEqualsFilter + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for NetworkStateFieldFilter", string(data)) +} + +func (u NetworkStateFieldFilter) MarshalJSON() ([]byte, error) { + if u.NetworkStateFieldEqualsFilter != nil { + return utils.MarshalJSON(u.NetworkStateFieldEqualsFilter, "", true) + } + + if u.NetworkStateFieldNotEqualsFilter != nil { + return utils.MarshalJSON(u.NetworkStateFieldNotEqualsFilter, "", true) + } + + if u.NetworkStateFieldOrEqualityFilter != nil { + return utils.MarshalJSON(u.NetworkStateFieldOrEqualityFilter, "", true) + } + + return nil, errors.New("could not marshal union type NetworkStateFieldFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/networkstatefieldnotequalsfilter.go b/tests/mockserver/internal/sdk/models/components/networkstatefieldnotequalsfilter.go new file mode 100644 index 00000000..1c4fdf5c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkstatefieldnotequalsfilter.go @@ -0,0 +1,7 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NetworkStateFieldNotEqualsFilter - Filter a network state by inequality match. +type NetworkStateFieldNotEqualsFilter struct { +} diff --git a/tests/mockserver/internal/sdk/models/components/networkstatefieldorequalityfilter.go b/tests/mockserver/internal/sdk/models/components/networkstatefieldorequalityfilter.go new file mode 100644 index 00000000..7cdf78f4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkstatefieldorequalityfilter.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NetworkStateFieldOrEqualityFilter - Filter a network state by determining if the value is equal to any in a set of values, where the set is a +// comma-delimited list. +type NetworkStateFieldOrEqualityFilter struct { + Oeq string `queryParam:"name=oeq"` +} + +func (o *NetworkStateFieldOrEqualityFilter) GetOeq() string { + if o == nil { + return "" + } + return o.Oeq +} diff --git a/tests/mockserver/internal/sdk/models/components/networkstatemetadata.go b/tests/mockserver/internal/sdk/models/components/networkstatemetadata.go new file mode 100644 index 00000000..ed7ea090 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/networkstatemetadata.go @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NetworkStateMetadata - Metadata describing the backing state of the network and why it may be in an erroneous state. +type NetworkStateMetadata struct { + // Reported status of the network from backing infrastructure. + ReportedStatus *string `json:"reported_status,omitempty"` + // Reason why the network may be in an erroneous state, reported from backing infrastructure. + // + Reason *string `json:"reason,omitempty"` +} + +func (o *NetworkStateMetadata) GetReportedStatus() *string { + if o == nil { + return nil + } + return o.ReportedStatus +} + +func (o *NetworkStateMetadata) GetReason() *string { + if o == nil { + return nil + } + return o.Reason +} diff --git a/tests/mockserver/internal/sdk/models/components/notification.go b/tests/mockserver/internal/sdk/models/components/notification.go new file mode 100644 index 00000000..2ae6a83b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notification.go @@ -0,0 +1,114 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// Details - Metadata associated with the notification to build actionable links. +type Details struct { +} + +// Notification - Properties of a notification. +type Notification struct { + // Contains a unique identifier used by the API for this resource. + ID string `json:"id"` + Title string `json:"title"` + Description string `json:"description"` + // Status of the notification. + Status NotificationStatus `json:"status"` + // Region associated to a notification. + Region NotificationRegion `json:"region"` + Namespace NotificationNamespace `json:"namespace"` + // ID of the entity. Use '*' to represent all entities of this type. + EntityID string `json:"entity_id"` + // Metadata associated with the notification to build actionable links. + Details Details `json:"details"` + // An ISO-8601 timestamp representation of entity creation date. + CreatedAt time.Time `json:"created_at"` + // An ISO-8601 timestamp representation of entity update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (n Notification) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(n, "", false) +} + +func (n *Notification) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + return err + } + return nil +} + +func (o *Notification) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *Notification) GetTitle() string { + if o == nil { + return "" + } + return o.Title +} + +func (o *Notification) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *Notification) GetStatus() NotificationStatus { + if o == nil { + return NotificationStatus("") + } + return o.Status +} + +func (o *Notification) GetRegion() NotificationRegion { + if o == nil { + return NotificationRegion("") + } + return o.Region +} + +func (o *Notification) GetNamespace() NotificationNamespace { + if o == nil { + return NotificationNamespace("") + } + return o.Namespace +} + +func (o *Notification) GetEntityID() string { + if o == nil { + return "" + } + return o.EntityID +} + +func (o *Notification) GetDetails() Details { + if o == nil { + return Details{} + } + return o.Details +} + +func (o *Notification) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *Notification) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationchannel.go b/tests/mockserver/internal/sdk/models/components/notificationchannel.go new file mode 100644 index 00000000..7003dd17 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationchannel.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NotificationChannel - Channel subscription details for an event. +type NotificationChannel struct { + Type NotificationChannelType `json:"type"` + Enabled bool `json:"enabled"` +} + +func (o *NotificationChannel) GetType() NotificationChannelType { + if o == nil { + return NotificationChannelType("") + } + return o.Type +} + +func (o *NotificationChannel) GetEnabled() bool { + if o == nil { + return false + } + return o.Enabled +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationchanneltype.go b/tests/mockserver/internal/sdk/models/components/notificationchanneltype.go new file mode 100644 index 00000000..ebc7ff81 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationchanneltype.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type NotificationChannelType string + +const ( + NotificationChannelTypeEmail NotificationChannelType = "EMAIL" + NotificationChannelTypeInApp NotificationChannelType = "IN_APP" +) + +func (e NotificationChannelType) ToPointer() *NotificationChannelType { + return &e +} +func (e *NotificationChannelType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "EMAIL": + fallthrough + case "IN_APP": + *e = NotificationChannelType(v) + return nil + default: + return fmt.Errorf("invalid value for NotificationChannelType: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationfilterparameters.go b/tests/mockserver/internal/sdk/models/components/notificationfilterparameters.go new file mode 100644 index 00000000..e522f2fd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationfilterparameters.go @@ -0,0 +1,51 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type NotificationFilterParameters struct { + // Filters on the given string field value by exact match inequality. + Title *StringFieldFilter `queryParam:"name=title"` + // Filters on the given string field value by exact match inequality. + Description *StringFieldFilter `queryParam:"name=description"` + // Filters on the given string field value by exact match inequality. + Namespace *StringFieldFilter `queryParam:"name=namespace"` + // Filters on the given string field value by exact match inequality. + Region *StringFieldFilter `queryParam:"name=region"` + // Filters on the given string field value by exact match inequality. + Status *StringFieldFilter `queryParam:"name=status"` +} + +func (o *NotificationFilterParameters) GetTitle() *StringFieldFilter { + if o == nil { + return nil + } + return o.Title +} + +func (o *NotificationFilterParameters) GetDescription() *StringFieldFilter { + if o == nil { + return nil + } + return o.Description +} + +func (o *NotificationFilterParameters) GetNamespace() *StringFieldFilter { + if o == nil { + return nil + } + return o.Namespace +} + +func (o *NotificationFilterParameters) GetRegion() *StringFieldFilter { + if o == nil { + return nil + } + return o.Region +} + +func (o *NotificationFilterParameters) GetStatus() *StringFieldFilter { + if o == nil { + return nil + } + return o.Status +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationlistresponse.go b/tests/mockserver/internal/sdk/models/components/notificationlistresponse.go new file mode 100644 index 00000000..e84caa04 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationlistresponse.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NotificationListResponse - A paginated list response for a collection of notifications +type NotificationListResponse struct { + Data []Notification `json:"data"` + Meta CursorMetaPage `json:"meta"` +} + +func (o *NotificationListResponse) GetData() []Notification { + if o == nil { + return []Notification{} + } + return o.Data +} + +func (o *NotificationListResponse) GetMeta() CursorMetaPage { + if o == nil { + return CursorMetaPage{} + } + return o.Meta +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationnamespace.go b/tests/mockserver/internal/sdk/models/components/notificationnamespace.go new file mode 100644 index 00000000..104d5fe7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationnamespace.go @@ -0,0 +1,43 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type NotificationNamespace string + +const ( + NotificationNamespacePlanAndUsage NotificationNamespace = "plan-and-usage" + NotificationNamespaceOrganization NotificationNamespace = "organization" + NotificationNamespaceDevPortal NotificationNamespace = "dev-portal" + NotificationNamespaceCloudGateways NotificationNamespace = "cloud-gateways" + NotificationNamespaceGatewayManager NotificationNamespace = "gateway-manager" +) + +func (e NotificationNamespace) ToPointer() *NotificationNamespace { + return &e +} +func (e *NotificationNamespace) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "plan-and-usage": + fallthrough + case "organization": + fallthrough + case "dev-portal": + fallthrough + case "cloud-gateways": + fallthrough + case "gateway-manager": + *e = NotificationNamespace(v) + return nil + default: + return fmt.Errorf("invalid value for NotificationNamespace: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationregion.go b/tests/mockserver/internal/sdk/models/components/notificationregion.go new file mode 100644 index 00000000..41a3054f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationregion.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// NotificationRegion - Region associated to a notification. +type NotificationRegion string + +const ( + NotificationRegionUs NotificationRegion = "US" + NotificationRegionEu NotificationRegion = "EU" + NotificationRegionAu NotificationRegion = "AU" + NotificationRegionMe NotificationRegion = "ME" + NotificationRegionIn NotificationRegion = "IN" + NotificationRegionWildcard NotificationRegion = "*" +) + +func (e NotificationRegion) ToPointer() *NotificationRegion { + return &e +} +func (e *NotificationRegion) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "US": + fallthrough + case "EU": + fallthrough + case "AU": + fallthrough + case "ME": + fallthrough + case "IN": + fallthrough + case "*": + *e = NotificationRegion(v) + return nil + default: + return fmt.Errorf("invalid value for NotificationRegion: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationstatus.go b/tests/mockserver/internal/sdk/models/components/notificationstatus.go new file mode 100644 index 00000000..81fac47e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationstatus.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// NotificationStatus - Status of the notification. +type NotificationStatus string + +const ( + NotificationStatusRead NotificationStatus = "READ" + NotificationStatusUnread NotificationStatus = "UNREAD" + NotificationStatusArchived NotificationStatus = "ARCHIVED" +) + +func (e NotificationStatus) ToPointer() *NotificationStatus { + return &e +} +func (e *NotificationStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "READ": + fallthrough + case "UNREAD": + fallthrough + case "ARCHIVED": + *e = NotificationStatus(v) + return nil + default: + return fmt.Errorf("invalid value for NotificationStatus: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/notificationupdatepayload.go b/tests/mockserver/internal/sdk/models/components/notificationupdatepayload.go new file mode 100644 index 00000000..f5bf1fae --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/notificationupdatepayload.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// NotificationUpdatePayload - Status of the notification. +type NotificationUpdatePayload struct { + // Status of the notification. + Status NotificationStatus `json:"status"` +} + +func (o *NotificationUpdatePayload) GetStatus() NotificationStatus { + if o == nil { + return NotificationStatus("") + } + return o.Status +} diff --git a/tests/mockserver/internal/sdk/models/components/oidcidentityproviderclaimmappings.go b/tests/mockserver/internal/sdk/models/components/oidcidentityproviderclaimmappings.go new file mode 100644 index 00000000..18163f2b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/oidcidentityproviderclaimmappings.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// OIDCIdentityProviderClaimMappings - Defines the mappings between OpenID Connect (OIDC) claims and local claims used by your application for +// authentication. +type OIDCIdentityProviderClaimMappings struct { + // The claim mapping for the user's name. + Name *string `json:"name,omitempty"` + // The claim mapping for the user's email address. + Email *string `json:"email,omitempty"` + // The claim mapping for the user's group membership information. + Groups *string `json:"groups,omitempty"` +} + +func (o *OIDCIdentityProviderClaimMappings) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *OIDCIdentityProviderClaimMappings) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *OIDCIdentityProviderClaimMappings) GetGroups() *string { + if o == nil { + return nil + } + return o.Groups +} diff --git a/tests/mockserver/internal/sdk/models/components/oidcidentityproviderconfig.go b/tests/mockserver/internal/sdk/models/components/oidcidentityproviderconfig.go new file mode 100644 index 00000000..1ba982a2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/oidcidentityproviderconfig.go @@ -0,0 +1,45 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// OIDCIdentityProviderConfig - The identity provider that contains configuration data for the OIDC authentication integration. +type OIDCIdentityProviderConfig struct { + // The issuer URI of the identity provider. This is the URL where the provider's metadata can be obtained. + IssuerURL string `json:"issuer_url"` + // The client ID assigned to your application by the identity provider. + ClientID string `json:"client_id"` + // The scopes requested by your application when authenticating with the identity provider. + Scopes []string `json:"scopes,omitempty"` + // Defines the mappings between OpenID Connect (OIDC) claims and local claims used by your application for + // authentication. + // + ClaimMappings *OIDCIdentityProviderClaimMappings `json:"claim_mappings,omitempty"` +} + +func (o *OIDCIdentityProviderConfig) GetIssuerURL() string { + if o == nil { + return "" + } + return o.IssuerURL +} + +func (o *OIDCIdentityProviderConfig) GetClientID() string { + if o == nil { + return "" + } + return o.ClientID +} + +func (o *OIDCIdentityProviderConfig) GetScopes() []string { + if o == nil { + return nil + } + return o.Scopes +} + +func (o *OIDCIdentityProviderConfig) GetClaimMappings() *OIDCIdentityProviderClaimMappings { + if o == nil { + return nil + } + return o.ClaimMappings +} diff --git a/tests/mockserver/internal/sdk/models/components/pagemeta.go b/tests/mockserver/internal/sdk/models/components/pagemeta.go new file mode 100644 index 00000000..1f2e1f2e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/pagemeta.go @@ -0,0 +1,31 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PageMeta - Contains pagination query parameters and the total number of objects returned. +type PageMeta struct { + Number float64 `json:"number"` + Size float64 `json:"size"` + Total float64 `json:"total"` +} + +func (o *PageMeta) GetNumber() float64 { + if o == nil { + return 0.0 + } + return o.Number +} + +func (o *PageMeta) GetSize() float64 { + if o == nil { + return 0.0 + } + return o.Size +} + +func (o *PageMeta) GetTotal() float64 { + if o == nil { + return 0.0 + } + return o.Total +} diff --git a/tests/mockserver/internal/sdk/models/components/paginatedmeta.go b/tests/mockserver/internal/sdk/models/components/paginatedmeta.go new file mode 100644 index 00000000..a87f73a0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/paginatedmeta.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PaginatedMeta - returns the pagination information +type PaginatedMeta struct { + // Contains pagination query parameters and the total number of objects returned. + Page PageMeta `json:"page"` +} + +func (o *PaginatedMeta) GetPage() PageMeta { + if o == nil { + return PageMeta{} + } + return o.Page +} diff --git a/tests/mockserver/internal/sdk/models/components/partial.go b/tests/mockserver/internal/sdk/models/components/partial.go new file mode 100644 index 00000000..b93fcd07 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/partial.go @@ -0,0 +1,64 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type Partial struct { + Config map[string]any `json:"config"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Tags []string `json:"tags,omitempty"` + Type string `json:"type"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *Partial) GetConfig() map[string]any { + if o == nil { + return map[string]any{} + } + return o.Config +} + +func (o *Partial) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Partial) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Partial) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *Partial) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Partial) GetType() string { + if o == nil { + return "" + } + return o.Type +} + +func (o *Partial) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/partialappauthstrategyconfigopenidconnect.go b/tests/mockserver/internal/sdk/models/components/partialappauthstrategyconfigopenidconnect.go new file mode 100644 index 00000000..47a47eab --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/partialappauthstrategyconfigopenidconnect.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" +) + +// PartialAppAuthStrategyConfigOpenIDConnect - A more advanced mode to configure an API Product Version’s Application Auth Strategy. +// Using this mode will allow developers to use API credentials issued from an external IdP that will authenticate their application requests. +// Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for the same Auth Strategy. +// An OIDC strategy may be used in conjunction with a DCR provider to automatically create the IdP application. +type PartialAppAuthStrategyConfigOpenIDConnect struct { + Issuer *string `json:"issuer,omitempty"` + CredentialClaim []string `json:"credential_claim,omitempty"` + Scopes []string `json:"scopes,omitempty"` + AuthMethods []string `json:"auth_methods,omitempty"` + AdditionalProperties map[string]any `additionalProperties:"true" json:"-"` +} + +func (p PartialAppAuthStrategyConfigOpenIDConnect) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PartialAppAuthStrategyConfigOpenIDConnect) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PartialAppAuthStrategyConfigOpenIDConnect) GetIssuer() *string { + if o == nil { + return nil + } + return o.Issuer +} + +func (o *PartialAppAuthStrategyConfigOpenIDConnect) GetCredentialClaim() []string { + if o == nil { + return nil + } + return o.CredentialClaim +} + +func (o *PartialAppAuthStrategyConfigOpenIDConnect) GetScopes() []string { + if o == nil { + return nil + } + return o.Scopes +} + +func (o *PartialAppAuthStrategyConfigOpenIDConnect) GetAuthMethods() []string { + if o == nil { + return nil + } + return o.AuthMethods +} + +func (o *PartialAppAuthStrategyConfigOpenIDConnect) GetAdditionalProperties() map[string]any { + if o == nil { + return nil + } + return o.AdditionalProperties +} diff --git a/tests/mockserver/internal/sdk/models/components/partiallink.go b/tests/mockserver/internal/sdk/models/components/partiallink.go new file mode 100644 index 00000000..73659164 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/partiallink.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type PartialLink struct { + // The plugin's unique identifier + ID string `json:"id"` + // The instance name of the plugin + InstanceName *string `json:"instance_name,omitempty"` + // The plugin's name + Name string `json:"name"` +} + +func (o *PartialLink) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *PartialLink) GetInstanceName() *string { + if o == nil { + return nil + } + return o.InstanceName +} + +func (o *PartialLink) GetName() string { + if o == nil { + return "" + } + return o.Name +} diff --git a/tests/mockserver/internal/sdk/models/components/patchnetworkrequest.go b/tests/mockserver/internal/sdk/models/components/patchnetworkrequest.go new file mode 100644 index 00000000..961578b0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/patchnetworkrequest.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PatchNetworkRequest - Request schema for updating a network. +type PatchNetworkRequest struct { + // Human-readable name of the network. + Name *string `json:"name,omitempty"` +} + +func (o *PatchNetworkRequest) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/tests/mockserver/internal/sdk/models/components/patchteamgroupmappings.go b/tests/mockserver/internal/sdk/models/components/patchteamgroupmappings.go new file mode 100644 index 00000000..545da3bd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/patchteamgroupmappings.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type DataRequestBody struct { + TeamID *string `json:"team_id,omitempty"` + Groups []string `json:"groups,omitempty"` +} + +func (o *DataRequestBody) GetTeamID() *string { + if o == nil { + return nil + } + return o.TeamID +} + +func (o *DataRequestBody) GetGroups() []string { + if o == nil { + return nil + } + return o.Groups +} + +// PatchTeamGroupMappings - The request schema for a partial update of mappings from Konnect Teams to IdP Groups. +type PatchTeamGroupMappings struct { + // The IdP groups to map to the given team. + Data []DataRequestBody `json:"data,omitempty"` +} + +func (o *PatchTeamGroupMappings) GetData() []DataRequestBody { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/plugin.go b/tests/mockserver/internal/sdk/models/components/plugin.go new file mode 100644 index 00000000..8de0b93c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/plugin.go @@ -0,0 +1,307 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PluginConsumer - If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer. +type PluginConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type PluginConsumerGroup struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginConsumerGroup) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type PluginAfter struct { + Access []string `json:"access,omitempty"` +} + +func (o *PluginAfter) GetAccess() []string { + if o == nil { + return nil + } + return o.Access +} + +type PluginBefore struct { + Access []string `json:"access,omitempty"` +} + +func (o *PluginBefore) GetAccess() []string { + if o == nil { + return nil + } + return o.Access +} + +type PluginOrdering struct { + After *PluginAfter `json:"after,omitempty"` + Before *PluginBefore `json:"before,omitempty"` +} + +func (o *PluginOrdering) GetAfter() *PluginAfter { + if o == nil { + return nil + } + return o.After +} + +func (o *PluginOrdering) GetBefore() *PluginBefore { + if o == nil { + return nil + } + return o.Before +} + +type PluginPartial struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` +} + +func (o *PluginPartial) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *PluginPartial) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *PluginPartial) GetPath() *string { + if o == nil { + return nil + } + return o.Path +} + +type PluginProtocol string + +const ( + PluginProtocolGrpc PluginProtocol = "grpc" + PluginProtocolGrpcs PluginProtocol = "grpcs" + PluginProtocolHTTP PluginProtocol = "http" + PluginProtocolHTTPS PluginProtocol = "https" + PluginProtocolTCP PluginProtocol = "tcp" + PluginProtocolTLS PluginProtocol = "tls" + PluginProtocolTLSPassthrough PluginProtocol = "tls_passthrough" + PluginProtocolUDP PluginProtocol = "udp" + PluginProtocolWs PluginProtocol = "ws" + PluginProtocolWss PluginProtocol = "wss" +) + +func (e PluginProtocol) ToPointer() *PluginProtocol { + return &e +} +func (e *PluginProtocol) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "grpc": + fallthrough + case "grpcs": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "tcp": + fallthrough + case "tls": + fallthrough + case "tls_passthrough": + fallthrough + case "udp": + fallthrough + case "ws": + fallthrough + case "wss": + *e = PluginProtocol(v) + return nil + default: + return fmt.Errorf("invalid value for PluginProtocol: %v", v) + } +} + +// PluginRoute - If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used. +type PluginRoute struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginRoute) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// PluginService - If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched. +type PluginService struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginService) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// A Plugin entity represents a plugin configuration that will be executed during the HTTP request/response lifecycle. It is how you can add functionalities to Services that run behind Kong, like Authentication or Rate Limiting for example. You can find more information about how to install and what values each plugin takes by visiting the [Kong Hub](https://docs.konghq.com/hub/). When adding a Plugin Configuration to a Service, every request made by a client to that Service will run said Plugin. If a Plugin needs to be tuned to different values for some specific Consumers, you can do so by creating a separate plugin instance that specifies both the Service and the Consumer, through the `service` and `consumer` fields. +type Plugin struct { + // The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/). + Config map[string]any `json:"config,omitempty"` + // If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer. + Consumer *PluginConsumer `json:"consumer,omitempty"` + ConsumerGroup *PluginConsumerGroup `json:"consumer_group,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Whether the plugin is applied. + Enabled *bool `json:"enabled,omitempty"` + ID *string `json:"id,omitempty"` + InstanceName *string `json:"instance_name,omitempty"` + // The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately. + Name string `json:"name"` + Ordering *PluginOrdering `json:"ordering,omitempty"` + Partials []PluginPartial `json:"partials,omitempty"` + // A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`. + Protocols []PluginProtocol `json:"protocols,omitempty"` + // If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used. + Route *PluginRoute `json:"route,omitempty"` + // If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched. + Service *PluginService `json:"service,omitempty"` + // An optional set of strings associated with the Plugin for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *Plugin) GetConfig() map[string]any { + if o == nil { + return nil + } + return o.Config +} + +func (o *Plugin) GetConsumer() *PluginConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *Plugin) GetConsumerGroup() *PluginConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroup +} + +func (o *Plugin) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Plugin) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *Plugin) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Plugin) GetInstanceName() *string { + if o == nil { + return nil + } + return o.InstanceName +} + +func (o *Plugin) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *Plugin) GetOrdering() *PluginOrdering { + if o == nil { + return nil + } + return o.Ordering +} + +func (o *Plugin) GetPartials() []PluginPartial { + if o == nil { + return nil + } + return o.Partials +} + +func (o *Plugin) GetProtocols() []PluginProtocol { + if o == nil { + return nil + } + return o.Protocols +} + +func (o *Plugin) GetRoute() *PluginRoute { + if o == nil { + return nil + } + return o.Route +} + +func (o *Plugin) GetService() *PluginService { + if o == nil { + return nil + } + return o.Service +} + +func (o *Plugin) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Plugin) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/pluginschemas.go b/tests/mockserver/internal/sdk/models/components/pluginschemas.go new file mode 100644 index 00000000..7a6f6c11 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/pluginschemas.go @@ -0,0 +1,54 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type PluginSchemasItem struct { + // The custom plugin schema; `jq -Rs '.' schema.lua`. + LuaSchema *string `json:"lua_schema,omitempty"` + // The custom plugin name determined by the custom plugin schema. + Name *string `json:"name,omitempty"` + // An ISO-8604 timestamp representation of custom plugin schema creation date. + CreatedAt *int64 `json:"created_at,omitempty"` + // An ISO-8604 timestamp representation of custom plugin schema update date. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *PluginSchemasItem) GetLuaSchema() *string { + if o == nil { + return nil + } + return o.LuaSchema +} + +func (o *PluginSchemasItem) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *PluginSchemasItem) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *PluginSchemasItem) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +// PluginSchemas - A response for a single custom plugin schema. +type PluginSchemas struct { + Item *PluginSchemasItem `json:"item,omitempty"` +} + +func (o *PluginSchemas) GetItem() *PluginSchemasItem { + if o == nil { + return nil + } + return o.Item +} diff --git a/tests/mockserver/internal/sdk/models/components/pluginwithoutparents.go b/tests/mockserver/internal/sdk/models/components/pluginwithoutparents.go new file mode 100644 index 00000000..a4ae7fee --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/pluginwithoutparents.go @@ -0,0 +1,307 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PluginWithoutParentsConsumer - If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer. +type PluginWithoutParentsConsumer struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginWithoutParentsConsumer) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type PluginWithoutParentsConsumerGroup struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginWithoutParentsConsumerGroup) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type PluginWithoutParentsAfter struct { + Access []string `json:"access,omitempty"` +} + +func (o *PluginWithoutParentsAfter) GetAccess() []string { + if o == nil { + return nil + } + return o.Access +} + +type PluginWithoutParentsBefore struct { + Access []string `json:"access,omitempty"` +} + +func (o *PluginWithoutParentsBefore) GetAccess() []string { + if o == nil { + return nil + } + return o.Access +} + +type PluginWithoutParentsOrdering struct { + After *PluginWithoutParentsAfter `json:"after,omitempty"` + Before *PluginWithoutParentsBefore `json:"before,omitempty"` +} + +func (o *PluginWithoutParentsOrdering) GetAfter() *PluginWithoutParentsAfter { + if o == nil { + return nil + } + return o.After +} + +func (o *PluginWithoutParentsOrdering) GetBefore() *PluginWithoutParentsBefore { + if o == nil { + return nil + } + return o.Before +} + +type PluginWithoutParentsPartial struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` +} + +func (o *PluginWithoutParentsPartial) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *PluginWithoutParentsPartial) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *PluginWithoutParentsPartial) GetPath() *string { + if o == nil { + return nil + } + return o.Path +} + +type PluginWithoutParentsProtocol string + +const ( + PluginWithoutParentsProtocolGrpc PluginWithoutParentsProtocol = "grpc" + PluginWithoutParentsProtocolGrpcs PluginWithoutParentsProtocol = "grpcs" + PluginWithoutParentsProtocolHTTP PluginWithoutParentsProtocol = "http" + PluginWithoutParentsProtocolHTTPS PluginWithoutParentsProtocol = "https" + PluginWithoutParentsProtocolTCP PluginWithoutParentsProtocol = "tcp" + PluginWithoutParentsProtocolTLS PluginWithoutParentsProtocol = "tls" + PluginWithoutParentsProtocolTLSPassthrough PluginWithoutParentsProtocol = "tls_passthrough" + PluginWithoutParentsProtocolUDP PluginWithoutParentsProtocol = "udp" + PluginWithoutParentsProtocolWs PluginWithoutParentsProtocol = "ws" + PluginWithoutParentsProtocolWss PluginWithoutParentsProtocol = "wss" +) + +func (e PluginWithoutParentsProtocol) ToPointer() *PluginWithoutParentsProtocol { + return &e +} +func (e *PluginWithoutParentsProtocol) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "grpc": + fallthrough + case "grpcs": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "tcp": + fallthrough + case "tls": + fallthrough + case "tls_passthrough": + fallthrough + case "udp": + fallthrough + case "ws": + fallthrough + case "wss": + *e = PluginWithoutParentsProtocol(v) + return nil + default: + return fmt.Errorf("invalid value for PluginWithoutParentsProtocol: %v", v) + } +} + +// PluginWithoutParentsRoute - If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used. +type PluginWithoutParentsRoute struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginWithoutParentsRoute) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// PluginWithoutParentsService - If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched. +type PluginWithoutParentsService struct { + ID *string `json:"id,omitempty"` +} + +func (o *PluginWithoutParentsService) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// PluginWithoutParents - A Plugin entity represents a plugin configuration that will be executed during the HTTP request/response lifecycle. It is how you can add functionalities to Services that run behind Kong, like Authentication or Rate Limiting for example. You can find more information about how to install and what values each plugin takes by visiting the [Kong Hub](https://docs.konghq.com/hub/). When adding a Plugin Configuration to a Service, every request made by a client to that Service will run said Plugin. If a Plugin needs to be tuned to different values for some specific Consumers, you can do so by creating a separate plugin instance that specifies both the Service and the Consumer, through the `service` and `consumer` fields. +type PluginWithoutParents struct { + // The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/). + Config map[string]any `json:"config,omitempty"` + // If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer. + Consumer *PluginWithoutParentsConsumer `json:"consumer,omitempty"` + ConsumerGroup *PluginWithoutParentsConsumerGroup `json:"consumer_group,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Whether the plugin is applied. + Enabled *bool `json:"enabled,omitempty"` + ID *string `json:"id,omitempty"` + InstanceName *string `json:"instance_name,omitempty"` + // The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately. + Name string `json:"name"` + Ordering *PluginWithoutParentsOrdering `json:"ordering,omitempty"` + Partials []PluginWithoutParentsPartial `json:"partials,omitempty"` + // A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`. + Protocols []PluginWithoutParentsProtocol `json:"protocols,omitempty"` + // If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the Route being used. + Route *PluginWithoutParentsRoute `json:"route,omitempty"` + // If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched. + Service *PluginWithoutParentsService `json:"service,omitempty"` + // An optional set of strings associated with the Plugin for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *PluginWithoutParents) GetConfig() map[string]any { + if o == nil { + return nil + } + return o.Config +} + +func (o *PluginWithoutParents) GetConsumer() *PluginWithoutParentsConsumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *PluginWithoutParents) GetConsumerGroup() *PluginWithoutParentsConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroup +} + +func (o *PluginWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *PluginWithoutParents) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *PluginWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *PluginWithoutParents) GetInstanceName() *string { + if o == nil { + return nil + } + return o.InstanceName +} + +func (o *PluginWithoutParents) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *PluginWithoutParents) GetOrdering() *PluginWithoutParentsOrdering { + if o == nil { + return nil + } + return o.Ordering +} + +func (o *PluginWithoutParents) GetPartials() []PluginWithoutParentsPartial { + if o == nil { + return nil + } + return o.Partials +} + +func (o *PluginWithoutParents) GetProtocols() []PluginWithoutParentsProtocol { + if o == nil { + return nil + } + return o.Protocols +} + +func (o *PluginWithoutParents) GetRoute() *PluginWithoutParentsRoute { + if o == nil { + return nil + } + return o.Route +} + +func (o *PluginWithoutParents) GetService() *PluginWithoutParentsService { + if o == nil { + return nil + } + return o.Service +} + +func (o *PluginWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *PluginWithoutParents) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/provider.go b/tests/mockserver/internal/sdk/models/components/provider.go new file mode 100644 index 00000000..bcff0fac --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/provider.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// Provider - Description of cloud provider that runs cloud gateway instances. +type Provider struct { + // Name of cloud provider. + Provider ProviderName `json:"provider"` + // List of available regions to run cloud gateway instances on for a given cloud provider. + Regions []ProviderRegion `json:"regions"` +} + +func (o *Provider) GetProvider() ProviderName { + if o == nil { + return ProviderName("") + } + return o.Provider +} + +func (o *Provider) GetRegions() []ProviderRegion { + if o == nil { + return []ProviderRegion{} + } + return o.Regions +} diff --git a/tests/mockserver/internal/sdk/models/components/provideraccount.go b/tests/mockserver/internal/sdk/models/components/provideraccount.go new file mode 100644 index 00000000..7a097b8d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/provideraccount.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// ProviderAccount - Object containing mapping for organization and cloud provider to account ID. +type ProviderAccount struct { + ID string `json:"id"` + // Name of cloud provider. + Provider ProviderName `json:"provider"` + // ID of the cloud provider account. + ProviderAccountID string `json:"provider_account_id"` + // An RFC-3339 timestamp representation of provider account creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of provider account update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (p ProviderAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *ProviderAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ProviderAccount) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *ProviderAccount) GetProvider() ProviderName { + if o == nil { + return ProviderName("") + } + return o.Provider +} + +func (o *ProviderAccount) GetProviderAccountID() string { + if o == nil { + return "" + } + return o.ProviderAccountID +} + +func (o *ProviderAccount) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *ProviderAccount) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/provideraccountsfilterparameters.go b/tests/mockserver/internal/sdk/models/components/provideraccountsfilterparameters.go new file mode 100644 index 00000000..17ba5da7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/provideraccountsfilterparameters.go @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ProviderAccountsFilterParameters struct { + Provider *CloudGatewaysStringFieldFilterOverride `queryParam:"name=provider"` +} + +func (o *ProviderAccountsFilterParameters) GetProvider() *CloudGatewaysStringFieldFilterOverride { + if o == nil { + return nil + } + return o.Provider +} diff --git a/tests/mockserver/internal/sdk/models/components/providername.go b/tests/mockserver/internal/sdk/models/components/providername.go new file mode 100644 index 00000000..06698147 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/providername.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ProviderName - Name of cloud provider. +type ProviderName string + +const ( + ProviderNameAws ProviderName = "aws" + ProviderNameAzure ProviderName = "azure" +) + +func (e ProviderName) ToPointer() *ProviderName { + return &e +} +func (e *ProviderName) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "aws": + fallthrough + case "azure": + *e = ProviderName(v) + return nil + default: + return fmt.Errorf("invalid value for ProviderName: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/providerregion.go b/tests/mockserver/internal/sdk/models/components/providerregion.go new file mode 100644 index 00000000..52b0474d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/providerregion.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ProviderRegion - Region ID and human-readable name for a cloud provider region. +type ProviderRegion struct { + // Region ID for cloud provider region. + Region string `json:"region"` + // Human-readable name for cloud provider region. The list of available provider regions can be retrieved via the + // availability endpoint `/v2/cloud-gateways/availability.json`. + // + Name string `json:"name"` + // List of supported availability zones for cloud provider region, for network AZ configuration. + // + AvailabilityZones []string `json:"availability_zones"` + // List of supported CIDR blocks for cloud provider region, for network CIDR block configuration. + // + CidrBlocks []string `json:"cidr_blocks"` + // List of reserved CIDR blocks for cloud provider region, to restrict allowed network CIDR block + // configuration. + // + ReservedCidrBlocks []string `json:"reserved_cidr_blocks"` +} + +func (o *ProviderRegion) GetRegion() string { + if o == nil { + return "" + } + return o.Region +} + +func (o *ProviderRegion) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ProviderRegion) GetAvailabilityZones() []string { + if o == nil { + return []string{} + } + return o.AvailabilityZones +} + +func (o *ProviderRegion) GetCidrBlocks() []string { + if o == nil { + return []string{} + } + return o.CidrBlocks +} + +func (o *ProviderRegion) GetReservedCidrBlocks() []string { + if o == nil { + return []string{} + } + return o.ReservedCidrBlocks +} diff --git a/tests/mockserver/internal/sdk/models/components/proxyurl.go b/tests/mockserver/internal/sdk/models/components/proxyurl.go new file mode 100644 index 00000000..6eee64a8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/proxyurl.go @@ -0,0 +1,34 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ProxyURL - Proxy URL associated with reaching the data-planes connected to a control-plane. +type ProxyURL struct { + // Hostname of the proxy URL. + Host string `json:"host"` + // Port of the proxy URL. + Port int64 `json:"port"` + // Protocol of the proxy URL. + Protocol string `json:"protocol"` +} + +func (o *ProxyURL) GetHost() string { + if o == nil { + return "" + } + return o.Host +} + +func (o *ProxyURL) GetPort() int64 { + if o == nil { + return 0 + } + return o.Port +} + +func (o *ProxyURL) GetProtocol() string { + if o == nil { + return "" + } + return o.Protocol +} diff --git a/tests/mockserver/internal/sdk/models/components/resourceconfiguration.go b/tests/mockserver/internal/sdk/models/components/resourceconfiguration.go new file mode 100644 index 00000000..80d1c37f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/resourceconfiguration.go @@ -0,0 +1,33 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// ResourceConfiguration - Object containing information about a resource configuration. +type ResourceConfiguration struct { + ID string `json:"id"` + // Enumeration of configuration qualifiers available for organization-wide configuration. + Qualifier ResourceConfigurationQualifier `json:"qualifier"` + // The value of this resource configuration. + Value int64 `json:"value"` +} + +func (o *ResourceConfiguration) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *ResourceConfiguration) GetQualifier() ResourceConfigurationQualifier { + if o == nil { + return ResourceConfigurationQualifier("") + } + return o.Qualifier +} + +func (o *ResourceConfiguration) GetValue() int64 { + if o == nil { + return 0 + } + return o.Value +} diff --git a/tests/mockserver/internal/sdk/models/components/resourceconfigurationqualifier.go b/tests/mockserver/internal/sdk/models/components/resourceconfigurationqualifier.go new file mode 100644 index 00000000..31a71be1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/resourceconfigurationqualifier.go @@ -0,0 +1,32 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ResourceConfigurationQualifier - Enumeration of configuration qualifiers available for organization-wide configuration. +type ResourceConfigurationQualifier string + +const ( + ResourceConfigurationQualifierDataPlaneGroupIdleTimeoutMinutes ResourceConfigurationQualifier = "data-plane-group-idle-timeout-minutes" +) + +func (e ResourceConfigurationQualifier) ToPointer() *ResourceConfigurationQualifier { + return &e +} +func (e *ResourceConfigurationQualifier) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "data-plane-group-idle-timeout-minutes": + *e = ResourceConfigurationQualifier(v) + return nil + default: + return fmt.Errorf("invalid value for ResourceConfigurationQualifier: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/resourcequota.go b/tests/mockserver/internal/sdk/models/components/resourcequota.go new file mode 100644 index 00000000..1319531f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/resourcequota.go @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// ResourceQuota - Object containing information about a resource quota for an organization. +type ResourceQuota struct { + ID string `json:"id"` + // Enumeration of resources available for quota enforcement. + Resource ResourceQuotaQualifier `json:"resource"` + // The human-readable name of this resource quota. + Name string `json:"name"` + // A more verbose description of what this resource quota enforces. + Description string `json:"description"` + // The aggregate non-negative integer count of this resource that's allowed for the organization. + // + Value int64 `json:"value"` + // An RFC-3339 timestamp representation of resource quota creation date. + CreatedAt time.Time `json:"created_at"` + // An RFC-3339 timestamp representation of resource quota update date. + UpdatedAt time.Time `json:"updated_at"` +} + +func (r ResourceQuota) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(r, "", false) +} + +func (r *ResourceQuota) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &r, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ResourceQuota) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *ResourceQuota) GetResource() ResourceQuotaQualifier { + if o == nil { + return ResourceQuotaQualifier("") + } + return o.Resource +} + +func (o *ResourceQuota) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ResourceQuota) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *ResourceQuota) GetValue() int64 { + if o == nil { + return 0 + } + return o.Value +} + +func (o *ResourceQuota) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *ResourceQuota) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/resourcequotaqualifier.go b/tests/mockserver/internal/sdk/models/components/resourcequotaqualifier.go new file mode 100644 index 00000000..ad0160b8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/resourcequotaqualifier.go @@ -0,0 +1,41 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ResourceQuotaQualifier - Enumeration of resources available for quota enforcement. +type ResourceQuotaQualifier string + +const ( + ResourceQuotaQualifierCountProviderAccountsPerProvider ResourceQuotaQualifier = "count/provider-accounts.per-provider" + ResourceQuotaQualifierCountNetworksNotOffline ResourceQuotaQualifier = "count/networks.not-offline" + ResourceQuotaQualifierCountDataPlanesEstimate ResourceQuotaQualifier = "count/data-planes-estimate" + ResourceQuotaQualifierCountServerlessDataPlanesEstimate ResourceQuotaQualifier = "count/serverless-data-planes-estimate" +) + +func (e ResourceQuotaQualifier) ToPointer() *ResourceQuotaQualifier { + return &e +} +func (e *ResourceQuotaQualifier) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "count/provider-accounts.per-provider": + fallthrough + case "count/networks.not-offline": + fallthrough + case "count/data-planes-estimate": + fallthrough + case "count/serverless-data-planes-estimate": + *e = ResourceQuotaQualifier(v) + return nil + default: + return fmt.Errorf("invalid value for ResourceQuotaQualifier: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/roles.go b/tests/mockserver/internal/sdk/models/components/roles.go new file mode 100644 index 00000000..120d101f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/roles.go @@ -0,0 +1,2102 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type NameControlPlanes string + +const ( + NameControlPlanesControlPlanes NameControlPlanes = "Control Planes" +) + +func (e NameControlPlanes) ToPointer() *NameControlPlanes { + return &e +} +func (e *NameControlPlanes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Control Planes": + *e = NameControlPlanes(v) + return nil + default: + return fmt.Errorf("invalid value for NameControlPlanes: %v", v) + } +} + +type NameControlPlanesAdmin string + +const ( + NameControlPlanesAdminAdmin NameControlPlanesAdmin = "Admin" +) + +func (e NameControlPlanesAdmin) ToPointer() *NameControlPlanesAdmin { + return &e +} +func (e *NameControlPlanesAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Admin": + *e = NameControlPlanesAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameControlPlanesAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlaneThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane = "This role grants full write access to all entities within a control plane." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to all entities within a control plane.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane: %v", v) + } +} + +type AdminThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane struct { + Name NameControlPlanesAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane `json:"description"` +} + +func (o *AdminThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane) GetName() NameControlPlanesAdmin { + if o == nil { + return NameControlPlanesAdmin("") + } + return o.Name +} + +func (o *AdminThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane("") + } + return o.Description +} + +type NameCertificateAdmin string + +const ( + NameCertificateAdminCertificateAdmin NameCertificateAdmin = "Certificate Admin" +) + +func (e NameCertificateAdmin) ToPointer() *NameCertificateAdmin { + return &e +} +func (e *NameCertificateAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Certificate Admin": + *e = NameCertificateAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameCertificateAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificatesThisRoleGrantsFullWriteAccessToAdministerCertificates DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates = "This role grants full write access to administer certificates." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer certificates.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates: %v", v) + } +} + +type CertificateAdmin struct { + Name NameCertificateAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates `json:"description"` +} + +func (o *CertificateAdmin) GetName() NameCertificateAdmin { + if o == nil { + return NameCertificateAdmin("") + } + return o.Name +} + +func (o *CertificateAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerCertificates("") + } + return o.Description +} + +type NameConsumerAdmin string + +const ( + NameConsumerAdminConsumerAdmin NameConsumerAdmin = "Consumer Admin" +) + +func (e NameConsumerAdmin) ToPointer() *NameConsumerAdmin { + return &e +} +func (e *NameConsumerAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Consumer Admin": + *e = NameConsumerAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameConsumerAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumersThisRoleGrantsFullWriteAccessToAdministerConsumers DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers = "This role grants full write access to administer consumers." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer consumers.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers: %v", v) + } +} + +type ConsumerAdmin struct { + Name NameConsumerAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers `json:"description"` +} + +func (o *ConsumerAdmin) GetName() NameConsumerAdmin { + if o == nil { + return NameConsumerAdmin("") + } + return o.Name +} + +func (o *ConsumerAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerConsumers("") + } + return o.Description +} + +type NameControlPlanesCreator string + +const ( + NameControlPlanesCreatorCreator NameControlPlanesCreator = "Creator" +) + +func (e NameControlPlanesCreator) ToPointer() *NameControlPlanesCreator { + return &e +} +func (e *NameControlPlanesCreator) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Creator": + *e = NameControlPlanesCreator(v) + return nil + default: + return fmt.Errorf("invalid value for NameControlPlanesCreator: %v", v) + } +} + +type DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate string + +const ( + DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreateCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate = "Creates a new Control Plane in an organization. The creator becomes the owner of the Control Plane they create." +) + +func (e DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate) ToPointer() *DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate { + return &e +} +func (e *DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Creates a new Control Plane in an organization. The creator becomes the owner of the Control Plane they create.": + *e = DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate: %v", v) + } +} + +type CreatorCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate struct { + Name NameControlPlanesCreator `json:"name"` + Description DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate `json:"description"` +} + +func (o *CreatorCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate) GetName() NameControlPlanesCreator { + if o == nil { + return NameControlPlanesCreator("") + } + return o.Name +} + +func (o *CreatorCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate) GetDescription() DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate { + if o == nil { + return DescriptionCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate("") + } + return o.Description +} + +type NameControlPlanesDeployer string + +const ( + NameControlPlanesDeployerDeployer NameControlPlanesDeployer = "Deployer" +) + +func (e NameControlPlanesDeployer) ToPointer() *NameControlPlanesDeployer { + return &e +} +func (e *NameControlPlanesDeployer) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Deployer": + *e = NameControlPlanesDeployer(v) + return nil + default: + return fmt.Errorf("invalid value for NameControlPlanesDeployer: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHubThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub = "This role grants full write access to administer services, routes and plugins necessary to deploy services in Service Hub." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer services, routes and plugins necessary to deploy services in Service Hub.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub: %v", v) + } +} + +type DeployerThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub struct { + Name NameControlPlanesDeployer `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub `json:"description"` +} + +func (o *DeployerThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub) GetName() NameControlPlanesDeployer { + if o == nil { + return NameControlPlanesDeployer("") + } + return o.Name +} + +func (o *DeployerThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub("") + } + return o.Description +} + +type NameGatewayServiceAdmin string + +const ( + NameGatewayServiceAdminGatewayServiceAdmin NameGatewayServiceAdmin = "Gateway Service Admin" +) + +func (e NameGatewayServiceAdmin) ToPointer() *NameGatewayServiceAdmin { + return &e +} +func (e *NameGatewayServiceAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Gateway Service Admin": + *e = NameGatewayServiceAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameGatewayServiceAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServicesThisRoleGrantsFullWriteAccessToAdministerGatewayServices DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices = "This role grants full write access to administer gateway services." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer gateway services.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices: %v", v) + } +} + +type GatewayServiceAdmin struct { + Name NameGatewayServiceAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices `json:"description"` +} + +func (o *GatewayServiceAdmin) GetName() NameGatewayServiceAdmin { + if o == nil { + return NameGatewayServiceAdmin("") + } + return o.Name +} + +func (o *GatewayServiceAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerGatewayServices("") + } + return o.Description +} + +type NamePluginAdmin string + +const ( + NamePluginAdminPluginAdmin NamePluginAdmin = "Plugin Admin" +) + +func (e NamePluginAdmin) ToPointer() *NamePluginAdmin { + return &e +} +func (e *NamePluginAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Plugin Admin": + *e = NamePluginAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NamePluginAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerPluginsThisRoleGrantsFullWriteAccessToAdministerPlugins DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins = "This role grants full write access to administer plugins." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer plugins.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins: %v", v) + } +} + +type PluginAdmin struct { + Name NamePluginAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins `json:"description"` +} + +func (o *PluginAdmin) GetName() NamePluginAdmin { + if o == nil { + return NamePluginAdmin("") + } + return o.Name +} + +func (o *PluginAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerPlugins("") + } + return o.Description +} + +type NameRouteAdmin string + +const ( + NameRouteAdminRouteAdmin NameRouteAdmin = "Route Admin" +) + +func (e NameRouteAdmin) ToPointer() *NameRouteAdmin { + return &e +} +func (e *NameRouteAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Route Admin": + *e = NameRouteAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameRouteAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutesThisRoleGrantsFullWriteAccessToAdministerRoutes DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes = "This role grants full write access to administer routes." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer routes.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes: %v", v) + } +} + +type RouteAdmin struct { + Name NameRouteAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes `json:"description"` +} + +func (o *RouteAdmin) GetName() NameRouteAdmin { + if o == nil { + return NameRouteAdmin("") + } + return o.Name +} + +func (o *RouteAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerRoutes("") + } + return o.Description +} + +type NameSniAdmin string + +const ( + NameSniAdminSniAdmin NameSniAdmin = "SNI Admin" +) + +func (e NameSniAdmin) ToPointer() *NameSniAdmin { + return &e +} +func (e *NameSniAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "SNI Admin": + *e = NameSniAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameSniAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIsThisRoleGrantsFullWriteAccessToAdministerSnIs DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs = "This role grants full write access to administer SNIs." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer SNIs.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs: %v", v) + } +} + +type SniAdmin struct { + Name NameSniAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs `json:"description"` +} + +func (o *SniAdmin) GetName() NameSniAdmin { + if o == nil { + return NameSniAdmin("") + } + return o.Name +} + +func (o *SniAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerSnIs("") + } + return o.Description +} + +type NameUpstreamAdmin string + +const ( + NameUpstreamAdminUpstreamAdmin NameUpstreamAdmin = "Upstream Admin" +) + +func (e NameUpstreamAdmin) ToPointer() *NameUpstreamAdmin { + return &e +} +func (e *NameUpstreamAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Upstream Admin": + *e = NameUpstreamAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameUpstreamAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreamsThisRoleGrantsFullWriteAccessToAdministerUpstreams DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams = "This role grants full write access to administer upstreams." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to administer upstreams.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams: %v", v) + } +} + +type UpstreamAdmin struct { + Name NameUpstreamAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams `json:"description"` +} + +func (o *UpstreamAdmin) GetName() NameUpstreamAdmin { + if o == nil { + return NameUpstreamAdmin("") + } + return o.Name +} + +func (o *UpstreamAdmin) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAdministerUpstreams("") + } + return o.Description +} + +type NameControlPlanesViewer string + +const ( + NameControlPlanesViewerViewer NameControlPlanesViewer = "Viewer" +) + +func (e NameControlPlanesViewer) ToPointer() *NameControlPlanesViewer { + return &e +} +func (e *NameControlPlanesViewer) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Viewer": + *e = NameControlPlanesViewer(v) + return nil + default: + return fmt.Errorf("invalid value for NameControlPlanesViewer: %v", v) + } +} + +type DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane string + +const ( + DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlaneThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane = "This role grants read only access to all entities within a control plane." +) + +func (e DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane) ToPointer() *DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane { + return &e +} +func (e *DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants read only access to all entities within a control plane.": + *e = DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane: %v", v) + } +} + +type ViewerThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane struct { + Name NameControlPlanesViewer `json:"name"` + Description DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane `json:"description"` +} + +func (o *ViewerThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane) GetName() NameControlPlanesViewer { + if o == nil { + return NameControlPlanesViewer("") + } + return o.Name +} + +func (o *ViewerThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane) GetDescription() DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane { + if o == nil { + return DescriptionThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane("") + } + return o.Description +} + +type RolesControlPlanes struct { + Admin *AdminThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane `json:"admin,omitempty"` + CertificateAdmin *CertificateAdmin `json:"certificate_admin,omitempty"` + ConsumerAdmin *ConsumerAdmin `json:"consumer_admin,omitempty"` + Creator *CreatorCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate `json:"creator,omitempty"` + Deployer *DeployerThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub `json:"deployer,omitempty"` + GatewayServiceAdmin *GatewayServiceAdmin `json:"gateway_service_admin,omitempty"` + PluginAdmin *PluginAdmin `json:"plugin_admin,omitempty"` + RouteAdmin *RouteAdmin `json:"route_admin,omitempty"` + SniAdmin *SniAdmin `json:"sni_admin,omitempty"` + UpstreamAdmin *UpstreamAdmin `json:"upstream_admin,omitempty"` + Viewer *ViewerThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane `json:"viewer,omitempty"` +} + +func (o *RolesControlPlanes) GetAdmin() *AdminThisRoleGrantsFullWriteAccessToAllEntitiesWithinAControlPlane { + if o == nil { + return nil + } + return o.Admin +} + +func (o *RolesControlPlanes) GetCertificateAdmin() *CertificateAdmin { + if o == nil { + return nil + } + return o.CertificateAdmin +} + +func (o *RolesControlPlanes) GetConsumerAdmin() *ConsumerAdmin { + if o == nil { + return nil + } + return o.ConsumerAdmin +} + +func (o *RolesControlPlanes) GetCreator() *CreatorCreatesANewControlPlaneInAnOrganizationTheCreatorBecomesTheOwnerOfTheControlPlaneTheyCreate { + if o == nil { + return nil + } + return o.Creator +} + +func (o *RolesControlPlanes) GetDeployer() *DeployerThisRoleGrantsFullWriteAccessToAdministerServicesRoutesAndPluginsNecessaryToDeployServicesInServiceHub { + if o == nil { + return nil + } + return o.Deployer +} + +func (o *RolesControlPlanes) GetGatewayServiceAdmin() *GatewayServiceAdmin { + if o == nil { + return nil + } + return o.GatewayServiceAdmin +} + +func (o *RolesControlPlanes) GetPluginAdmin() *PluginAdmin { + if o == nil { + return nil + } + return o.PluginAdmin +} + +func (o *RolesControlPlanes) GetRouteAdmin() *RouteAdmin { + if o == nil { + return nil + } + return o.RouteAdmin +} + +func (o *RolesControlPlanes) GetSniAdmin() *SniAdmin { + if o == nil { + return nil + } + return o.SniAdmin +} + +func (o *RolesControlPlanes) GetUpstreamAdmin() *UpstreamAdmin { + if o == nil { + return nil + } + return o.UpstreamAdmin +} + +func (o *RolesControlPlanes) GetViewer() *ViewerThisRoleGrantsReadOnlyAccessToAllEntitiesWithinAControlPlane { + if o == nil { + return nil + } + return o.Viewer +} + +type ControlPlanes struct { + Name NameControlPlanes `json:"name"` + Roles RolesControlPlanes `json:"roles"` +} + +func (o *ControlPlanes) GetName() NameControlPlanes { + if o == nil { + return NameControlPlanes("") + } + return o.Name +} + +func (o *ControlPlanes) GetRoles() RolesControlPlanes { + if o == nil { + return RolesControlPlanes{} + } + return o.Roles +} + +type NameAPIProducts string + +const ( + NameAPIProductsAPIProducts NameAPIProducts = "API Products" +) + +func (e NameAPIProducts) ToPointer() *NameAPIProducts { + return &e +} +func (e *NameAPIProducts) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "API Products": + *e = NameAPIProducts(v) + return nil + default: + return fmt.Errorf("invalid value for NameAPIProducts: %v", v) + } +} + +type NameAPIProductsAdmin string + +const ( + NameAPIProductsAdminAdmin NameAPIProductsAdmin = "Admin" +) + +func (e NameAPIProductsAdmin) ToPointer() *NameAPIProductsAdmin { + return &e +} +func (e *NameAPIProductsAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Admin": + *e = NameAPIProductsAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameAPIProductsAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersionsThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions = "This role grants full write access to an API product and its versions." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to an API product and its versions.": + *e = DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions: %v", v) + } +} + +type AdminThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions struct { + Name NameAPIProductsAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions `json:"description"` +} + +func (o *AdminThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions) GetName() NameAPIProductsAdmin { + if o == nil { + return NameAPIProductsAdmin("") + } + return o.Name +} + +func (o *AdminThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions("") + } + return o.Description +} + +type NameApplicationRegistration string + +const ( + NameApplicationRegistrationApplicationRegistration NameApplicationRegistration = "Application Registration" +) + +func (e NameApplicationRegistration) ToPointer() *NameApplicationRegistration { + return &e +} +func (e *NameApplicationRegistration) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Application Registration": + *e = NameApplicationRegistration(v) + return nil + default: + return fmt.Errorf("invalid value for NameApplicationRegistration: %v", v) + } +} + +type DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct string + +const ( + DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProductThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct = "This role grants permission to enable and disable application registration on an API product." +) + +func (e DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct) ToPointer() *DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct { + return &e +} +func (e *DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants permission to enable and disable application registration on an API product.": + *e = DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct: %v", v) + } +} + +type ApplicationRegistration struct { + Name NameApplicationRegistration `json:"name"` + Description DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct `json:"description"` +} + +func (o *ApplicationRegistration) GetName() NameApplicationRegistration { + if o == nil { + return NameApplicationRegistration("") + } + return o.Name +} + +func (o *ApplicationRegistration) GetDescription() DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct { + if o == nil { + return DescriptionThisRoleGrantsPermissionToEnableAndDisableApplicationRegistrationOnAnAPIProduct("") + } + return o.Description +} + +type NameAPIProductsCreator string + +const ( + NameAPIProductsCreatorCreator NameAPIProductsCreator = "Creator" +) + +func (e NameAPIProductsCreator) ToPointer() *NameAPIProductsCreator { + return &e +} +func (e *NameAPIProductsCreator) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Creator": + *e = NameAPIProductsCreator(v) + return nil + default: + return fmt.Errorf("invalid value for NameAPIProductsCreator: %v", v) + } +} + +type DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc string + +const ( + DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtcThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc = "This access is required to create API products. This access is not for creating sub-entities such as versions, API specs, etc." +) + +func (e DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc) ToPointer() *DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc { + return &e +} +func (e *DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This access is required to create API products. This access is not for creating sub-entities such as versions, API specs, etc.": + *e = DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc: %v", v) + } +} + +type CreatorThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc struct { + Name NameAPIProductsCreator `json:"name"` + Description DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc `json:"description"` +} + +func (o *CreatorThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc) GetName() NameAPIProductsCreator { + if o == nil { + return NameAPIProductsCreator("") + } + return o.Name +} + +func (o *CreatorThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc) GetDescription() DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc { + if o == nil { + return DescriptionThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc("") + } + return o.Description +} + +type NameAPIProductsDeployer string + +const ( + NameAPIProductsDeployerDeployer NameAPIProductsDeployer = "Deployer" +) + +func (e NameAPIProductsDeployer) ToPointer() *NameAPIProductsDeployer { + return &e +} +func (e *NameAPIProductsDeployer) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Deployer": + *e = NameAPIProductsDeployer(v) + return nil + default: + return fmt.Errorf("invalid value for NameAPIProductsDeployer: %v", v) + } +} + +type DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane string + +const ( + DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlaneThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane = "This role grants permission to deploy and remove an API product from a control plane." +) + +func (e DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane) ToPointer() *DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane { + return &e +} +func (e *DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants permission to deploy and remove an API product from a control plane.": + *e = DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane: %v", v) + } +} + +type DeployerThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane struct { + Name NameAPIProductsDeployer `json:"name"` + Description DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane `json:"description"` +} + +func (o *DeployerThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane) GetName() NameAPIProductsDeployer { + if o == nil { + return NameAPIProductsDeployer("") + } + return o.Name +} + +func (o *DeployerThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane) GetDescription() DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane { + if o == nil { + return DescriptionThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane("") + } + return o.Description +} + +type NameMaintainer string + +const ( + NameMaintainerMaintainer NameMaintainer = "Maintainer" +) + +func (e NameMaintainer) ToPointer() *NameMaintainer { + return &e +} +func (e *NameMaintainer) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Maintainer": + *e = NameMaintainer(v) + return nil + default: + return fmt.Errorf("invalid value for NameMaintainer: %v", v) + } +} + +type DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins string + +const ( + DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPluginsThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins = "This role grants all write permission to manage an API product and to administer plugins." +) + +func (e DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins) ToPointer() *DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins { + return &e +} +func (e *DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants all write permission to manage an API product and to administer plugins.": + *e = DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins: %v", v) + } +} + +type Maintainer struct { + Name NameMaintainer `json:"name"` + Description DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins `json:"description"` +} + +func (o *Maintainer) GetName() NameMaintainer { + if o == nil { + return NameMaintainer("") + } + return o.Name +} + +func (o *Maintainer) GetDescription() DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins { + if o == nil { + return DescriptionThisRoleGrantsAllWritePermissionToManageAnAPIProductAndToAdministerPlugins("") + } + return o.Description +} + +type NamePluginsAdmin string + +const ( + NamePluginsAdminPluginsAdmin NamePluginsAdmin = "Plugins Admin" +) + +func (e NamePluginsAdmin) ToPointer() *NamePluginsAdmin { + return &e +} +func (e *NamePluginsAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Plugins Admin": + *e = NamePluginsAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NamePluginsAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins string + +const ( + DescriptionThisRoleGrantsFullWritePermissionToAdministerPluginsThisRoleGrantsFullWritePermissionToAdministerPlugins DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins = "This role grants full write permission to administer plugins." +) + +func (e DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins) ToPointer() *DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins { + return &e +} +func (e *DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write permission to administer plugins.": + *e = DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins: %v", v) + } +} + +type PluginsAdmin struct { + Name NamePluginsAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins `json:"description"` +} + +func (o *PluginsAdmin) GetName() NamePluginsAdmin { + if o == nil { + return NamePluginsAdmin("") + } + return o.Name +} + +func (o *PluginsAdmin) GetDescription() DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins { + if o == nil { + return DescriptionThisRoleGrantsFullWritePermissionToAdministerPlugins("") + } + return o.Description +} + +type NamePublisher string + +const ( + NamePublisherPublisher NamePublisher = "Publisher" +) + +func (e NamePublisher) ToPointer() *NamePublisher { + return &e +} +func (e *NamePublisher) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Publisher": + *e = NamePublisher(v) + return nil + default: + return fmt.Errorf("invalid value for NamePublisher: %v", v) + } +} + +type DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals string + +const ( + DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortalsThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals = "This role grants permission to publish an API product to one or more portals." +) + +func (e DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals) ToPointer() *DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals { + return &e +} +func (e *DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants permission to publish an API product to one or more portals.": + *e = DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals: %v", v) + } +} + +type Publisher struct { + Name NamePublisher `json:"name"` + Description DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals `json:"description"` +} + +func (o *Publisher) GetName() NamePublisher { + if o == nil { + return NamePublisher("") + } + return o.Name +} + +func (o *Publisher) GetDescription() DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals { + if o == nil { + return DescriptionThisRoleGrantsPermissionToPublishAnAPIProductToOneOrMorePortals("") + } + return o.Description +} + +type NameAPIProductsViewer string + +const ( + NameAPIProductsViewerViewer NameAPIProductsViewer = "Viewer" +) + +func (e NameAPIProductsViewer) ToPointer() *NameAPIProductsViewer { + return &e +} +func (e *NameAPIProductsViewer) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Viewer": + *e = NameAPIProductsViewer(v) + return nil + default: + return fmt.Errorf("invalid value for NameAPIProductsViewer: %v", v) + } +} + +type DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities string + +const ( + DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntitiesViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities = "Viewer has read-only access to an API product and its sub-entities." +) + +func (e DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities) ToPointer() *DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities { + return &e +} +func (e *DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Viewer has read-only access to an API product and its sub-entities.": + *e = DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities: %v", v) + } +} + +type ViewerViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities struct { + Name NameAPIProductsViewer `json:"name"` + Description DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities `json:"description"` +} + +func (o *ViewerViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities) GetName() NameAPIProductsViewer { + if o == nil { + return NameAPIProductsViewer("") + } + return o.Name +} + +func (o *ViewerViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities) GetDescription() DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities { + if o == nil { + return DescriptionViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities("") + } + return o.Description +} + +type RolesAPIProducts struct { + Admin *AdminThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions `json:"admin,omitempty"` + ApplicationRegistration *ApplicationRegistration `json:"application_registration,omitempty"` + Creator *CreatorThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc `json:"creator,omitempty"` + Deployer *DeployerThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane `json:"deployer,omitempty"` + Maintainer *Maintainer `json:"maintainer,omitempty"` + PluginsAdmin *PluginsAdmin `json:"plugins_admin,omitempty"` + Publisher *Publisher `json:"publisher,omitempty"` + Viewer *ViewerViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities `json:"viewer,omitempty"` +} + +func (o *RolesAPIProducts) GetAdmin() *AdminThisRoleGrantsFullWriteAccessToAnAPIProductAndItsVersions { + if o == nil { + return nil + } + return o.Admin +} + +func (o *RolesAPIProducts) GetApplicationRegistration() *ApplicationRegistration { + if o == nil { + return nil + } + return o.ApplicationRegistration +} + +func (o *RolesAPIProducts) GetCreator() *CreatorThisAccessIsRequiredToCreateAPIProductsThisAccessIsNotForCreatingSubEntitiesSuchAsVersionsAPISpecsEtc { + if o == nil { + return nil + } + return o.Creator +} + +func (o *RolesAPIProducts) GetDeployer() *DeployerThisRoleGrantsPermissionToDeployAndRemoveAnAPIProductFromAControlPlane { + if o == nil { + return nil + } + return o.Deployer +} + +func (o *RolesAPIProducts) GetMaintainer() *Maintainer { + if o == nil { + return nil + } + return o.Maintainer +} + +func (o *RolesAPIProducts) GetPluginsAdmin() *PluginsAdmin { + if o == nil { + return nil + } + return o.PluginsAdmin +} + +func (o *RolesAPIProducts) GetPublisher() *Publisher { + if o == nil { + return nil + } + return o.Publisher +} + +func (o *RolesAPIProducts) GetViewer() *ViewerViewerHasReadOnlyAccessToAnAPIProductAndItsSubEntities { + if o == nil { + return nil + } + return o.Viewer +} + +type APIProducts struct { + Name NameAPIProducts `json:"name"` + Roles RolesAPIProducts `json:"roles"` +} + +func (o *APIProducts) GetName() NameAPIProducts { + if o == nil { + return NameAPIProducts("") + } + return o.Name +} + +func (o *APIProducts) GetRoles() RolesAPIProducts { + if o == nil { + return RolesAPIProducts{} + } + return o.Roles +} + +type NameAuditLogs string + +const ( + NameAuditLogsAuditLogs NameAuditLogs = "Audit Logs" +) + +func (e NameAuditLogs) ToPointer() *NameAuditLogs { + return &e +} +func (e *NameAuditLogs) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Audit Logs": + *e = NameAuditLogs(v) + return nil + default: + return fmt.Errorf("invalid value for NameAuditLogs: %v", v) + } +} + +type NameAuditLogsAdmin string + +const ( + NameAuditLogsAdminAdmin NameAuditLogsAdmin = "Admin" +) + +func (e NameAuditLogsAdmin) ToPointer() *NameAuditLogsAdmin { + return &e +} +func (e *NameAuditLogsAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Admin": + *e = NameAuditLogsAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameAuditLogsAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfigurationThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration = "This role grants full write access to the Audit log configuration." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to the Audit log configuration.": + *e = DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration: %v", v) + } +} + +type AdminThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration struct { + Name NameAuditLogsAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration `json:"description"` +} + +func (o *AdminThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration) GetName() NameAuditLogsAdmin { + if o == nil { + return NameAuditLogsAdmin("") + } + return o.Name +} + +func (o *AdminThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration("") + } + return o.Description +} + +type RolesAuditLogs struct { + Admin *AdminThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration `json:"admin,omitempty"` +} + +func (o *RolesAuditLogs) GetAdmin() *AdminThisRoleGrantsFullWriteAccessToTheAuditLogConfiguration { + if o == nil { + return nil + } + return o.Admin +} + +type AuditLogs struct { + Name NameAuditLogs `json:"name"` + Roles RolesAuditLogs `json:"roles"` +} + +func (o *AuditLogs) GetName() NameAuditLogs { + if o == nil { + return NameAuditLogs("") + } + return o.Name +} + +func (o *AuditLogs) GetRoles() RolesAuditLogs { + if o == nil { + return RolesAuditLogs{} + } + return o.Roles +} + +type NameIdentity string + +const ( + NameIdentityIdentity NameIdentity = "Identity" +) + +func (e NameIdentity) ToPointer() *NameIdentity { + return &e +} +func (e *NameIdentity) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Identity": + *e = NameIdentity(v) + return nil + default: + return fmt.Errorf("invalid value for NameIdentity: %v", v) + } +} + +type NameIdentityAdmin string + +const ( + NameIdentityAdminAdmin NameIdentityAdmin = "Admin" +) + +func (e NameIdentityAdmin) ToPointer() *NameIdentityAdmin { + return &e +} +func (e *NameIdentityAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Admin": + *e = NameIdentityAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameIdentityAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfigurationThisRoleGrantsFullWriteAccessToTheIdentityConfiguration DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration = "This role grants full write access to the Identity configuration." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to the Identity configuration.": + *e = DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration: %v", v) + } +} + +type AdminThisRoleGrantsFullWriteAccessToTheIdentityConfiguration struct { + Name NameIdentityAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration `json:"description"` +} + +func (o *AdminThisRoleGrantsFullWriteAccessToTheIdentityConfiguration) GetName() NameIdentityAdmin { + if o == nil { + return NameIdentityAdmin("") + } + return o.Name +} + +func (o *AdminThisRoleGrantsFullWriteAccessToTheIdentityConfiguration) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToTheIdentityConfiguration("") + } + return o.Description +} + +type RolesIdentity struct { + Admin *AdminThisRoleGrantsFullWriteAccessToTheIdentityConfiguration `json:"admin,omitempty"` +} + +func (o *RolesIdentity) GetAdmin() *AdminThisRoleGrantsFullWriteAccessToTheIdentityConfiguration { + if o == nil { + return nil + } + return o.Admin +} + +type Identity struct { + Name NameIdentity `json:"name"` + Roles RolesIdentity `json:"roles"` +} + +func (o *Identity) GetName() NameIdentity { + if o == nil { + return NameIdentity("") + } + return o.Name +} + +func (o *Identity) GetRoles() RolesIdentity { + if o == nil { + return RolesIdentity{} + } + return o.Roles +} + +type NameMeshControlPlane string + +const ( + NameMeshControlPlaneMeshControlPlane NameMeshControlPlane = "Mesh Control Plane" +) + +func (e NameMeshControlPlane) ToPointer() *NameMeshControlPlane { + return &e +} +func (e *NameMeshControlPlane) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Mesh Control Plane": + *e = NameMeshControlPlane(v) + return nil + default: + return fmt.Errorf("invalid value for NameMeshControlPlane: %v", v) + } +} + +type NameMeshControlPlaneAdmin string + +const ( + NameMeshControlPlaneAdminAdmin NameMeshControlPlaneAdmin = "Admin" +) + +func (e NameMeshControlPlaneAdmin) ToPointer() *NameMeshControlPlaneAdmin { + return &e +} +func (e *NameMeshControlPlaneAdmin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Admin": + *e = NameMeshControlPlaneAdmin(v) + return nil + default: + return fmt.Errorf("invalid value for NameMeshControlPlaneAdmin: %v", v) + } +} + +type DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes string + +const ( + DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanesThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes = "This role grants full write access to the related to Mesh control planes." +) + +func (e DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes) ToPointer() *DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes { + return &e +} +func (e *DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants full write access to the related to Mesh control planes.": + *e = DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes: %v", v) + } +} + +type AdminThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes struct { + Name NameMeshControlPlaneAdmin `json:"name"` + Description DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes `json:"description"` +} + +func (o *AdminThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes) GetName() NameMeshControlPlaneAdmin { + if o == nil { + return NameMeshControlPlaneAdmin("") + } + return o.Name +} + +func (o *AdminThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes) GetDescription() DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes { + if o == nil { + return DescriptionThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes("") + } + return o.Description +} + +type NameConnector string + +const ( + NameConnectorConnector NameConnector = "Connector" +) + +func (e NameConnector) ToPointer() *NameConnector { + return &e +} +func (e *NameConnector) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Connector": + *e = NameConnector(v) + return nil + default: + return fmt.Errorf("invalid value for NameConnector: %v", v) + } +} + +type DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect string + +const ( + DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnectThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect = "This role grants a mesh zone to connect to the mesh control plane in Konnect." +) + +func (e DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect) ToPointer() *DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect { + return &e +} +func (e *DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants a mesh zone to connect to the mesh control plane in Konnect.": + *e = DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect: %v", v) + } +} + +type Connector struct { + Name NameConnector `json:"name"` + Description DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect `json:"description"` +} + +func (o *Connector) GetName() NameConnector { + if o == nil { + return NameConnector("") + } + return o.Name +} + +func (o *Connector) GetDescription() DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect { + if o == nil { + return DescriptionThisRoleGrantsAMeshZoneToConnectToTheMeshControlPlaneInKonnect("") + } + return o.Description +} + +type NameMeshControlPlaneCreator string + +const ( + NameMeshControlPlaneCreatorCreator NameMeshControlPlaneCreator = "Creator" +) + +func (e NameMeshControlPlaneCreator) ToPointer() *NameMeshControlPlaneCreator { + return &e +} +func (e *NameMeshControlPlaneCreator) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Creator": + *e = NameMeshControlPlaneCreator(v) + return nil + default: + return fmt.Errorf("invalid value for NameMeshControlPlaneCreator: %v", v) + } +} + +type DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes string + +const ( + DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanesThisRoleGrantsAccessToCreateNewMeshControlPlanes DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes = "This role grants access to create new Mesh control planes." +) + +func (e DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes) ToPointer() *DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes { + return &e +} +func (e *DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants access to create new Mesh control planes.": + *e = DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes: %v", v) + } +} + +type CreatorThisRoleGrantsAccessToCreateNewMeshControlPlanes struct { + Name NameMeshControlPlaneCreator `json:"name"` + Description DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes `json:"description"` +} + +func (o *CreatorThisRoleGrantsAccessToCreateNewMeshControlPlanes) GetName() NameMeshControlPlaneCreator { + if o == nil { + return NameMeshControlPlaneCreator("") + } + return o.Name +} + +func (o *CreatorThisRoleGrantsAccessToCreateNewMeshControlPlanes) GetDescription() DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes { + if o == nil { + return DescriptionThisRoleGrantsAccessToCreateNewMeshControlPlanes("") + } + return o.Description +} + +type NameMeshControlPlaneViewer string + +const ( + NameMeshControlPlaneViewerViewer NameMeshControlPlaneViewer = "Viewer" +) + +func (e NameMeshControlPlaneViewer) ToPointer() *NameMeshControlPlaneViewer { + return &e +} +func (e *NameMeshControlPlaneViewer) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Viewer": + *e = NameMeshControlPlaneViewer(v) + return nil + default: + return fmt.Errorf("invalid value for NameMeshControlPlaneViewer: %v", v) + } +} + +type DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes string + +const ( + DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanesThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes = "This role grants access to read-only permissions to Mesh control planes." +) + +func (e DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes) ToPointer() *DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes { + return &e +} +func (e *DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "This role grants access to read-only permissions to Mesh control planes.": + *e = DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes(v) + return nil + default: + return fmt.Errorf("invalid value for DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes: %v", v) + } +} + +type ViewerThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes struct { + Name NameMeshControlPlaneViewer `json:"name"` + Description DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes `json:"description"` +} + +func (o *ViewerThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes) GetName() NameMeshControlPlaneViewer { + if o == nil { + return NameMeshControlPlaneViewer("") + } + return o.Name +} + +func (o *ViewerThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes) GetDescription() DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes { + if o == nil { + return DescriptionThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes("") + } + return o.Description +} + +type RolesMeshControlPlane struct { + Admin *AdminThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes `json:"admin,omitempty"` + Connector *Connector `json:"connector,omitempty"` + Creator *CreatorThisRoleGrantsAccessToCreateNewMeshControlPlanes `json:"creator,omitempty"` + Viewer *ViewerThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes `json:"viewer,omitempty"` +} + +func (o *RolesMeshControlPlane) GetAdmin() *AdminThisRoleGrantsFullWriteAccessToTheRelatedToMeshControlPlanes { + if o == nil { + return nil + } + return o.Admin +} + +func (o *RolesMeshControlPlane) GetConnector() *Connector { + if o == nil { + return nil + } + return o.Connector +} + +func (o *RolesMeshControlPlane) GetCreator() *CreatorThisRoleGrantsAccessToCreateNewMeshControlPlanes { + if o == nil { + return nil + } + return o.Creator +} + +func (o *RolesMeshControlPlane) GetViewer() *ViewerThisRoleGrantsAccessToReadOnlyPermissionsToMeshControlPlanes { + if o == nil { + return nil + } + return o.Viewer +} + +type MeshControlPlanes struct { + Name NameMeshControlPlane `json:"name"` + Roles RolesMeshControlPlane `json:"roles"` +} + +func (o *MeshControlPlanes) GetName() NameMeshControlPlane { + if o == nil { + return NameMeshControlPlane("") + } + return o.Name +} + +func (o *MeshControlPlanes) GetRoles() RolesMeshControlPlane { + if o == nil { + return RolesMeshControlPlane{} + } + return o.Roles +} + +// Roles - The predefined, or system managed, roles. +type Roles struct { + ControlPlanes *ControlPlanes `json:"control_planes,omitempty"` + APIProducts *APIProducts `json:"api_products,omitempty"` + AuditLogs *AuditLogs `json:"audit_logs,omitempty"` + Identity *Identity `json:"identity,omitempty"` + MeshControlPlanes *MeshControlPlanes `json:"mesh_control_planes,omitempty"` +} + +func (o *Roles) GetControlPlanes() *ControlPlanes { + if o == nil { + return nil + } + return o.ControlPlanes +} + +func (o *Roles) GetAPIProducts() *APIProducts { + if o == nil { + return nil + } + return o.APIProducts +} + +func (o *Roles) GetAuditLogs() *AuditLogs { + if o == nil { + return nil + } + return o.AuditLogs +} + +func (o *Roles) GetIdentity() *Identity { + if o == nil { + return nil + } + return o.Identity +} + +func (o *Roles) GetMeshControlPlanes() *MeshControlPlanes { + if o == nil { + return nil + } + return o.MeshControlPlanes +} diff --git a/tests/mockserver/internal/sdk/models/components/route.go b/tests/mockserver/internal/sdk/models/components/route.go new file mode 100644 index 00000000..7bfc9504 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/route.go @@ -0,0 +1,72 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type RouteType string + +const ( + RouteTypeRouteJSON RouteType = "RouteJson" + RouteTypeRouteExpression RouteType = "RouteExpression" +) + +type Route struct { + RouteJSON *RouteJSON `queryParam:"inline"` + RouteExpression *RouteExpression `queryParam:"inline"` + + Type RouteType +} + +func CreateRouteRouteJSON(routeJSON RouteJSON) Route { + typ := RouteTypeRouteJSON + + return Route{ + RouteJSON: &routeJSON, + Type: typ, + } +} + +func CreateRouteRouteExpression(routeExpression RouteExpression) Route { + typ := RouteTypeRouteExpression + + return Route{ + RouteExpression: &routeExpression, + Type: typ, + } +} + +func (u *Route) UnmarshalJSON(data []byte) error { + + var routeExpression RouteExpression = RouteExpression{} + if err := utils.UnmarshalJSON(data, &routeExpression, "", true, true); err == nil { + u.RouteExpression = &routeExpression + u.Type = RouteTypeRouteExpression + return nil + } + + var routeJSON RouteJSON = RouteJSON{} + if err := utils.UnmarshalJSON(data, &routeJSON, "", true, true); err == nil { + u.RouteJSON = &routeJSON + u.Type = RouteTypeRouteJSON + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Route", string(data)) +} + +func (u Route) MarshalJSON() ([]byte, error) { + if u.RouteJSON != nil { + return utils.MarshalJSON(u.RouteJSON, "", true) + } + + if u.RouteExpression != nil { + return utils.MarshalJSON(u.RouteExpression, "", true) + } + + return nil, errors.New("could not marshal union type Route: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/routeexpression.go b/tests/mockserver/internal/sdk/models/components/routeexpression.go new file mode 100644 index 00000000..da97a9dc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/routeexpression.go @@ -0,0 +1,270 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// RouteExpressionHTTPSRedirectStatusCode - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. +type RouteExpressionHTTPSRedirectStatusCode int64 + +const ( + RouteExpressionHTTPSRedirectStatusCodeFourHundredAndTwentySix RouteExpressionHTTPSRedirectStatusCode = 426 + RouteExpressionHTTPSRedirectStatusCodeThreeHundredAndOne RouteExpressionHTTPSRedirectStatusCode = 301 + RouteExpressionHTTPSRedirectStatusCodeThreeHundredAndTwo RouteExpressionHTTPSRedirectStatusCode = 302 + RouteExpressionHTTPSRedirectStatusCodeThreeHundredAndSeven RouteExpressionHTTPSRedirectStatusCode = 307 + RouteExpressionHTTPSRedirectStatusCodeThreeHundredAndEight RouteExpressionHTTPSRedirectStatusCode = 308 +) + +func (e RouteExpressionHTTPSRedirectStatusCode) ToPointer() *RouteExpressionHTTPSRedirectStatusCode { + return &e +} +func (e *RouteExpressionHTTPSRedirectStatusCode) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 426: + fallthrough + case 301: + fallthrough + case 302: + fallthrough + case 307: + fallthrough + case 308: + *e = RouteExpressionHTTPSRedirectStatusCode(v) + return nil + default: + return fmt.Errorf("invalid value for RouteExpressionHTTPSRedirectStatusCode: %v", v) + } +} + +// RouteExpressionPathHandling - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior. +type RouteExpressionPathHandling string + +const ( + RouteExpressionPathHandlingV0 RouteExpressionPathHandling = "v0" + RouteExpressionPathHandlingV1 RouteExpressionPathHandling = "v1" +) + +func (e RouteExpressionPathHandling) ToPointer() *RouteExpressionPathHandling { + return &e +} +func (e *RouteExpressionPathHandling) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "v0": + fallthrough + case "v1": + *e = RouteExpressionPathHandling(v) + return nil + default: + return fmt.Errorf("invalid value for RouteExpressionPathHandling: %v", v) + } +} + +type RouteExpressionProtocol string + +const ( + RouteExpressionProtocolGrpc RouteExpressionProtocol = "grpc" + RouteExpressionProtocolGrpcs RouteExpressionProtocol = "grpcs" + RouteExpressionProtocolHTTP RouteExpressionProtocol = "http" + RouteExpressionProtocolHTTPS RouteExpressionProtocol = "https" + RouteExpressionProtocolTCP RouteExpressionProtocol = "tcp" + RouteExpressionProtocolTLS RouteExpressionProtocol = "tls" + RouteExpressionProtocolTLSPassthrough RouteExpressionProtocol = "tls_passthrough" + RouteExpressionProtocolUDP RouteExpressionProtocol = "udp" + RouteExpressionProtocolWs RouteExpressionProtocol = "ws" + RouteExpressionProtocolWss RouteExpressionProtocol = "wss" +) + +func (e RouteExpressionProtocol) ToPointer() *RouteExpressionProtocol { + return &e +} +func (e *RouteExpressionProtocol) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "grpc": + fallthrough + case "grpcs": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "tcp": + fallthrough + case "tls": + fallthrough + case "tls_passthrough": + fallthrough + case "udp": + fallthrough + case "ws": + fallthrough + case "wss": + *e = RouteExpressionProtocol(v) + return nil + default: + return fmt.Errorf("invalid value for RouteExpressionProtocol: %v", v) + } +} + +// RouteExpressionService - The Service this Route is associated to. This is where the Route proxies traffic to. +type RouteExpressionService struct { + ID *string `json:"id,omitempty"` +} + +func (o *RouteExpressionService) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// RouteExpression - Route entities define rules to match client requests. Each Route is associated with a Service, and a Service may have multiple Routes associated to it. Every request matching a given Route will be proxied to its associated Service. The combination of Routes and Services (and the separation of concerns between them) offers a powerful routing mechanism with which it is possible to define fine-grained entry-points in Kong leading to different upstream services of your infrastructure. You need at least one matching rule that applies to the protocol being matched by the Route. +type RouteExpression struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Use Router Expression to perform route match. This option is only available when `router_flavor` is set to `expressions`. + Expression *string `json:"expression,omitempty"` + // The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. + HTTPSRedirectStatusCode *RouteExpressionHTTPSRedirectStatusCode `json:"https_redirect_status_code,omitempty"` + ID *string `json:"id,omitempty"` + // The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named "test" and "Test". + Name *string `json:"name,omitempty"` + // Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior. + PathHandling *RouteExpressionPathHandling `json:"path_handling,omitempty"` + // When matching a Route via one of the `hosts` domain names, use the request `Host` header in the upstream request headers. If set to `false`, the upstream `Host` header will be that of the Service's `host`. + PreserveHost *bool `json:"preserve_host,omitempty"` + Priority *int64 `json:"priority,omitempty"` + // An array of the protocols this Route should allow. See the [Route Object](#route-object) section for a list of accepted protocols. When set to only `"https"`, HTTP requests are answered with an upgrade error. When set to only `"http"`, HTTPS requests are answered with an error. + Protocols []RouteExpressionProtocol `json:"protocols,omitempty"` + // Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. + RequestBuffering *bool `json:"request_buffering,omitempty"` + // Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. + ResponseBuffering *bool `json:"response_buffering,omitempty"` + // The Service this Route is associated to. This is where the Route proxies traffic to. + Service *RouteExpressionService `json:"service,omitempty"` + // When matching a Route via one of the `paths`, strip the matching prefix from the upstream request URL. + StripPath *bool `json:"strip_path,omitempty"` + // An optional set of strings associated with the Route for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *RouteExpression) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *RouteExpression) GetExpression() *string { + if o == nil { + return nil + } + return o.Expression +} + +func (o *RouteExpression) GetHTTPSRedirectStatusCode() *RouteExpressionHTTPSRedirectStatusCode { + if o == nil { + return nil + } + return o.HTTPSRedirectStatusCode +} + +func (o *RouteExpression) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *RouteExpression) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *RouteExpression) GetPathHandling() *RouteExpressionPathHandling { + if o == nil { + return nil + } + return o.PathHandling +} + +func (o *RouteExpression) GetPreserveHost() *bool { + if o == nil { + return nil + } + return o.PreserveHost +} + +func (o *RouteExpression) GetPriority() *int64 { + if o == nil { + return nil + } + return o.Priority +} + +func (o *RouteExpression) GetProtocols() []RouteExpressionProtocol { + if o == nil { + return nil + } + return o.Protocols +} + +func (o *RouteExpression) GetRequestBuffering() *bool { + if o == nil { + return nil + } + return o.RequestBuffering +} + +func (o *RouteExpression) GetResponseBuffering() *bool { + if o == nil { + return nil + } + return o.ResponseBuffering +} + +func (o *RouteExpression) GetService() *RouteExpressionService { + if o == nil { + return nil + } + return o.Service +} + +func (o *RouteExpression) GetStripPath() *bool { + if o == nil { + return nil + } + return o.StripPath +} + +func (o *RouteExpression) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *RouteExpression) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/routejson.go b/tests/mockserver/internal/sdk/models/components/routejson.go new file mode 100644 index 00000000..95cfeff5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/routejson.go @@ -0,0 +1,363 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type Destination struct { + IP *string `json:"ip,omitempty"` + Port *int64 `json:"port,omitempty"` +} + +func (o *Destination) GetIP() *string { + if o == nil { + return nil + } + return o.IP +} + +func (o *Destination) GetPort() *int64 { + if o == nil { + return nil + } + return o.Port +} + +// RouteJSONHTTPSRedirectStatusCode - The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. +type RouteJSONHTTPSRedirectStatusCode int64 + +const ( + RouteJSONHTTPSRedirectStatusCodeFourHundredAndTwentySix RouteJSONHTTPSRedirectStatusCode = 426 + RouteJSONHTTPSRedirectStatusCodeThreeHundredAndOne RouteJSONHTTPSRedirectStatusCode = 301 + RouteJSONHTTPSRedirectStatusCodeThreeHundredAndTwo RouteJSONHTTPSRedirectStatusCode = 302 + RouteJSONHTTPSRedirectStatusCodeThreeHundredAndSeven RouteJSONHTTPSRedirectStatusCode = 307 + RouteJSONHTTPSRedirectStatusCodeThreeHundredAndEight RouteJSONHTTPSRedirectStatusCode = 308 +) + +func (e RouteJSONHTTPSRedirectStatusCode) ToPointer() *RouteJSONHTTPSRedirectStatusCode { + return &e +} +func (e *RouteJSONHTTPSRedirectStatusCode) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 426: + fallthrough + case 301: + fallthrough + case 302: + fallthrough + case 307: + fallthrough + case 308: + *e = RouteJSONHTTPSRedirectStatusCode(v) + return nil + default: + return fmt.Errorf("invalid value for RouteJSONHTTPSRedirectStatusCode: %v", v) + } +} + +// RouteJSONPathHandling - Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior. +type RouteJSONPathHandling string + +const ( + RouteJSONPathHandlingV0 RouteJSONPathHandling = "v0" + RouteJSONPathHandlingV1 RouteJSONPathHandling = "v1" +) + +func (e RouteJSONPathHandling) ToPointer() *RouteJSONPathHandling { + return &e +} +func (e *RouteJSONPathHandling) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "v0": + fallthrough + case "v1": + *e = RouteJSONPathHandling(v) + return nil + default: + return fmt.Errorf("invalid value for RouteJSONPathHandling: %v", v) + } +} + +type RouteJSONProtocol string + +const ( + RouteJSONProtocolGrpc RouteJSONProtocol = "grpc" + RouteJSONProtocolGrpcs RouteJSONProtocol = "grpcs" + RouteJSONProtocolHTTP RouteJSONProtocol = "http" + RouteJSONProtocolHTTPS RouteJSONProtocol = "https" + RouteJSONProtocolTCP RouteJSONProtocol = "tcp" + RouteJSONProtocolTLS RouteJSONProtocol = "tls" + RouteJSONProtocolTLSPassthrough RouteJSONProtocol = "tls_passthrough" + RouteJSONProtocolUDP RouteJSONProtocol = "udp" + RouteJSONProtocolWs RouteJSONProtocol = "ws" + RouteJSONProtocolWss RouteJSONProtocol = "wss" +) + +func (e RouteJSONProtocol) ToPointer() *RouteJSONProtocol { + return &e +} +func (e *RouteJSONProtocol) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "grpc": + fallthrough + case "grpcs": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "tcp": + fallthrough + case "tls": + fallthrough + case "tls_passthrough": + fallthrough + case "udp": + fallthrough + case "ws": + fallthrough + case "wss": + *e = RouteJSONProtocol(v) + return nil + default: + return fmt.Errorf("invalid value for RouteJSONProtocol: %v", v) + } +} + +// RouteJSONService - The Service this Route is associated to. This is where the Route proxies traffic to. +type RouteJSONService struct { + ID *string `json:"id,omitempty"` +} + +func (o *RouteJSONService) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +type Source struct { + IP *string `json:"ip,omitempty"` + Port *int64 `json:"port,omitempty"` +} + +func (o *Source) GetIP() *string { + if o == nil { + return nil + } + return o.IP +} + +func (o *Source) GetPort() *int64 { + if o == nil { + return nil + } + return o.Port +} + +// RouteJSON - Route entities define rules to match client requests. Each Route is associated with a Service, and a Service may have multiple Routes associated to it. Every request matching a given Route will be proxied to its associated Service. The combination of Routes and Services (and the separation of concerns between them) offers a powerful routing mechanism with which it is possible to define fine-grained entry-points in Kong leading to different upstream services of your infrastructure. You need at least one matching rule that applies to the protocol being matched by the Route. +type RouteJSON struct { + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port". + Destinations []Destination `json:"destinations,omitempty"` + // One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. + Headers map[string][]string `json:"headers,omitempty"` + // A list of domain names that match this Route. Note that the hosts value is case sensitive. + Hosts []string `json:"hosts,omitempty"` + // The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. + HTTPSRedirectStatusCode *RouteJSONHTTPSRedirectStatusCode `json:"https_redirect_status_code,omitempty"` + ID *string `json:"id,omitempty"` + // A list of HTTP methods that match this Route. + Methods []string `json:"methods,omitempty"` + // The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named "test" and "Test". + Name *string `json:"name,omitempty"` + // Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior. + PathHandling *RouteJSONPathHandling `json:"path_handling,omitempty"` + // A list of paths that match this Route. + Paths []string `json:"paths,omitempty"` + // When matching a Route via one of the `hosts` domain names, use the request `Host` header in the upstream request headers. If set to `false`, the upstream `Host` header will be that of the Service's `host`. + PreserveHost *bool `json:"preserve_host,omitempty"` + // An array of the protocols this Route should allow. See the [Route Object](#route-object) section for a list of accepted protocols. When set to only `"https"`, HTTP requests are answered with an upgrade error. When set to only `"http"`, HTTPS requests are answered with an error. + Protocols []RouteJSONProtocol `json:"protocols,omitempty"` + // A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same `regex_priority`, the older one (lowest `created_at`) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones). + RegexPriority *int64 `json:"regex_priority,omitempty"` + // Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding. + RequestBuffering *bool `json:"request_buffering,omitempty"` + // Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding. + ResponseBuffering *bool `json:"response_buffering,omitempty"` + // The Service this Route is associated to. This is where the Route proxies traffic to. + Service *RouteJSONService `json:"service,omitempty"` + // A list of SNIs that match this Route when using stream routing. + Snis []string `json:"snis,omitempty"` + // A list of IP sources of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port". + Sources []Source `json:"sources,omitempty"` + // When matching a Route via one of the `paths`, strip the matching prefix from the upstream request URL. + StripPath *bool `json:"strip_path,omitempty"` + // An optional set of strings associated with the Route for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *RouteJSON) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *RouteJSON) GetDestinations() []Destination { + if o == nil { + return nil + } + return o.Destinations +} + +func (o *RouteJSON) GetHeaders() map[string][]string { + if o == nil { + return nil + } + return o.Headers +} + +func (o *RouteJSON) GetHosts() []string { + if o == nil { + return nil + } + return o.Hosts +} + +func (o *RouteJSON) GetHTTPSRedirectStatusCode() *RouteJSONHTTPSRedirectStatusCode { + if o == nil { + return nil + } + return o.HTTPSRedirectStatusCode +} + +func (o *RouteJSON) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *RouteJSON) GetMethods() []string { + if o == nil { + return nil + } + return o.Methods +} + +func (o *RouteJSON) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *RouteJSON) GetPathHandling() *RouteJSONPathHandling { + if o == nil { + return nil + } + return o.PathHandling +} + +func (o *RouteJSON) GetPaths() []string { + if o == nil { + return nil + } + return o.Paths +} + +func (o *RouteJSON) GetPreserveHost() *bool { + if o == nil { + return nil + } + return o.PreserveHost +} + +func (o *RouteJSON) GetProtocols() []RouteJSONProtocol { + if o == nil { + return nil + } + return o.Protocols +} + +func (o *RouteJSON) GetRegexPriority() *int64 { + if o == nil { + return nil + } + return o.RegexPriority +} + +func (o *RouteJSON) GetRequestBuffering() *bool { + if o == nil { + return nil + } + return o.RequestBuffering +} + +func (o *RouteJSON) GetResponseBuffering() *bool { + if o == nil { + return nil + } + return o.ResponseBuffering +} + +func (o *RouteJSON) GetService() *RouteJSONService { + if o == nil { + return nil + } + return o.Service +} + +func (o *RouteJSON) GetSnis() []string { + if o == nil { + return nil + } + return o.Snis +} + +func (o *RouteJSON) GetSources() []Source { + if o == nil { + return nil + } + return o.Sources +} + +func (o *RouteJSON) GetStripPath() *bool { + if o == nil { + return nil + } + return o.StripPath +} + +func (o *RouteJSON) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *RouteJSON) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/routewithoutparents.go b/tests/mockserver/internal/sdk/models/components/routewithoutparents.go new file mode 100644 index 00000000..602cff2a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/routewithoutparents.go @@ -0,0 +1,72 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type RouteWithoutParentsType string + +const ( + RouteWithoutParentsTypeRouteJSON RouteWithoutParentsType = "RouteJson" + RouteWithoutParentsTypeRouteExpression RouteWithoutParentsType = "RouteExpression" +) + +type RouteWithoutParents struct { + RouteJSON *RouteJSON `queryParam:"inline"` + RouteExpression *RouteExpression `queryParam:"inline"` + + Type RouteWithoutParentsType +} + +func CreateRouteWithoutParentsRouteJSON(routeJSON RouteJSON) RouteWithoutParents { + typ := RouteWithoutParentsTypeRouteJSON + + return RouteWithoutParents{ + RouteJSON: &routeJSON, + Type: typ, + } +} + +func CreateRouteWithoutParentsRouteExpression(routeExpression RouteExpression) RouteWithoutParents { + typ := RouteWithoutParentsTypeRouteExpression + + return RouteWithoutParents{ + RouteExpression: &routeExpression, + Type: typ, + } +} + +func (u *RouteWithoutParents) UnmarshalJSON(data []byte) error { + + var routeExpression RouteExpression = RouteExpression{} + if err := utils.UnmarshalJSON(data, &routeExpression, "", true, true); err == nil { + u.RouteExpression = &routeExpression + u.Type = RouteWithoutParentsTypeRouteExpression + return nil + } + + var routeJSON RouteJSON = RouteJSON{} + if err := utils.UnmarshalJSON(data, &routeJSON, "", true, true); err == nil { + u.RouteJSON = &routeJSON + u.Type = RouteWithoutParentsTypeRouteJSON + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for RouteWithoutParents", string(data)) +} + +func (u RouteWithoutParents) MarshalJSON() ([]byte, error) { + if u.RouteJSON != nil { + return utils.MarshalJSON(u.RouteJSON, "", true) + } + + if u.RouteExpression != nil { + return utils.MarshalJSON(u.RouteExpression, "", true) + } + + return nil, errors.New("could not marshal union type RouteWithoutParents: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/samlidentityproviderconfig.go b/tests/mockserver/internal/sdk/models/components/samlidentityproviderconfig.go new file mode 100644 index 00000000..7221f433 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/samlidentityproviderconfig.go @@ -0,0 +1,61 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// SAMLIdentityProviderConfig - The identity provider that contains configuration data for the SAML authentication integration. +type SAMLIdentityProviderConfig struct { + // The identity provider's metadata URL where the identity provider's metadata can be obtained. + IdpMetadataURL *string `json:"idp_metadata_url,omitempty"` + // The identity provider's SAML metadata. If the identity provider supports a metadata URL, you can use the `idp_metadata_url` field instead. + // + IdpMetadataXML *string `json:"idp_metadata_xml,omitempty"` + SpMetadataURL *string `json:"sp_metadata_url,omitempty"` + // The entity ID of the service provider (SP). + SpEntityID *string `json:"sp_entity_id,omitempty"` + // The URL to redirect users to for initiating login with the identity provider. + LoginURL *string `json:"login_url,omitempty"` + // The URL where the SAML identity provider sends authentication responses after successful login attempts. + CallbackURL *string `json:"callback_url,omitempty"` +} + +func (o *SAMLIdentityProviderConfig) GetIdpMetadataURL() *string { + if o == nil { + return nil + } + return o.IdpMetadataURL +} + +func (o *SAMLIdentityProviderConfig) GetIdpMetadataXML() *string { + if o == nil { + return nil + } + return o.IdpMetadataXML +} + +func (o *SAMLIdentityProviderConfig) GetSpMetadataURL() *string { + if o == nil { + return nil + } + return o.SpMetadataURL +} + +func (o *SAMLIdentityProviderConfig) GetSpEntityID() *string { + if o == nil { + return nil + } + return o.SpEntityID +} + +func (o *SAMLIdentityProviderConfig) GetLoginURL() *string { + if o == nil { + return nil + } + return o.LoginURL +} + +func (o *SAMLIdentityProviderConfig) GetCallbackURL() *string { + if o == nil { + return nil + } + return o.CallbackURL +} diff --git a/tests/mockserver/internal/sdk/models/components/samlidentityproviderconfiginput.go b/tests/mockserver/internal/sdk/models/components/samlidentityproviderconfiginput.go new file mode 100644 index 00000000..ad0fd317 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/samlidentityproviderconfiginput.go @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// SAMLIdentityProviderConfigInput - The identity provider that contains configuration data for the SAML authentication integration. +type SAMLIdentityProviderConfigInput struct { + // The identity provider's metadata URL where the identity provider's metadata can be obtained. + IdpMetadataURL *string `json:"idp_metadata_url,omitempty"` + // The identity provider's SAML metadata. If the identity provider supports a metadata URL, you can use the `idp_metadata_url` field instead. + // + IdpMetadataXML *string `json:"idp_metadata_xml,omitempty"` +} + +func (o *SAMLIdentityProviderConfigInput) GetIdpMetadataURL() *string { + if o == nil { + return nil + } + return o.IdpMetadataURL +} + +func (o *SAMLIdentityProviderConfigInput) GetIdpMetadataXML() *string { + if o == nil { + return nil + } + return o.IdpMetadataXML +} diff --git a/tests/mockserver/internal/sdk/models/components/security.go b/tests/mockserver/internal/sdk/models/components/security.go new file mode 100644 index 00000000..427dbf12 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/security.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type Security struct { + PersonalAccessToken *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` + SystemAccountAccessToken *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` + KonnectAccessToken *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` + ServiceAccessToken *string `security:"scheme,type=http,subtype=bearer,name=Authorization"` +} + +func (o *Security) GetPersonalAccessToken() *string { + if o == nil { + return nil + } + return o.PersonalAccessToken +} + +func (o *Security) GetSystemAccountAccessToken() *string { + if o == nil { + return nil + } + return o.SystemAccountAccessToken +} + +func (o *Security) GetKonnectAccessToken() *string { + if o == nil { + return nil + } + return o.KonnectAccessToken +} + +func (o *Security) GetServiceAccessToken() *string { + if o == nil { + return nil + } + return o.ServiceAccessToken +} diff --git a/tests/mockserver/internal/sdk/models/components/serviceoutput.go b/tests/mockserver/internal/sdk/models/components/serviceoutput.go new file mode 100644 index 00000000..5f96ced8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/serviceoutput.go @@ -0,0 +1,410 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ServiceClientCertificate - Certificate to be used as client certificate while TLS handshaking to the upstream server. +type ServiceClientCertificate struct { + ID *string `json:"id,omitempty"` +} + +func (o *ServiceClientCertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// ServiceProtocol - The protocol used to communicate with the upstream. +type ServiceProtocol string + +const ( + ServiceProtocolGrpc ServiceProtocol = "grpc" + ServiceProtocolGrpcs ServiceProtocol = "grpcs" + ServiceProtocolHTTP ServiceProtocol = "http" + ServiceProtocolHTTPS ServiceProtocol = "https" + ServiceProtocolTCP ServiceProtocol = "tcp" + ServiceProtocolTLS ServiceProtocol = "tls" + ServiceProtocolTLSPassthrough ServiceProtocol = "tls_passthrough" + ServiceProtocolUDP ServiceProtocol = "udp" + ServiceProtocolWs ServiceProtocol = "ws" + ServiceProtocolWss ServiceProtocol = "wss" +) + +func (e ServiceProtocol) ToPointer() *ServiceProtocol { + return &e +} +func (e *ServiceProtocol) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "grpc": + fallthrough + case "grpcs": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "tcp": + fallthrough + case "tls": + fallthrough + case "tls_passthrough": + fallthrough + case "udp": + fallthrough + case "ws": + fallthrough + case "wss": + *e = ServiceProtocol(v) + return nil + default: + return fmt.Errorf("invalid value for ServiceProtocol: %v", v) + } +} + +// ServiceOutput - Service entities, as the name implies, are abstractions of each of your own upstream services. Examples of Services would be a data transformation microservice, a billing API, etc. The main attribute of a Service is its URL (where Kong should proxy traffic to), which can be set as a single string or by specifying its `protocol`, `host`, `port` and `path` individually. Services are associated to Routes (a Service can have many Routes associated with it). Routes are entry-points in Kong and define rules to match client requests. Once a Route is matched, Kong proxies the request to its associated Service. See the [Proxy Reference][proxy-reference] for a detailed explanation of how Kong proxies traffic. +type ServiceOutput struct { + // Array of `CA Certificate` object UUIDs that are used to build the trust store while verifying upstream server's TLS certificate. If set to `null` when Nginx default is respected. If default CA list in Nginx are not specified and TLS verification is enabled, then handshake with upstream server will always fail (because no CA are trusted). + CaCertificates []string `json:"ca_certificates,omitempty"` + // Certificate to be used as client certificate while TLS handshaking to the upstream server. + ClientCertificate *ServiceClientCertificate `json:"client_certificate,omitempty"` + // The timeout in milliseconds for establishing a connection to the upstream server. + ConnectTimeout *int64 `json:"connect_timeout,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Whether the Service is active. If set to `false`, the proxy behavior will be as if any routes attached to it do not exist (404). Default: `true`. + Enabled *bool `json:"enabled,omitempty"` + // The host of the upstream server. Note that the host value is case sensitive. + Host string `json:"host"` + ID *string `json:"id,omitempty"` + // The Service name. + Name *string `json:"name,omitempty"` + // The path to be used in requests to the upstream server. + Path *string `json:"path,omitempty"` + // The upstream server port. + Port *int64 `json:"port,omitempty"` + // The protocol used to communicate with the upstream. + Protocol *ServiceProtocol `json:"protocol,omitempty"` + // The timeout in milliseconds between two successive read operations for transmitting a request to the upstream server. + ReadTimeout *int64 `json:"read_timeout,omitempty"` + // The number of retries to execute upon failure to proxy. + Retries *int64 `json:"retries,omitempty"` + // An optional set of strings associated with the Service for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Whether to enable verification of upstream server TLS certificate. If set to `null`, then the Nginx default is respected. + TLSVerify *bool `json:"tls_verify,omitempty"` + // Maximum depth of chain while verifying Upstream server's TLS certificate. If set to `null`, then the Nginx default is respected. + TLSVerifyDepth *int64 `json:"tls_verify_depth,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + // The timeout in milliseconds between two successive write operations for transmitting a request to the upstream server. + WriteTimeout *int64 `json:"write_timeout,omitempty"` +} + +func (o *ServiceOutput) GetCaCertificates() []string { + if o == nil { + return nil + } + return o.CaCertificates +} + +func (o *ServiceOutput) GetClientCertificate() *ServiceClientCertificate { + if o == nil { + return nil + } + return o.ClientCertificate +} + +func (o *ServiceOutput) GetConnectTimeout() *int64 { + if o == nil { + return nil + } + return o.ConnectTimeout +} + +func (o *ServiceOutput) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *ServiceOutput) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *ServiceOutput) GetHost() string { + if o == nil { + return "" + } + return o.Host +} + +func (o *ServiceOutput) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ServiceOutput) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ServiceOutput) GetPath() *string { + if o == nil { + return nil + } + return o.Path +} + +func (o *ServiceOutput) GetPort() *int64 { + if o == nil { + return nil + } + return o.Port +} + +func (o *ServiceOutput) GetProtocol() *ServiceProtocol { + if o == nil { + return nil + } + return o.Protocol +} + +func (o *ServiceOutput) GetReadTimeout() *int64 { + if o == nil { + return nil + } + return o.ReadTimeout +} + +func (o *ServiceOutput) GetRetries() *int64 { + if o == nil { + return nil + } + return o.Retries +} + +func (o *ServiceOutput) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *ServiceOutput) GetTLSVerify() *bool { + if o == nil { + return nil + } + return o.TLSVerify +} + +func (o *ServiceOutput) GetTLSVerifyDepth() *int64 { + if o == nil { + return nil + } + return o.TLSVerifyDepth +} + +func (o *ServiceOutput) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *ServiceOutput) GetWriteTimeout() *int64 { + if o == nil { + return nil + } + return o.WriteTimeout +} + +// Service entities, as the name implies, are abstractions of each of your own upstream services. Examples of Services would be a data transformation microservice, a billing API, etc. The main attribute of a Service is its URL (where Kong should proxy traffic to), which can be set as a single string or by specifying its `protocol`, `host`, `port` and `path` individually. Services are associated to Routes (a Service can have many Routes associated with it). Routes are entry-points in Kong and define rules to match client requests. Once a Route is matched, Kong proxies the request to its associated Service. See the [Proxy Reference][proxy-reference] for a detailed explanation of how Kong proxies traffic. +type Service struct { + // Array of `CA Certificate` object UUIDs that are used to build the trust store while verifying upstream server's TLS certificate. If set to `null` when Nginx default is respected. If default CA list in Nginx are not specified and TLS verification is enabled, then handshake with upstream server will always fail (because no CA are trusted). + CaCertificates []string `json:"ca_certificates,omitempty"` + // Certificate to be used as client certificate while TLS handshaking to the upstream server. + ClientCertificate *ServiceClientCertificate `json:"client_certificate,omitempty"` + // The timeout in milliseconds for establishing a connection to the upstream server. + ConnectTimeout *int64 `json:"connect_timeout,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // Whether the Service is active. If set to `false`, the proxy behavior will be as if any routes attached to it do not exist (404). Default: `true`. + Enabled *bool `json:"enabled,omitempty"` + // The host of the upstream server. Note that the host value is case sensitive. + Host string `json:"host"` + ID *string `json:"id,omitempty"` + // The Service name. + Name *string `json:"name,omitempty"` + // The path to be used in requests to the upstream server. + Path *string `json:"path,omitempty"` + // The upstream server port. + Port *int64 `json:"port,omitempty"` + // The protocol used to communicate with the upstream. + Protocol *ServiceProtocol `json:"protocol,omitempty"` + // The timeout in milliseconds between two successive read operations for transmitting a request to the upstream server. + ReadTimeout *int64 `json:"read_timeout,omitempty"` + // The number of retries to execute upon failure to proxy. + Retries *int64 `json:"retries,omitempty"` + // An optional set of strings associated with the Service for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Whether to enable verification of upstream server TLS certificate. If set to `null`, then the Nginx default is respected. + TLSVerify *bool `json:"tls_verify,omitempty"` + // Maximum depth of chain while verifying Upstream server's TLS certificate. If set to `null`, then the Nginx default is respected. + TLSVerifyDepth *int64 `json:"tls_verify_depth,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + // Helper field to set `protocol`, `host`, `port` and `path` using a URL. This field is write-only and is not returned in responses. + URL *string `json:"url,omitempty"` + // The timeout in milliseconds between two successive write operations for transmitting a request to the upstream server. + WriteTimeout *int64 `json:"write_timeout,omitempty"` +} + +func (o *Service) GetCaCertificates() []string { + if o == nil { + return nil + } + return o.CaCertificates +} + +func (o *Service) GetClientCertificate() *ServiceClientCertificate { + if o == nil { + return nil + } + return o.ClientCertificate +} + +func (o *Service) GetConnectTimeout() *int64 { + if o == nil { + return nil + } + return o.ConnectTimeout +} + +func (o *Service) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Service) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *Service) GetHost() string { + if o == nil { + return "" + } + return o.Host +} + +func (o *Service) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Service) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *Service) GetPath() *string { + if o == nil { + return nil + } + return o.Path +} + +func (o *Service) GetPort() *int64 { + if o == nil { + return nil + } + return o.Port +} + +func (o *Service) GetProtocol() *ServiceProtocol { + if o == nil { + return nil + } + return o.Protocol +} + +func (o *Service) GetReadTimeout() *int64 { + if o == nil { + return nil + } + return o.ReadTimeout +} + +func (o *Service) GetRetries() *int64 { + if o == nil { + return nil + } + return o.Retries +} + +func (o *Service) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Service) GetTLSVerify() *bool { + if o == nil { + return nil + } + return o.TLSVerify +} + +func (o *Service) GetTLSVerifyDepth() *int64 { + if o == nil { + return nil + } + return o.TLSVerifyDepth +} + +func (o *Service) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *Service) GetURL() *string { + if o == nil { + return nil + } + return o.URL +} + +func (o *Service) GetWriteTimeout() *int64 { + if o == nil { + return nil + } + return o.WriteTimeout +} diff --git a/tests/mockserver/internal/sdk/models/components/serviceunavailableerror.go b/tests/mockserver/internal/sdk/models/components/serviceunavailableerror.go new file mode 100644 index 00000000..1b779c1a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/serviceunavailableerror.go @@ -0,0 +1,32 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// ServiceUnavailableStatus - The HTTP status code. +type ServiceUnavailableStatus int + +const ( + ServiceUnavailableStatusFiveHundredAndThree ServiceUnavailableStatus = 503 +) + +func (e ServiceUnavailableStatus) ToPointer() *ServiceUnavailableStatus { + return &e +} +func (e *ServiceUnavailableStatus) UnmarshalJSON(data []byte) error { + var v int + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 503: + *e = ServiceUnavailableStatus(v) + return nil + default: + return fmt.Errorf("invalid value for ServiceUnavailableStatus: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/sni.go b/tests/mockserver/internal/sdk/models/components/sni.go new file mode 100644 index 00000000..1f07c88b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/sni.go @@ -0,0 +1,72 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// SNICertificate - The id (a UUID) of the certificate with which to associate the SNI hostname. The Certificate must have a valid private key associated with it to be used by the SNI object. +type SNICertificate struct { + ID *string `json:"id,omitempty"` +} + +func (o *SNICertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// Sni - An SNI object represents a many-to-one mapping of hostnames to a certificate. That is, a certificate object can have many hostnames associated with it; when Kong receives an SSL request, it uses the SNI field in the Client Hello to lookup the certificate object based on the SNI associated with the certificate. +type Sni struct { + // The id (a UUID) of the certificate with which to associate the SNI hostname. The Certificate must have a valid private key associated with it to be used by the SNI object. + Certificate *SNICertificate `json:"certificate"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // The SNI name to associate with the given certificate. + Name string `json:"name"` + // An optional set of strings associated with the SNIs for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *Sni) GetCertificate() *SNICertificate { + if o == nil { + return nil + } + return o.Certificate +} + +func (o *Sni) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Sni) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Sni) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *Sni) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Sni) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/sniwithoutparents.go b/tests/mockserver/internal/sdk/models/components/sniwithoutparents.go new file mode 100644 index 00000000..64a93ac2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/sniwithoutparents.go @@ -0,0 +1,72 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// SNIWithoutParentsCertificate - The id (a UUID) of the certificate with which to associate the SNI hostname. The Certificate must have a valid private key associated with it to be used by the SNI object. +type SNIWithoutParentsCertificate struct { + ID *string `json:"id,omitempty"` +} + +func (o *SNIWithoutParentsCertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// SNIWithoutParents - An SNI object represents a many-to-one mapping of hostnames to a certificate. That is, a certificate object can have many hostnames associated with it; when Kong receives an SSL request, it uses the SNI field in the Client Hello to lookup the certificate object based on the SNI associated with the certificate. +type SNIWithoutParents struct { + // The id (a UUID) of the certificate with which to associate the SNI hostname. The Certificate must have a valid private key associated with it to be used by the SNI object. + Certificate *SNIWithoutParentsCertificate `json:"certificate,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // The SNI name to associate with the given certificate. + Name string `json:"name"` + // An optional set of strings associated with the SNIs for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *SNIWithoutParents) GetCertificate() *SNIWithoutParentsCertificate { + if o == nil { + return nil + } + return o.Certificate +} + +func (o *SNIWithoutParents) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *SNIWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *SNIWithoutParents) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SNIWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *SNIWithoutParents) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/stringfieldcontainsfilter.go b/tests/mockserver/internal/sdk/models/components/stringfieldcontainsfilter.go new file mode 100644 index 00000000..9fa2f6dc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/stringfieldcontainsfilter.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// StringFieldContainsFilter - Filters on the given string field value by fuzzy match. +type StringFieldContainsFilter struct { + Contains string `queryParam:"name=contains"` +} + +func (o *StringFieldContainsFilter) GetContains() string { + if o == nil { + return "" + } + return o.Contains +} diff --git a/tests/mockserver/internal/sdk/models/components/stringfieldfilter.go b/tests/mockserver/internal/sdk/models/components/stringfieldfilter.go new file mode 100644 index 00000000..0726cfab --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/stringfieldfilter.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// StringFieldFilter - Filters on the given string field value by exact match inequality. +type StringFieldFilter struct { + Eq *string `queryParam:"name=eq"` + Contains *string `queryParam:"name=contains"` + Ocontains *string `queryParam:"name=ocontains"` + Oeq *string `queryParam:"name=oeq"` + Neq *string `queryParam:"name=neq"` +} + +func (o *StringFieldFilter) GetEq() *string { + if o == nil { + return nil + } + return o.Eq +} + +func (o *StringFieldFilter) GetContains() *string { + if o == nil { + return nil + } + return o.Contains +} + +func (o *StringFieldFilter) GetOcontains() *string { + if o == nil { + return nil + } + return o.Ocontains +} + +func (o *StringFieldFilter) GetOeq() *string { + if o == nil { + return nil + } + return o.Oeq +} + +func (o *StringFieldFilter) GetNeq() *string { + if o == nil { + return nil + } + return o.Neq +} diff --git a/tests/mockserver/internal/sdk/models/components/stringfieldneqfilter.go b/tests/mockserver/internal/sdk/models/components/stringfieldneqfilter.go new file mode 100644 index 00000000..e522ea71 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/stringfieldneqfilter.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// StringFieldNEQFilter - Filters on the given string field value by exact match inequality. +type StringFieldNEQFilter struct { + Neq string `queryParam:"name=neq"` +} + +func (o *StringFieldNEQFilter) GetNeq() string { + if o == nil { + return "" + } + return o.Neq +} diff --git a/tests/mockserver/internal/sdk/models/components/stringfieldocontainsfilter.go b/tests/mockserver/internal/sdk/models/components/stringfieldocontainsfilter.go new file mode 100644 index 00000000..9c1801d1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/stringfieldocontainsfilter.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// StringFieldOContainsFilter - Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string. +type StringFieldOContainsFilter struct { + Ocontains string `queryParam:"name=ocontains"` +} + +func (o *StringFieldOContainsFilter) GetOcontains() string { + if o == nil { + return "" + } + return o.Ocontains +} diff --git a/tests/mockserver/internal/sdk/models/components/stringfieldoeqfilter.go b/tests/mockserver/internal/sdk/models/components/stringfieldoeqfilter.go new file mode 100644 index 00000000..0e6db18e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/stringfieldoeqfilter.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// StringFieldOEQFilter - Returns entities that exact match any of the comma-delimited phrases in the filter string. +type StringFieldOEQFilter struct { + Oeq string `queryParam:"name=oeq"` +} + +func (o *StringFieldOEQFilter) GetOeq() string { + if o == nil { + return "" + } + return o.Oeq +} diff --git a/tests/mockserver/internal/sdk/models/components/systemaccount.go b/tests/mockserver/internal/sdk/models/components/systemaccount.go new file mode 100644 index 00000000..0d35dfd9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/systemaccount.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// SystemAccount - Schema of the system account. +type SystemAccount struct { + // ID of the system account. + ID *string `json:"id,omitempty"` + // Name of the system account. + Name *string `json:"name,omitempty"` + // Description of the system account. + Description *string `json:"description,omitempty"` + // Timestamp of when the system account was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Timestamp of when the system account was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // The system account is managed by Konnect (true/false). + KonnectManaged *bool `json:"konnect_managed,omitempty"` +} + +func (s SystemAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SystemAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + +func (o *SystemAccount) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *SystemAccount) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *SystemAccount) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *SystemAccount) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *SystemAccount) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *SystemAccount) GetKonnectManaged() *bool { + if o == nil { + return nil + } + return o.KonnectManaged +} diff --git a/tests/mockserver/internal/sdk/models/components/systemaccountaccesstoken.go b/tests/mockserver/internal/sdk/models/components/systemaccountaccesstoken.go new file mode 100644 index 00000000..772fc00c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/systemaccountaccesstoken.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// SystemAccountAccessToken - Schema of the system account access token. +type SystemAccountAccessToken struct { + // ID of the system account access token. + ID *string `json:"id,omitempty"` + // Name of the system account access token. + Name *string `json:"name,omitempty"` + // Timestamp of when the system account access token was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Timestamp of when the system account access token was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Timestamp of when the system account access token will expire. + ExpiresAt *time.Time `json:"expires_at,omitempty"` + // Timestamp of when the system account access token was last used. + LastUsedAt *time.Time `json:"last_used_at,omitempty"` +} + +func (s SystemAccountAccessToken) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SystemAccountAccessToken) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + +func (o *SystemAccountAccessToken) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *SystemAccountAccessToken) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *SystemAccountAccessToken) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *SystemAccountAccessToken) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *SystemAccountAccessToken) GetExpiresAt() *time.Time { + if o == nil { + return nil + } + return o.ExpiresAt +} + +func (o *SystemAccountAccessToken) GetLastUsedAt() *time.Time { + if o == nil { + return nil + } + return o.LastUsedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencollection.go b/tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencollection.go new file mode 100644 index 00000000..3aeb9174 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencollection.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// SystemAccountAccessTokenCollection - A paginated list response for a collection of system accounts access tokens. +type SystemAccountAccessTokenCollection struct { + // returns the pagination information + Meta *PaginatedMeta `json:"meta,omitempty"` + Data []SystemAccountAccessToken `json:"data,omitempty"` +} + +func (o *SystemAccountAccessTokenCollection) GetMeta() *PaginatedMeta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *SystemAccountAccessTokenCollection) GetData() []SystemAccountAccessToken { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencreated.go b/tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencreated.go new file mode 100644 index 00000000..989a0864 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/systemaccountaccesstokencreated.go @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// SystemAccountAccessTokenCreated - A response including a single system account access token with the token. +type SystemAccountAccessTokenCreated struct { + // ID of the system account access token. + ID *string `json:"id,omitempty"` + // Name of the system account access token. + Name *string `json:"name,omitempty"` + // Timestamp of when the system account access token was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Timestamp of when the system account access token was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Timestamp of when the system account access token will expire. + ExpiresAt *time.Time `json:"expires_at,omitempty"` + // Timestamp of when the system account access token was last used. + LastUsedAt *time.Time `json:"last_used_at,omitempty"` + // The token of the system account access token. + Token *string `json:"token,omitempty"` +} + +func (s SystemAccountAccessTokenCreated) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SystemAccountAccessTokenCreated) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + +func (o *SystemAccountAccessTokenCreated) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *SystemAccountAccessTokenCreated) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *SystemAccountAccessTokenCreated) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *SystemAccountAccessTokenCreated) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *SystemAccountAccessTokenCreated) GetExpiresAt() *time.Time { + if o == nil { + return nil + } + return o.ExpiresAt +} + +func (o *SystemAccountAccessTokenCreated) GetLastUsedAt() *time.Time { + if o == nil { + return nil + } + return o.LastUsedAt +} + +func (o *SystemAccountAccessTokenCreated) GetToken() *string { + if o == nil { + return nil + } + return o.Token +} diff --git a/tests/mockserver/internal/sdk/models/components/systemaccountcollection.go b/tests/mockserver/internal/sdk/models/components/systemaccountcollection.go new file mode 100644 index 00000000..06b1db53 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/systemaccountcollection.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// SystemAccountCollection - A paginated list response for a collection of system accounts. +type SystemAccountCollection struct { + // returns the pagination information + Meta *PaginatedMeta `json:"meta,omitempty"` + Data []SystemAccount `json:"data,omitempty"` +} + +func (o *SystemAccountCollection) GetMeta() *PaginatedMeta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *SystemAccountCollection) GetData() []SystemAccount { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/target.go b/tests/mockserver/internal/sdk/models/components/target.go new file mode 100644 index 00000000..c49061e9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/target.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type TargetUpstream struct { + ID *string `json:"id,omitempty"` +} + +func (o *TargetUpstream) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// Target - A target is an ip address/hostname with a port that identifies an instance of a backend service. Every upstream can have many targets, and the targets can be dynamically added, modified, or deleted. Changes take effect on the fly. To disable a target, post a new one with `weight=0`; alternatively, use the `DELETE` convenience method to accomplish the same. The current target object definition is the one with the latest `created_at`. +type Target struct { + // Unix epoch when the resource was created. + CreatedAt *float64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // An optional set of strings associated with the Target for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // The target address (ip or hostname) and port. If the hostname resolves to an SRV record, the `port` value will be overridden by the value from the DNS record. + Target *string `json:"target,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *float64 `json:"updated_at,omitempty"` + Upstream *TargetUpstream `json:"upstream,omitempty"` + // The weight this target gets within the upstream loadbalancer (`0`-`65535`). If the hostname resolves to an SRV record, the `weight` value will be overridden by the value from the DNS record. + Weight *int64 `json:"weight,omitempty"` +} + +func (o *Target) GetCreatedAt() *float64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Target) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Target) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Target) GetTarget() *string { + if o == nil { + return nil + } + return o.Target +} + +func (o *Target) GetUpdatedAt() *float64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *Target) GetUpstream() *TargetUpstream { + if o == nil { + return nil + } + return o.Upstream +} + +func (o *Target) GetWeight() *int64 { + if o == nil { + return nil + } + return o.Weight +} diff --git a/tests/mockserver/internal/sdk/models/components/targetwithoutparents.go b/tests/mockserver/internal/sdk/models/components/targetwithoutparents.go new file mode 100644 index 00000000..09c30fc3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/targetwithoutparents.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type TargetWithoutParentsUpstream struct { + ID *string `json:"id,omitempty"` +} + +func (o *TargetWithoutParentsUpstream) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// TargetWithoutParents - A target is an ip address/hostname with a port that identifies an instance of a backend service. Every upstream can have many targets, and the targets can be dynamically added, modified, or deleted. Changes take effect on the fly. To disable a target, post a new one with `weight=0`; alternatively, use the `DELETE` convenience method to accomplish the same. The current target object definition is the one with the latest `created_at`. +type TargetWithoutParents struct { + // Unix epoch when the resource was created. + CreatedAt *float64 `json:"created_at,omitempty"` + ID *string `json:"id,omitempty"` + // An optional set of strings associated with the Target for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // The target address (ip or hostname) and port. If the hostname resolves to an SRV record, the `port` value will be overridden by the value from the DNS record. + Target *string `json:"target,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *float64 `json:"updated_at,omitempty"` + Upstream *TargetWithoutParentsUpstream `json:"upstream,omitempty"` + // The weight this target gets within the upstream loadbalancer (`0`-`65535`). If the hostname resolves to an SRV record, the `weight` value will be overridden by the value from the DNS record. + Weight *int64 `json:"weight,omitempty"` +} + +func (o *TargetWithoutParents) GetCreatedAt() *float64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *TargetWithoutParents) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *TargetWithoutParents) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *TargetWithoutParents) GetTarget() *string { + if o == nil { + return nil + } + return o.Target +} + +func (o *TargetWithoutParents) GetUpdatedAt() *float64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *TargetWithoutParents) GetUpstream() *TargetWithoutParentsUpstream { + if o == nil { + return nil + } + return o.Upstream +} + +func (o *TargetWithoutParents) GetWeight() *int64 { + if o == nil { + return nil + } + return o.Weight +} diff --git a/tests/mockserver/internal/sdk/models/components/team.go b/tests/mockserver/internal/sdk/models/components/team.go new file mode 100644 index 00000000..a2d1b06c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/team.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// Team - The team object contains information about a group of users. +type Team struct { + // The team ID. + ID *string `json:"id,omitempty"` + // The name of the team. + Name *string `json:"name,omitempty"` + // The team description in Konnect. + Description *string `json:"description,omitempty"` + // Returns True if a user belongs to a `system_team`. System teams are teams that can manage Konnect objects, like "Organization Admin", or "Service" + SystemTeam *bool `json:"system_team,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` + // A Unix timestamp representation of team creation. + CreatedAt *time.Time `json:"created_at,omitempty"` + // A Unix timestamp representation of the most recent change to the team object in Konnect. + // + UpdatedAt *time.Time `json:"updated_at,omitempty"` +} + +func (t Team) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *Team) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil +} + +func (o *Team) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Team) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *Team) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *Team) GetSystemTeam() *bool { + if o == nil { + return nil + } + return o.SystemTeam +} + +func (o *Team) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *Team) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Team) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/teamcollection.go b/tests/mockserver/internal/sdk/models/components/teamcollection.go new file mode 100644 index 00000000..a1a190d1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/teamcollection.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TeamCollection - A paginated list response for a collection of users. +type TeamCollection struct { + // returns the pagination information + Meta *PaginatedMeta `json:"meta,omitempty"` + Data []Team `json:"data,omitempty"` +} + +func (o *TeamCollection) GetMeta() *PaginatedMeta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *TeamCollection) GetData() []Team { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/teamgroupmapping.go b/tests/mockserver/internal/sdk/models/components/teamgroupmapping.go new file mode 100644 index 00000000..b637584a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/teamgroupmapping.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TeamGroupMapping - A map of Konnect Team to IdP groups. +type TeamGroupMapping struct { + // The Konnect team ID. + TeamID *string `json:"team_id,omitempty"` + // The IdP groups that are mapped to the specified team. + Groups []string `json:"groups,omitempty"` +} + +func (o *TeamGroupMapping) GetTeamID() *string { + if o == nil { + return nil + } + return o.TeamID +} + +func (o *TeamGroupMapping) GetGroups() []string { + if o == nil { + return nil + } + return o.Groups +} diff --git a/tests/mockserver/internal/sdk/models/components/teamgroupmappingcollection.go b/tests/mockserver/internal/sdk/models/components/teamgroupmappingcollection.go new file mode 100644 index 00000000..1cc3aa27 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/teamgroupmappingcollection.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TeamGroupMappingCollection - A paginated collection of mappings grouped by team_id. +type TeamGroupMappingCollection struct { + // returns the pagination information + Meta *PaginatedMeta `json:"meta,omitempty"` + Data []TeamGroupMapping `json:"data,omitempty"` +} + +func (o *TeamGroupMappingCollection) GetMeta() *PaginatedMeta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *TeamGroupMappingCollection) GetData() []TeamGroupMapping { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/teammapping.go b/tests/mockserver/internal/sdk/models/components/teammapping.go new file mode 100644 index 00000000..ce7c382a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/teammapping.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TeamMapping - A team assignment is a mapping of an IdP group to a Konnect Team. +type TeamMapping struct { + // The IdP group. + Group *string `json:"group,omitempty"` + // An array of ID's that are mapped to the specified group. + TeamIds []string `json:"team_ids,omitempty"` +} + +func (o *TeamMapping) GetGroup() *string { + if o == nil { + return nil + } + return o.Group +} + +func (o *TeamMapping) GetTeamIds() []string { + if o == nil { + return nil + } + return o.TeamIds +} diff --git a/tests/mockserver/internal/sdk/models/components/teammappingcollection.go b/tests/mockserver/internal/sdk/models/components/teammappingcollection.go new file mode 100644 index 00000000..694e3bc5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/teammappingcollection.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TeamMappingCollection - A paginated list response for a collection of team mappings. +type TeamMappingCollection struct { + Data []TeamMapping `json:"data,omitempty"` +} + +func (o *TeamMappingCollection) GetData() []TeamMapping { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/teammappingresponse.go b/tests/mockserver/internal/sdk/models/components/teammappingresponse.go new file mode 100644 index 00000000..b28fa131 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/teammappingresponse.go @@ -0,0 +1,89 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TeamMappingResponsePage - The page object. +type TeamMappingResponsePage struct { + // Page number. + Number *int64 `json:"number,omitempty"` + // Page size. + Size *int64 `json:"size,omitempty"` + // Total number of results. + Total *int64 `json:"total,omitempty"` +} + +func (o *TeamMappingResponsePage) GetNumber() *int64 { + if o == nil { + return nil + } + return o.Number +} + +func (o *TeamMappingResponsePage) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *TeamMappingResponsePage) GetTotal() *int64 { + if o == nil { + return nil + } + return o.Total +} + +// Meta - Contains pagination data. +type Meta struct { + // The page object. + Page *TeamMappingResponsePage `json:"page,omitempty"` +} + +func (o *Meta) GetPage() *TeamMappingResponsePage { + if o == nil { + return nil + } + return o.Page +} + +type DataResponse struct { + // Group names. + Group *string `json:"group,omitempty"` + // Team ID's that belong to the specified group. + TeamIds []string `json:"team_ids,omitempty"` +} + +func (o *DataResponse) GetGroup() *string { + if o == nil { + return nil + } + return o.Group +} + +func (o *DataResponse) GetTeamIds() []string { + if o == nil { + return nil + } + return o.TeamIds +} + +// TeamMappingResponse - A paginated list response for a collection of team mappings. +type TeamMappingResponse struct { + // Contains pagination data. + Meta *Meta `json:"meta,omitempty"` + Data []DataResponse `json:"data,omitempty"` +} + +func (o *TeamMappingResponse) GetMeta() *Meta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *TeamMappingResponse) GetData() []DataResponse { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaydnsconfig.go b/tests/mockserver/internal/sdk/models/components/transitgatewaydnsconfig.go new file mode 100644 index 00000000..230ebe07 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaydnsconfig.go @@ -0,0 +1,26 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type TransitGatewayDNSConfig struct { + // Remote DNS Server IP Addresses to connect to for resolving internal DNS via a transit gateway. + RemoteDNSServerIPAddresses []string `json:"remote_dns_server_ip_addresses"` + // Internal domain names to proxy for DNS resolution from the listed remote DNS server IP addresses, + // for a transit gateway. + // + DomainProxyList []string `json:"domain_proxy_list"` +} + +func (o *TransitGatewayDNSConfig) GetRemoteDNSServerIPAddresses() []string { + if o == nil { + return []string{} + } + return o.RemoteDNSServerIPAddresses +} + +func (o *TransitGatewayDNSConfig) GetDomainProxyList() []string { + if o == nil { + return []string{} + } + return o.DomainProxyList +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewayresponse.go b/tests/mockserver/internal/sdk/models/components/transitgatewayresponse.go new file mode 100644 index 00000000..24884ba8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewayresponse.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type TransitGatewayResponseType string + +const ( + TransitGatewayResponseTypeAwsTransitGatewayResponse TransitGatewayResponseType = "AwsTransitGatewayResponse" + TransitGatewayResponseTypeAwsVpcPeeringGatewayResponse TransitGatewayResponseType = "AwsVpcPeeringGatewayResponse" + TransitGatewayResponseTypeAzureTransitGatewayResponse TransitGatewayResponseType = "AzureTransitGatewayResponse" +) + +type TransitGatewayResponse struct { + AwsTransitGatewayResponse *AwsTransitGatewayResponse `queryParam:"inline"` + AwsVpcPeeringGatewayResponse *AwsVpcPeeringGatewayResponse `queryParam:"inline"` + AzureTransitGatewayResponse *AzureTransitGatewayResponse `queryParam:"inline"` + + Type TransitGatewayResponseType +} + +func CreateTransitGatewayResponseAwsTransitGatewayResponse(awsTransitGatewayResponse AwsTransitGatewayResponse) TransitGatewayResponse { + typ := TransitGatewayResponseTypeAwsTransitGatewayResponse + + return TransitGatewayResponse{ + AwsTransitGatewayResponse: &awsTransitGatewayResponse, + Type: typ, + } +} + +func CreateTransitGatewayResponseAwsVpcPeeringGatewayResponse(awsVpcPeeringGatewayResponse AwsVpcPeeringGatewayResponse) TransitGatewayResponse { + typ := TransitGatewayResponseTypeAwsVpcPeeringGatewayResponse + + return TransitGatewayResponse{ + AwsVpcPeeringGatewayResponse: &awsVpcPeeringGatewayResponse, + Type: typ, + } +} + +func CreateTransitGatewayResponseAzureTransitGatewayResponse(azureTransitGatewayResponse AzureTransitGatewayResponse) TransitGatewayResponse { + typ := TransitGatewayResponseTypeAzureTransitGatewayResponse + + return TransitGatewayResponse{ + AzureTransitGatewayResponse: &azureTransitGatewayResponse, + Type: typ, + } +} + +func (u *TransitGatewayResponse) UnmarshalJSON(data []byte) error { + + var azureTransitGatewayResponse AzureTransitGatewayResponse = AzureTransitGatewayResponse{} + if err := utils.UnmarshalJSON(data, &azureTransitGatewayResponse, "", true, true); err == nil { + u.AzureTransitGatewayResponse = &azureTransitGatewayResponse + u.Type = TransitGatewayResponseTypeAzureTransitGatewayResponse + return nil + } + + var awsTransitGatewayResponse AwsTransitGatewayResponse = AwsTransitGatewayResponse{} + if err := utils.UnmarshalJSON(data, &awsTransitGatewayResponse, "", true, true); err == nil { + u.AwsTransitGatewayResponse = &awsTransitGatewayResponse + u.Type = TransitGatewayResponseTypeAwsTransitGatewayResponse + return nil + } + + var awsVpcPeeringGatewayResponse AwsVpcPeeringGatewayResponse = AwsVpcPeeringGatewayResponse{} + if err := utils.UnmarshalJSON(data, &awsVpcPeeringGatewayResponse, "", true, true); err == nil { + u.AwsVpcPeeringGatewayResponse = &awsVpcPeeringGatewayResponse + u.Type = TransitGatewayResponseTypeAwsVpcPeeringGatewayResponse + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for TransitGatewayResponse", string(data)) +} + +func (u TransitGatewayResponse) MarshalJSON() ([]byte, error) { + if u.AwsTransitGatewayResponse != nil { + return utils.MarshalJSON(u.AwsTransitGatewayResponse, "", true) + } + + if u.AwsVpcPeeringGatewayResponse != nil { + return utils.MarshalJSON(u.AwsVpcPeeringGatewayResponse, "", true) + } + + if u.AzureTransitGatewayResponse != nil { + return utils.MarshalJSON(u.AzureTransitGatewayResponse, "", true) + } + + return nil, errors.New("could not marshal union type TransitGatewayResponse: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaysfilterparameters.go b/tests/mockserver/internal/sdk/models/components/transitgatewaysfilterparameters.go new file mode 100644 index 00000000..370faf0f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaysfilterparameters.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type TransitGatewaysFilterParameters struct { + Name *CloudGatewaysStringFieldFilterOverride `queryParam:"name=name"` + State *TransitGatewayStateFieldFilter `queryParam:"name=state"` +} + +func (o *TransitGatewaysFilterParameters) GetName() *CloudGatewaysStringFieldFilterOverride { + if o == nil { + return nil + } + return o.Name +} + +func (o *TransitGatewaysFilterParameters) GetState() *TransitGatewayStateFieldFilter { + if o == nil { + return nil + } + return o.State +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaystate.go b/tests/mockserver/internal/sdk/models/components/transitgatewaystate.go new file mode 100644 index 00000000..6160689d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaystate.go @@ -0,0 +1,53 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// TransitGatewayState - The current state of the Transit Gateway. Possible values: +// - `created` - The attachment has been created but is not attached to transit gateway. +// - `initializing` - The attachment is in the process of being initialized and is setting up necessary resources. +// - `pending-acceptance` The attachment request is awaiting acceptance in customer VPC. +// - `ready` - The transit gateway attachment is fully operational and can route traffic as configured. +// - `terminating` - The attachment is in the process of being deleted and is no longer accepting new traffic. +// - `terminated` - The attachment has been fully deleted and is no longer available. +type TransitGatewayState string + +const ( + TransitGatewayStateCreated TransitGatewayState = "created" + TransitGatewayStateInitializing TransitGatewayState = "initializing" + TransitGatewayStatePendingAcceptance TransitGatewayState = "pending-acceptance" + TransitGatewayStateReady TransitGatewayState = "ready" + TransitGatewayStateTerminating TransitGatewayState = "terminating" + TransitGatewayStateTerminated TransitGatewayState = "terminated" +) + +func (e TransitGatewayState) ToPointer() *TransitGatewayState { + return &e +} +func (e *TransitGatewayState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "created": + fallthrough + case "initializing": + fallthrough + case "pending-acceptance": + fallthrough + case "ready": + fallthrough + case "terminating": + fallthrough + case "terminated": + *e = TransitGatewayState(v) + return nil + default: + return fmt.Errorf("invalid value for TransitGatewayState: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldequalsfilter.go b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldequalsfilter.go new file mode 100644 index 00000000..46cd4929 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldequalsfilter.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type TransitGatewayStateFieldEqualsComparison struct { +} + +type TransitGatewayStateFieldEqualsFilterType string + +const ( + TransitGatewayStateFieldEqualsFilterTypeTransitGatewayState TransitGatewayStateFieldEqualsFilterType = "TransitGatewayState" + TransitGatewayStateFieldEqualsFilterTypeTransitGatewayStateFieldEqualsComparison TransitGatewayStateFieldEqualsFilterType = "TransitGatewayStateFieldEqualsComparison" +) + +// TransitGatewayStateFieldEqualsFilter - Filter transit-gateway state by exact match. +type TransitGatewayStateFieldEqualsFilter struct { + TransitGatewayState *TransitGatewayState `queryParam:"inline"` + TransitGatewayStateFieldEqualsComparison *TransitGatewayStateFieldEqualsComparison `queryParam:"inline"` + + Type TransitGatewayStateFieldEqualsFilterType +} + +func CreateTransitGatewayStateFieldEqualsFilterTransitGatewayState(transitGatewayState TransitGatewayState) TransitGatewayStateFieldEqualsFilter { + typ := TransitGatewayStateFieldEqualsFilterTypeTransitGatewayState + + return TransitGatewayStateFieldEqualsFilter{ + TransitGatewayState: &transitGatewayState, + Type: typ, + } +} + +func CreateTransitGatewayStateFieldEqualsFilterTransitGatewayStateFieldEqualsComparison(transitGatewayStateFieldEqualsComparison TransitGatewayStateFieldEqualsComparison) TransitGatewayStateFieldEqualsFilter { + typ := TransitGatewayStateFieldEqualsFilterTypeTransitGatewayStateFieldEqualsComparison + + return TransitGatewayStateFieldEqualsFilter{ + TransitGatewayStateFieldEqualsComparison: &transitGatewayStateFieldEqualsComparison, + Type: typ, + } +} + +func (u *TransitGatewayStateFieldEqualsFilter) UnmarshalJSON(data []byte) error { + + var transitGatewayStateFieldEqualsComparison TransitGatewayStateFieldEqualsComparison = TransitGatewayStateFieldEqualsComparison{} + if err := utils.UnmarshalJSON(data, &transitGatewayStateFieldEqualsComparison, "", true, true); err == nil { + u.TransitGatewayStateFieldEqualsComparison = &transitGatewayStateFieldEqualsComparison + u.Type = TransitGatewayStateFieldEqualsFilterTypeTransitGatewayStateFieldEqualsComparison + return nil + } + + var transitGatewayState TransitGatewayState = TransitGatewayState("") + if err := utils.UnmarshalJSON(data, &transitGatewayState, "", true, true); err == nil { + u.TransitGatewayState = &transitGatewayState + u.Type = TransitGatewayStateFieldEqualsFilterTypeTransitGatewayState + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for TransitGatewayStateFieldEqualsFilter", string(data)) +} + +func (u TransitGatewayStateFieldEqualsFilter) MarshalJSON() ([]byte, error) { + if u.TransitGatewayState != nil { + return utils.MarshalJSON(u.TransitGatewayState, "", true) + } + + if u.TransitGatewayStateFieldEqualsComparison != nil { + return utils.MarshalJSON(u.TransitGatewayStateFieldEqualsComparison, "", true) + } + + return nil, errors.New("could not marshal union type TransitGatewayStateFieldEqualsFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldfilter.go b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldfilter.go new file mode 100644 index 00000000..5f3d4a1d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldfilter.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type TransitGatewayStateFieldFilterType string + +const ( + TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldEqualsFilter TransitGatewayStateFieldFilterType = "TransitGatewayStateFieldEqualsFilter" + TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldNotEqualsFilter TransitGatewayStateFieldFilterType = "TransitGatewayStateFieldNotEqualsFilter" + TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldOrEqualityFilter TransitGatewayStateFieldFilterType = "TransitGatewayStateFieldOrEqualityFilter" +) + +type TransitGatewayStateFieldFilter struct { + TransitGatewayStateFieldEqualsFilter *TransitGatewayStateFieldEqualsFilter `queryParam:"inline"` + TransitGatewayStateFieldNotEqualsFilter *TransitGatewayStateFieldNotEqualsFilter `queryParam:"inline"` + TransitGatewayStateFieldOrEqualityFilter *TransitGatewayStateFieldOrEqualityFilter `queryParam:"inline"` + + Type TransitGatewayStateFieldFilterType +} + +func CreateTransitGatewayStateFieldFilterTransitGatewayStateFieldEqualsFilter(transitGatewayStateFieldEqualsFilter TransitGatewayStateFieldEqualsFilter) TransitGatewayStateFieldFilter { + typ := TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldEqualsFilter + + return TransitGatewayStateFieldFilter{ + TransitGatewayStateFieldEqualsFilter: &transitGatewayStateFieldEqualsFilter, + Type: typ, + } +} + +func CreateTransitGatewayStateFieldFilterTransitGatewayStateFieldNotEqualsFilter(transitGatewayStateFieldNotEqualsFilter TransitGatewayStateFieldNotEqualsFilter) TransitGatewayStateFieldFilter { + typ := TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldNotEqualsFilter + + return TransitGatewayStateFieldFilter{ + TransitGatewayStateFieldNotEqualsFilter: &transitGatewayStateFieldNotEqualsFilter, + Type: typ, + } +} + +func CreateTransitGatewayStateFieldFilterTransitGatewayStateFieldOrEqualityFilter(transitGatewayStateFieldOrEqualityFilter TransitGatewayStateFieldOrEqualityFilter) TransitGatewayStateFieldFilter { + typ := TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldOrEqualityFilter + + return TransitGatewayStateFieldFilter{ + TransitGatewayStateFieldOrEqualityFilter: &transitGatewayStateFieldOrEqualityFilter, + Type: typ, + } +} + +func (u *TransitGatewayStateFieldFilter) UnmarshalJSON(data []byte) error { + + var transitGatewayStateFieldNotEqualsFilter TransitGatewayStateFieldNotEqualsFilter = TransitGatewayStateFieldNotEqualsFilter{} + if err := utils.UnmarshalJSON(data, &transitGatewayStateFieldNotEqualsFilter, "", true, true); err == nil { + u.TransitGatewayStateFieldNotEqualsFilter = &transitGatewayStateFieldNotEqualsFilter + u.Type = TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldNotEqualsFilter + return nil + } + + var transitGatewayStateFieldOrEqualityFilter TransitGatewayStateFieldOrEqualityFilter = TransitGatewayStateFieldOrEqualityFilter{} + if err := utils.UnmarshalJSON(data, &transitGatewayStateFieldOrEqualityFilter, "", true, true); err == nil { + u.TransitGatewayStateFieldOrEqualityFilter = &transitGatewayStateFieldOrEqualityFilter + u.Type = TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldOrEqualityFilter + return nil + } + + var transitGatewayStateFieldEqualsFilter TransitGatewayStateFieldEqualsFilter = TransitGatewayStateFieldEqualsFilter{} + if err := utils.UnmarshalJSON(data, &transitGatewayStateFieldEqualsFilter, "", true, true); err == nil { + u.TransitGatewayStateFieldEqualsFilter = &transitGatewayStateFieldEqualsFilter + u.Type = TransitGatewayStateFieldFilterTypeTransitGatewayStateFieldEqualsFilter + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for TransitGatewayStateFieldFilter", string(data)) +} + +func (u TransitGatewayStateFieldFilter) MarshalJSON() ([]byte, error) { + if u.TransitGatewayStateFieldEqualsFilter != nil { + return utils.MarshalJSON(u.TransitGatewayStateFieldEqualsFilter, "", true) + } + + if u.TransitGatewayStateFieldNotEqualsFilter != nil { + return utils.MarshalJSON(u.TransitGatewayStateFieldNotEqualsFilter, "", true) + } + + if u.TransitGatewayStateFieldOrEqualityFilter != nil { + return utils.MarshalJSON(u.TransitGatewayStateFieldOrEqualityFilter, "", true) + } + + return nil, errors.New("could not marshal union type TransitGatewayStateFieldFilter: all fields are null") +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldnotequalsfilter.go b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldnotequalsfilter.go new file mode 100644 index 00000000..58a6c1ed --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldnotequalsfilter.go @@ -0,0 +1,7 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TransitGatewayStateFieldNotEqualsFilter - Filter transit-gateway state by inequality match. +type TransitGatewayStateFieldNotEqualsFilter struct { +} diff --git a/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldorequalityfilter.go b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldorequalityfilter.go new file mode 100644 index 00000000..d3a4d183 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/transitgatewaystatefieldorequalityfilter.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// TransitGatewayStateFieldOrEqualityFilter - Filter transit-gateway state by determining if the value is equal to any in a set of values, where the set is a +// comma-delimited list. +type TransitGatewayStateFieldOrEqualityFilter struct { + Oeq string `queryParam:"name=oeq"` +} + +func (o *TransitGatewayStateFieldOrEqualityFilter) GetOeq() string { + if o == nil { + return "" + } + return o.Oeq +} diff --git a/tests/mockserver/internal/sdk/models/components/updateappauthstrategyrequest.go b/tests/mockserver/internal/sdk/models/components/updateappauthstrategyrequest.go new file mode 100644 index 00000000..8498be86 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateappauthstrategyrequest.go @@ -0,0 +1,159 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type UpdateAppAuthStrategyRequestConfigs2 struct { + // The most basic mode to configure an Application Auth Strategy for an API Product Version. + // Using this mode will allow developers to generate API keys that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for Key Auth. + // + KeyAuth AppAuthStrategyConfigKeyAuth `json:"key-auth"` +} + +func (o *UpdateAppAuthStrategyRequestConfigs2) GetKeyAuth() AppAuthStrategyConfigKeyAuth { + if o == nil { + return AppAuthStrategyConfigKeyAuth{} + } + return o.KeyAuth +} + +type UpdateAppAuthStrategyRequestConfigs1 struct { + // A more advanced mode to configure an API Product Version’s Application Auth Strategy. + // Using this mode will allow developers to use API credentials issued from an external IdP that will authenticate their application requests. + // Once authenticated, an application will be granted access to any Product Version it is registered for that is configured for the same Auth Strategy. + // An OIDC strategy may be used in conjunction with a DCR provider to automatically create the IdP application. + // + OpenidConnect PartialAppAuthStrategyConfigOpenIDConnect `json:"openid-connect"` +} + +func (o *UpdateAppAuthStrategyRequestConfigs1) GetOpenidConnect() PartialAppAuthStrategyConfigOpenIDConnect { + if o == nil { + return PartialAppAuthStrategyConfigOpenIDConnect{} + } + return o.OpenidConnect +} + +type ConfigsType string + +const ( + ConfigsTypeUpdateAppAuthStrategyRequestConfigs1 ConfigsType = "UpdateAppAuthStrategyRequest_configs_1" + ConfigsTypeUpdateAppAuthStrategyRequestConfigs2 ConfigsType = "UpdateAppAuthStrategyRequest_configs_2" +) + +// Configs - JSON-B object containing the configuration for the OIDC strategy under the key 'openid-connect' or the configuration for the Key Auth strategy under the key 'key-auth' +type Configs struct { + UpdateAppAuthStrategyRequestConfigs1 *UpdateAppAuthStrategyRequestConfigs1 `queryParam:"inline"` + UpdateAppAuthStrategyRequestConfigs2 *UpdateAppAuthStrategyRequestConfigs2 `queryParam:"inline"` + + Type ConfigsType +} + +func CreateConfigsUpdateAppAuthStrategyRequestConfigs1(updateAppAuthStrategyRequestConfigs1 UpdateAppAuthStrategyRequestConfigs1) Configs { + typ := ConfigsTypeUpdateAppAuthStrategyRequestConfigs1 + + return Configs{ + UpdateAppAuthStrategyRequestConfigs1: &updateAppAuthStrategyRequestConfigs1, + Type: typ, + } +} + +func CreateConfigsUpdateAppAuthStrategyRequestConfigs2(updateAppAuthStrategyRequestConfigs2 UpdateAppAuthStrategyRequestConfigs2) Configs { + typ := ConfigsTypeUpdateAppAuthStrategyRequestConfigs2 + + return Configs{ + UpdateAppAuthStrategyRequestConfigs2: &updateAppAuthStrategyRequestConfigs2, + Type: typ, + } +} + +func (u *Configs) UnmarshalJSON(data []byte) error { + + var updateAppAuthStrategyRequestConfigs1 UpdateAppAuthStrategyRequestConfigs1 = UpdateAppAuthStrategyRequestConfigs1{} + if err := utils.UnmarshalJSON(data, &updateAppAuthStrategyRequestConfigs1, "", true, true); err == nil { + u.UpdateAppAuthStrategyRequestConfigs1 = &updateAppAuthStrategyRequestConfigs1 + u.Type = ConfigsTypeUpdateAppAuthStrategyRequestConfigs1 + return nil + } + + var updateAppAuthStrategyRequestConfigs2 UpdateAppAuthStrategyRequestConfigs2 = UpdateAppAuthStrategyRequestConfigs2{} + if err := utils.UnmarshalJSON(data, &updateAppAuthStrategyRequestConfigs2, "", true, true); err == nil { + u.UpdateAppAuthStrategyRequestConfigs2 = &updateAppAuthStrategyRequestConfigs2 + u.Type = ConfigsTypeUpdateAppAuthStrategyRequestConfigs2 + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Configs", string(data)) +} + +func (u Configs) MarshalJSON() ([]byte, error) { + if u.UpdateAppAuthStrategyRequestConfigs1 != nil { + return utils.MarshalJSON(u.UpdateAppAuthStrategyRequestConfigs1, "", true) + } + + if u.UpdateAppAuthStrategyRequestConfigs2 != nil { + return utils.MarshalJSON(u.UpdateAppAuthStrategyRequestConfigs2, "", true) + } + + return nil, errors.New("could not marshal union type Configs: all fields are null") +} + +// UpdateAppAuthStrategyRequest - Request body for updating an Application Auth Strategy +type UpdateAppAuthStrategyRequest struct { + // The name of the auth strategy. This is used to identify the auth strategy in the Konnect UI. + // + Name *string `json:"name,omitempty"` + // The display name of the Auth strategy. This is used to identify the Auth strategy in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Labels are intended to store **INTERNAL** metadata. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]*string `json:"labels,omitempty"` + DcrProviderID *string `json:"dcr_provider_id,omitempty"` + // JSON-B object containing the configuration for the OIDC strategy under the key 'openid-connect' or the configuration for the Key Auth strategy under the key 'key-auth' + Configs *Configs `json:"configs,omitempty"` +} + +func (o *UpdateAppAuthStrategyRequest) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *UpdateAppAuthStrategyRequest) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *UpdateAppAuthStrategyRequest) GetLabels() map[string]*string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *UpdateAppAuthStrategyRequest) GetDcrProviderID() *string { + if o == nil { + return nil + } + return o.DcrProviderID +} + +func (o *UpdateAppAuthStrategyRequest) GetConfigs() *Configs { + if o == nil { + return nil + } + return o.Configs +} diff --git a/tests/mockserver/internal/sdk/models/components/updateauthenticationsettings.go b/tests/mockserver/internal/sdk/models/components/updateauthenticationsettings.go new file mode 100644 index 00000000..fc322fba --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateauthenticationsettings.go @@ -0,0 +1,52 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateAuthenticationSettings - The request schema to update an organization's authentication settings. +type UpdateAuthenticationSettings struct { + // The organization has basic auth enabled. + BasicAuthEnabled *bool `json:"basic_auth_enabled,omitempty"` + // The organization has OIDC disabled. + OidcAuthEnabled *bool `json:"oidc_auth_enabled,omitempty"` + // The organization has SAML disabled. + SamlAuthEnabled *bool `json:"saml_auth_enabled,omitempty"` + // Whether IdP groups determine the Konnect teams a user has. + IdpMappingEnabled *bool `json:"idp_mapping_enabled,omitempty"` + // Whether a Konnect Identity Admin assigns teams to a user. + KonnectMappingEnabled *bool `json:"konnect_mapping_enabled,omitempty"` +} + +func (o *UpdateAuthenticationSettings) GetBasicAuthEnabled() *bool { + if o == nil { + return nil + } + return o.BasicAuthEnabled +} + +func (o *UpdateAuthenticationSettings) GetOidcAuthEnabled() *bool { + if o == nil { + return nil + } + return o.OidcAuthEnabled +} + +func (o *UpdateAuthenticationSettings) GetSamlAuthEnabled() *bool { + if o == nil { + return nil + } + return o.SamlAuthEnabled +} + +func (o *UpdateAuthenticationSettings) GetIdpMappingEnabled() *bool { + if o == nil { + return nil + } + return o.IdpMappingEnabled +} + +func (o *UpdateAuthenticationSettings) GetKonnectMappingEnabled() *bool { + if o == nil { + return nil + } + return o.KonnectMappingEnabled +} diff --git a/tests/mockserver/internal/sdk/models/components/updateconfigstore.go b/tests/mockserver/internal/sdk/models/components/updateconfigstore.go new file mode 100644 index 00000000..5197c019 --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/updateconfigstoresecret.go b/tests/mockserver/internal/sdk/models/components/updateconfigstoresecret.go new file mode 100644 index 00000000..44c63929 --- /dev/null +++ b/tests/mockserver/internal/sdk/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/tests/mockserver/internal/sdk/models/components/updatecontrolplanerequest.go b/tests/mockserver/internal/sdk/models/components/updatecontrolplanerequest.go new file mode 100644 index 00000000..11920461 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatecontrolplanerequest.go @@ -0,0 +1,87 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// UpdateControlPlaneRequestAuthType - The auth type value of the cluster associated with the Runtime Group. +type UpdateControlPlaneRequestAuthType string + +const ( + UpdateControlPlaneRequestAuthTypePinnedClientCerts UpdateControlPlaneRequestAuthType = "pinned_client_certs" + UpdateControlPlaneRequestAuthTypePkiClientCerts UpdateControlPlaneRequestAuthType = "pki_client_certs" +) + +func (e UpdateControlPlaneRequestAuthType) ToPointer() *UpdateControlPlaneRequestAuthType { + return &e +} +func (e *UpdateControlPlaneRequestAuthType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "pinned_client_certs": + fallthrough + case "pki_client_certs": + *e = UpdateControlPlaneRequestAuthType(v) + return nil + default: + return fmt.Errorf("invalid value for UpdateControlPlaneRequestAuthType: %v", v) + } +} + +// UpdateControlPlaneRequest - The request schema for the update control plane request. +type UpdateControlPlaneRequest struct { + // The name of the control plane. + Name *string `json:"name,omitempty"` + // The description of the control plane in Konnect. + Description *string `json:"description,omitempty"` + // The auth type value of the cluster associated with the Runtime Group. + AuthType *UpdateControlPlaneRequestAuthType `json:"auth_type,omitempty"` + // Array of proxy URLs associated with reaching the data-planes connected to a control-plane. + ProxyUrls []ProxyURL `json:"proxy_urls,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]string `json:"labels,omitempty"` +} + +func (o *UpdateControlPlaneRequest) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *UpdateControlPlaneRequest) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *UpdateControlPlaneRequest) GetAuthType() *UpdateControlPlaneRequestAuthType { + if o == nil { + return nil + } + return o.AuthType +} + +func (o *UpdateControlPlaneRequest) GetProxyUrls() []ProxyURL { + if o == nil { + return nil + } + return o.ProxyUrls +} + +func (o *UpdateControlPlaneRequest) GetLabels() map[string]string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/updatedcrconfigauth0inrequest.go b/tests/mockserver/internal/sdk/models/components/updatedcrconfigauth0inrequest.go new file mode 100644 index 00000000..3092f5b3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatedcrconfigauth0inrequest.go @@ -0,0 +1,49 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateDcrConfigAuth0InRequest - Payload to update an Auth0 DCR provider. +type UpdateDcrConfigAuth0InRequest struct { + // This ID should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientID *string `json:"initial_client_id,omitempty"` + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientSecret *string `json:"initial_client_secret,omitempty"` + // This is the audience value used for the initial client. + // If using a custom domain on Auth0, this must be set as to the Auth0 Management API audience value. + // If left blank, the issuer will be used instead. + // + InitialClientAudience *string `json:"initial_client_audience,omitempty"` + UseDeveloperManagedScopes *bool `json:"use_developer_managed_scopes,omitempty"` +} + +func (o *UpdateDcrConfigAuth0InRequest) GetInitialClientID() *string { + if o == nil { + return nil + } + return o.InitialClientID +} + +func (o *UpdateDcrConfigAuth0InRequest) GetInitialClientSecret() *string { + if o == nil { + return nil + } + return o.InitialClientSecret +} + +func (o *UpdateDcrConfigAuth0InRequest) GetInitialClientAudience() *string { + if o == nil { + return nil + } + return o.InitialClientAudience +} + +func (o *UpdateDcrConfigAuth0InRequest) GetUseDeveloperManagedScopes() *bool { + if o == nil { + return nil + } + return o.UseDeveloperManagedScopes +} diff --git a/tests/mockserver/internal/sdk/models/components/updatedcrconfigazureadinrequest.go b/tests/mockserver/internal/sdk/models/components/updatedcrconfigazureadinrequest.go new file mode 100644 index 00000000..1e53fdb0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatedcrconfigazureadinrequest.go @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateDcrConfigAzureAdInRequest - Payload to update an Azure AD DCR provider. +type UpdateDcrConfigAzureAdInRequest struct { + // This ID should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientID *string `json:"initial_client_id,omitempty"` + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientSecret *string `json:"initial_client_secret,omitempty"` +} + +func (o *UpdateDcrConfigAzureAdInRequest) GetInitialClientID() *string { + if o == nil { + return nil + } + return o.InitialClientID +} + +func (o *UpdateDcrConfigAzureAdInRequest) GetInitialClientSecret() *string { + if o == nil { + return nil + } + return o.InitialClientSecret +} diff --git a/tests/mockserver/internal/sdk/models/components/updatedcrconfigcurityinrequest.go b/tests/mockserver/internal/sdk/models/components/updatedcrconfigcurityinrequest.go new file mode 100644 index 00000000..bd076d79 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatedcrconfigcurityinrequest.go @@ -0,0 +1,29 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateDcrConfigCurityInRequest - Payload to update a Curity DCR provider. +type UpdateDcrConfigCurityInRequest struct { + // This ID should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientID *string `json:"initial_client_id,omitempty"` + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + InitialClientSecret *string `json:"initial_client_secret,omitempty"` +} + +func (o *UpdateDcrConfigCurityInRequest) GetInitialClientID() *string { + if o == nil { + return nil + } + return o.InitialClientID +} + +func (o *UpdateDcrConfigCurityInRequest) GetInitialClientSecret() *string { + if o == nil { + return nil + } + return o.InitialClientSecret +} diff --git a/tests/mockserver/internal/sdk/models/components/updatedcrconfighttpinrequest.go b/tests/mockserver/internal/sdk/models/components/updatedcrconfighttpinrequest.go new file mode 100644 index 00000000..35ca4ba1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatedcrconfighttpinrequest.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateDcrConfigHTTPInRequest - Payload to update an HTTP DCR provider. +type UpdateDcrConfigHTTPInRequest struct { + // The base URL of the DCR server. This is the URL that will be used to make the HTTP requests from Konnect to the DCR provider. + // This URL must be accessible from the Konnect service. + // + DcrBaseURL *string `json:"dcr_base_url,omitempty"` + // This is the API Key that will be sent with each HTTP request to the custom DCR server. It can be + // verified on the server to ensure that incoming requests are coming from Konnect. + // + APIKey *string `json:"api_key,omitempty"` + // This flag disables all the event-hooks on the application flow for the DCR provider. + DisableEventHooks *bool `json:"disable_event_hooks,omitempty"` + // This flag disable the refresh-secret endpoint on the application flow for the DCR provider. + DisableRefreshSecret *bool `json:"disable_refresh_secret,omitempty"` +} + +func (o *UpdateDcrConfigHTTPInRequest) GetDcrBaseURL() *string { + if o == nil { + return nil + } + return o.DcrBaseURL +} + +func (o *UpdateDcrConfigHTTPInRequest) GetAPIKey() *string { + if o == nil { + return nil + } + return o.APIKey +} + +func (o *UpdateDcrConfigHTTPInRequest) GetDisableEventHooks() *bool { + if o == nil { + return nil + } + return o.DisableEventHooks +} + +func (o *UpdateDcrConfigHTTPInRequest) GetDisableRefreshSecret() *bool { + if o == nil { + return nil + } + return o.DisableRefreshSecret +} diff --git a/tests/mockserver/internal/sdk/models/components/updatedcrconfigoktainrequest.go b/tests/mockserver/internal/sdk/models/components/updatedcrconfigoktainrequest.go new file mode 100644 index 00000000..84cf5969 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatedcrconfigoktainrequest.go @@ -0,0 +1,18 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateDcrConfigOktaInRequest - Payload to update an Okta DCR provider. +type UpdateDcrConfigOktaInRequest struct { + // This secret should be copied from your identity provider's settings after you create a client + // and assign it as the management client for DCR for this developer portal + // + DcrToken *string `json:"dcr_token,omitempty"` +} + +func (o *UpdateDcrConfigOktaInRequest) GetDcrToken() *string { + if o == nil { + return nil + } + return o.DcrToken +} diff --git a/tests/mockserver/internal/sdk/models/components/updatedcrproviderrequest.go b/tests/mockserver/internal/sdk/models/components/updatedcrproviderrequest.go new file mode 100644 index 00000000..aab3d680 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatedcrproviderrequest.go @@ -0,0 +1,192 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type DcrConfigType string + +const ( + DcrConfigTypeUpdateDcrConfigAuth0InRequest DcrConfigType = "UpdateDcrConfigAuth0InRequest" + DcrConfigTypeUpdateDcrConfigAzureAdInRequest DcrConfigType = "UpdateDcrConfigAzureAdInRequest" + DcrConfigTypeUpdateDcrConfigCurityInRequest DcrConfigType = "UpdateDcrConfigCurityInRequest" + DcrConfigTypeUpdateDcrConfigOktaInRequest DcrConfigType = "UpdateDcrConfigOktaInRequest" + DcrConfigTypeUpdateDcrConfigHTTPInRequest DcrConfigType = "UpdateDcrConfigHttpInRequest" +) + +type DcrConfig struct { + UpdateDcrConfigAuth0InRequest *UpdateDcrConfigAuth0InRequest `queryParam:"inline"` + UpdateDcrConfigAzureAdInRequest *UpdateDcrConfigAzureAdInRequest `queryParam:"inline"` + UpdateDcrConfigCurityInRequest *UpdateDcrConfigCurityInRequest `queryParam:"inline"` + UpdateDcrConfigOktaInRequest *UpdateDcrConfigOktaInRequest `queryParam:"inline"` + UpdateDcrConfigHTTPInRequest *UpdateDcrConfigHTTPInRequest `queryParam:"inline"` + + Type DcrConfigType +} + +func CreateDcrConfigUpdateDcrConfigAuth0InRequest(updateDcrConfigAuth0InRequest UpdateDcrConfigAuth0InRequest) DcrConfig { + typ := DcrConfigTypeUpdateDcrConfigAuth0InRequest + + return DcrConfig{ + UpdateDcrConfigAuth0InRequest: &updateDcrConfigAuth0InRequest, + Type: typ, + } +} + +func CreateDcrConfigUpdateDcrConfigAzureAdInRequest(updateDcrConfigAzureAdInRequest UpdateDcrConfigAzureAdInRequest) DcrConfig { + typ := DcrConfigTypeUpdateDcrConfigAzureAdInRequest + + return DcrConfig{ + UpdateDcrConfigAzureAdInRequest: &updateDcrConfigAzureAdInRequest, + Type: typ, + } +} + +func CreateDcrConfigUpdateDcrConfigCurityInRequest(updateDcrConfigCurityInRequest UpdateDcrConfigCurityInRequest) DcrConfig { + typ := DcrConfigTypeUpdateDcrConfigCurityInRequest + + return DcrConfig{ + UpdateDcrConfigCurityInRequest: &updateDcrConfigCurityInRequest, + Type: typ, + } +} + +func CreateDcrConfigUpdateDcrConfigOktaInRequest(updateDcrConfigOktaInRequest UpdateDcrConfigOktaInRequest) DcrConfig { + typ := DcrConfigTypeUpdateDcrConfigOktaInRequest + + return DcrConfig{ + UpdateDcrConfigOktaInRequest: &updateDcrConfigOktaInRequest, + Type: typ, + } +} + +func CreateDcrConfigUpdateDcrConfigHTTPInRequest(updateDcrConfigHTTPInRequest UpdateDcrConfigHTTPInRequest) DcrConfig { + typ := DcrConfigTypeUpdateDcrConfigHTTPInRequest + + return DcrConfig{ + UpdateDcrConfigHTTPInRequest: &updateDcrConfigHTTPInRequest, + Type: typ, + } +} + +func (u *DcrConfig) UnmarshalJSON(data []byte) error { + + var updateDcrConfigOktaInRequest UpdateDcrConfigOktaInRequest = UpdateDcrConfigOktaInRequest{} + if err := utils.UnmarshalJSON(data, &updateDcrConfigOktaInRequest, "", true, true); err == nil { + u.UpdateDcrConfigOktaInRequest = &updateDcrConfigOktaInRequest + u.Type = DcrConfigTypeUpdateDcrConfigOktaInRequest + return nil + } + + var updateDcrConfigAzureAdInRequest UpdateDcrConfigAzureAdInRequest = UpdateDcrConfigAzureAdInRequest{} + if err := utils.UnmarshalJSON(data, &updateDcrConfigAzureAdInRequest, "", true, true); err == nil { + u.UpdateDcrConfigAzureAdInRequest = &updateDcrConfigAzureAdInRequest + u.Type = DcrConfigTypeUpdateDcrConfigAzureAdInRequest + return nil + } + + var updateDcrConfigCurityInRequest UpdateDcrConfigCurityInRequest = UpdateDcrConfigCurityInRequest{} + if err := utils.UnmarshalJSON(data, &updateDcrConfigCurityInRequest, "", true, true); err == nil { + u.UpdateDcrConfigCurityInRequest = &updateDcrConfigCurityInRequest + u.Type = DcrConfigTypeUpdateDcrConfigCurityInRequest + return nil + } + + var updateDcrConfigAuth0InRequest UpdateDcrConfigAuth0InRequest = UpdateDcrConfigAuth0InRequest{} + if err := utils.UnmarshalJSON(data, &updateDcrConfigAuth0InRequest, "", true, true); err == nil { + u.UpdateDcrConfigAuth0InRequest = &updateDcrConfigAuth0InRequest + u.Type = DcrConfigTypeUpdateDcrConfigAuth0InRequest + return nil + } + + var updateDcrConfigHTTPInRequest UpdateDcrConfigHTTPInRequest = UpdateDcrConfigHTTPInRequest{} + if err := utils.UnmarshalJSON(data, &updateDcrConfigHTTPInRequest, "", true, true); err == nil { + u.UpdateDcrConfigHTTPInRequest = &updateDcrConfigHTTPInRequest + u.Type = DcrConfigTypeUpdateDcrConfigHTTPInRequest + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for DcrConfig", string(data)) +} + +func (u DcrConfig) MarshalJSON() ([]byte, error) { + if u.UpdateDcrConfigAuth0InRequest != nil { + return utils.MarshalJSON(u.UpdateDcrConfigAuth0InRequest, "", true) + } + + if u.UpdateDcrConfigAzureAdInRequest != nil { + return utils.MarshalJSON(u.UpdateDcrConfigAzureAdInRequest, "", true) + } + + if u.UpdateDcrConfigCurityInRequest != nil { + return utils.MarshalJSON(u.UpdateDcrConfigCurityInRequest, "", true) + } + + if u.UpdateDcrConfigOktaInRequest != nil { + return utils.MarshalJSON(u.UpdateDcrConfigOktaInRequest, "", true) + } + + if u.UpdateDcrConfigHTTPInRequest != nil { + return utils.MarshalJSON(u.UpdateDcrConfigHTTPInRequest, "", true) + } + + return nil, errors.New("could not marshal union type DcrConfig: all fields are null") +} + +// UpdateDcrProviderRequest - A set of updates to a DCR provider. The provider_type cannot be updated after creation. +type UpdateDcrProviderRequest struct { + // The name of the DCR provider. This is used to identify the DCR provider in the Konnect UI. + // + Name *string `json:"name,omitempty"` + // The display name of the DCR provider. This is used to identify the DCR provider in the Portal UI. + // + DisplayName *string `json:"display_name,omitempty"` + Issuer *string `json:"issuer,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Labels are intended to store **INTERNAL** metadata. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]*string `json:"labels,omitempty"` + DcrConfig *DcrConfig `json:"dcr_config,omitempty"` +} + +func (o *UpdateDcrProviderRequest) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *UpdateDcrProviderRequest) GetDisplayName() *string { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *UpdateDcrProviderRequest) GetIssuer() *string { + if o == nil { + return nil + } + return o.Issuer +} + +func (o *UpdateDcrProviderRequest) GetLabels() map[string]*string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *UpdateDcrProviderRequest) GetDcrConfig() *DcrConfig { + if o == nil { + return nil + } + return o.DcrConfig +} diff --git a/tests/mockserver/internal/sdk/models/components/updateidentityprovider.go b/tests/mockserver/internal/sdk/models/components/updateidentityprovider.go new file mode 100644 index 00000000..7c41b74c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateidentityprovider.go @@ -0,0 +1,115 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "errors" + "fmt" + "mockserver/internal/sdk/utils" +) + +type UpdateIdentityProviderConfigType string + +const ( + UpdateIdentityProviderConfigTypeConfigureOIDCIdentityProviderConfig UpdateIdentityProviderConfigType = "ConfigureOIDCIdentityProviderConfig" + UpdateIdentityProviderConfigTypeSAMLIdentityProviderConfigInput UpdateIdentityProviderConfigType = "SAMLIdentityProviderConfig_input" +) + +type UpdateIdentityProviderConfig struct { + ConfigureOIDCIdentityProviderConfig *ConfigureOIDCIdentityProviderConfig `queryParam:"inline"` + SAMLIdentityProviderConfigInput *SAMLIdentityProviderConfigInput `queryParam:"inline"` + + Type UpdateIdentityProviderConfigType +} + +func CreateUpdateIdentityProviderConfigConfigureOIDCIdentityProviderConfig(configureOIDCIdentityProviderConfig ConfigureOIDCIdentityProviderConfig) UpdateIdentityProviderConfig { + typ := UpdateIdentityProviderConfigTypeConfigureOIDCIdentityProviderConfig + + return UpdateIdentityProviderConfig{ + ConfigureOIDCIdentityProviderConfig: &configureOIDCIdentityProviderConfig, + Type: typ, + } +} + +func CreateUpdateIdentityProviderConfigSAMLIdentityProviderConfigInput(samlIdentityProviderConfigInput SAMLIdentityProviderConfigInput) UpdateIdentityProviderConfig { + typ := UpdateIdentityProviderConfigTypeSAMLIdentityProviderConfigInput + + return UpdateIdentityProviderConfig{ + SAMLIdentityProviderConfigInput: &samlIdentityProviderConfigInput, + Type: typ, + } +} + +func (u *UpdateIdentityProviderConfig) UnmarshalJSON(data []byte) error { + + var samlIdentityProviderConfigInput SAMLIdentityProviderConfigInput = SAMLIdentityProviderConfigInput{} + if err := utils.UnmarshalJSON(data, &samlIdentityProviderConfigInput, "", true, true); err == nil { + u.SAMLIdentityProviderConfigInput = &samlIdentityProviderConfigInput + u.Type = UpdateIdentityProviderConfigTypeSAMLIdentityProviderConfigInput + return nil + } + + var configureOIDCIdentityProviderConfig ConfigureOIDCIdentityProviderConfig = ConfigureOIDCIdentityProviderConfig{} + if err := utils.UnmarshalJSON(data, &configureOIDCIdentityProviderConfig, "", true, true); err == nil { + u.ConfigureOIDCIdentityProviderConfig = &configureOIDCIdentityProviderConfig + u.Type = UpdateIdentityProviderConfigTypeConfigureOIDCIdentityProviderConfig + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for UpdateIdentityProviderConfig", string(data)) +} + +func (u UpdateIdentityProviderConfig) MarshalJSON() ([]byte, error) { + if u.ConfigureOIDCIdentityProviderConfig != nil { + return utils.MarshalJSON(u.ConfigureOIDCIdentityProviderConfig, "", true) + } + + if u.SAMLIdentityProviderConfigInput != nil { + return utils.MarshalJSON(u.SAMLIdentityProviderConfigInput, "", true) + } + + return nil, errors.New("could not marshal union type UpdateIdentityProviderConfig: all fields are null") +} + +// UpdateIdentityProvider - The identity provider that contains configuration data for updating an authentication integration. +type UpdateIdentityProvider struct { + // Indicates whether the identity provider is enabled. + // Only one identity provider can be active at a time, such as SAML or OIDC. + // + Enabled *bool `default:"false" json:"enabled"` + // The path used for initiating login requests with the identity provider. + LoginPath *string `json:"login_path,omitempty"` + Config *UpdateIdentityProviderConfig `json:"config,omitempty"` +} + +func (u UpdateIdentityProvider) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateIdentityProvider) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + return err + } + return nil +} + +func (o *UpdateIdentityProvider) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} + +func (o *UpdateIdentityProvider) GetLoginPath() *string { + if o == nil { + return nil + } + return o.LoginPath +} + +func (o *UpdateIdentityProvider) GetConfig() *UpdateIdentityProviderConfig { + if o == nil { + return nil + } + return o.Config +} diff --git a/tests/mockserver/internal/sdk/models/components/updateidpconfiguration.go b/tests/mockserver/internal/sdk/models/components/updateidpconfiguration.go new file mode 100644 index 00000000..36457f2f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateidpconfiguration.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type ClaimMappingsRequestBody struct { + Name *string `json:"name,omitempty"` + Email *string `json:"email,omitempty"` + Groups *string `json:"groups,omitempty"` +} + +func (o *ClaimMappingsRequestBody) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ClaimMappingsRequestBody) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *ClaimMappingsRequestBody) GetGroups() *string { + if o == nil { + return nil + } + return o.Groups +} + +// UpdateIDPConfiguration - The request schema for the update IdP configuration request. +type UpdateIDPConfiguration struct { + Issuer *string `json:"issuer,omitempty"` + LoginPath *string `json:"login_path,omitempty"` + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + Scopes []string `json:"scopes,omitempty"` + ClaimMappings *ClaimMappingsRequestBody `json:"claim_mappings,omitempty"` +} + +func (o *UpdateIDPConfiguration) GetIssuer() *string { + if o == nil { + return nil + } + return o.Issuer +} + +func (o *UpdateIDPConfiguration) GetLoginPath() *string { + if o == nil { + return nil + } + return o.LoginPath +} + +func (o *UpdateIDPConfiguration) GetClientID() *string { + if o == nil { + return nil + } + return o.ClientID +} + +func (o *UpdateIDPConfiguration) GetClientSecret() *string { + if o == nil { + return nil + } + return o.ClientSecret +} + +func (o *UpdateIDPConfiguration) GetScopes() []string { + if o == nil { + return nil + } + return o.Scopes +} + +func (o *UpdateIDPConfiguration) GetClaimMappings() *ClaimMappingsRequestBody { + if o == nil { + return nil + } + return o.ClaimMappings +} diff --git a/tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsrequest.go b/tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsrequest.go new file mode 100644 index 00000000..878f76f3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsrequest.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateImpersonationSettingsRequest - The request schema for adding a system account to a team. +type UpdateImpersonationSettingsRequest struct { + // Indicates if user impersonation is allowed for the organization. + Enabled *bool `json:"enabled,omitempty"` +} + +func (o *UpdateImpersonationSettingsRequest) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} diff --git a/tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsresponse.go b/tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsresponse.go new file mode 100644 index 00000000..7f06f69d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateimpersonationsettingsresponse.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateImpersonationSettingsResponse - Response for Update Impersonation Settings endpoint +type UpdateImpersonationSettingsResponse struct { + // The organization has user impersonation enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +func (o *UpdateImpersonationSettingsResponse) GetEnabled() *bool { + if o == nil { + return nil + } + return o.Enabled +} diff --git a/tests/mockserver/internal/sdk/models/components/updatesystemaccount.go b/tests/mockserver/internal/sdk/models/components/updatesystemaccount.go new file mode 100644 index 00000000..a973ad47 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatesystemaccount.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateSystemAccount - The request schema for the update system account request. +type UpdateSystemAccount struct { + // Name of the system account. + Name *string `json:"name,omitempty"` + // Description of the system account. + Description *string `json:"description,omitempty"` +} + +func (o *UpdateSystemAccount) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *UpdateSystemAccount) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} diff --git a/tests/mockserver/internal/sdk/models/components/updatesystemaccountaccesstoken.go b/tests/mockserver/internal/sdk/models/components/updatesystemaccountaccesstoken.go new file mode 100644 index 00000000..e60090fb --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updatesystemaccountaccesstoken.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type UpdateSystemAccountAccessToken struct { + // Name of the system account access token. + Name *string `json:"name,omitempty"` +} + +func (o *UpdateSystemAccountAccessToken) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/tests/mockserver/internal/sdk/models/components/updateteam.go b/tests/mockserver/internal/sdk/models/components/updateteam.go new file mode 100644 index 00000000..9bb15d15 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateteam.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateTeam - The request schema for the update team request. +type UpdateTeam struct { + // The name of the team. + Name *string `json:"name,omitempty"` + // The description of the team. + Description *string `json:"description,omitempty"` + // Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. + // + // Labels are intended to store **INTERNAL** metadata. + // + // Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_". + // + Labels map[string]*string `json:"labels,omitempty"` +} + +func (o *UpdateTeam) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *UpdateTeam) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *UpdateTeam) GetLabels() map[string]*string { + if o == nil { + return nil + } + return o.Labels +} diff --git a/tests/mockserver/internal/sdk/models/components/updateteammappings.go b/tests/mockserver/internal/sdk/models/components/updateteammappings.go new file mode 100644 index 00000000..c34b7f28 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateteammappings.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type Mapping struct { + Group *string `json:"group,omitempty"` + TeamIds []string `json:"team_ids,omitempty"` +} + +func (o *Mapping) GetGroup() *string { + if o == nil { + return nil + } + return o.Group +} + +func (o *Mapping) GetTeamIds() []string { + if o == nil { + return nil + } + return o.TeamIds +} + +// UpdateTeamMappings - The request schema for updating IdP team mappings. +type UpdateTeamMappings struct { + // The mappings object. + Mappings []Mapping `json:"mappings,omitempty"` +} + +func (o *UpdateTeamMappings) GetMappings() []Mapping { + if o == nil { + return nil + } + return o.Mappings +} diff --git a/tests/mockserver/internal/sdk/models/components/updateuser.go b/tests/mockserver/internal/sdk/models/components/updateuser.go new file mode 100644 index 00000000..db1a9375 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/updateuser.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UpdateUser - The request schema for the update user request. +type UpdateUser struct { + // The user's full name. + FullName *string `json:"full_name,omitempty"` + // The user's desired name. + PreferredName *string `json:"preferred_name,omitempty"` +} + +func (o *UpdateUser) GetFullName() *string { + if o == nil { + return nil + } + return o.FullName +} + +func (o *UpdateUser) GetPreferredName() *string { + if o == nil { + return nil + } + return o.PreferredName +} diff --git a/tests/mockserver/internal/sdk/models/components/upstream.go b/tests/mockserver/internal/sdk/models/components/upstream.go new file mode 100644 index 00000000..7526e8ba --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/upstream.go @@ -0,0 +1,657 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// UpstreamAlgorithm - Which load balancing algorithm to use. +type UpstreamAlgorithm string + +const ( + UpstreamAlgorithmConsistentHashing UpstreamAlgorithm = "consistent-hashing" + UpstreamAlgorithmLeastConnections UpstreamAlgorithm = "least-connections" + UpstreamAlgorithmRoundRobin UpstreamAlgorithm = "round-robin" + UpstreamAlgorithmLatency UpstreamAlgorithm = "latency" +) + +func (e UpstreamAlgorithm) ToPointer() *UpstreamAlgorithm { + return &e +} +func (e *UpstreamAlgorithm) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "consistent-hashing": + fallthrough + case "least-connections": + fallthrough + case "round-robin": + fallthrough + case "latency": + *e = UpstreamAlgorithm(v) + return nil + default: + return fmt.Errorf("invalid value for UpstreamAlgorithm: %v", v) + } +} + +// UpstreamClientCertificate - If set, the certificate to be used as client certificate while TLS handshaking to the upstream server. +type UpstreamClientCertificate struct { + ID *string `json:"id,omitempty"` +} + +func (o *UpstreamClientCertificate) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +// HashFallback - What to use as hashing input if the primary `hash_on` does not return a hash (eg. header is missing, or no Consumer identified). Not available if `hash_on` is set to `cookie`. +type HashFallback string + +const ( + HashFallbackNone HashFallback = "none" + HashFallbackConsumer HashFallback = "consumer" + HashFallbackIP HashFallback = "ip" + HashFallbackHeader HashFallback = "header" + HashFallbackCookie HashFallback = "cookie" + HashFallbackPath HashFallback = "path" + HashFallbackQueryArg HashFallback = "query_arg" + HashFallbackURICapture HashFallback = "uri_capture" +) + +func (e HashFallback) ToPointer() *HashFallback { + return &e +} +func (e *HashFallback) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "none": + fallthrough + case "consumer": + fallthrough + case "ip": + fallthrough + case "header": + fallthrough + case "cookie": + fallthrough + case "path": + fallthrough + case "query_arg": + fallthrough + case "uri_capture": + *e = HashFallback(v) + return nil + default: + return fmt.Errorf("invalid value for HashFallback: %v", v) + } +} + +// HashOn - What to use as hashing input. Using `none` results in a weighted-round-robin scheme with no hashing. +type HashOn string + +const ( + HashOnNone HashOn = "none" + HashOnConsumer HashOn = "consumer" + HashOnIP HashOn = "ip" + HashOnHeader HashOn = "header" + HashOnCookie HashOn = "cookie" + HashOnPath HashOn = "path" + HashOnQueryArg HashOn = "query_arg" + HashOnURICapture HashOn = "uri_capture" +) + +func (e HashOn) ToPointer() *HashOn { + return &e +} +func (e *HashOn) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "none": + fallthrough + case "consumer": + fallthrough + case "ip": + fallthrough + case "header": + fallthrough + case "cookie": + fallthrough + case "path": + fallthrough + case "query_arg": + fallthrough + case "uri_capture": + *e = HashOn(v) + return nil + default: + return fmt.Errorf("invalid value for HashOn: %v", v) + } +} + +type ActiveHealthy struct { + HTTPStatuses []int64 `json:"http_statuses,omitempty"` + Interval *float64 `json:"interval,omitempty"` + Successes *int64 `json:"successes,omitempty"` +} + +func (o *ActiveHealthy) GetHTTPStatuses() []int64 { + if o == nil { + return nil + } + return o.HTTPStatuses +} + +func (o *ActiveHealthy) GetInterval() *float64 { + if o == nil { + return nil + } + return o.Interval +} + +func (o *ActiveHealthy) GetSuccesses() *int64 { + if o == nil { + return nil + } + return o.Successes +} + +type ActiveType string + +const ( + ActiveTypeTCP ActiveType = "tcp" + ActiveTypeHTTP ActiveType = "http" + ActiveTypeHTTPS ActiveType = "https" + ActiveTypeGrpc ActiveType = "grpc" + ActiveTypeGrpcs ActiveType = "grpcs" +) + +func (e ActiveType) ToPointer() *ActiveType { + return &e +} +func (e *ActiveType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "tcp": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "grpc": + fallthrough + case "grpcs": + *e = ActiveType(v) + return nil + default: + return fmt.Errorf("invalid value for ActiveType: %v", v) + } +} + +type ActiveUnhealthy struct { + HTTPFailures *int64 `json:"http_failures,omitempty"` + HTTPStatuses []int64 `json:"http_statuses,omitempty"` + Interval *float64 `json:"interval,omitempty"` + TCPFailures *int64 `json:"tcp_failures,omitempty"` + Timeouts *int64 `json:"timeouts,omitempty"` +} + +func (o *ActiveUnhealthy) GetHTTPFailures() *int64 { + if o == nil { + return nil + } + return o.HTTPFailures +} + +func (o *ActiveUnhealthy) GetHTTPStatuses() []int64 { + if o == nil { + return nil + } + return o.HTTPStatuses +} + +func (o *ActiveUnhealthy) GetInterval() *float64 { + if o == nil { + return nil + } + return o.Interval +} + +func (o *ActiveUnhealthy) GetTCPFailures() *int64 { + if o == nil { + return nil + } + return o.TCPFailures +} + +func (o *ActiveUnhealthy) GetTimeouts() *int64 { + if o == nil { + return nil + } + return o.Timeouts +} + +type Active struct { + Concurrency *int64 `json:"concurrency,omitempty"` + Headers map[string]string `json:"headers,omitempty"` + Healthy *ActiveHealthy `json:"healthy,omitempty"` + HTTPPath *string `json:"http_path,omitempty"` + HTTPSSni *string `json:"https_sni,omitempty"` + HTTPSVerifyCertificate *bool `json:"https_verify_certificate,omitempty"` + Timeout *float64 `json:"timeout,omitempty"` + Type *ActiveType `json:"type,omitempty"` + Unhealthy *ActiveUnhealthy `json:"unhealthy,omitempty"` +} + +func (o *Active) GetConcurrency() *int64 { + if o == nil { + return nil + } + return o.Concurrency +} + +func (o *Active) GetHeaders() map[string]string { + if o == nil { + return nil + } + return o.Headers +} + +func (o *Active) GetHealthy() *ActiveHealthy { + if o == nil { + return nil + } + return o.Healthy +} + +func (o *Active) GetHTTPPath() *string { + if o == nil { + return nil + } + return o.HTTPPath +} + +func (o *Active) GetHTTPSSni() *string { + if o == nil { + return nil + } + return o.HTTPSSni +} + +func (o *Active) GetHTTPSVerifyCertificate() *bool { + if o == nil { + return nil + } + return o.HTTPSVerifyCertificate +} + +func (o *Active) GetTimeout() *float64 { + if o == nil { + return nil + } + return o.Timeout +} + +func (o *Active) GetType() *ActiveType { + if o == nil { + return nil + } + return o.Type +} + +func (o *Active) GetUnhealthy() *ActiveUnhealthy { + if o == nil { + return nil + } + return o.Unhealthy +} + +type PassiveHealthy struct { + HTTPStatuses []int64 `json:"http_statuses,omitempty"` + Successes *int64 `json:"successes,omitempty"` +} + +func (o *PassiveHealthy) GetHTTPStatuses() []int64 { + if o == nil { + return nil + } + return o.HTTPStatuses +} + +func (o *PassiveHealthy) GetSuccesses() *int64 { + if o == nil { + return nil + } + return o.Successes +} + +type PassiveType string + +const ( + PassiveTypeTCP PassiveType = "tcp" + PassiveTypeHTTP PassiveType = "http" + PassiveTypeHTTPS PassiveType = "https" + PassiveTypeGrpc PassiveType = "grpc" + PassiveTypeGrpcs PassiveType = "grpcs" +) + +func (e PassiveType) ToPointer() *PassiveType { + return &e +} +func (e *PassiveType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "tcp": + fallthrough + case "http": + fallthrough + case "https": + fallthrough + case "grpc": + fallthrough + case "grpcs": + *e = PassiveType(v) + return nil + default: + return fmt.Errorf("invalid value for PassiveType: %v", v) + } +} + +type PassiveUnhealthy struct { + HTTPFailures *int64 `json:"http_failures,omitempty"` + HTTPStatuses []int64 `json:"http_statuses,omitempty"` + TCPFailures *int64 `json:"tcp_failures,omitempty"` + Timeouts *int64 `json:"timeouts,omitempty"` +} + +func (o *PassiveUnhealthy) GetHTTPFailures() *int64 { + if o == nil { + return nil + } + return o.HTTPFailures +} + +func (o *PassiveUnhealthy) GetHTTPStatuses() []int64 { + if o == nil { + return nil + } + return o.HTTPStatuses +} + +func (o *PassiveUnhealthy) GetTCPFailures() *int64 { + if o == nil { + return nil + } + return o.TCPFailures +} + +func (o *PassiveUnhealthy) GetTimeouts() *int64 { + if o == nil { + return nil + } + return o.Timeouts +} + +type Passive struct { + Healthy *PassiveHealthy `json:"healthy,omitempty"` + Type *PassiveType `json:"type,omitempty"` + Unhealthy *PassiveUnhealthy `json:"unhealthy,omitempty"` +} + +func (o *Passive) GetHealthy() *PassiveHealthy { + if o == nil { + return nil + } + return o.Healthy +} + +func (o *Passive) GetType() *PassiveType { + if o == nil { + return nil + } + return o.Type +} + +func (o *Passive) GetUnhealthy() *PassiveUnhealthy { + if o == nil { + return nil + } + return o.Unhealthy +} + +type Healthchecks struct { + Active *Active `json:"active,omitempty"` + Passive *Passive `json:"passive,omitempty"` + Threshold *float64 `json:"threshold,omitempty"` +} + +func (o *Healthchecks) GetActive() *Active { + if o == nil { + return nil + } + return o.Active +} + +func (o *Healthchecks) GetPassive() *Passive { + if o == nil { + return nil + } + return o.Passive +} + +func (o *Healthchecks) GetThreshold() *float64 { + if o == nil { + return nil + } + return o.Threshold +} + +// Upstream - The upstream object represents a virtual hostname and can be used to loadbalance incoming requests over multiple services (targets). So for example an upstream named `service.v1.xyz` for a Service object whose `host` is `service.v1.xyz`. Requests for this Service would be proxied to the targets defined within the upstream. An upstream also includes a [health checker][healthchecks], which is able to enable and disable targets based on their ability or inability to serve requests. The configuration for the health checker is stored in the upstream object, and applies to all of its targets. +type Upstream struct { + // Which load balancing algorithm to use. + Algorithm *UpstreamAlgorithm `json:"algorithm,omitempty"` + // If set, the certificate to be used as client certificate while TLS handshaking to the upstream server. + ClientCertificate *UpstreamClientCertificate `json:"client_certificate,omitempty"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // What to use as hashing input if the primary `hash_on` does not return a hash (eg. header is missing, or no Consumer identified). Not available if `hash_on` is set to `cookie`. + HashFallback *HashFallback `json:"hash_fallback,omitempty"` + // The header name to take the value from as hash input. Only required when `hash_fallback` is set to `header`. + HashFallbackHeader *string `json:"hash_fallback_header,omitempty"` + // The name of the query string argument to take the value from as hash input. Only required when `hash_fallback` is set to `query_arg`. + HashFallbackQueryArg *string `json:"hash_fallback_query_arg,omitempty"` + // The name of the route URI capture to take the value from as hash input. Only required when `hash_fallback` is set to `uri_capture`. + HashFallbackURICapture *string `json:"hash_fallback_uri_capture,omitempty"` + // What to use as hashing input. Using `none` results in a weighted-round-robin scheme with no hashing. + HashOn *HashOn `json:"hash_on,omitempty"` + // The cookie name to take the value from as hash input. Only required when `hash_on` or `hash_fallback` is set to `cookie`. If the specified cookie is not in the request, Kong will generate a value and set the cookie in the response. + HashOnCookie *string `json:"hash_on_cookie,omitempty"` + // The cookie path to set in the response headers. Only required when `hash_on` or `hash_fallback` is set to `cookie`. + HashOnCookiePath *string `json:"hash_on_cookie_path,omitempty"` + // The header name to take the value from as hash input. Only required when `hash_on` is set to `header`. + HashOnHeader *string `json:"hash_on_header,omitempty"` + // The name of the query string argument to take the value from as hash input. Only required when `hash_on` is set to `query_arg`. + HashOnQueryArg *string `json:"hash_on_query_arg,omitempty"` + // The name of the route URI capture to take the value from as hash input. Only required when `hash_on` is set to `uri_capture`. + HashOnURICapture *string `json:"hash_on_uri_capture,omitempty"` + Healthchecks *Healthchecks `json:"healthchecks,omitempty"` + // The hostname to be used as `Host` header when proxying requests through Kong. + HostHeader *string `json:"host_header,omitempty"` + ID *string `json:"id,omitempty"` + // This is a hostname, which must be equal to the `host` of a Service. + Name string `json:"name"` + // The number of slots in the load balancer algorithm. If `algorithm` is set to `round-robin`, this setting determines the maximum number of slots. If `algorithm` is set to `consistent-hashing`, this setting determines the actual number of slots in the algorithm. Accepts an integer in the range `10`-`65536`. + Slots *int64 `json:"slots,omitempty"` + // An optional set of strings associated with the Upstream for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` + // If set, the balancer will use SRV hostname(if DNS Answer has SRV record) as the proxy upstream `Host`. + UseSrvName *bool `json:"use_srv_name,omitempty"` +} + +func (o *Upstream) GetAlgorithm() *UpstreamAlgorithm { + if o == nil { + return nil + } + return o.Algorithm +} + +func (o *Upstream) GetClientCertificate() *UpstreamClientCertificate { + if o == nil { + return nil + } + return o.ClientCertificate +} + +func (o *Upstream) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Upstream) GetHashFallback() *HashFallback { + if o == nil { + return nil + } + return o.HashFallback +} + +func (o *Upstream) GetHashFallbackHeader() *string { + if o == nil { + return nil + } + return o.HashFallbackHeader +} + +func (o *Upstream) GetHashFallbackQueryArg() *string { + if o == nil { + return nil + } + return o.HashFallbackQueryArg +} + +func (o *Upstream) GetHashFallbackURICapture() *string { + if o == nil { + return nil + } + return o.HashFallbackURICapture +} + +func (o *Upstream) GetHashOn() *HashOn { + if o == nil { + return nil + } + return o.HashOn +} + +func (o *Upstream) GetHashOnCookie() *string { + if o == nil { + return nil + } + return o.HashOnCookie +} + +func (o *Upstream) GetHashOnCookiePath() *string { + if o == nil { + return nil + } + return o.HashOnCookiePath +} + +func (o *Upstream) GetHashOnHeader() *string { + if o == nil { + return nil + } + return o.HashOnHeader +} + +func (o *Upstream) GetHashOnQueryArg() *string { + if o == nil { + return nil + } + return o.HashOnQueryArg +} + +func (o *Upstream) GetHashOnURICapture() *string { + if o == nil { + return nil + } + return o.HashOnURICapture +} + +func (o *Upstream) GetHealthchecks() *Healthchecks { + if o == nil { + return nil + } + return o.Healthchecks +} + +func (o *Upstream) GetHostHeader() *string { + if o == nil { + return nil + } + return o.HostHeader +} + +func (o *Upstream) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Upstream) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *Upstream) GetSlots() *int64 { + if o == nil { + return nil + } + return o.Slots +} + +func (o *Upstream) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Upstream) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *Upstream) GetUseSrvName() *bool { + if o == nil { + return nil + } + return o.UseSrvName +} diff --git a/tests/mockserver/internal/sdk/models/components/user.go b/tests/mockserver/internal/sdk/models/components/user.go new file mode 100644 index 00000000..9763beef --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/user.go @@ -0,0 +1,95 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// User - The user object contains information about an individual user who can use the Konnect application and API. +type User struct { + // The User ID. + ID *string `json:"id,omitempty"` + // The email registered to the user. + Email *string `json:"email,omitempty"` + // The User's full name. + FullName *string `json:"full_name,omitempty"` + // The User's preferred name. + PreferredName *string `json:"preferred_name,omitempty"` + // Returns True if a user has verified their email address. + Active *bool `json:"active,omitempty"` + // The Konnect region closest to the user's IP address. This property might only be set for users on signup through Konnect’s build-in native authentication. + InferredRegion *string `json:"inferred_region,omitempty"` + // The time stamp for the date the account was registered. + CreatedAt *time.Time `json:"created_at,omitempty"` + // A Unix timestamp representation of the most recent change to the User account. + UpdatedAt *time.Time `json:"updated_at,omitempty"` +} + +func (u User) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *User) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + return err + } + return nil +} + +func (o *User) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *User) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *User) GetFullName() *string { + if o == nil { + return nil + } + return o.FullName +} + +func (o *User) GetPreferredName() *string { + if o == nil { + return nil + } + return o.PreferredName +} + +func (o *User) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +func (o *User) GetInferredRegion() *string { + if o == nil { + return nil + } + return o.InferredRegion +} + +func (o *User) GetCreatedAt() *time.Time { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *User) GetUpdatedAt() *time.Time { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/usercollection.go b/tests/mockserver/internal/sdk/models/components/usercollection.go new file mode 100644 index 00000000..09490ea7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/usercollection.go @@ -0,0 +1,24 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UserCollection - A paginated list response for a collection of users. +type UserCollection struct { + // returns the pagination information + Meta *PaginatedMeta `json:"meta,omitempty"` + Data []User `json:"data,omitempty"` +} + +func (o *UserCollection) GetMeta() *PaginatedMeta { + if o == nil { + return nil + } + return o.Meta +} + +func (o *UserCollection) GetData() []User { + if o == nil { + return nil + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/userconfiguration.go b/tests/mockserver/internal/sdk/models/components/userconfiguration.go new file mode 100644 index 00000000..fff85a43 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/userconfiguration.go @@ -0,0 +1,55 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UserConfiguration - Properties of an event. +type UserConfiguration struct { + EventID string `json:"event_id"` + EventTitle string `json:"event_title"` + EventDescription string `json:"event_description"` + EventNamespace NotificationNamespace `json:"event_namespace"` + EventSubscriptionCount int64 `json:"event_subscription_count"` + DefaultSubscription []DefaultSubscription `json:"default_subscription"` +} + +func (o *UserConfiguration) GetEventID() string { + if o == nil { + return "" + } + return o.EventID +} + +func (o *UserConfiguration) GetEventTitle() string { + if o == nil { + return "" + } + return o.EventTitle +} + +func (o *UserConfiguration) GetEventDescription() string { + if o == nil { + return "" + } + return o.EventDescription +} + +func (o *UserConfiguration) GetEventNamespace() NotificationNamespace { + if o == nil { + return NotificationNamespace("") + } + return o.EventNamespace +} + +func (o *UserConfiguration) GetEventSubscriptionCount() int64 { + if o == nil { + return 0 + } + return o.EventSubscriptionCount +} + +func (o *UserConfiguration) GetDefaultSubscription() []DefaultSubscription { + if o == nil { + return []DefaultSubscription{} + } + return o.DefaultSubscription +} diff --git a/tests/mockserver/internal/sdk/models/components/userconfigurationlistresponse.go b/tests/mockserver/internal/sdk/models/components/userconfigurationlistresponse.go new file mode 100644 index 00000000..85a250e2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/userconfigurationlistresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UserConfigurationListResponse - A paginated list response for all notification events and user subscriptions. +type UserConfigurationListResponse struct { + Data []UserConfiguration `json:"data"` +} + +func (o *UserConfigurationListResponse) GetData() []UserConfiguration { + if o == nil { + return []UserConfiguration{} + } + return o.Data +} diff --git a/tests/mockserver/internal/sdk/models/components/uuidfieldfilter.go b/tests/mockserver/internal/sdk/models/components/uuidfieldfilter.go new file mode 100644 index 00000000..f79d99eb --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/uuidfieldfilter.go @@ -0,0 +1,31 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// UUIDFieldFilter - Filters on the given string field value by exact match inequality. +type UUIDFieldFilter struct { + Eq *string `queryParam:"name=eq"` + Oeq *string `queryParam:"name=oeq"` + Neq *string `queryParam:"name=neq"` +} + +func (o *UUIDFieldFilter) GetEq() *string { + if o == nil { + return nil + } + return o.Eq +} + +func (o *UUIDFieldFilter) GetOeq() *string { + if o == nil { + return nil + } + return o.Oeq +} + +func (o *UUIDFieldFilter) GetNeq() *string { + if o == nil { + return nil + } + return o.Neq +} diff --git a/tests/mockserver/internal/sdk/models/components/vault.go b/tests/mockserver/internal/sdk/models/components/vault.go new file mode 100644 index 00000000..4b570109 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/vault.go @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// Vault entities are used to configure different Vault connectors. Examples of Vaults are Environment Variables, Hashicorp Vault and AWS Secrets Manager. Configuring a Vault allows referencing the secrets with other entities. For example a certificate entity can store a reference to a certificate and key, stored in a vault, instead of storing the certificate and key within the entity. This allows a proper separation of secrets and configuration and prevents secret sprawl. +type Vault struct { + // The configuration properties for the Vault which can be found on the vaults' documentation page. + Config map[string]any `json:"config"` + // Unix epoch when the resource was created. + CreatedAt *int64 `json:"created_at,omitempty"` + // The description of the Vault entity. + Description *string `json:"description,omitempty"` + ID *string `json:"id,omitempty"` + // The name of the Vault that's going to be added. Currently, the Vault implementation must be installed in every Kong instance. + Name string `json:"name"` + // The unique prefix (or identifier) for this Vault configuration. The prefix is used to load the right Vault configuration and implementation when referencing secrets with the other entities. + Prefix string `json:"prefix"` + // An optional set of strings associated with the Vault for grouping and filtering. + Tags []string `json:"tags,omitempty"` + // Unix epoch when the resource was last updated. + UpdatedAt *int64 `json:"updated_at,omitempty"` +} + +func (o *Vault) GetConfig() map[string]any { + if o == nil { + return map[string]any{} + } + return o.Config +} + +func (o *Vault) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *Vault) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *Vault) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Vault) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *Vault) GetPrefix() string { + if o == nil { + return "" + } + return o.Prefix +} + +func (o *Vault) GetTags() []string { + if o == nil { + return nil + } + return o.Tags +} + +func (o *Vault) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/verifydcrproviderresponse.go b/tests/mockserver/internal/sdk/models/components/verifydcrproviderresponse.go new file mode 100644 index 00000000..1cad29e1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/verifydcrproviderresponse.go @@ -0,0 +1,54 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +type VerifyDcrProviderResponseStatus string + +const ( + VerifyDcrProviderResponseStatusSuccess VerifyDcrProviderResponseStatus = "success" + VerifyDcrProviderResponseStatusFailed VerifyDcrProviderResponseStatus = "failed" +) + +func (e VerifyDcrProviderResponseStatus) ToPointer() *VerifyDcrProviderResponseStatus { + return &e +} +func (e *VerifyDcrProviderResponseStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "success": + fallthrough + case "failed": + *e = VerifyDcrProviderResponseStatus(v) + return nil + default: + return fmt.Errorf("invalid value for VerifyDcrProviderResponseStatus: %v", v) + } +} + +// VerifyDcrProviderResponse - A response containing the result of attempting to verify a DCR provider configuration. +type VerifyDcrProviderResponse struct { + Status VerifyDcrProviderResponseStatus `json:"status"` + Errors []string `json:"errors"` +} + +func (o *VerifyDcrProviderResponse) GetStatus() VerifyDcrProviderResponseStatus { + if o == nil { + return VerifyDcrProviderResponseStatus("") + } + return o.Status +} + +func (o *VerifyDcrProviderResponse) GetErrors() []string { + if o == nil { + return []string{} + } + return o.Errors +} diff --git a/tests/mockserver/internal/sdk/models/operations/addconsumertogroup.go b/tests/mockserver/internal/sdk/models/operations/addconsumertogroup.go new file mode 100644 index 00000000..737d6a67 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/addconsumertogroup.go @@ -0,0 +1,86 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type AddConsumerToGroupRequestBody struct { + ConsumerID *string `json:"consumer,omitempty"` +} + +func (o *AddConsumerToGroupRequestBody) GetConsumerID() *string { + if o == nil { + return nil + } + return o.ConsumerID +} + +type AddConsumerToGroupRequest struct { + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + RequestBody *AddConsumerToGroupRequestBody `request:"mediaType=application/json"` +} + +func (o *AddConsumerToGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *AddConsumerToGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *AddConsumerToGroupRequest) GetRequestBody() *AddConsumerToGroupRequestBody { + if o == nil { + return nil + } + return o.RequestBody +} + +// AddConsumerToGroupResponseBody - Consumer added to group +type AddConsumerToGroupResponseBody struct { + ConsumerGroup *components.ConsumerGroup `json:"consumer_group,omitempty"` + Consumers []components.Consumer `json:"consumers,omitempty"` +} + +func (o *AddConsumerToGroupResponseBody) GetConsumerGroup() *components.ConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroup +} + +func (o *AddConsumerToGroupResponseBody) GetConsumers() []components.Consumer { + if o == nil { + return nil + } + return o.Consumers +} + +type AddConsumerToGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Consumer added to group + Object *AddConsumerToGroupResponseBody +} + +func (o *AddConsumerToGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *AddConsumerToGroupResponse) GetObject() *AddConsumerToGroupResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/addconsumertospecificconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/addconsumertospecificconsumergroup.go new file mode 100644 index 00000000..86d3f300 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/addconsumertospecificconsumergroup.go @@ -0,0 +1,88 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type AddConsumerToSpecificConsumerGroupRequestBody struct { + Group *string `json:"group,omitempty"` +} + +func (o *AddConsumerToSpecificConsumerGroupRequestBody) GetGroup() *string { + if o == nil { + return nil + } + return o.Group +} + +type AddConsumerToSpecificConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` + RequestBody *AddConsumerToSpecificConsumerGroupRequestBody `request:"mediaType=application/json"` +} + +func (o *AddConsumerToSpecificConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *AddConsumerToSpecificConsumerGroupRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +func (o *AddConsumerToSpecificConsumerGroupRequest) GetRequestBody() *AddConsumerToSpecificConsumerGroupRequestBody { + if o == nil { + return nil + } + return o.RequestBody +} + +// AddConsumerToSpecificConsumerGroupResponseBody - Consumer added to a specific group +type AddConsumerToSpecificConsumerGroupResponseBody struct { + // The Consumer object represents a consumer - or a user - of a Service. You can either rely on Kong as the primary datastore, or you can map the consumer list with your database to keep consistency between Kong and your existing primary datastore. + Consumer *components.Consumer `json:"consumer,omitempty"` + ConsumerGroups []components.ConsumerGroup `json:"consumer_groups,omitempty"` +} + +func (o *AddConsumerToSpecificConsumerGroupResponseBody) GetConsumer() *components.Consumer { + if o == nil { + return nil + } + return o.Consumer +} + +func (o *AddConsumerToSpecificConsumerGroupResponseBody) GetConsumerGroups() []components.ConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroups +} + +type AddConsumerToSpecificConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Consumer added to a specific group + Object *AddConsumerToSpecificConsumerGroupResponseBody +} + +func (o *AddConsumerToSpecificConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *AddConsumerToSpecificConsumerGroupResponse) GetObject() *AddConsumerToSpecificConsumerGroupResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/addusertoteam.go b/tests/mockserver/internal/sdk/models/operations/addusertoteam.go new file mode 100644 index 00000000..281d4c8a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/addusertoteam.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type AddUserToTeamRequest struct { + // ID of the team. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // The request schema for adding a user to a team. + AddUserToTeam *components.AddUserToTeam `request:"mediaType=application/json"` +} + +func (o *AddUserToTeamRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *AddUserToTeamRequest) GetAddUserToTeam() *components.AddUserToTeam { + if o == nil { + return nil + } + return o.AddUserToTeam +} + +type AddUserToTeamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *AddUserToTeamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/authenticatesso.go b/tests/mockserver/internal/sdk/models/operations/authenticatesso.go new file mode 100644 index 00000000..712aa8b7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/authenticatesso.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type AuthenticateSsoRequest struct { + // The login path for the organization. + OrganizationLoginPath string `pathParam:"style=simple,explode=false,name=organizationLoginPath"` + // Return destination for the callback. + ReturnTo *string `queryParam:"style=form,explode=true,name=return_to"` +} + +func (o *AuthenticateSsoRequest) GetOrganizationLoginPath() string { + if o == nil { + return "" + } + return o.OrganizationLoginPath +} + +func (o *AuthenticateSsoRequest) GetReturnTo() *string { + if o == nil { + return nil + } + return o.ReturnTo +} + +type AuthenticateSsoResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *AuthenticateSsoResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/bulknotifications.go b/tests/mockserver/internal/sdk/models/operations/bulknotifications.go new file mode 100644 index 00000000..2894e753 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/bulknotifications.go @@ -0,0 +1,18 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type BulkNotificationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *BulkNotificationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/createaclwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createaclwithconsumer.go new file mode 100644 index 00000000..6a71593e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createaclwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateACLWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new ACL for creation + ACLWithoutParents components.ACLWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateACLWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateACLWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreateACLWithConsumerRequest) GetACLWithoutParents() components.ACLWithoutParents { + if o == nil { + return components.ACLWithoutParents{} + } + return o.ACLWithoutParents +} + +type CreateACLWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created ACL + ACL *components.ACL +} + +func (o *CreateACLWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateACLWithConsumerResponse) GetACL() *components.ACL { + if o == nil { + return nil + } + return o.ACL +} diff --git a/tests/mockserver/internal/sdk/models/operations/createappauthstrategy.go b/tests/mockserver/internal/sdk/models/operations/createappauthstrategy.go new file mode 100644 index 00000000..a40b00ca --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createappauthstrategy.go @@ -0,0 +1,41 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateAppAuthStrategyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing the newly created application auth strategy object. + CreateAppAuthStrategyResponse *components.CreateAppAuthStrategyResponse +} + +func (o *CreateAppAuthStrategyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateAppAuthStrategyResponse) GetCreateAppAuthStrategyResponse() *components.CreateAppAuthStrategyResponse { + if o == nil { + return nil + } + return o.CreateAppAuthStrategyResponse +} + +func (o *CreateAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseKeyAuth() *components.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse + } + return nil +} + +func (o *CreateAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseOpenidConnect() *components.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/createbasicauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createbasicauthwithconsumer.go new file mode 100644 index 00000000..0d87077a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createbasicauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateBasicAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new Basic-auth credential for creation + BasicAuthWithoutParents components.BasicAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateBasicAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateBasicAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreateBasicAuthWithConsumerRequest) GetBasicAuthWithoutParents() components.BasicAuthWithoutParents { + if o == nil { + return components.BasicAuthWithoutParents{} + } + return o.BasicAuthWithoutParents +} + +type CreateBasicAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Basic-auth credential + BasicAuth *components.BasicAuth +} + +func (o *CreateBasicAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateBasicAuthWithConsumerResponse) GetBasicAuth() *components.BasicAuth { + if o == nil { + return nil + } + return o.BasicAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/createcacertificate.go b/tests/mockserver/internal/sdk/models/operations/createcacertificate.go new file mode 100644 index 00000000..89ffd8f6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createcacertificate.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateCaCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new CA Certificate for creation + CACertificate components.CACertificate `request:"mediaType=application/json"` +} + +func (o *CreateCaCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateCaCertificateRequest) GetCACertificate() components.CACertificate { + if o == nil { + return components.CACertificate{} + } + return o.CACertificate +} + +type CreateCaCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created CA Certificate + CACertificate *components.CACertificate +} + +func (o *CreateCaCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateCaCertificateResponse) GetCACertificate() *components.CACertificate { + if o == nil { + return nil + } + return o.CACertificate +} diff --git a/tests/mockserver/internal/sdk/models/operations/createcertificate.go b/tests/mockserver/internal/sdk/models/operations/createcertificate.go new file mode 100644 index 00000000..34b8b76a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createcertificate.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Certificate for creation + Certificate components.Certificate `request:"mediaType=application/json"` +} + +func (o *CreateCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateCertificateRequest) GetCertificate() components.Certificate { + if o == nil { + return components.Certificate{} + } + return o.Certificate +} + +type CreateCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Certificate + Certificate *components.Certificate +} + +func (o *CreateCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateCertificateResponse) GetCertificate() *components.Certificate { + if o == nil { + return nil + } + return o.Certificate +} diff --git a/tests/mockserver/internal/sdk/models/operations/createconfigstore.go b/tests/mockserver/internal/sdk/models/operations/createconfigstore.go new file mode 100644 index 00000000..a32908f9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createconfigstore.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // Config Store + ConfigStore *components.ConfigStore +} + +func (o *CreateConfigStoreResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateConfigStoreResponse) GetConfigStore() *components.ConfigStore { + if o == nil { + return nil + } + return o.ConfigStore +} diff --git a/tests/mockserver/internal/sdk/models/operations/createconfigstoresecret.go b/tests/mockserver/internal/sdk/models/operations/createconfigstoresecret.go new file mode 100644 index 00000000..f7a04246 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createconfigstoresecret.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // Config Store Secret + ConfigStoreSecret *components.ConfigStoreSecret +} + +func (o *CreateConfigStoreSecretResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateConfigStoreSecretResponse) GetConfigStoreSecret() *components.ConfigStoreSecret { + if o == nil { + return nil + } + return o.ConfigStoreSecret +} diff --git a/tests/mockserver/internal/sdk/models/operations/createconfiguration.go b/tests/mockserver/internal/sdk/models/operations/createconfiguration.go new file mode 100644 index 00000000..b102636f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createconfiguration.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateConfigurationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for creating a configuration. + ConfigurationManifest *components.ConfigurationManifest +} + +func (o *CreateConfigurationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateConfigurationResponse) GetConfigurationManifest() *components.ConfigurationManifest { + if o == nil { + return nil + } + return o.ConfigurationManifest +} diff --git a/tests/mockserver/internal/sdk/models/operations/createconsumer.go b/tests/mockserver/internal/sdk/models/operations/createconsumer.go new file mode 100644 index 00000000..58d10bad --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Consumer for creation + Consumer components.Consumer `request:"mediaType=application/json"` +} + +func (o *CreateConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateConsumerRequest) GetConsumer() components.Consumer { + if o == nil { + return components.Consumer{} + } + return o.Consumer +} + +type CreateConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Consumer + Consumer *components.Consumer +} + +func (o *CreateConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateConsumerResponse) GetConsumer() *components.Consumer { + if o == nil { + return nil + } + return o.Consumer +} diff --git a/tests/mockserver/internal/sdk/models/operations/createconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/createconsumergroup.go new file mode 100644 index 00000000..03621838 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createconsumergroup.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Consumer Group for creation + ConsumerGroup components.ConsumerGroup `request:"mediaType=application/json"` +} + +func (o *CreateConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateConsumerGroupRequest) GetConsumerGroup() components.ConsumerGroup { + if o == nil { + return components.ConsumerGroup{} + } + return o.ConsumerGroup +} + +type CreateConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Consumer Group + ConsumerGroup *components.ConsumerGroup +} + +func (o *CreateConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateConsumerGroupResponse) GetConsumerGroup() *components.ConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroup +} diff --git a/tests/mockserver/internal/sdk/models/operations/createcontrolplane.go b/tests/mockserver/internal/sdk/models/operations/createcontrolplane.go new file mode 100644 index 00000000..742a0f0e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createcontrolplane.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateControlPlaneResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response to creating a control plane. + ControlPlane *components.ControlPlane +} + +func (o *CreateControlPlaneResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateControlPlaneResponse) GetControlPlane() *components.ControlPlane { + if o == nil { + return nil + } + return o.ControlPlane +} diff --git a/tests/mockserver/internal/sdk/models/operations/createcustomdomains.go b/tests/mockserver/internal/sdk/models/operations/createcustomdomains.go new file mode 100644 index 00000000..802b263e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createcustomdomains.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateCustomDomainsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for creating a custom domain for a control-plane in the global API. + CustomDomain *components.CustomDomain +} + +func (o *CreateCustomDomainsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateCustomDomainsResponse) GetCustomDomain() *components.CustomDomain { + if o == nil { + return nil + } + return o.CustomDomain +} diff --git a/tests/mockserver/internal/sdk/models/operations/createcustomplugin.go b/tests/mockserver/internal/sdk/models/operations/createcustomplugin.go new file mode 100644 index 00000000..e0c71f4e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createcustomplugin.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateCustomPluginRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new CustomPlugin for creation + CustomPlugin components.CustomPlugin `request:"mediaType=application/json"` +} + +func (o *CreateCustomPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateCustomPluginRequest) GetCustomPlugin() components.CustomPlugin { + if o == nil { + return components.CustomPlugin{} + } + return o.CustomPlugin +} + +type CreateCustomPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created CustomPlugin + CustomPlugin *components.CustomPlugin +} + +func (o *CreateCustomPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateCustomPluginResponse) GetCustomPlugin() *components.CustomPlugin { + if o == nil { + return nil + } + return o.CustomPlugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/createdataplanecertificate.go b/tests/mockserver/internal/sdk/models/operations/createdataplanecertificate.go new file mode 100644 index 00000000..1405d533 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createdataplanecertificate.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateDataplaneCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Request body for creating a dp-client-certificate. + DataPlaneClientCertificateRequest *components.DataPlaneClientCertificateRequest `request:"mediaType=application/json"` +} + +func (o *CreateDataplaneCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateDataplaneCertificateRequest) GetDataPlaneClientCertificateRequest() *components.DataPlaneClientCertificateRequest { + if o == nil { + return nil + } + return o.DataPlaneClientCertificateRequest +} + +type CreateDataplaneCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response body for retrieving a dp-client-certificate. + DataPlaneClientCertificateResponse *components.DataPlaneClientCertificateResponse +} + +func (o *CreateDataplaneCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateDataplaneCertificateResponse) GetDataPlaneClientCertificateResponse() *components.DataPlaneClientCertificateResponse { + if o == nil { + return nil + } + return o.DataPlaneClientCertificateResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/createdcrprovider.go b/tests/mockserver/internal/sdk/models/operations/createdcrprovider.go new file mode 100644 index 00000000..6e452346 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createdcrprovider.go @@ -0,0 +1,62 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateDcrProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing the newly created DCR provider object. + CreateDcrProviderResponse *components.CreateDcrProviderResponse +} + +func (o *CreateDcrProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateDcrProviderResponse) GetCreateDcrProviderResponse() *components.CreateDcrProviderResponse { + if o == nil { + return nil + } + return o.CreateDcrProviderResponse +} + +func (o *CreateDcrProviderResponse) GetCreateDcrProviderResponseDcrProviderAuth0() *components.CreateDCRProviderResponseDCRProviderAuth0 { + if v := o.GetCreateDcrProviderResponse(); v != nil { + return v.CreateDCRProviderResponseDCRProviderAuth0 + } + return nil +} + +func (o *CreateDcrProviderResponse) GetCreateDcrProviderResponseDcrProviderAzureAd() *components.CreateDCRProviderResponseDCRProviderAzureAD { + if v := o.GetCreateDcrProviderResponse(); v != nil { + return v.CreateDCRProviderResponseDCRProviderAzureAD + } + return nil +} + +func (o *CreateDcrProviderResponse) GetCreateDcrProviderResponseDcrProviderCurity() *components.CreateDCRProviderResponseDCRProviderCurity { + if v := o.GetCreateDcrProviderResponse(); v != nil { + return v.CreateDCRProviderResponseDCRProviderCurity + } + return nil +} + +func (o *CreateDcrProviderResponse) GetCreateDcrProviderResponseDcrProviderOkta() *components.CreateDCRProviderResponseDCRProviderOKTA { + if v := o.GetCreateDcrProviderResponse(); v != nil { + return v.CreateDCRProviderResponseDCRProviderOKTA + } + return nil +} + +func (o *CreateDcrProviderResponse) GetCreateDcrProviderResponseDcrProviderHTTP() *components.CreateDCRProviderResponseDCRProviderHTTP { + if v := o.GetCreateDcrProviderResponse(); v != nil { + return v.CreateDCRProviderResponseDCRProviderHTTP + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/createdegraphqlroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/createdegraphqlroutewithservice.go new file mode 100644 index 00000000..21ce90e4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createdegraphqlroutewithservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateDegraphqlRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // Description of new Degraphql_route for creation + DegraphqlRouteWithoutParents components.DegraphqlRouteWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateDegraphqlRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateDegraphqlRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *CreateDegraphqlRouteWithServiceRequest) GetDegraphqlRouteWithoutParents() components.DegraphqlRouteWithoutParents { + if o == nil { + return components.DegraphqlRouteWithoutParents{} + } + return o.DegraphqlRouteWithoutParents +} + +type CreateDegraphqlRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Degraphql_route + DegraphqlRoute *components.DegraphqlRoute +} + +func (o *CreateDegraphqlRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateDegraphqlRouteWithServiceResponse) GetDegraphqlRoute() *components.DegraphqlRoute { + if o == nil { + return nil + } + return o.DegraphqlRoute +} diff --git a/tests/mockserver/internal/sdk/models/operations/createeventsubscription.go b/tests/mockserver/internal/sdk/models/operations/createeventsubscription.go new file mode 100644 index 00000000..9a6b0e97 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createeventsubscription.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateEventSubscriptionRequest struct { + // Formatted string ID of the notification event. + EventID string `pathParam:"style=simple,explode=false,name=eventId"` + // Request body schema for creating/updating event subscription. + EventSubscription *components.EventSubscription `request:"mediaType=application/json"` +} + +func (o *CreateEventSubscriptionRequest) GetEventID() string { + if o == nil { + return "" + } + return o.EventID +} + +func (o *CreateEventSubscriptionRequest) GetEventSubscription() *components.EventSubscription { + if o == nil { + return nil + } + return o.EventSubscription +} + +type CreateEventSubscriptionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response containing specific subscription details associated with an event. + EventSubscriptionResponse *components.EventSubscriptionResponse +} + +func (o *CreateEventSubscriptionResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateEventSubscriptionResponse) GetEventSubscriptionResponse() *components.EventSubscriptionResponse { + if o == nil { + return nil + } + return o.EventSubscriptionResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/createhmacauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createhmacauthwithconsumer.go new file mode 100644 index 00000000..0c3efff6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createhmacauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateHmacAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new HMAC-auth credential for creation + HMACAuthWithoutParents components.HMACAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateHmacAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateHmacAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreateHmacAuthWithConsumerRequest) GetHMACAuthWithoutParents() components.HMACAuthWithoutParents { + if o == nil { + return components.HMACAuthWithoutParents{} + } + return o.HMACAuthWithoutParents +} + +type CreateHmacAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created HMAC-auth credential + HMACAuth *components.HMACAuth +} + +func (o *CreateHmacAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateHmacAuthWithConsumerResponse) GetHMACAuth() *components.HMACAuth { + if o == nil { + return nil + } + return o.HMACAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/createidentityprovider.go b/tests/mockserver/internal/sdk/models/operations/createidentityprovider.go new file mode 100644 index 00000000..63392aa9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createidentityprovider.go @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateIdentityProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // An identity provider configuration. This response represents the configuration of a specific identity provider, which can be either OIDC or SAML. + // + IdentityProvider *components.IdentityProvider +} + +func (o *CreateIdentityProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateIdentityProviderResponse) GetIdentityProvider() *components.IdentityProvider { + if o == nil { + return nil + } + return o.IdentityProvider +} diff --git a/tests/mockserver/internal/sdk/models/operations/createjwtwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createjwtwithconsumer.go new file mode 100644 index 00000000..ff4cd28e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createjwtwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateJwtWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new JWT for creation + JWTWithoutParents *components.JWTWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateJwtWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateJwtWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreateJwtWithConsumerRequest) GetJWTWithoutParents() *components.JWTWithoutParents { + if o == nil { + return nil + } + return o.JWTWithoutParents +} + +type CreateJwtWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created JWT + Jwt *components.Jwt +} + +func (o *CreateJwtWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateJwtWithConsumerResponse) GetJwt() *components.Jwt { + if o == nil { + return nil + } + return o.Jwt +} diff --git a/tests/mockserver/internal/sdk/models/operations/createkey.go b/tests/mockserver/internal/sdk/models/operations/createkey.go new file mode 100644 index 00000000..9688de7e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createkey.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateKeyRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Key for creation + Key components.Key `request:"mediaType=application/json"` +} + +func (o *CreateKeyRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateKeyRequest) GetKey() components.Key { + if o == nil { + return components.Key{} + } + return o.Key +} + +type CreateKeyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Key + Key *components.Key +} + +func (o *CreateKeyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateKeyResponse) GetKey() *components.Key { + if o == nil { + return nil + } + return o.Key +} diff --git a/tests/mockserver/internal/sdk/models/operations/createkeyauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createkeyauthwithconsumer.go new file mode 100644 index 00000000..1eb35637 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createkeyauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateKeyAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new API-key for creation + KeyAuthWithoutParents *components.KeyAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateKeyAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateKeyAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreateKeyAuthWithConsumerRequest) GetKeyAuthWithoutParents() *components.KeyAuthWithoutParents { + if o == nil { + return nil + } + return o.KeyAuthWithoutParents +} + +type CreateKeyAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created API-key + KeyAuth *components.KeyAuth +} + +func (o *CreateKeyAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateKeyAuthWithConsumerResponse) GetKeyAuth() *components.KeyAuth { + if o == nil { + return nil + } + return o.KeyAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/createkeyset.go b/tests/mockserver/internal/sdk/models/operations/createkeyset.go new file mode 100644 index 00000000..69742480 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createkeyset.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new KeySet for creation + KeySet components.KeySet `request:"mediaType=application/json"` +} + +func (o *CreateKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateKeySetRequest) GetKeySet() components.KeySet { + if o == nil { + return components.KeySet{} + } + return o.KeySet +} + +type CreateKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created KeySet + KeySet *components.KeySet +} + +func (o *CreateKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateKeySetResponse) GetKeySet() *components.KeySet { + if o == nil { + return nil + } + return o.KeySet +} diff --git a/tests/mockserver/internal/sdk/models/operations/createkeywithkeyset.go b/tests/mockserver/internal/sdk/models/operations/createkeywithkeyset.go new file mode 100644 index 00000000..c9916c25 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createkeywithkeyset.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateKeyWithKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // Description of new Key for creation + KeyWithoutParents components.KeyWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateKeyWithKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateKeyWithKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *CreateKeyWithKeySetRequest) GetKeyWithoutParents() components.KeyWithoutParents { + if o == nil { + return components.KeyWithoutParents{} + } + return o.KeyWithoutParents +} + +type CreateKeyWithKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Key + Key *components.Key +} + +func (o *CreateKeyWithKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateKeyWithKeySetResponse) GetKey() *components.Key { + if o == nil { + return nil + } + return o.Key +} diff --git a/tests/mockserver/internal/sdk/models/operations/createmtlsauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createmtlsauthwithconsumer.go new file mode 100644 index 00000000..c3f5e31c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createmtlsauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateMtlsAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new MTLS-auth credential for creation + MTLSAuthWithoutParents components.MTLSAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateMtlsAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateMtlsAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreateMtlsAuthWithConsumerRequest) GetMTLSAuthWithoutParents() components.MTLSAuthWithoutParents { + if o == nil { + return components.MTLSAuthWithoutParents{} + } + return o.MTLSAuthWithoutParents +} + +type CreateMtlsAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created MTLS-auth credential + MTLSAuth *components.MTLSAuth +} + +func (o *CreateMtlsAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateMtlsAuthWithConsumerResponse) GetMTLSAuth() *components.MTLSAuth { + if o == nil { + return nil + } + return o.MTLSAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/createnetwork.go b/tests/mockserver/internal/sdk/models/operations/createnetwork.go new file mode 100644 index 00000000..166e76e9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createnetwork.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateNetworkResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for creating a network. + Network *components.Network +} + +func (o *CreateNetworkResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateNetworkResponse) GetNetwork() *components.Network { + if o == nil { + return nil + } + return o.Network +} diff --git a/tests/mockserver/internal/sdk/models/operations/createpartial.go b/tests/mockserver/internal/sdk/models/operations/createpartial.go new file mode 100644 index 00000000..ebeba459 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createpartial.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePartialRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Partial for creation + Partial components.Partial `request:"mediaType=application/json"` +} + +func (o *CreatePartialRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePartialRequest) GetPartial() components.Partial { + if o == nil { + return components.Partial{} + } + return o.Partial +} + +type CreatePartialResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Partial + Partial *components.Partial +} + +func (o *CreatePartialResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePartialResponse) GetPartial() *components.Partial { + if o == nil { + return nil + } + return o.Partial +} diff --git a/tests/mockserver/internal/sdk/models/operations/createplugin.go b/tests/mockserver/internal/sdk/models/operations/createplugin.go new file mode 100644 index 00000000..3f609075 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createplugin.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePluginRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Plugin for creation + Plugin components.Plugin `request:"mediaType=application/json"` +} + +func (o *CreatePluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePluginRequest) GetPlugin() components.Plugin { + if o == nil { + return components.Plugin{} + } + return o.Plugin +} + +type CreatePluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Plugin + Plugin *components.Plugin +} + +func (o *CreatePluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePluginResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/createpluginschemas.go b/tests/mockserver/internal/sdk/models/operations/createpluginschemas.go new file mode 100644 index 00000000..702cf7f3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createpluginschemas.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePluginSchemasRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + CreatePluginSchemas *components.CreatePluginSchemas `request:"mediaType=application/json"` +} + +func (o *CreatePluginSchemasRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePluginSchemasRequest) GetCreatePluginSchemas() *components.CreatePluginSchemas { + if o == nil { + return nil + } + return o.CreatePluginSchemas +} + +type CreatePluginSchemasResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response for a single custom plugin schema. + PluginSchemas *components.PluginSchemas +} + +func (o *CreatePluginSchemasResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePluginSchemasResponse) GetPluginSchemas() *components.PluginSchemas { + if o == nil { + return nil + } + return o.PluginSchemas +} diff --git a/tests/mockserver/internal/sdk/models/operations/createpluginwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/createpluginwithconsumer.go new file mode 100644 index 00000000..9e047cef --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createpluginwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePluginWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Description of new Plugin for creation + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreatePluginWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePluginWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *CreatePluginWithConsumerRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type CreatePluginWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Plugin + Plugin *components.Plugin +} + +func (o *CreatePluginWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePluginWithConsumerResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/createpluginwithconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/createpluginwithconsumergroup.go new file mode 100644 index 00000000..a5c78c02 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createpluginwithconsumergroup.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePluginWithConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // Description of new Plugin for creation + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreatePluginWithConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePluginWithConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *CreatePluginWithConsumerGroupRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type CreatePluginWithConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Plugin + Plugin *components.Plugin +} + +func (o *CreatePluginWithConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePluginWithConsumerGroupResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/createpluginwithroute.go b/tests/mockserver/internal/sdk/models/operations/createpluginwithroute.go new file mode 100644 index 00000000..2f738714 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createpluginwithroute.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePluginWithRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // Description of new Plugin for creation + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreatePluginWithRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePluginWithRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *CreatePluginWithRouteRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type CreatePluginWithRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Plugin + Plugin *components.Plugin +} + +func (o *CreatePluginWithRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePluginWithRouteResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/createpluginwithservice.go b/tests/mockserver/internal/sdk/models/operations/createpluginwithservice.go new file mode 100644 index 00000000..62b16fea --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createpluginwithservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreatePluginWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // Description of new Plugin for creation + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreatePluginWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreatePluginWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *CreatePluginWithServiceRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type CreatePluginWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Plugin + Plugin *components.Plugin +} + +func (o *CreatePluginWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreatePluginWithServiceResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/createroute.go b/tests/mockserver/internal/sdk/models/operations/createroute.go new file mode 100644 index 00000000..b4713ae4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createroute.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Route for creation + Route components.Route `request:"mediaType=application/json"` +} + +func (o *CreateRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateRouteRequest) GetRoute() components.Route { + if o == nil { + return components.Route{} + } + return o.Route +} + +type CreateRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Route + Route *components.Route +} + +func (o *CreateRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateRouteResponse) GetRoute() *components.Route { + if o == nil { + return nil + } + return o.Route +} diff --git a/tests/mockserver/internal/sdk/models/operations/createroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/createroutewithservice.go new file mode 100644 index 00000000..56e6de5f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createroutewithservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // Description of new Route for creation + RouteWithoutParents components.RouteWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *CreateRouteWithServiceRequest) GetRouteWithoutParents() components.RouteWithoutParents { + if o == nil { + return components.RouteWithoutParents{} + } + return o.RouteWithoutParents +} + +type CreateRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Route + Route *components.Route +} + +func (o *CreateRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateRouteWithServiceResponse) GetRoute() *components.Route { + if o == nil { + return nil + } + return o.Route +} diff --git a/tests/mockserver/internal/sdk/models/operations/createservice.go b/tests/mockserver/internal/sdk/models/operations/createservice.go new file mode 100644 index 00000000..7d337756 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createservice.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Service for creation + Service components.Service `request:"mediaType=application/json"` +} + +func (o *CreateServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateServiceRequest) GetService() components.Service { + if o == nil { + return components.Service{} + } + return o.Service +} + +type CreateServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Service + Service *components.ServiceOutput +} + +func (o *CreateServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateServiceResponse) GetService() *components.ServiceOutput { + if o == nil { + return nil + } + return o.Service +} diff --git a/tests/mockserver/internal/sdk/models/operations/createsni.go b/tests/mockserver/internal/sdk/models/operations/createsni.go new file mode 100644 index 00000000..ba5f4cf0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createsni.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateSniRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new SNI for creation + Sni components.Sni `request:"mediaType=application/json"` +} + +func (o *CreateSniRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateSniRequest) GetSni() components.Sni { + if o == nil { + return components.Sni{} + } + return o.Sni +} + +type CreateSniResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created SNI + Sni *components.Sni +} + +func (o *CreateSniResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateSniResponse) GetSni() *components.Sni { + if o == nil { + return nil + } + return o.Sni +} diff --git a/tests/mockserver/internal/sdk/models/operations/createsniwithcertificate.go b/tests/mockserver/internal/sdk/models/operations/createsniwithcertificate.go new file mode 100644 index 00000000..f49dd5d6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createsniwithcertificate.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateSniWithCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // Description of new SNI for creation + SNIWithoutParents components.SNIWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateSniWithCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateSniWithCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *CreateSniWithCertificateRequest) GetSNIWithoutParents() components.SNIWithoutParents { + if o == nil { + return components.SNIWithoutParents{} + } + return o.SNIWithoutParents +} + +type CreateSniWithCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created SNI + Sni *components.Sni +} + +func (o *CreateSniWithCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateSniWithCertificateResponse) GetSni() *components.Sni { + if o == nil { + return nil + } + return o.Sni +} diff --git a/tests/mockserver/internal/sdk/models/operations/createtargetwithupstream.go b/tests/mockserver/internal/sdk/models/operations/createtargetwithupstream.go new file mode 100644 index 00000000..a696c0b0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createtargetwithupstream.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateTargetWithUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID or target of the Target to lookup + UpstreamIDForTarget string `pathParam:"style=simple,explode=false,name=UpstreamIdForTarget"` + // Description of new Target for creation + TargetWithoutParents components.TargetWithoutParents `request:"mediaType=application/json"` +} + +func (o *CreateTargetWithUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateTargetWithUpstreamRequest) GetUpstreamIDForTarget() string { + if o == nil { + return "" + } + return o.UpstreamIDForTarget +} + +func (o *CreateTargetWithUpstreamRequest) GetTargetWithoutParents() components.TargetWithoutParents { + if o == nil { + return components.TargetWithoutParents{} + } + return o.TargetWithoutParents +} + +type CreateTargetWithUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Target + Target *components.Target +} + +func (o *CreateTargetWithUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateTargetWithUpstreamResponse) GetTarget() *components.Target { + if o == nil { + return nil + } + return o.Target +} diff --git a/tests/mockserver/internal/sdk/models/operations/createteam.go b/tests/mockserver/internal/sdk/models/operations/createteam.go new file mode 100644 index 00000000..bbec14b1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createteam.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateTeamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single team. + Team *components.Team +} + +func (o *CreateTeamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateTeamResponse) GetTeam() *components.Team { + if o == nil { + return nil + } + return o.Team +} diff --git a/tests/mockserver/internal/sdk/models/operations/createtransitgateway.go b/tests/mockserver/internal/sdk/models/operations/createtransitgateway.go new file mode 100644 index 00000000..28a0cfa8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createtransitgateway.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateTransitGatewayRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` + CreateTransitGatewayRequest components.CreateTransitGatewayRequest `request:"mediaType=application/json"` +} + +func (o *CreateTransitGatewayRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +func (o *CreateTransitGatewayRequest) GetCreateTransitGatewayRequest() components.CreateTransitGatewayRequest { + if o == nil { + return components.CreateTransitGatewayRequest{} + } + return o.CreateTransitGatewayRequest +} + +type CreateTransitGatewayResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for creating a transit gateway. + TransitGatewayResponse *components.TransitGatewayResponse +} + +func (o *CreateTransitGatewayResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateTransitGatewayResponse) GetTransitGatewayResponse() *components.TransitGatewayResponse { + if o == nil { + return nil + } + return o.TransitGatewayResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/createupstream.go b/tests/mockserver/internal/sdk/models/operations/createupstream.go new file mode 100644 index 00000000..6542c201 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createupstream.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Upstream for creation + Upstream components.Upstream `request:"mediaType=application/json"` +} + +func (o *CreateUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateUpstreamRequest) GetUpstream() components.Upstream { + if o == nil { + return components.Upstream{} + } + return o.Upstream +} + +type CreateUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Upstream + Upstream *components.Upstream +} + +func (o *CreateUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateUpstreamResponse) GetUpstream() *components.Upstream { + if o == nil { + return nil + } + return o.Upstream +} diff --git a/tests/mockserver/internal/sdk/models/operations/createvault.go b/tests/mockserver/internal/sdk/models/operations/createvault.go new file mode 100644 index 00000000..c19c61fc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/createvault.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type CreateVaultRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the new Vault for creation + Vault components.Vault `request:"mediaType=application/json"` +} + +func (o *CreateVaultRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *CreateVaultRequest) GetVault() components.Vault { + if o == nil { + return components.Vault{} + } + return o.Vault +} + +type CreateVaultResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully created Vault + Vault *components.Vault +} + +func (o *CreateVaultResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *CreateVaultResponse) GetVault() *components.Vault { + if o == nil { + return nil + } + return o.Vault +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteaclwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deleteaclwithconsumer.go new file mode 100644 index 00000000..b22e9b39 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteaclwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteACLWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the ACL to lookup + ACLID string `pathParam:"style=simple,explode=false,name=ACLId"` +} + +func (o *DeleteACLWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteACLWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeleteACLWithConsumerRequest) GetACLID() string { + if o == nil { + return "" + } + return o.ACLID +} + +type DeleteACLWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteACLWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteappauthstrategy.go b/tests/mockserver/internal/sdk/models/operations/deleteappauthstrategy.go new file mode 100644 index 00000000..ad3655d0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteappauthstrategy.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteAppAuthStrategyRequest struct { + // Application auth strategy identifier + AuthStrategyID string `pathParam:"style=simple,explode=false,name=authStrategyId"` +} + +func (o *DeleteAppAuthStrategyRequest) GetAuthStrategyID() string { + if o == nil { + return "" + } + return o.AuthStrategyID +} + +type DeleteAppAuthStrategyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteAppAuthStrategyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletebasicauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deletebasicauthwithconsumer.go new file mode 100644 index 00000000..27a911ac --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletebasicauthwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteBasicAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the Basic-auth credential to lookup + BasicAuthID string `pathParam:"style=simple,explode=false,name=BasicAuthId"` +} + +func (o *DeleteBasicAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteBasicAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeleteBasicAuthWithConsumerRequest) GetBasicAuthID() string { + if o == nil { + return "" + } + return o.BasicAuthID +} + +type DeleteBasicAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteBasicAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletecacertificate.go b/tests/mockserver/internal/sdk/models/operations/deletecacertificate.go new file mode 100644 index 00000000..5e2ff6b8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletecacertificate.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteCaCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the CA Certificate to lookup + CACertificateID string `pathParam:"style=simple,explode=false,name=CACertificateId"` +} + +func (o *DeleteCaCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteCaCertificateRequest) GetCACertificateID() string { + if o == nil { + return "" + } + return o.CACertificateID +} + +type DeleteCaCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteCaCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletecertificate.go b/tests/mockserver/internal/sdk/models/operations/deletecertificate.go new file mode 100644 index 00000000..8b1fd4a0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletecertificate.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` +} + +func (o *DeleteCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +type DeleteCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteconfigstore.go b/tests/mockserver/internal/sdk/models/operations/deleteconfigstore.go new file mode 100644 index 00000000..150e223e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteconfigstore.go @@ -0,0 +1,89 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +// 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 { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteConfigStoreResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteconfigstoresecret.go b/tests/mockserver/internal/sdk/models/operations/deleteconfigstoresecret.go new file mode 100644 index 00000000..b7f9bca4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteconfigstoresecret.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteConfigStoreSecretResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteconsumer.go b/tests/mockserver/internal/sdk/models/operations/deleteconsumer.go new file mode 100644 index 00000000..03051a87 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteconsumer.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` +} + +func (o *DeleteConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteConsumerRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +type DeleteConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/deleteconsumergroup.go new file mode 100644 index 00000000..405f82d4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteconsumergroup.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` +} + +func (o *DeleteConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +type DeleteConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletecontrolplane.go b/tests/mockserver/internal/sdk/models/operations/deletecontrolplane.go new file mode 100644 index 00000000..570e5caf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletecontrolplane.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteControlPlaneRequest struct { + // The control plane ID + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (o *DeleteControlPlaneRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type DeleteControlPlaneResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteControlPlaneResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletecustomdomain.go b/tests/mockserver/internal/sdk/models/operations/deletecustomdomain.go new file mode 100644 index 00000000..aa516245 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletecustomdomain.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteCustomDomainRequest struct { + // ID of the custom domain to operate on. + CustomDomainID string `pathParam:"style=simple,explode=false,name=customDomainId"` +} + +func (o *DeleteCustomDomainRequest) GetCustomDomainID() string { + if o == nil { + return "" + } + return o.CustomDomainID +} + +type DeleteCustomDomainResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteCustomDomainResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletecustomplugin.go b/tests/mockserver/internal/sdk/models/operations/deletecustomplugin.go new file mode 100644 index 00000000..3597243a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletecustomplugin.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteCustomPluginRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the CustomPlugin to lookup + CustomPluginID string `pathParam:"style=simple,explode=false,name=CustomPluginId"` +} + +func (o *DeleteCustomPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteCustomPluginRequest) GetCustomPluginID() string { + if o == nil { + return "" + } + return o.CustomPluginID +} + +type DeleteCustomPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteCustomPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletedataplanecertificate.go b/tests/mockserver/internal/sdk/models/operations/deletedataplanecertificate.go new file mode 100644 index 00000000..02f3c2fb --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletedataplanecertificate.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteDataplaneCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + CertificateID string `pathParam:"style=simple,explode=false,name=certificateId"` +} + +func (o *DeleteDataplaneCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteDataplaneCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +type DeleteDataplaneCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteDataplaneCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletedcrprovider.go b/tests/mockserver/internal/sdk/models/operations/deletedcrprovider.go new file mode 100644 index 00000000..93c0408b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletedcrprovider.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteDcrProviderRequest struct { + // DCR provider identifier + DcrProviderID string `pathParam:"style=simple,explode=false,name=dcrProviderId"` +} + +func (o *DeleteDcrProviderRequest) GetDcrProviderID() string { + if o == nil { + return "" + } + return o.DcrProviderID +} + +type DeleteDcrProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteDcrProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletedegraphqlroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/deletedegraphqlroutewithservice.go new file mode 100644 index 00000000..fec57909 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletedegraphqlroutewithservice.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteDegraphqlRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Degraphql_route to lookup + DegraphqlRouteID string `pathParam:"style=simple,explode=false,name=Degraphql_routeId"` +} + +func (o *DeleteDegraphqlRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteDegraphqlRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *DeleteDegraphqlRouteWithServiceRequest) GetDegraphqlRouteID() string { + if o == nil { + return "" + } + return o.DegraphqlRouteID +} + +type DeleteDegraphqlRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteDegraphqlRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteeventsubscription.go b/tests/mockserver/internal/sdk/models/operations/deleteeventsubscription.go new file mode 100644 index 00000000..79f6a239 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteeventsubscription.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteEventSubscriptionRequest struct { + // Formatted string ID of the notification event. + EventID string `pathParam:"style=simple,explode=false,name=eventId"` + // Subscription ID of the user configuration. + SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionId"` +} + +func (o *DeleteEventSubscriptionRequest) GetEventID() string { + if o == nil { + return "" + } + return o.EventID +} + +func (o *DeleteEventSubscriptionRequest) GetSubscriptionID() string { + if o == nil { + return "" + } + return o.SubscriptionID +} + +type DeleteEventSubscriptionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteEventSubscriptionResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletehmacauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deletehmacauthwithconsumer.go new file mode 100644 index 00000000..aef57130 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletehmacauthwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteHmacAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the HMAC-auth credential to lookup + HMACAuthID string `pathParam:"style=simple,explode=false,name=HMACAuthId"` +} + +func (o *DeleteHmacAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteHmacAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeleteHmacAuthWithConsumerRequest) GetHMACAuthID() string { + if o == nil { + return "" + } + return o.HMACAuthID +} + +type DeleteHmacAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteHmacAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteidentityprovider.go b/tests/mockserver/internal/sdk/models/operations/deleteidentityprovider.go new file mode 100644 index 00000000..c06bd810 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteidentityprovider.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteIdentityProviderRequest struct { + // ID of the identity provider. + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (o *DeleteIdentityProviderRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type DeleteIdentityProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteIdentityProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletejwtwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deletejwtwithconsumer.go new file mode 100644 index 00000000..cf54bb8c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletejwtwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteJwtWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the JWT to lookup + JWTID string `pathParam:"style=simple,explode=false,name=JWTId"` +} + +func (o *DeleteJwtWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteJwtWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeleteJwtWithConsumerRequest) GetJWTID() string { + if o == nil { + return "" + } + return o.JWTID +} + +type DeleteJwtWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteJwtWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletekey.go b/tests/mockserver/internal/sdk/models/operations/deletekey.go new file mode 100644 index 00000000..1b7c0e39 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletekey.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteKeyRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Key to lookup + KeyID string `pathParam:"style=simple,explode=false,name=KeyId"` +} + +func (o *DeleteKeyRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteKeyRequest) GetKeyID() string { + if o == nil { + return "" + } + return o.KeyID +} + +type DeleteKeyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteKeyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletekeyauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deletekeyauthwithconsumer.go new file mode 100644 index 00000000..72ca2abf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletekeyauthwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteKeyAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the API-key to lookup + KeyAuthID string `pathParam:"style=simple,explode=false,name=KeyAuthId"` +} + +func (o *DeleteKeyAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteKeyAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeleteKeyAuthWithConsumerRequest) GetKeyAuthID() string { + if o == nil { + return "" + } + return o.KeyAuthID +} + +type DeleteKeyAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteKeyAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletekeyset.go b/tests/mockserver/internal/sdk/models/operations/deletekeyset.go new file mode 100644 index 00000000..236fdb06 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletekeyset.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` +} + +func (o *DeleteKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +type DeleteKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletekeywithkeyset.go b/tests/mockserver/internal/sdk/models/operations/deletekeywithkeyset.go new file mode 100644 index 00000000..fe29dc80 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletekeywithkeyset.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteKeyWithKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // ID of the Key to lookup + KeyID string `pathParam:"style=simple,explode=false,name=KeyId"` +} + +func (o *DeleteKeyWithKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteKeyWithKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *DeleteKeyWithKeySetRequest) GetKeyID() string { + if o == nil { + return "" + } + return o.KeyID +} + +type DeleteKeyWithKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteKeyWithKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletemtlsauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deletemtlsauthwithconsumer.go new file mode 100644 index 00000000..1abebeb5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletemtlsauthwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteMtlsAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the MTLS-auth credential to lookup + MTLSAuthID string `pathParam:"style=simple,explode=false,name=MTLSAuthId"` +} + +func (o *DeleteMtlsAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteMtlsAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeleteMtlsAuthWithConsumerRequest) GetMTLSAuthID() string { + if o == nil { + return "" + } + return o.MTLSAuthID +} + +type DeleteMtlsAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteMtlsAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletenetwork.go b/tests/mockserver/internal/sdk/models/operations/deletenetwork.go new file mode 100644 index 00000000..61ab8b1d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletenetwork.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteNetworkRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` +} + +func (o *DeleteNetworkRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +type DeleteNetworkResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteNetworkResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletenodesnodeid.go b/tests/mockserver/internal/sdk/models/operations/deletenodesnodeid.go new file mode 100644 index 00000000..076021d9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletenodesnodeid.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteNodesNodeIDRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Node identifier + NodeID string `pathParam:"style=simple,explode=false,name=nodeId"` +} + +func (o *DeleteNodesNodeIDRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteNodesNodeIDRequest) GetNodeID() string { + if o == nil { + return "" + } + return o.NodeID +} + +type DeleteNodesNodeIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteNodesNodeIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletenotification.go b/tests/mockserver/internal/sdk/models/operations/deletenotification.go new file mode 100644 index 00000000..b2720983 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletenotification.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteNotificationRequest struct { + // ID of the notification. + NotificationID string `pathParam:"style=simple,explode=false,name=notificationId"` +} + +func (o *DeleteNotificationRequest) GetNotificationID() string { + if o == nil { + return "" + } + return o.NotificationID +} + +type DeleteNotificationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteNotificationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletepartial.go b/tests/mockserver/internal/sdk/models/operations/deletepartial.go new file mode 100644 index 00000000..32f0777f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletepartial.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePartialRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Partial to lookup + PartialID string `pathParam:"style=simple,explode=false,name=PartialId"` +} + +func (o *DeletePartialRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePartialRequest) GetPartialID() string { + if o == nil { + return "" + } + return o.PartialID +} + +type DeletePartialResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePartialResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteplugin.go b/tests/mockserver/internal/sdk/models/operations/deleteplugin.go new file mode 100644 index 00000000..3e8e9ffd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteplugin.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePluginRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *DeletePluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePluginRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type DeletePluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletepluginschemas.go b/tests/mockserver/internal/sdk/models/operations/deletepluginschemas.go new file mode 100644 index 00000000..831cb730 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletepluginschemas.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePluginSchemasRequest 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 custom plugin name + Name string `pathParam:"style=simple,explode=false,name=name"` +} + +func (o *DeletePluginSchemasRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePluginSchemasRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +type DeletePluginSchemasResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePluginSchemasResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumer.go new file mode 100644 index 00000000..1ea187d9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePluginWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *DeletePluginWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePluginWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *DeletePluginWithConsumerRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type DeletePluginWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePluginWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumergroup.go new file mode 100644 index 00000000..4dd057e5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletepluginwithconsumergroup.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePluginWithConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *DeletePluginWithConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePluginWithConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *DeletePluginWithConsumerGroupRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type DeletePluginWithConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePluginWithConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletepluginwithroute.go b/tests/mockserver/internal/sdk/models/operations/deletepluginwithroute.go new file mode 100644 index 00000000..d873a7d2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletepluginwithroute.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePluginWithRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *DeletePluginWithRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePluginWithRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *DeletePluginWithRouteRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type DeletePluginWithRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePluginWithRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletepluginwithservice.go b/tests/mockserver/internal/sdk/models/operations/deletepluginwithservice.go new file mode 100644 index 00000000..cd06652a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletepluginwithservice.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeletePluginWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *DeletePluginWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeletePluginWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *DeletePluginWithServiceRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type DeletePluginWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeletePluginWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteroute.go b/tests/mockserver/internal/sdk/models/operations/deleteroute.go new file mode 100644 index 00000000..a796ec74 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteroute.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` +} + +func (o *DeleteRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +type DeleteRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/deleteroutewithservice.go new file mode 100644 index 00000000..5db947d5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteroutewithservice.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` +} + +func (o *DeleteRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *DeleteRouteWithServiceRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +type DeleteRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteservice.go b/tests/mockserver/internal/sdk/models/operations/deleteservice.go new file mode 100644 index 00000000..e9a5264c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteservice.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` +} + +func (o *DeleteServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +type DeleteServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletesni.go b/tests/mockserver/internal/sdk/models/operations/deletesni.go new file mode 100644 index 00000000..940ab8ef --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletesni.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteSniRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the SNI to lookup + SNIID string `pathParam:"style=simple,explode=false,name=SNIId"` +} + +func (o *DeleteSniRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteSniRequest) GetSNIID() string { + if o == nil { + return "" + } + return o.SNIID +} + +type DeleteSniResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteSniResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletesniwithcertificate.go b/tests/mockserver/internal/sdk/models/operations/deletesniwithcertificate.go new file mode 100644 index 00000000..36aab59b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletesniwithcertificate.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteSniWithCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // ID of the SNI to lookup + SNIID string `pathParam:"style=simple,explode=false,name=SNIId"` +} + +func (o *DeleteSniWithCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteSniWithCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *DeleteSniWithCertificateRequest) GetSNIID() string { + if o == nil { + return "" + } + return o.SNIID +} + +type DeleteSniWithCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteSniWithCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsaccountidassignedrolesroleid.go b/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsaccountidassignedrolesroleid.go new file mode 100644 index 00000000..43eb47dd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsaccountidassignedrolesroleid.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteSystemAccountsAccountIDAssignedRolesRoleIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // ID of the role. + RoleID string `pathParam:"style=simple,explode=false,name=roleId"` +} + +func (o *DeleteSystemAccountsAccountIDAssignedRolesRoleIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *DeleteSystemAccountsAccountIDAssignedRolesRoleIDRequest) GetRoleID() string { + if o == nil { + return "" + } + return o.RoleID +} + +type DeleteSystemAccountsAccountIDAssignedRolesRoleIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteSystemAccountsAccountIDAssignedRolesRoleIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsid.go b/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsid.go new file mode 100644 index 00000000..89e3ee2d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsid.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteSystemAccountsIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` +} + +func (o *DeleteSystemAccountsIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +type DeleteSystemAccountsIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteSystemAccountsIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsidaccesstokensid.go b/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsidaccesstokensid.go new file mode 100644 index 00000000..4f810452 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletesystemaccountsidaccesstokensid.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteSystemAccountsIDAccessTokensIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // ID of the system account access token. + TokenID string `pathParam:"style=simple,explode=false,name=tokenId"` +} + +func (o *DeleteSystemAccountsIDAccessTokensIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *DeleteSystemAccountsIDAccessTokensIDRequest) GetTokenID() string { + if o == nil { + return "" + } + return o.TokenID +} + +type DeleteSystemAccountsIDAccessTokensIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteSystemAccountsIDAccessTokensIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletetargetwithupstream.go b/tests/mockserver/internal/sdk/models/operations/deletetargetwithupstream.go new file mode 100644 index 00000000..e4a1d30f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletetargetwithupstream.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteTargetWithUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID or target of the Target to lookup + UpstreamIDForTarget string `pathParam:"style=simple,explode=false,name=UpstreamIdForTarget"` + // ID of the Target to lookup + TargetID string `pathParam:"style=simple,explode=false,name=TargetId"` +} + +func (o *DeleteTargetWithUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteTargetWithUpstreamRequest) GetUpstreamIDForTarget() string { + if o == nil { + return "" + } + return o.UpstreamIDForTarget +} + +func (o *DeleteTargetWithUpstreamRequest) GetTargetID() string { + if o == nil { + return "" + } + return o.TargetID +} + +type DeleteTargetWithUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteTargetWithUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteteam.go b/tests/mockserver/internal/sdk/models/operations/deleteteam.go new file mode 100644 index 00000000..c5da46c9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteteam.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteTeamRequest struct { + // The team ID + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` +} + +func (o *DeleteTeamRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +type DeleteTeamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteTeamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteteamsteamidsystemaccountsaccountid.go b/tests/mockserver/internal/sdk/models/operations/deleteteamsteamidsystemaccountsaccountid.go new file mode 100644 index 00000000..fb5e31fe --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteteamsteamidsystemaccountsaccountid.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteTeamsTeamIDSystemAccountsAccountIDRequest struct { + // ID of the team. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` +} + +func (o *DeleteTeamsTeamIDSystemAccountsAccountIDRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *DeleteTeamsTeamIDSystemAccountsAccountIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +type DeleteTeamsTeamIDSystemAccountsAccountIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteTeamsTeamIDSystemAccountsAccountIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletetransitgateway.go b/tests/mockserver/internal/sdk/models/operations/deletetransitgateway.go new file mode 100644 index 00000000..3203fb7b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletetransitgateway.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteTransitGatewayRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` + // The ID of the transit gateway to operate on. + TransitGatewayID string `pathParam:"style=simple,explode=false,name=transitGatewayId"` +} + +func (o *DeleteTransitGatewayRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +func (o *DeleteTransitGatewayRequest) GetTransitGatewayID() string { + if o == nil { + return "" + } + return o.TransitGatewayID +} + +type DeleteTransitGatewayResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteTransitGatewayResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteupstream.go b/tests/mockserver/internal/sdk/models/operations/deleteupstream.go new file mode 100644 index 00000000..6bdbbaaf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteupstream.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Upstream to lookup + UpstreamID string `pathParam:"style=simple,explode=false,name=UpstreamId"` +} + +func (o *DeleteUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteUpstreamRequest) GetUpstreamID() string { + if o == nil { + return "" + } + return o.UpstreamID +} + +type DeleteUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deleteuser.go b/tests/mockserver/internal/sdk/models/operations/deleteuser.go new file mode 100644 index 00000000..6554e81a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deleteuser.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteUserRequest struct { + // The ID of the user being deleted. + UserID string `pathParam:"style=simple,explode=false,name=userId"` +} + +func (o *DeleteUserRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +type DeleteUserResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteUserResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/deletevault.go b/tests/mockserver/internal/sdk/models/operations/deletevault.go new file mode 100644 index 00000000..2b431960 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/deletevault.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type DeleteVaultRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Vault to lookup + VaultID string `pathParam:"style=simple,explode=false,name=VaultId"` +} + +func (o *DeleteVaultRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *DeleteVaultRequest) GetVaultID() string { + if o == nil { + return "" + } + return o.VaultID +} + +type DeleteVaultResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *DeleteVaultResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/fetchpluginschema.go b/tests/mockserver/internal/sdk/models/operations/fetchpluginschema.go new file mode 100644 index 00000000..2ec302cf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/fetchpluginschema.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type FetchPluginSchemaRequest struct { + // The name of the plugin + PluginName string `pathParam:"style=simple,explode=false,name=pluginName"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *FetchPluginSchemaRequest) GetPluginName() string { + if o == nil { + return "" + } + return o.PluginName +} + +func (o *FetchPluginSchemaRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +// FetchPluginSchemaResponseBody - The schema for the plugin +type FetchPluginSchemaResponseBody struct { + Fields []map[string]any `json:"fields,omitempty"` +} + +func (o *FetchPluginSchemaResponseBody) GetFields() []map[string]any { + if o == nil { + return nil + } + return o.Fields +} + +type FetchPluginSchemaResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // The schema for the plugin + Object *FetchPluginSchemaResponseBody +} + +func (o *FetchPluginSchemaResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *FetchPluginSchemaResponse) GetObject() *FetchPluginSchemaResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/getacl.go b/tests/mockserver/internal/sdk/models/operations/getacl.go new file mode 100644 index 00000000..8c64b497 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getacl.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetACLRequest struct { + // ID of the ACL to lookup + ACLID string `pathParam:"style=simple,explode=false,name=ACLId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetACLRequest) GetACLID() string { + if o == nil { + return "" + } + return o.ACLID +} + +func (o *GetACLRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetACLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched ACL + ACL *components.ACL +} + +func (o *GetACLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetACLResponse) GetACL() *components.ACL { + if o == nil { + return nil + } + return o.ACL +} diff --git a/tests/mockserver/internal/sdk/models/operations/getaclwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/getaclwithconsumer.go new file mode 100644 index 00000000..c6b98c8a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getaclwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetACLWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the ACL to lookup + ACLID string `pathParam:"style=simple,explode=false,name=ACLId"` +} + +func (o *GetACLWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetACLWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetACLWithConsumerRequest) GetACLID() string { + if o == nil { + return "" + } + return o.ACLID +} + +type GetACLWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched ACL + ACL *components.ACL +} + +func (o *GetACLWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetACLWithConsumerResponse) GetACL() *components.ACL { + if o == nil { + return nil + } + return o.ACL +} diff --git a/tests/mockserver/internal/sdk/models/operations/getappauthstrategy.go b/tests/mockserver/internal/sdk/models/operations/getappauthstrategy.go new file mode 100644 index 00000000..ded92132 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getappauthstrategy.go @@ -0,0 +1,53 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetAppAuthStrategyRequest struct { + // Application auth strategy identifier + AuthStrategyID string `pathParam:"style=simple,explode=false,name=authStrategyId"` +} + +func (o *GetAppAuthStrategyRequest) GetAuthStrategyID() string { + if o == nil { + return "" + } + return o.AuthStrategyID +} + +type GetAppAuthStrategyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing a single application auth strategy object. + CreateAppAuthStrategyResponse *components.CreateAppAuthStrategyResponse +} + +func (o *GetAppAuthStrategyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetAppAuthStrategyResponse) GetCreateAppAuthStrategyResponse() *components.CreateAppAuthStrategyResponse { + if o == nil { + return nil + } + return o.CreateAppAuthStrategyResponse +} + +func (o *GetAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseKeyAuth() *components.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse + } + return nil +} + +func (o *GetAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseOpenidConnect() *components.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/getauthenticationsettings.go b/tests/mockserver/internal/sdk/models/operations/getauthenticationsettings.go new file mode 100644 index 00000000..d547d617 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getauthenticationsettings.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetAuthenticationSettingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response for authentication settings endpoint + AuthenticationSettings *components.AuthenticationSettings +} + +func (o *GetAuthenticationSettingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetAuthenticationSettingsResponse) GetAuthenticationSettings() *components.AuthenticationSettings { + if o == nil { + return nil + } + return o.AuthenticationSettings +} diff --git a/tests/mockserver/internal/sdk/models/operations/getavailabilityjson.go b/tests/mockserver/internal/sdk/models/operations/getavailabilityjson.go new file mode 100644 index 00000000..ce4105d0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getavailabilityjson.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetAvailabilityJSONResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving the cloud gateways availability JSON document. + AvailabilityDocument *components.AvailabilityDocument +} + +func (o *GetAvailabilityJSONResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetAvailabilityJSONResponse) GetAvailabilityDocument() *components.AvailabilityDocument { + if o == nil { + return nil + } + return o.AvailabilityDocument +} diff --git a/tests/mockserver/internal/sdk/models/operations/getbasicauth.go b/tests/mockserver/internal/sdk/models/operations/getbasicauth.go new file mode 100644 index 00000000..0b4594c8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getbasicauth.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetBasicAuthRequest struct { + // ID of the Basic-auth credential to lookup + BasicAuthID string `pathParam:"style=simple,explode=false,name=BasicAuthId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetBasicAuthRequest) GetBasicAuthID() string { + if o == nil { + return "" + } + return o.BasicAuthID +} + +func (o *GetBasicAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetBasicAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Basic-auth credential + BasicAuth *components.BasicAuth +} + +func (o *GetBasicAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetBasicAuthResponse) GetBasicAuth() *components.BasicAuth { + if o == nil { + return nil + } + return o.BasicAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getbasicauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/getbasicauthwithconsumer.go new file mode 100644 index 00000000..4ad28097 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getbasicauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetBasicAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the Basic-auth credential to lookup + BasicAuthID string `pathParam:"style=simple,explode=false,name=BasicAuthId"` +} + +func (o *GetBasicAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetBasicAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetBasicAuthWithConsumerRequest) GetBasicAuthID() string { + if o == nil { + return "" + } + return o.BasicAuthID +} + +type GetBasicAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Basic-auth credential + BasicAuth *components.BasicAuth +} + +func (o *GetBasicAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetBasicAuthWithConsumerResponse) GetBasicAuth() *components.BasicAuth { + if o == nil { + return nil + } + return o.BasicAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcacertificate.go b/tests/mockserver/internal/sdk/models/operations/getcacertificate.go new file mode 100644 index 00000000..0020791f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcacertificate.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetCaCertificateRequest struct { + // ID of the CA Certificate to lookup + CACertificateID string `pathParam:"style=simple,explode=false,name=CACertificateId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetCaCertificateRequest) GetCACertificateID() string { + if o == nil { + return "" + } + return o.CACertificateID +} + +func (o *GetCaCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetCaCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched CA Certificate + CACertificate *components.CACertificate +} + +func (o *GetCaCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetCaCertificateResponse) GetCACertificate() *components.CACertificate { + if o == nil { + return nil + } + return o.CACertificate +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcertificate.go b/tests/mockserver/internal/sdk/models/operations/getcertificate.go new file mode 100644 index 00000000..e469aea6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcertificate.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetCertificateRequest struct { + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *GetCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Certificate + Certificate *components.Certificate +} + +func (o *GetCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetCertificateResponse) GetCertificate() *components.Certificate { + if o == nil { + return nil + } + return o.Certificate +} diff --git a/tests/mockserver/internal/sdk/models/operations/getconfigstore.go b/tests/mockserver/internal/sdk/models/operations/getconfigstore.go new file mode 100644 index 00000000..0e9a53d6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getconfigstore.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // Config Store + ConfigStore *components.ConfigStore +} + +func (o *GetConfigStoreResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetConfigStoreResponse) GetConfigStore() *components.ConfigStore { + if o == nil { + return nil + } + return o.ConfigStore +} diff --git a/tests/mockserver/internal/sdk/models/operations/getconfigstoresecret.go b/tests/mockserver/internal/sdk/models/operations/getconfigstoresecret.go new file mode 100644 index 00000000..45e56430 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getconfigstoresecret.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // Config Store Secret + ConfigStoreSecret *components.ConfigStoreSecret +} + +func (o *GetConfigStoreSecretResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetConfigStoreSecretResponse) GetConfigStoreSecret() *components.ConfigStoreSecret { + if o == nil { + return nil + } + return o.ConfigStoreSecret +} diff --git a/tests/mockserver/internal/sdk/models/operations/getconfiguration.go b/tests/mockserver/internal/sdk/models/operations/getconfiguration.go new file mode 100644 index 00000000..95619c14 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getconfiguration.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetConfigurationRequest struct { + // The ID of the configuration to operate on. + ConfigurationID string `pathParam:"style=simple,explode=false,name=configurationId"` +} + +func (o *GetConfigurationRequest) GetConfigurationID() string { + if o == nil { + return "" + } + return o.ConfigurationID +} + +type GetConfigurationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a configuration by ID. + ConfigurationManifest *components.ConfigurationManifest +} + +func (o *GetConfigurationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetConfigurationResponse) GetConfigurationManifest() *components.ConfigurationManifest { + if o == nil { + return nil + } + return o.ConfigurationManifest +} diff --git a/tests/mockserver/internal/sdk/models/operations/getconsumer.go b/tests/mockserver/internal/sdk/models/operations/getconsumer.go new file mode 100644 index 00000000..fd88b3aa --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getconsumer.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetConsumerRequest struct { + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetConsumerRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +func (o *GetConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Consumer + Consumer *components.Consumer +} + +func (o *GetConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetConsumerResponse) GetConsumer() *components.Consumer { + if o == nil { + return nil + } + return o.Consumer +} diff --git a/tests/mockserver/internal/sdk/models/operations/getconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/getconsumergroup.go new file mode 100644 index 00000000..e7f1a3e7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getconsumergroup.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetConsumerGroupRequest struct { + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *GetConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Consumer Group + ConsumerGroupInsideWrapper *components.ConsumerGroupInsideWrapper +} + +func (o *GetConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetConsumerGroupResponse) GetConsumerGroupInsideWrapper() *components.ConsumerGroupInsideWrapper { + if o == nil { + return nil + } + return o.ConsumerGroupInsideWrapper +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcontrolplane.go b/tests/mockserver/internal/sdk/models/operations/getcontrolplane.go new file mode 100644 index 00000000..389e127e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcontrolplane.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetControlPlaneRequest struct { + // The control plane ID + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (o *GetControlPlaneRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type GetControlPlaneResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response to retrieving a single control plane. + ControlPlane *components.ControlPlane +} + +func (o *GetControlPlaneResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetControlPlaneResponse) GetControlPlane() *components.ControlPlane { + if o == nil { + return nil + } + return o.ControlPlane +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberships.go b/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberships.go new file mode 100644 index 00000000..86720bdd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberships.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetControlPlanesIDGroupMembershipsRequest struct { + // ID of a control plane group + ID string `pathParam:"style=simple,explode=false,name=id"` + // 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 *GetControlPlanesIDGroupMembershipsRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *GetControlPlanesIDGroupMembershipsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetControlPlanesIDGroupMembershipsRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +type GetControlPlanesIDGroupMembershipsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of control plane group memberships. + ListGroupMemberships *components.ListGroupMemberships +} + +func (o *GetControlPlanesIDGroupMembershipsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetControlPlanesIDGroupMembershipsResponse) GetListGroupMemberships() *components.ListGroupMemberships { + if o == nil { + return nil + } + return o.ListGroupMemberships +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberstatus.go b/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberstatus.go new file mode 100644 index 00000000..da43f76b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupmemberstatus.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetControlPlanesIDGroupMemberStatusRequest struct { + // ID of a control plane + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (o *GetControlPlanesIDGroupMemberStatusRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type GetControlPlanesIDGroupMemberStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Determines the group membership status of a control plane. + GroupMemberStatus *components.GroupMemberStatus +} + +func (o *GetControlPlanesIDGroupMemberStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetControlPlanesIDGroupMemberStatusResponse) GetGroupMemberStatus() *components.GroupMemberStatus { + if o == nil { + return nil + } + return o.GroupMemberStatus +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupstatus.go b/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupstatus.go new file mode 100644 index 00000000..7dc485fd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcontrolplanesidgroupstatus.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetControlPlanesIDGroupStatusRequest struct { + // ID of a control plane group + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (o *GetControlPlanesIDGroupStatusRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type GetControlPlanesIDGroupStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Status of a control plane group, including existing conflicts. + GetGroupStatus *components.GetGroupStatus +} + +func (o *GetControlPlanesIDGroupStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetControlPlanesIDGroupStatusResponse) GetGetGroupStatus() *components.GetGroupStatus { + if o == nil { + return nil + } + return o.GetGroupStatus +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcustomdomain.go b/tests/mockserver/internal/sdk/models/operations/getcustomdomain.go new file mode 100644 index 00000000..73851d35 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcustomdomain.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetCustomDomainRequest struct { + // ID of the custom domain to operate on. + CustomDomainID string `pathParam:"style=simple,explode=false,name=customDomainId"` +} + +func (o *GetCustomDomainRequest) GetCustomDomainID() string { + if o == nil { + return "" + } + return o.CustomDomainID +} + +type GetCustomDomainResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a custom domain for a control-plane. + CustomDomain *components.CustomDomain +} + +func (o *GetCustomDomainResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetCustomDomainResponse) GetCustomDomain() *components.CustomDomain { + if o == nil { + return nil + } + return o.CustomDomain +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcustomdomainonlinestatus.go b/tests/mockserver/internal/sdk/models/operations/getcustomdomainonlinestatus.go new file mode 100644 index 00000000..156840f4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcustomdomainonlinestatus.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetCustomDomainOnlineStatusRequest struct { + // ID of the custom domain to operate on. + CustomDomainID string `pathParam:"style=simple,explode=false,name=customDomainId"` +} + +func (o *GetCustomDomainOnlineStatusRequest) GetCustomDomainID() string { + if o == nil { + return "" + } + return o.CustomDomainID +} + +type GetCustomDomainOnlineStatusResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving the CNAME and SSL status of a custom domain. + CustomDomainOnlineStatus *components.CustomDomainOnlineStatus +} + +func (o *GetCustomDomainOnlineStatusResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetCustomDomainOnlineStatusResponse) GetCustomDomainOnlineStatus() *components.CustomDomainOnlineStatus { + if o == nil { + return nil + } + return o.CustomDomainOnlineStatus +} diff --git a/tests/mockserver/internal/sdk/models/operations/getcustomplugin.go b/tests/mockserver/internal/sdk/models/operations/getcustomplugin.go new file mode 100644 index 00000000..67f312de --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getcustomplugin.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetCustomPluginRequest struct { + // ID of the CustomPlugin to lookup + CustomPluginID string `pathParam:"style=simple,explode=false,name=CustomPluginId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetCustomPluginRequest) GetCustomPluginID() string { + if o == nil { + return "" + } + return o.CustomPluginID +} + +func (o *GetCustomPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetCustomPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched CustomPlugin + CustomPlugin *components.CustomPlugin +} + +func (o *GetCustomPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetCustomPluginResponse) GetCustomPlugin() *components.CustomPlugin { + if o == nil { + return nil + } + return o.CustomPlugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/getdataplanecertificate.go b/tests/mockserver/internal/sdk/models/operations/getdataplanecertificate.go new file mode 100644 index 00000000..07269adc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getdataplanecertificate.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetDataplaneCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + CertificateID string `pathParam:"style=simple,explode=false,name=certificateId"` +} + +func (o *GetDataplaneCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetDataplaneCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +type GetDataplaneCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response body for retrieving a dp-client-certificate. + DataPlaneClientCertificateResponse *components.DataPlaneClientCertificateResponse +} + +func (o *GetDataplaneCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetDataplaneCertificateResponse) GetDataPlaneClientCertificateResponse() *components.DataPlaneClientCertificateResponse { + if o == nil { + return nil + } + return o.DataPlaneClientCertificateResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/getdcrprovider.go b/tests/mockserver/internal/sdk/models/operations/getdcrprovider.go new file mode 100644 index 00000000..8ac0529d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getdcrprovider.go @@ -0,0 +1,74 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetDcrProviderRequest struct { + // DCR provider identifier + DcrProviderID string `pathParam:"style=simple,explode=false,name=dcrProviderId"` +} + +func (o *GetDcrProviderRequest) GetDcrProviderID() string { + if o == nil { + return "" + } + return o.DcrProviderID +} + +type GetDcrProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing a single DCR provider object. Sensitive fields will be removed from the response. + DcrProviderResponse *components.DcrProviderResponse +} + +func (o *GetDcrProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetDcrProviderResponse) GetDcrProviderResponse() *components.DcrProviderResponse { + if o == nil { + return nil + } + return o.DcrProviderResponse +} + +func (o *GetDcrProviderResponse) GetDcrProviderResponseDcrProviderAuth0() *components.DCRProviderResponseDCRProviderAuth0 { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderAuth0 + } + return nil +} + +func (o *GetDcrProviderResponse) GetDcrProviderResponseDcrProviderAzureAd() *components.DCRProviderResponseDCRProviderAzureAD { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderAzureAD + } + return nil +} + +func (o *GetDcrProviderResponse) GetDcrProviderResponseDcrProviderCurity() *components.DCRProviderResponseDCRProviderCurity { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderCurity + } + return nil +} + +func (o *GetDcrProviderResponse) GetDcrProviderResponseDcrProviderOkta() *components.DCRProviderResponseDCRProviderOKTA { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderOKTA + } + return nil +} + +func (o *GetDcrProviderResponse) GetDcrProviderResponseDcrProviderHTTP() *components.DCRProviderResponseDCRProviderHTTP { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderHTTP + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/getdegraphqlroute.go b/tests/mockserver/internal/sdk/models/operations/getdegraphqlroute.go new file mode 100644 index 00000000..97f890df --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getdegraphqlroute.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetDegraphqlRouteRequest struct { + // ID of the Degraphql_route to lookup + DegraphqlRouteID string `pathParam:"style=simple,explode=false,name=Degraphql_routeId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetDegraphqlRouteRequest) GetDegraphqlRouteID() string { + if o == nil { + return "" + } + return o.DegraphqlRouteID +} + +func (o *GetDegraphqlRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetDegraphqlRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Degraphql_route + DegraphqlRoute *components.DegraphqlRoute +} + +func (o *GetDegraphqlRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetDegraphqlRouteResponse) GetDegraphqlRoute() *components.DegraphqlRoute { + if o == nil { + return nil + } + return o.DegraphqlRoute +} diff --git a/tests/mockserver/internal/sdk/models/operations/getdegraphqlroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/getdegraphqlroutewithservice.go new file mode 100644 index 00000000..b6e6d72c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getdegraphqlroutewithservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetDegraphqlRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Degraphql_route to lookup + DegraphqlRouteID string `pathParam:"style=simple,explode=false,name=Degraphql_routeId"` +} + +func (o *GetDegraphqlRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetDegraphqlRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *GetDegraphqlRouteWithServiceRequest) GetDegraphqlRouteID() string { + if o == nil { + return "" + } + return o.DegraphqlRouteID +} + +type GetDegraphqlRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Degraphql_route + DegraphqlRoute *components.DegraphqlRoute +} + +func (o *GetDegraphqlRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetDegraphqlRouteWithServiceResponse) GetDegraphqlRoute() *components.DegraphqlRoute { + if o == nil { + return nil + } + return o.DegraphqlRoute +} diff --git a/tests/mockserver/internal/sdk/models/operations/geteventsubscription.go b/tests/mockserver/internal/sdk/models/operations/geteventsubscription.go new file mode 100644 index 00000000..995eb453 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/geteventsubscription.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetEventSubscriptionRequest struct { + // Formatted string ID of the notification event. + EventID string `pathParam:"style=simple,explode=false,name=eventId"` + // Subscription ID of the user configuration. + SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionId"` +} + +func (o *GetEventSubscriptionRequest) GetEventID() string { + if o == nil { + return "" + } + return o.EventID +} + +func (o *GetEventSubscriptionRequest) GetSubscriptionID() string { + if o == nil { + return "" + } + return o.SubscriptionID +} + +type GetEventSubscriptionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response containing specific subscription details associated with an event. + EventSubscriptionResponse *components.EventSubscriptionResponse +} + +func (o *GetEventSubscriptionResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetEventSubscriptionResponse) GetEventSubscriptionResponse() *components.EventSubscriptionResponse { + if o == nil { + return nil + } + return o.EventSubscriptionResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/getexpectedconfighash.go b/tests/mockserver/internal/sdk/models/operations/getexpectedconfighash.go new file mode 100644 index 00000000..018a618b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getexpectedconfighash.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetExpectedConfigHashRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetExpectedConfigHashRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetExpectedConfigHashResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response body for retrieving the expected config hash of the control plane. + GetExpectedConfigHashResponse *components.GetExpectedConfigHashResponse +} + +func (o *GetExpectedConfigHashResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetExpectedConfigHashResponse) GetGetExpectedConfigHashResponse() *components.GetExpectedConfigHashResponse { + if o == nil { + return nil + } + return o.GetExpectedConfigHashResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/gethmacauth.go b/tests/mockserver/internal/sdk/models/operations/gethmacauth.go new file mode 100644 index 00000000..cc167dda --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/gethmacauth.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetHmacAuthRequest struct { + // ID of the HMAC-auth credential to lookup + HMACAuthID string `pathParam:"style=simple,explode=false,name=HMACAuthId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetHmacAuthRequest) GetHMACAuthID() string { + if o == nil { + return "" + } + return o.HMACAuthID +} + +func (o *GetHmacAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetHmacAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched HMAC-auth credential + HMACAuth *components.HMACAuth +} + +func (o *GetHmacAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetHmacAuthResponse) GetHMACAuth() *components.HMACAuth { + if o == nil { + return nil + } + return o.HMACAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/gethmacauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/gethmacauthwithconsumer.go new file mode 100644 index 00000000..f45153ae --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/gethmacauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetHmacAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the HMAC-auth credential to lookup + HMACAuthID string `pathParam:"style=simple,explode=false,name=HMACAuthId"` +} + +func (o *GetHmacAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetHmacAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetHmacAuthWithConsumerRequest) GetHMACAuthID() string { + if o == nil { + return "" + } + return o.HMACAuthID +} + +type GetHmacAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched HMAC-auth credential + HMACAuth *components.HMACAuth +} + +func (o *GetHmacAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetHmacAuthWithConsumerResponse) GetHMACAuth() *components.HMACAuth { + if o == nil { + return nil + } + return o.HMACAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getidentityprovider.go b/tests/mockserver/internal/sdk/models/operations/getidentityprovider.go new file mode 100644 index 00000000..0135213e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getidentityprovider.go @@ -0,0 +1,40 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetIdentityProviderRequest struct { + // ID of the identity provider. + ID string `pathParam:"style=simple,explode=false,name=id"` +} + +func (o *GetIdentityProviderRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type GetIdentityProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // An identity provider configuration. This response represents the configuration of a specific identity provider, which can be either OIDC or SAML. + // + IdentityProvider *components.IdentityProvider +} + +func (o *GetIdentityProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetIdentityProviderResponse) GetIdentityProvider() *components.IdentityProvider { + if o == nil { + return nil + } + return o.IdentityProvider +} diff --git a/tests/mockserver/internal/sdk/models/operations/getidentityproviders.go b/tests/mockserver/internal/sdk/models/operations/getidentityproviders.go new file mode 100644 index 00000000..6cef0c4f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getidentityproviders.go @@ -0,0 +1,53 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// GetIdentityProvidersFilter - Filter identity providers returned in the response. +type GetIdentityProvidersFilter struct { + // Filters on the given string field value by exact match. + Type *string `queryParam:"name=type"` +} + +func (o *GetIdentityProvidersFilter) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +type GetIdentityProvidersRequest struct { + // Filter identity providers returned in the response. + Filter *GetIdentityProvidersFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *GetIdentityProvidersRequest) GetFilter() *GetIdentityProvidersFilter { + if o == nil { + return nil + } + return o.Filter +} + +type GetIdentityProvidersResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A collection of identity providers. This response contains a collection of identity providers, which may include both OIDC and SAML identity providers. + // + IdentityProviders []components.IdentityProvider +} + +func (o *GetIdentityProvidersResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetIdentityProvidersResponse) GetIdentityProviders() []components.IdentityProvider { + if o == nil { + return nil + } + return o.IdentityProviders +} diff --git a/tests/mockserver/internal/sdk/models/operations/getidpconfiguration.go b/tests/mockserver/internal/sdk/models/operations/getidpconfiguration.go new file mode 100644 index 00000000..fe73fb59 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getidpconfiguration.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetIdpConfigurationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of the IdP configuration. + IDP *components.IDP +} + +func (o *GetIdpConfigurationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetIdpConfigurationResponse) GetIDP() *components.IDP { + if o == nil { + return nil + } + return o.IDP +} diff --git a/tests/mockserver/internal/sdk/models/operations/getidpteammappings.go b/tests/mockserver/internal/sdk/models/operations/getidpteammappings.go new file mode 100644 index 00000000..ee8a1109 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getidpteammappings.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetIdpTeamMappingsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *GetIdpTeamMappingsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetIdpTeamMappingsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type GetIdpTeamMappingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of team mappings. + TeamMappingResponse *components.TeamMappingResponse +} + +func (o *GetIdpTeamMappingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetIdpTeamMappingsResponse) GetTeamMappingResponse() *components.TeamMappingResponse { + if o == nil { + return nil + } + return o.TeamMappingResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/getimpersonationsettings.go b/tests/mockserver/internal/sdk/models/operations/getimpersonationsettings.go new file mode 100644 index 00000000..c76328b6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getimpersonationsettings.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetImpersonationSettingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response for Get Impersonation Settings endpoint + GetImpersonationSettingsResponse *components.GetImpersonationSettingsResponse +} + +func (o *GetImpersonationSettingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetImpersonationSettingsResponse) GetGetImpersonationSettingsResponse() *components.GetImpersonationSettingsResponse { + if o == nil { + return nil + } + return o.GetImpersonationSettingsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/getjwt.go b/tests/mockserver/internal/sdk/models/operations/getjwt.go new file mode 100644 index 00000000..c565f155 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getjwt.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetJwtRequest struct { + // ID of the JWT to lookup + JWTID string `pathParam:"style=simple,explode=false,name=JWTId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetJwtRequest) GetJWTID() string { + if o == nil { + return "" + } + return o.JWTID +} + +func (o *GetJwtRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetJwtResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched JWT + Jwt *components.Jwt +} + +func (o *GetJwtResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetJwtResponse) GetJwt() *components.Jwt { + if o == nil { + return nil + } + return o.Jwt +} diff --git a/tests/mockserver/internal/sdk/models/operations/getjwtwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/getjwtwithconsumer.go new file mode 100644 index 00000000..1d1a95fd --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getjwtwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetJwtWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the JWT to lookup + JWTID string `pathParam:"style=simple,explode=false,name=JWTId"` +} + +func (o *GetJwtWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetJwtWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetJwtWithConsumerRequest) GetJWTID() string { + if o == nil { + return "" + } + return o.JWTID +} + +type GetJwtWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched JWT + Jwt *components.Jwt +} + +func (o *GetJwtWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetJwtWithConsumerResponse) GetJwt() *components.Jwt { + if o == nil { + return nil + } + return o.Jwt +} diff --git a/tests/mockserver/internal/sdk/models/operations/getkey.go b/tests/mockserver/internal/sdk/models/operations/getkey.go new file mode 100644 index 00000000..ab865627 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getkey.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetKeyRequest struct { + // ID of the Key to lookup + KeyID string `pathParam:"style=simple,explode=false,name=KeyId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetKeyRequest) GetKeyID() string { + if o == nil { + return "" + } + return o.KeyID +} + +func (o *GetKeyRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetKeyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Key + Key *components.Key +} + +func (o *GetKeyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetKeyResponse) GetKey() *components.Key { + if o == nil { + return nil + } + return o.Key +} diff --git a/tests/mockserver/internal/sdk/models/operations/getkeyauth.go b/tests/mockserver/internal/sdk/models/operations/getkeyauth.go new file mode 100644 index 00000000..ef82eaf5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getkeyauth.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetKeyAuthRequest struct { + // ID of the API-key to lookup + KeyAuthID string `pathParam:"style=simple,explode=false,name=KeyAuthId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetKeyAuthRequest) GetKeyAuthID() string { + if o == nil { + return "" + } + return o.KeyAuthID +} + +func (o *GetKeyAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetKeyAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched API-key + KeyAuth *components.KeyAuth +} + +func (o *GetKeyAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetKeyAuthResponse) GetKeyAuth() *components.KeyAuth { + if o == nil { + return nil + } + return o.KeyAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getkeyauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/getkeyauthwithconsumer.go new file mode 100644 index 00000000..f443f829 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getkeyauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetKeyAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the API-key to lookup + KeyAuthID string `pathParam:"style=simple,explode=false,name=KeyAuthId"` +} + +func (o *GetKeyAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetKeyAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetKeyAuthWithConsumerRequest) GetKeyAuthID() string { + if o == nil { + return "" + } + return o.KeyAuthID +} + +type GetKeyAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched API-key + KeyAuth *components.KeyAuth +} + +func (o *GetKeyAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetKeyAuthWithConsumerResponse) GetKeyAuth() *components.KeyAuth { + if o == nil { + return nil + } + return o.KeyAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getkeyset.go b/tests/mockserver/internal/sdk/models/operations/getkeyset.go new file mode 100644 index 00000000..5a8b5e81 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getkeyset.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetKeySetRequest struct { + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *GetKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched KeySet + KeySet *components.KeySet +} + +func (o *GetKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetKeySetResponse) GetKeySet() *components.KeySet { + if o == nil { + return nil + } + return o.KeySet +} diff --git a/tests/mockserver/internal/sdk/models/operations/getkeywithkeyset.go b/tests/mockserver/internal/sdk/models/operations/getkeywithkeyset.go new file mode 100644 index 00000000..1f99c907 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getkeywithkeyset.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetKeyWithKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // ID of the Key to lookup + KeyID string `pathParam:"style=simple,explode=false,name=KeyId"` +} + +func (o *GetKeyWithKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetKeyWithKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *GetKeyWithKeySetRequest) GetKeyID() string { + if o == nil { + return "" + } + return o.KeyID +} + +type GetKeyWithKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Key + Key *components.Key +} + +func (o *GetKeyWithKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetKeyWithKeySetResponse) GetKey() *components.Key { + if o == nil { + return nil + } + return o.Key +} diff --git a/tests/mockserver/internal/sdk/models/operations/getmtlsauth.go b/tests/mockserver/internal/sdk/models/operations/getmtlsauth.go new file mode 100644 index 00000000..6e2a0340 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getmtlsauth.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetMtlsAuthRequest struct { + // ID of the MTLS-auth credential to lookup + MTLSAuthID string `pathParam:"style=simple,explode=false,name=MTLSAuthId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetMtlsAuthRequest) GetMTLSAuthID() string { + if o == nil { + return "" + } + return o.MTLSAuthID +} + +func (o *GetMtlsAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetMtlsAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched MTLS-auth credential + MTLSAuth *components.MTLSAuth +} + +func (o *GetMtlsAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetMtlsAuthResponse) GetMTLSAuth() *components.MTLSAuth { + if o == nil { + return nil + } + return o.MTLSAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getmtlsauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/getmtlsauthwithconsumer.go new file mode 100644 index 00000000..d080b934 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getmtlsauthwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetMtlsAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the MTLS-auth credential to lookup + MTLSAuthID string `pathParam:"style=simple,explode=false,name=MTLSAuthId"` +} + +func (o *GetMtlsAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetMtlsAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetMtlsAuthWithConsumerRequest) GetMTLSAuthID() string { + if o == nil { + return "" + } + return o.MTLSAuthID +} + +type GetMtlsAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched MTLS-auth credential + MTLSAuth *components.MTLSAuth +} + +func (o *GetMtlsAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetMtlsAuthWithConsumerResponse) GetMTLSAuth() *components.MTLSAuth { + if o == nil { + return nil + } + return o.MTLSAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/getnetwork.go b/tests/mockserver/internal/sdk/models/operations/getnetwork.go new file mode 100644 index 00000000..30cd4333 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getnetwork.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetNetworkRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` +} + +func (o *GetNetworkRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +type GetNetworkResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a network. + Network *components.Network +} + +func (o *GetNetworkResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetNetworkResponse) GetNetwork() *components.Network { + if o == nil { + return nil + } + return o.Network +} diff --git a/tests/mockserver/internal/sdk/models/operations/getnodeseol.go b/tests/mockserver/internal/sdk/models/operations/getnodeseol.go new file mode 100644 index 00000000..37c71bb4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getnodeseol.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetNodesEolRequest 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 *GetNodesEolRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetNodesEolRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetNodesEolRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +type GetNodesEolResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Example response + ListNodesEol *components.ListNodesEol +} + +func (o *GetNodesEolResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetNodesEolResponse) GetListNodesEol() *components.ListNodesEol { + if o == nil { + return nil + } + return o.ListNodesEol +} diff --git a/tests/mockserver/internal/sdk/models/operations/getnodesnodeid.go b/tests/mockserver/internal/sdk/models/operations/getnodesnodeid.go new file mode 100644 index 00000000..7e68319e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getnodesnodeid.go @@ -0,0 +1,78 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type GetNodesNodeIDRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Node identifier + NodeID string `pathParam:"style=simple,explode=false,name=nodeId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (g GetNodesNodeIDRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetNodesNodeIDRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetNodesNodeIDRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetNodesNodeIDRequest) GetNodeID() string { + if o == nil { + return "" + } + return o.NodeID +} + +func (o *GetNodesNodeIDRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetNodesNodeIDRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +type GetNodesNodeIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Example response + GetNode *components.GetNode +} + +func (o *GetNodesNodeIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetNodesNodeIDResponse) GetGetNode() *components.GetNode { + if o == nil { + return nil + } + return o.GetNode +} diff --git a/tests/mockserver/internal/sdk/models/operations/getnotificationdetails.go b/tests/mockserver/internal/sdk/models/operations/getnotificationdetails.go new file mode 100644 index 00000000..394fb514 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getnotificationdetails.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetNotificationDetailsRequest struct { + // ID of the notification. + NotificationID string `pathParam:"style=simple,explode=false,name=notificationId"` +} + +func (o *GetNotificationDetailsRequest) GetNotificationID() string { + if o == nil { + return "" + } + return o.NotificationID +} + +type GetNotificationDetailsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // View a single notification. + Notification *components.Notification +} + +func (o *GetNotificationDetailsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetNotificationDetailsResponse) GetNotification() *components.Notification { + if o == nil { + return nil + } + return o.Notification +} diff --git a/tests/mockserver/internal/sdk/models/operations/getorganizationsme.go b/tests/mockserver/internal/sdk/models/operations/getorganizationsme.go new file mode 100644 index 00000000..d4da863d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getorganizationsme.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetOrganizationsMeResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Me Organization + MeOrganization *components.MeOrganization +} + +func (o *GetOrganizationsMeResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetOrganizationsMeResponse) GetMeOrganization() *components.MeOrganization { + if o == nil { + return nil + } + return o.MeOrganization +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpartial.go b/tests/mockserver/internal/sdk/models/operations/getpartial.go new file mode 100644 index 00000000..6e392db5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpartial.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPartialRequest struct { + // ID of the Partial to lookup + PartialID string `pathParam:"style=simple,explode=false,name=PartialId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetPartialRequest) GetPartialID() string { + if o == nil { + return "" + } + return o.PartialID +} + +func (o *GetPartialRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetPartialResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Partial + Partial *components.Partial +} + +func (o *GetPartialResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPartialResponse) GetPartial() *components.Partial { + if o == nil { + return nil + } + return o.Partial +} diff --git a/tests/mockserver/internal/sdk/models/operations/getplugin.go b/tests/mockserver/internal/sdk/models/operations/getplugin.go new file mode 100644 index 00000000..ca401bc0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getplugin.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPluginRequest struct { + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetPluginRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +func (o *GetPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Plugin + Plugin *components.Plugin +} + +func (o *GetPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPluginResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpluginschema.go b/tests/mockserver/internal/sdk/models/operations/getpluginschema.go new file mode 100644 index 00000000..7d2f0d8f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpluginschema.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPluginSchemaRequest 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 custom plugin name + Name string `pathParam:"style=simple,explode=false,name=name"` +} + +func (o *GetPluginSchemaRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetPluginSchemaRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +type GetPluginSchemaResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response for a single custom plugin schema. + PluginSchemas *components.PluginSchemas +} + +func (o *GetPluginSchemaResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPluginSchemaResponse) GetPluginSchemas() *components.PluginSchemas { + if o == nil { + return nil + } + return o.PluginSchemas +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpluginwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/getpluginwithconsumer.go new file mode 100644 index 00000000..e4a535c6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpluginwithconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPluginWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *GetPluginWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetPluginWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *GetPluginWithConsumerRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type GetPluginWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Plugin + Plugin *components.Plugin +} + +func (o *GetPluginWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPluginWithConsumerResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpluginwithconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/getpluginwithconsumergroup.go new file mode 100644 index 00000000..555e1cf6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpluginwithconsumergroup.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPluginWithConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *GetPluginWithConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetPluginWithConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *GetPluginWithConsumerGroupRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type GetPluginWithConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Plugin + Plugin *components.Plugin +} + +func (o *GetPluginWithConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPluginWithConsumerGroupResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpluginwithroute.go b/tests/mockserver/internal/sdk/models/operations/getpluginwithroute.go new file mode 100644 index 00000000..b7362f1f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpluginwithroute.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPluginWithRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *GetPluginWithRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetPluginWithRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *GetPluginWithRouteRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type GetPluginWithRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Plugin + Plugin *components.Plugin +} + +func (o *GetPluginWithRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPluginWithRouteResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpluginwithservice.go b/tests/mockserver/internal/sdk/models/operations/getpluginwithservice.go new file mode 100644 index 00000000..b0280e33 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpluginwithservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPluginWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` +} + +func (o *GetPluginWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetPluginWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *GetPluginWithServiceRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +type GetPluginWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Plugin + Plugin *components.Plugin +} + +func (o *GetPluginWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPluginWithServiceResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/getpredefinedroles.go b/tests/mockserver/internal/sdk/models/operations/getpredefinedroles.go new file mode 100644 index 00000000..af3949f3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getpredefinedroles.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetPredefinedRolesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // The predefined, or system managed, roles. + Roles *components.Roles +} + +func (o *GetPredefinedRolesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetPredefinedRolesResponse) GetRoles() *components.Roles { + if o == nil { + return nil + } + return o.Roles +} diff --git a/tests/mockserver/internal/sdk/models/operations/getprovideraccount.go b/tests/mockserver/internal/sdk/models/operations/getprovideraccount.go new file mode 100644 index 00000000..77dd0ec2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getprovideraccount.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetProviderAccountRequest struct { + // The ID of the provider account to operate on. + ProviderAccountID string `pathParam:"style=simple,explode=false,name=providerAccountId"` +} + +func (o *GetProviderAccountRequest) GetProviderAccountID() string { + if o == nil { + return "" + } + return o.ProviderAccountID +} + +type GetProviderAccountResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a provider account. + ProviderAccount *components.ProviderAccount +} + +func (o *GetProviderAccountResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetProviderAccountResponse) GetProviderAccount() *components.ProviderAccount { + if o == nil { + return nil + } + return o.ProviderAccount +} diff --git a/tests/mockserver/internal/sdk/models/operations/getresourceconfiguration.go b/tests/mockserver/internal/sdk/models/operations/getresourceconfiguration.go new file mode 100644 index 00000000..dcb35669 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getresourceconfiguration.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetResourceConfigurationRequest struct { + // The ID of the resource configuration to operate on. + ResourceConfigurationID string `pathParam:"style=simple,explode=false,name=resourceConfigurationId"` +} + +func (o *GetResourceConfigurationRequest) GetResourceConfigurationID() string { + if o == nil { + return "" + } + return o.ResourceConfigurationID +} + +type GetResourceConfigurationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a resource configuration for an organization. + ResourceConfiguration *components.ResourceConfiguration +} + +func (o *GetResourceConfigurationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetResourceConfigurationResponse) GetResourceConfiguration() *components.ResourceConfiguration { + if o == nil { + return nil + } + return o.ResourceConfiguration +} diff --git a/tests/mockserver/internal/sdk/models/operations/getresourcequota.go b/tests/mockserver/internal/sdk/models/operations/getresourcequota.go new file mode 100644 index 00000000..69e4e2fc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getresourcequota.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetResourceQuotaRequest struct { + // The ID of the resource quota to operate on. + ResourceQuotaID string `pathParam:"style=simple,explode=false,name=resourceQuotaId"` +} + +func (o *GetResourceQuotaRequest) GetResourceQuotaID() string { + if o == nil { + return "" + } + return o.ResourceQuotaID +} + +type GetResourceQuotaResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a resource quota for an organization. + ResourceQuota *components.ResourceQuota +} + +func (o *GetResourceQuotaResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetResourceQuotaResponse) GetResourceQuota() *components.ResourceQuota { + if o == nil { + return nil + } + return o.ResourceQuota +} diff --git a/tests/mockserver/internal/sdk/models/operations/getroute.go b/tests/mockserver/internal/sdk/models/operations/getroute.go new file mode 100644 index 00000000..103274f6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getroute.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetRouteRequest struct { + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *GetRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Route + Route *components.Route +} + +func (o *GetRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetRouteResponse) GetRoute() *components.Route { + if o == nil { + return nil + } + return o.Route +} diff --git a/tests/mockserver/internal/sdk/models/operations/getroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/getroutewithservice.go new file mode 100644 index 00000000..c7e3a330 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getroutewithservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` +} + +func (o *GetRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *GetRouteWithServiceRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +type GetRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Route + Route *components.Route +} + +func (o *GetRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetRouteWithServiceResponse) GetRoute() *components.Route { + if o == nil { + return nil + } + return o.Route +} diff --git a/tests/mockserver/internal/sdk/models/operations/getservice.go b/tests/mockserver/internal/sdk/models/operations/getservice.go new file mode 100644 index 00000000..0d1c3d4c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getservice.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetServiceRequest struct { + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *GetServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Service + Service *components.ServiceOutput +} + +func (o *GetServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetServiceResponse) GetService() *components.ServiceOutput { + if o == nil { + return nil + } + return o.Service +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsni.go b/tests/mockserver/internal/sdk/models/operations/getsni.go new file mode 100644 index 00000000..1510908d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsni.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetSniRequest struct { + // ID of the SNI to lookup + SNIID string `pathParam:"style=simple,explode=false,name=SNIId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetSniRequest) GetSNIID() string { + if o == nil { + return "" + } + return o.SNIID +} + +func (o *GetSniRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetSniResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched SNI + Sni *components.Sni +} + +func (o *GetSniResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSniResponse) GetSni() *components.Sni { + if o == nil { + return nil + } + return o.Sni +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsniwithcertificate.go b/tests/mockserver/internal/sdk/models/operations/getsniwithcertificate.go new file mode 100644 index 00000000..46f98e87 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsniwithcertificate.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetSniWithCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // ID of the SNI to lookup + SNIID string `pathParam:"style=simple,explode=false,name=SNIId"` +} + +func (o *GetSniWithCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetSniWithCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *GetSniWithCertificateRequest) GetSNIID() string { + if o == nil { + return "" + } + return o.SNIID +} + +type GetSniWithCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched SNI + Sni *components.Sni +} + +func (o *GetSniWithCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSniWithCertificateResponse) GetSni() *components.Sni { + if o == nil { + return nil + } + return o.Sni +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsystemaccountidaccesstokens.go b/tests/mockserver/internal/sdk/models/operations/getsystemaccountidaccesstokens.go new file mode 100644 index 00000000..55aa9268 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsystemaccountidaccesstokens.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// GetSystemAccountIDAccessTokensFilter - Filter access tokens returned in the response. +type GetSystemAccountIDAccessTokensFilter struct { + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` +} + +func (o *GetSystemAccountIDAccessTokensFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +type GetSystemAccountIDAccessTokensRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter access tokens returned in the response. + Filter *GetSystemAccountIDAccessTokensFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *GetSystemAccountIDAccessTokensRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *GetSystemAccountIDAccessTokensRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetSystemAccountIDAccessTokensRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *GetSystemAccountIDAccessTokensRequest) GetFilter() *GetSystemAccountIDAccessTokensFilter { + if o == nil { + return nil + } + return o.Filter +} + +type GetSystemAccountIDAccessTokensResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of system accounts access tokens. + SystemAccountAccessTokenCollection *components.SystemAccountAccessTokenCollection +} + +func (o *GetSystemAccountIDAccessTokensResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSystemAccountIDAccessTokensResponse) GetSystemAccountAccessTokenCollection() *components.SystemAccountAccessTokenCollection { + if o == nil { + return nil + } + return o.SystemAccountAccessTokenCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsystemaccounts.go b/tests/mockserver/internal/sdk/models/operations/getsystemaccounts.go new file mode 100644 index 00000000..88c5a671 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsystemaccounts.go @@ -0,0 +1,88 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// GetSystemAccountsFilter - Filter system accounts returned in the response. +type GetSystemAccountsFilter struct { + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` + // Filters on the given string field value by exact match inequality. + Description *components.StringFieldFilter `queryParam:"name=description"` + // Filter by a boolean value (true/false). + KonnectManaged *bool `queryParam:"name=konnect_managed"` +} + +func (o *GetSystemAccountsFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +func (o *GetSystemAccountsFilter) GetDescription() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Description +} + +func (o *GetSystemAccountsFilter) GetKonnectManaged() *bool { + if o == nil { + return nil + } + return o.KonnectManaged +} + +type GetSystemAccountsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter system accounts returned in the response. + Filter *GetSystemAccountsFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *GetSystemAccountsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetSystemAccountsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *GetSystemAccountsRequest) GetFilter() *GetSystemAccountsFilter { + if o == nil { + return nil + } + return o.Filter +} + +type GetSystemAccountsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of system accounts. + SystemAccountCollection *components.SystemAccountCollection +} + +func (o *GetSystemAccountsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSystemAccountsResponse) GetSystemAccountCollection() *components.SystemAccountCollection { + if o == nil { + return nil + } + return o.SystemAccountCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidassignedroles.go b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidassignedroles.go new file mode 100644 index 00000000..458d6d82 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidassignedroles.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// GetSystemAccountsAccountIDAssignedRolesFilter - Filter roles returned in the response. +type GetSystemAccountsAccountIDAssignedRolesFilter struct { + // Filters on the given string field value by exact match. + RoleName *string `queryParam:"name=role_name"` + // Filters on the given string field value by exact match. + EntityTypeName *string `queryParam:"name=entity_type_name"` +} + +func (o *GetSystemAccountsAccountIDAssignedRolesFilter) GetRoleName() *string { + if o == nil { + return nil + } + return o.RoleName +} + +func (o *GetSystemAccountsAccountIDAssignedRolesFilter) GetEntityTypeName() *string { + if o == nil { + return nil + } + return o.EntityTypeName +} + +type GetSystemAccountsAccountIDAssignedRolesRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // Filter roles returned in the response. + Filter *GetSystemAccountsAccountIDAssignedRolesFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *GetSystemAccountsAccountIDAssignedRolesRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *GetSystemAccountsAccountIDAssignedRolesRequest) GetFilter() *GetSystemAccountsAccountIDAssignedRolesFilter { + if o == nil { + return nil + } + return o.Filter +} + +type GetSystemAccountsAccountIDAssignedRolesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of assigned roles. + AssignedRoleCollection *components.AssignedRoleCollection +} + +func (o *GetSystemAccountsAccountIDAssignedRolesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSystemAccountsAccountIDAssignedRolesResponse) GetAssignedRoleCollection() *components.AssignedRoleCollection { + if o == nil { + return nil + } + return o.AssignedRoleCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidteams.go b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidteams.go new file mode 100644 index 00000000..cc28dce6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsaccountidteams.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// GetSystemAccountsAccountIDTeamsFilter - Filter teams returned in the response. +type GetSystemAccountsAccountIDTeamsFilter struct { + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` +} + +func (o *GetSystemAccountsAccountIDTeamsFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +type GetSystemAccountsAccountIDTeamsRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter teams returned in the response. + Filter *GetSystemAccountsAccountIDTeamsFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *GetSystemAccountsAccountIDTeamsRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *GetSystemAccountsAccountIDTeamsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetSystemAccountsAccountIDTeamsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *GetSystemAccountsAccountIDTeamsRequest) GetFilter() *GetSystemAccountsAccountIDTeamsFilter { + if o == nil { + return nil + } + return o.Filter +} + +type GetSystemAccountsAccountIDTeamsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of users. + TeamCollection *components.TeamCollection +} + +func (o *GetSystemAccountsAccountIDTeamsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSystemAccountsAccountIDTeamsResponse) GetTeamCollection() *components.TeamCollection { + if o == nil { + return nil + } + return o.TeamCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsystemaccountsid.go b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsid.go new file mode 100644 index 00000000..78e3cdc5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsid.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetSystemAccountsIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` +} + +func (o *GetSystemAccountsIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +type GetSystemAccountsIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single system account. + SystemAccount *components.SystemAccount +} + +func (o *GetSystemAccountsIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSystemAccountsIDResponse) GetSystemAccount() *components.SystemAccount { + if o == nil { + return nil + } + return o.SystemAccount +} diff --git a/tests/mockserver/internal/sdk/models/operations/getsystemaccountsidaccesstokensid.go b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsidaccesstokensid.go new file mode 100644 index 00000000..ae6839f1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getsystemaccountsidaccesstokensid.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetSystemAccountsIDAccessTokensIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // ID of the system account access token. + TokenID string `pathParam:"style=simple,explode=false,name=tokenId"` +} + +func (o *GetSystemAccountsIDAccessTokensIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *GetSystemAccountsIDAccessTokensIDRequest) GetTokenID() string { + if o == nil { + return "" + } + return o.TokenID +} + +type GetSystemAccountsIDAccessTokensIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single system account access token. + SystemAccountAccessToken *components.SystemAccountAccessToken +} + +func (o *GetSystemAccountsIDAccessTokensIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetSystemAccountsIDAccessTokensIDResponse) GetSystemAccountAccessToken() *components.SystemAccountAccessToken { + if o == nil { + return nil + } + return o.SystemAccountAccessToken +} diff --git a/tests/mockserver/internal/sdk/models/operations/gettargetwithupstream.go b/tests/mockserver/internal/sdk/models/operations/gettargetwithupstream.go new file mode 100644 index 00000000..2b92a204 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/gettargetwithupstream.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetTargetWithUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID or target of the Target to lookup + UpstreamIDForTarget string `pathParam:"style=simple,explode=false,name=UpstreamIdForTarget"` + // ID of the Target to lookup + TargetID string `pathParam:"style=simple,explode=false,name=TargetId"` +} + +func (o *GetTargetWithUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *GetTargetWithUpstreamRequest) GetUpstreamIDForTarget() string { + if o == nil { + return "" + } + return o.UpstreamIDForTarget +} + +func (o *GetTargetWithUpstreamRequest) GetTargetID() string { + if o == nil { + return "" + } + return o.TargetID +} + +type GetTargetWithUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Target + Target *components.Target +} + +func (o *GetTargetWithUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetTargetWithUpstreamResponse) GetTarget() *components.Target { + if o == nil { + return nil + } + return o.Target +} diff --git a/tests/mockserver/internal/sdk/models/operations/getteam.go b/tests/mockserver/internal/sdk/models/operations/getteam.go new file mode 100644 index 00000000..b298722c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getteam.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetTeamRequest struct { + // The team ID + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` +} + +func (o *GetTeamRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +type GetTeamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single team. + Team *components.Team +} + +func (o *GetTeamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetTeamResponse) GetTeam() *components.Team { + if o == nil { + return nil + } + return o.Team +} diff --git a/tests/mockserver/internal/sdk/models/operations/getteamgroupmappings.go b/tests/mockserver/internal/sdk/models/operations/getteamgroupmappings.go new file mode 100644 index 00000000..7d7f194f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getteamgroupmappings.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetTeamGroupMappingsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *GetTeamGroupMappingsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetTeamGroupMappingsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type GetTeamGroupMappingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated collection of mappings grouped by team_id. + TeamGroupMappingCollection *components.TeamGroupMappingCollection +} + +func (o *GetTeamGroupMappingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetTeamGroupMappingsResponse) GetTeamGroupMappingCollection() *components.TeamGroupMappingCollection { + if o == nil { + return nil + } + return o.TeamGroupMappingCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/getteamsteamidsystemaccounts.go b/tests/mockserver/internal/sdk/models/operations/getteamsteamidsystemaccounts.go new file mode 100644 index 00000000..2bdc3e35 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getteamsteamidsystemaccounts.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// GetTeamsTeamIDSystemAccountsFilter - Filter system accounts returned in the response. +type GetTeamsTeamIDSystemAccountsFilter struct { + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` +} + +func (o *GetTeamsTeamIDSystemAccountsFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +type GetTeamsTeamIDSystemAccountsRequest struct { + // ID of the team. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter system accounts returned in the response. + Filter *GetTeamsTeamIDSystemAccountsFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *GetTeamsTeamIDSystemAccountsRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *GetTeamsTeamIDSystemAccountsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *GetTeamsTeamIDSystemAccountsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *GetTeamsTeamIDSystemAccountsRequest) GetFilter() *GetTeamsTeamIDSystemAccountsFilter { + if o == nil { + return nil + } + return o.Filter +} + +type GetTeamsTeamIDSystemAccountsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of system accounts. + SystemAccountCollection *components.SystemAccountCollection +} + +func (o *GetTeamsTeamIDSystemAccountsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetTeamsTeamIDSystemAccountsResponse) GetSystemAccountCollection() *components.SystemAccountCollection { + if o == nil { + return nil + } + return o.SystemAccountCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/gettransitgateway.go b/tests/mockserver/internal/sdk/models/operations/gettransitgateway.go new file mode 100644 index 00000000..b369983b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/gettransitgateway.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetTransitGatewayRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` + // The ID of the transit gateway to operate on. + TransitGatewayID string `pathParam:"style=simple,explode=false,name=transitGatewayId"` +} + +func (o *GetTransitGatewayRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +func (o *GetTransitGatewayRequest) GetTransitGatewayID() string { + if o == nil { + return "" + } + return o.TransitGatewayID +} + +type GetTransitGatewayResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for retrieving a transit gateway. + TransitGatewayResponse *components.TransitGatewayResponse +} + +func (o *GetTransitGatewayResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetTransitGatewayResponse) GetTransitGatewayResponse() *components.TransitGatewayResponse { + if o == nil { + return nil + } + return o.TransitGatewayResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/getupstream.go b/tests/mockserver/internal/sdk/models/operations/getupstream.go new file mode 100644 index 00000000..1e894785 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getupstream.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetUpstreamRequest struct { + // ID of the Upstream to lookup + UpstreamID string `pathParam:"style=simple,explode=false,name=UpstreamId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetUpstreamRequest) GetUpstreamID() string { + if o == nil { + return "" + } + return o.UpstreamID +} + +func (o *GetUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Upstream + Upstream *components.Upstream +} + +func (o *GetUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetUpstreamResponse) GetUpstream() *components.Upstream { + if o == nil { + return nil + } + return o.Upstream +} diff --git a/tests/mockserver/internal/sdk/models/operations/getuser.go b/tests/mockserver/internal/sdk/models/operations/getuser.go new file mode 100644 index 00000000..bd108667 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getuser.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetUserRequest struct { + // The ID of the user being deleted. + UserID string `pathParam:"style=simple,explode=false,name=userId"` +} + +func (o *GetUserRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +type GetUserResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of a single user. + User *components.User +} + +func (o *GetUserResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetUserResponse) GetUser() *components.User { + if o == nil { + return nil + } + return o.User +} diff --git a/tests/mockserver/internal/sdk/models/operations/getusersme.go b/tests/mockserver/internal/sdk/models/operations/getusersme.go new file mode 100644 index 00000000..420e51ae --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getusersme.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetUsersMeResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of a single user. + User *components.User +} + +func (o *GetUsersMeResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetUsersMeResponse) GetUser() *components.User { + if o == nil { + return nil + } + return o.User +} diff --git a/tests/mockserver/internal/sdk/models/operations/getvault.go b/tests/mockserver/internal/sdk/models/operations/getvault.go new file mode 100644 index 00000000..b5f324e0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/getvault.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type GetVaultRequest struct { + // ID of the Vault to lookup + VaultID string `pathParam:"style=simple,explode=false,name=VaultId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *GetVaultRequest) GetVaultID() string { + if o == nil { + return "" + } + return o.VaultID +} + +func (o *GetVaultRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type GetVaultResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully fetched Vault + Vault *components.Vault +} + +func (o *GetVaultResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetVaultResponse) GetVault() *components.Vault { + if o == nil { + return nil + } + return o.Vault +} diff --git a/tests/mockserver/internal/sdk/models/operations/inviteuser.go b/tests/mockserver/internal/sdk/models/operations/inviteuser.go new file mode 100644 index 00000000..efb3a306 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/inviteuser.go @@ -0,0 +1,18 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type InviteUserResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *InviteUserResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/listacl.go b/tests/mockserver/internal/sdk/models/operations/listacl.go new file mode 100644 index 00000000..f1bf53c2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listacl.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListACLRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListACLRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListACLRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListACLRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListACLRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListACLRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListACLRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListACLResponseBody - A successful response listing ACLs +type ListACLResponseBody struct { + Data []components.ACL `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListACLResponseBody) GetData() []components.ACL { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListACLResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListACLResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListACLResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing ACLs + Object *ListACLResponseBody +} + +func (o *ListACLResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListACLResponse) GetObject() *ListACLResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listaclwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listaclwithconsumer.go new file mode 100644 index 00000000..ce3ec06e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listaclwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListACLWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListACLWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListACLWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListACLWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListACLWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListACLWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListACLWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListACLWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListACLWithConsumerResponseBody - A successful response listing ACLs +type ListACLWithConsumerResponseBody struct { + Data []components.ACL `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListACLWithConsumerResponseBody) GetData() []components.ACL { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListACLWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListACLWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListACLWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing ACLs + Object *ListACLWithConsumerResponseBody +} + +func (o *ListACLWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListACLWithConsumerResponse) GetObject() *ListACLWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listappauthstrategies.go b/tests/mockserver/internal/sdk/models/operations/listappauthstrategies.go new file mode 100644 index 00000000..81b4ee00 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listappauthstrategies.go @@ -0,0 +1,136 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListAppAuthStrategiesFilter - Filter application auth strategies returned in the response. +type ListAppAuthStrategiesFilter struct { + // Filters on the given string field value by exact match inequality. + StrategyType *components.StringFieldFilter `queryParam:"name=strategy_type"` + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` + // Filters on the given string field value by exact match inequality. + DisplayName *components.StringFieldFilter `queryParam:"name=display_name"` + // Filters on the given string field value by exact match inequality. + DcrProviderID *components.UUIDFieldFilter `queryParam:"name=dcr_provider_id"` + // Filters on the given string field value by exact match inequality. + DcrProviderName *components.StringFieldFilter `queryParam:"name=dcr_provider_name"` + // Filters on the given string field value by exact match inequality. + DcrProviderType *components.StringFieldFilter `queryParam:"name=dcr_provider_type"` +} + +func (o *ListAppAuthStrategiesFilter) GetStrategyType() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.StrategyType +} + +func (o *ListAppAuthStrategiesFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +func (o *ListAppAuthStrategiesFilter) GetDisplayName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.DisplayName +} + +func (o *ListAppAuthStrategiesFilter) GetDcrProviderID() *components.UUIDFieldFilter { + if o == nil { + return nil + } + return o.DcrProviderID +} + +func (o *ListAppAuthStrategiesFilter) GetDcrProviderName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.DcrProviderName +} + +func (o *ListAppAuthStrategiesFilter) GetDcrProviderType() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.DcrProviderType +} + +type ListAppAuthStrategiesRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Sorts a collection of application auth strategies. Supported sort attributes are: + // + // + // + // - created_at + // - updated_at + // - strategy_type + // - name + // - display_name + // - dcr_provider_id + // - dcr_provider_name + // - dcr_provider_type + // + Sort *string `queryParam:"style=form,explode=true,name=sort"` + // Filter application auth strategies returned in the response. + Filter *ListAppAuthStrategiesFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListAppAuthStrategiesRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListAppAuthStrategiesRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListAppAuthStrategiesRequest) GetSort() *string { + if o == nil { + return nil + } + return o.Sort +} + +func (o *ListAppAuthStrategiesRequest) GetFilter() *ListAppAuthStrategiesFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListAppAuthStrategiesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of application auth strategies. + ListAppAuthStrategiesResponse *components.ListAppAuthStrategiesResponse +} + +func (o *ListAppAuthStrategiesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListAppAuthStrategiesResponse) GetListAppAuthStrategiesResponse() *components.ListAppAuthStrategiesResponse { + if o == nil { + return nil + } + return o.ListAppAuthStrategiesResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listbasicauth.go b/tests/mockserver/internal/sdk/models/operations/listbasicauth.go new file mode 100644 index 00000000..d75a983e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listbasicauth.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListBasicAuthRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListBasicAuthRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListBasicAuthRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListBasicAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListBasicAuthRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListBasicAuthRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListBasicAuthRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListBasicAuthResponseBody - A successful response listing Basic-auth credentials +type ListBasicAuthResponseBody struct { + Data []components.BasicAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListBasicAuthResponseBody) GetData() []components.BasicAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListBasicAuthResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListBasicAuthResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListBasicAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Basic-auth credentials + Object *ListBasicAuthResponseBody +} + +func (o *ListBasicAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListBasicAuthResponse) GetObject() *ListBasicAuthResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listbasicauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listbasicauthwithconsumer.go new file mode 100644 index 00000000..5567ca96 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listbasicauthwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListBasicAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListBasicAuthWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListBasicAuthWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListBasicAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListBasicAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListBasicAuthWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListBasicAuthWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListBasicAuthWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListBasicAuthWithConsumerResponseBody - A successful response listing Basic-auth credentials +type ListBasicAuthWithConsumerResponseBody struct { + Data []components.BasicAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListBasicAuthWithConsumerResponseBody) GetData() []components.BasicAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListBasicAuthWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListBasicAuthWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListBasicAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Basic-auth credentials + Object *ListBasicAuthWithConsumerResponseBody +} + +func (o *ListBasicAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListBasicAuthWithConsumerResponse) GetObject() *ListBasicAuthWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listcacertificate.go b/tests/mockserver/internal/sdk/models/operations/listcacertificate.go new file mode 100644 index 00000000..63407270 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listcacertificate.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListCaCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListCaCertificateRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListCaCertificateRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListCaCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListCaCertificateRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListCaCertificateRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListCaCertificateRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListCaCertificateResponseBody - A successful response listing CA Certificates +type ListCaCertificateResponseBody struct { + Data []components.CACertificate `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListCaCertificateResponseBody) GetData() []components.CACertificate { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListCaCertificateResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListCaCertificateResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListCaCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing CA Certificates + Object *ListCaCertificateResponseBody +} + +func (o *ListCaCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListCaCertificateResponse) GetObject() *ListCaCertificateResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listcertificate.go b/tests/mockserver/internal/sdk/models/operations/listcertificate.go new file mode 100644 index 00000000..59187909 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listcertificate.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListCertificateRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListCertificateRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListCertificateRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListCertificateRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListCertificateRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListCertificateResponseBody - A successful response listing Certificates +type ListCertificateResponseBody struct { + Data []components.Certificate `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListCertificateResponseBody) GetData() []components.Certificate { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListCertificateResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListCertificateResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Certificates + Object *ListCertificateResponseBody +} + +func (o *ListCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListCertificateResponse) GetObject() *ListCertificateResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconfigstores.go b/tests/mockserver/internal/sdk/models/operations/listconfigstores.go new file mode 100644 index 00000000..f2778251 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconfigstores.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // List of Config Stores + ListConfigStoresResponse *components.ListConfigStoresResponse +} + +func (o *ListConfigStoresResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConfigStoresResponse) GetListConfigStoresResponse() *components.ListConfigStoresResponse { + if o == nil { + return nil + } + return o.ListConfigStoresResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconfigstoresecrets.go b/tests/mockserver/internal/sdk/models/operations/listconfigstoresecrets.go new file mode 100644 index 00000000..dee7b75f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconfigstoresecrets.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // List of Config Store Secrets + ListConfigStoreSecretsResponse *components.ListConfigStoreSecretsResponse +} + +func (o *ListConfigStoreSecretsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConfigStoreSecretsResponse) GetListConfigStoreSecretsResponse() *components.ListConfigStoreSecretsResponse { + if o == nil { + return nil + } + return o.ListConfigStoreSecretsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconfigurations.go b/tests/mockserver/internal/sdk/models/operations/listconfigurations.go new file mode 100644 index 00000000..83768dab --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconfigurations.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListConfigurationsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filters supported for configurations. + Filter *components.ConfigurationsFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListConfigurationsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListConfigurationsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListConfigurationsRequest) GetFilter() *components.ConfigurationsFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +type ListConfigurationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of configurations. + ListConfigurationsResponse *components.ListConfigurationsResponse +} + +func (o *ListConfigurationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConfigurationsResponse) GetListConfigurationsResponse() *components.ListConfigurationsResponse { + if o == nil { + return nil + } + return o.ListConfigurationsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconsumer.go b/tests/mockserver/internal/sdk/models/operations/listconsumer.go new file mode 100644 index 00000000..21b7efe1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconsumer.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListConsumerResponseBody - A successful response listing Consumers +type ListConsumerResponseBody struct { + Data []components.Consumer `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListConsumerResponseBody) GetData() []components.Consumer { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Consumers + Object *ListConsumerResponseBody +} + +func (o *ListConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConsumerResponse) GetObject() *ListConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/listconsumergroup.go new file mode 100644 index 00000000..765529cf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconsumergroup.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListConsumerGroupRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListConsumerGroupRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListConsumerGroupRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListConsumerGroupRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListConsumerGroupRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListConsumerGroupResponseBody - A successful response listing Consumer Groups +type ListConsumerGroupResponseBody struct { + Data []components.ConsumerGroup `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListConsumerGroupResponseBody) GetData() []components.ConsumerGroup { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListConsumerGroupResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListConsumerGroupResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Consumer Groups + Object *ListConsumerGroupResponseBody +} + +func (o *ListConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConsumerGroupResponse) GetObject() *ListConsumerGroupResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconsumergroupsforconsumer.go b/tests/mockserver/internal/sdk/models/operations/listconsumergroupsforconsumer.go new file mode 100644 index 00000000..a56875d6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconsumergroupsforconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListConsumerGroupsForConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListConsumerGroupsForConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListConsumerGroupsForConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListConsumerGroupsForConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListConsumerGroupsForConsumerRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +func (o *ListConsumerGroupsForConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListConsumerGroupsForConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListConsumerGroupsForConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListConsumerGroupsForConsumerResponseBody - A successful response listing consumer groups +type ListConsumerGroupsForConsumerResponseBody struct { + Data []components.ConsumerGroup `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListConsumerGroupsForConsumerResponseBody) GetData() []components.ConsumerGroup { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListConsumerGroupsForConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListConsumerGroupsForConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListConsumerGroupsForConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing consumer groups + Object *ListConsumerGroupsForConsumerResponseBody +} + +func (o *ListConsumerGroupsForConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConsumerGroupsForConsumerResponse) GetObject() *ListConsumerGroupsForConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listconsumersforconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/listconsumersforconsumergroup.go new file mode 100644 index 00000000..1e834c52 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listconsumersforconsumergroup.go @@ -0,0 +1,116 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListConsumersForConsumerGroupRequest struct { + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListConsumersForConsumerGroupRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListConsumersForConsumerGroupRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListConsumersForConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *ListConsumersForConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListConsumersForConsumerGroupRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListConsumersForConsumerGroupRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListConsumersForConsumerGroupRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListConsumersForConsumerGroupResponseBody - A successful response listing of consumers +type ListConsumersForConsumerGroupResponseBody struct { + Data []components.Consumer `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListConsumersForConsumerGroupResponseBody) GetData() []components.Consumer { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListConsumersForConsumerGroupResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListConsumersForConsumerGroupResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListConsumersForConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing of consumers + Object *ListConsumersForConsumerGroupResponseBody +} + +func (o *ListConsumersForConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListConsumersForConsumerGroupResponse) GetObject() *ListConsumersForConsumerGroupResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listcontrolplanes.go b/tests/mockserver/internal/sdk/models/operations/listcontrolplanes.go new file mode 100644 index 00000000..cee0b541 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listcontrolplanes.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListControlPlanesRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filters a collection of control-planes. + Filter *components.ControlPlaneFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` + // Filter control planes in the response by associated labels. + Labels *string `queryParam:"style=form,explode=true,name=labels"` + // Sorts a collection of control-planes. Supported sort attributes are: + // - created_at + // + Sort *string `queryParam:"style=form,explode=true,name=sort"` +} + +func (o *ListControlPlanesRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListControlPlanesRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListControlPlanesRequest) GetFilter() *components.ControlPlaneFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +func (o *ListControlPlanesRequest) GetLabels() *string { + if o == nil { + return nil + } + return o.Labels +} + +func (o *ListControlPlanesRequest) GetSort() *string { + if o == nil { + return nil + } + return o.Sort +} + +type ListControlPlanesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of control planes. + ListControlPlanesResponse *components.ListControlPlanesResponse +} + +func (o *ListControlPlanesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListControlPlanesResponse) GetListControlPlanesResponse() *components.ListControlPlanesResponse { + if o == nil { + return nil + } + return o.ListControlPlanesResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listcustomdomains.go b/tests/mockserver/internal/sdk/models/operations/listcustomdomains.go new file mode 100644 index 00000000..af52a442 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listcustomdomains.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListCustomDomainsRequest struct { + // Filters supported for custom domains on the global API. + Filter *components.CustomDomainsFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListCustomDomainsRequest) GetFilter() *components.CustomDomainsFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +func (o *ListCustomDomainsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListCustomDomainsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListCustomDomainsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of custom domains. + ListCustomDomainsResponse *components.ListCustomDomainsResponse +} + +func (o *ListCustomDomainsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListCustomDomainsResponse) GetListCustomDomainsResponse() *components.ListCustomDomainsResponse { + if o == nil { + return nil + } + return o.ListCustomDomainsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listcustomplugin.go b/tests/mockserver/internal/sdk/models/operations/listcustomplugin.go new file mode 100644 index 00000000..21012e85 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listcustomplugin.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListCustomPluginRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListCustomPluginRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListCustomPluginRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListCustomPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListCustomPluginRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListCustomPluginRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListCustomPluginRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListCustomPluginResponseBody - A successful response listing CustomPlugins +type ListCustomPluginResponseBody struct { + Data []components.CustomPlugin `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListCustomPluginResponseBody) GetData() []components.CustomPlugin { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListCustomPluginResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListCustomPluginResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListCustomPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing CustomPlugins + Object *ListCustomPluginResponseBody +} + +func (o *ListCustomPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListCustomPluginResponse) GetObject() *ListCustomPluginResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdataplanenodes.go b/tests/mockserver/internal/sdk/models/operations/listdataplanenodes.go new file mode 100644 index 00000000..de77bdfe --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdataplanenodes.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListDataplaneNodesRequest 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 *ListDataplaneNodesRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListDataplaneNodesRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListDataplaneNodesRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +type ListDataplaneNodesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Example response + ListNodes *components.ListNodes +} + +func (o *ListDataplaneNodesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDataplaneNodesResponse) GetListNodes() *components.ListNodes { + if o == nil { + return nil + } + return o.ListNodes +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdcrproviders.go b/tests/mockserver/internal/sdk/models/operations/listdcrproviders.go new file mode 100644 index 00000000..84f0313c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdcrproviders.go @@ -0,0 +1,216 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListDcrProvidersRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Sorts a collection of DCR Providers. Supported sort attributes are: + // - created_at + // - updated_at + // - provider_type + // - issuer + // - name + // + Sort *string `queryParam:"style=form,explode=true,name=sort"` + // filters DCR Providers by their id + FilterIDEq *string `queryParam:"style=form,explode=true,name=filter[id][eq]"` + // filters DCR Providers by their id (alias for filter[id][eq]) + FilterID *string `queryParam:"style=form,explode=true,name=filter[id]"` + // filters DCR Providers by their id with a supplied substring + FilterIDContains *string `queryParam:"style=form,explode=true,name=filter[id][contains]"` + // filters DCR Providers by their issuer + FilterIssuerEq *string `queryParam:"style=form,explode=true,name=filter[issuer][eq]"` + // filters DCR Providers by their issuer (alias for filter[issuer][eq]) + FilterIssuer *string `queryParam:"style=form,explode=true,name=filter[issuer]"` + // filters DCR Providers by their issuer with a supplied substring + FilterIssuerContains *string `queryParam:"style=form,explode=true,name=filter[issuer][contains]"` + // filters DCR Providers by their name + FilterNameEq *string `queryParam:"style=form,explode=true,name=filter[name][eq]"` + // filters DCR Providers by their name (alias for filter[name][eq]) + FilterName *string `queryParam:"style=form,explode=true,name=filter[name]"` + // filters DCR Providers by their name with a supplied substring + FilterNameContains *string `queryParam:"style=form,explode=true,name=filter[name][contains]"` + // filters DCR Providers by their provider type + FilterProviderTypeEq *string `queryParam:"style=form,explode=true,name=filter[provider_type][eq]"` + // filters DCR Providers by their provider type (alias for filter[provider_type][eq]) + FilterProviderType *string `queryParam:"style=form,explode=true,name=filter[provider_type]"` + // filters DCR Providers by their initial client id + FilterInitialClientIDEq *string `queryParam:"style=form,explode=true,name=filter[initial_client_id][eq]"` + // filters DCR Providers by their initial client id (alias for filter[initial_client_id][eq]) + FilterInitialClientID *string `queryParam:"style=form,explode=true,name=filter[initial_client_id]"` + // filters DCR Providers by their initial client id with a supplied substring + FilterInitialClientIDContains *string `queryParam:"style=form,explode=true,name=filter[initial_client_id][contains]"` + // filters DCR Providers by their initial client audience + FilterInitialClientAudienceEq *string `queryParam:"style=form,explode=true,name=filter[initial_client_audience][eq]"` + // filters DCR Providers by their initial client audience (alias for filter[initial_client_audience][eq]) + FilterInitialClientAudience *string `queryParam:"style=form,explode=true,name=filter[initial_client_audience]"` + // filters DCR Providers by their initial client audience with a supplied substring + FilterInitialClientAudienceContains *string `queryParam:"style=form,explode=true,name=filter[initial_client_audience][contains]"` +} + +func (o *ListDcrProvidersRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListDcrProvidersRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListDcrProvidersRequest) GetSort() *string { + if o == nil { + return nil + } + return o.Sort +} + +func (o *ListDcrProvidersRequest) GetFilterIDEq() *string { + if o == nil { + return nil + } + return o.FilterIDEq +} + +func (o *ListDcrProvidersRequest) GetFilterID() *string { + if o == nil { + return nil + } + return o.FilterID +} + +func (o *ListDcrProvidersRequest) GetFilterIDContains() *string { + if o == nil { + return nil + } + return o.FilterIDContains +} + +func (o *ListDcrProvidersRequest) GetFilterIssuerEq() *string { + if o == nil { + return nil + } + return o.FilterIssuerEq +} + +func (o *ListDcrProvidersRequest) GetFilterIssuer() *string { + if o == nil { + return nil + } + return o.FilterIssuer +} + +func (o *ListDcrProvidersRequest) GetFilterIssuerContains() *string { + if o == nil { + return nil + } + return o.FilterIssuerContains +} + +func (o *ListDcrProvidersRequest) GetFilterNameEq() *string { + if o == nil { + return nil + } + return o.FilterNameEq +} + +func (o *ListDcrProvidersRequest) GetFilterName() *string { + if o == nil { + return nil + } + return o.FilterName +} + +func (o *ListDcrProvidersRequest) GetFilterNameContains() *string { + if o == nil { + return nil + } + return o.FilterNameContains +} + +func (o *ListDcrProvidersRequest) GetFilterProviderTypeEq() *string { + if o == nil { + return nil + } + return o.FilterProviderTypeEq +} + +func (o *ListDcrProvidersRequest) GetFilterProviderType() *string { + if o == nil { + return nil + } + return o.FilterProviderType +} + +func (o *ListDcrProvidersRequest) GetFilterInitialClientIDEq() *string { + if o == nil { + return nil + } + return o.FilterInitialClientIDEq +} + +func (o *ListDcrProvidersRequest) GetFilterInitialClientID() *string { + if o == nil { + return nil + } + return o.FilterInitialClientID +} + +func (o *ListDcrProvidersRequest) GetFilterInitialClientIDContains() *string { + if o == nil { + return nil + } + return o.FilterInitialClientIDContains +} + +func (o *ListDcrProvidersRequest) GetFilterInitialClientAudienceEq() *string { + if o == nil { + return nil + } + return o.FilterInitialClientAudienceEq +} + +func (o *ListDcrProvidersRequest) GetFilterInitialClientAudience() *string { + if o == nil { + return nil + } + return o.FilterInitialClientAudience +} + +func (o *ListDcrProvidersRequest) GetFilterInitialClientAudienceContains() *string { + if o == nil { + return nil + } + return o.FilterInitialClientAudienceContains +} + +type ListDcrProvidersResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of DCR providers + ListDcrProvidersResponse *components.ListDcrProvidersResponse +} + +func (o *ListDcrProvidersResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDcrProvidersResponse) GetListDcrProvidersResponse() *components.ListDcrProvidersResponse { + if o == nil { + return nil + } + return o.ListDcrProvidersResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdefaultresourceconfigurations.go b/tests/mockserver/internal/sdk/models/operations/listdefaultresourceconfigurations.go new file mode 100644 index 00000000..0e5f1944 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdefaultresourceconfigurations.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListDefaultResourceConfigurationsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListDefaultResourceConfigurationsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListDefaultResourceConfigurationsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListDefaultResourceConfigurationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of default resource configurations. + ListDefaultResourceConfigurationsResponse *components.ListDefaultResourceConfigurationsResponse +} + +func (o *ListDefaultResourceConfigurationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDefaultResourceConfigurationsResponse) GetListDefaultResourceConfigurationsResponse() *components.ListDefaultResourceConfigurationsResponse { + if o == nil { + return nil + } + return o.ListDefaultResourceConfigurationsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdefaultresourcequotas.go b/tests/mockserver/internal/sdk/models/operations/listdefaultresourcequotas.go new file mode 100644 index 00000000..f97a8371 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdefaultresourcequotas.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListDefaultResourceQuotasRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListDefaultResourceQuotasRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListDefaultResourceQuotasRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListDefaultResourceQuotasResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of default resource quotas. + ListDefaultResourceQuotasResponse *components.ListDefaultResourceQuotasResponse +} + +func (o *ListDefaultResourceQuotasResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDefaultResourceQuotasResponse) GetListDefaultResourceQuotasResponse() *components.ListDefaultResourceQuotasResponse { + if o == nil { + return nil + } + return o.ListDefaultResourceQuotasResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdegraphqlroute.go b/tests/mockserver/internal/sdk/models/operations/listdegraphqlroute.go new file mode 100644 index 00000000..6887721d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdegraphqlroute.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListDegraphqlRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListDegraphqlRouteRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListDegraphqlRouteRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListDegraphqlRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListDegraphqlRouteRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListDegraphqlRouteRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListDegraphqlRouteRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListDegraphqlRouteResponseBody - A successful response listing Degraphql_routes +type ListDegraphqlRouteResponseBody struct { + Data []components.DegraphqlRoute `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListDegraphqlRouteResponseBody) GetData() []components.DegraphqlRoute { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListDegraphqlRouteResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListDegraphqlRouteResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListDegraphqlRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Degraphql_routes + Object *ListDegraphqlRouteResponseBody +} + +func (o *ListDegraphqlRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDegraphqlRouteResponse) GetObject() *ListDegraphqlRouteResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdegraphqlroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/listdegraphqlroutewithservice.go new file mode 100644 index 00000000..d8be869a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdegraphqlroutewithservice.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListDegraphqlRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListDegraphqlRouteWithServiceRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListDegraphqlRouteWithServiceRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListDegraphqlRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListDegraphqlRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *ListDegraphqlRouteWithServiceRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListDegraphqlRouteWithServiceRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListDegraphqlRouteWithServiceRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListDegraphqlRouteWithServiceResponseBody - A successful response listing Degraphql_routes +type ListDegraphqlRouteWithServiceResponseBody struct { + Data []components.DegraphqlRoute `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListDegraphqlRouteWithServiceResponseBody) GetData() []components.DegraphqlRoute { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListDegraphqlRouteWithServiceResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListDegraphqlRouteWithServiceResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListDegraphqlRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Degraphql_routes + Object *ListDegraphqlRouteWithServiceResponseBody +} + +func (o *ListDegraphqlRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDegraphqlRouteWithServiceResponse) GetObject() *ListDegraphqlRouteWithServiceResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listdpclientcertificates.go b/tests/mockserver/internal/sdk/models/operations/listdpclientcertificates.go new file mode 100644 index 00000000..cc4f7a6e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listdpclientcertificates.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListDpClientCertificatesRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *ListDpClientCertificatesRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type ListDpClientCertificatesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Example response + ListDataPlaneCertificatesResponse *components.ListDataPlaneCertificatesResponse +} + +func (o *ListDpClientCertificatesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListDpClientCertificatesResponse) GetListDataPlaneCertificatesResponse() *components.ListDataPlaneCertificatesResponse { + if o == nil { + return nil + } + return o.ListDataPlaneCertificatesResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listeventsubscriptions.go b/tests/mockserver/internal/sdk/models/operations/listeventsubscriptions.go new file mode 100644 index 00000000..84d1c223 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listeventsubscriptions.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListEventSubscriptionsRequest struct { + // Formatted string ID of the notification event. + EventID string `pathParam:"style=simple,explode=false,name=eventId"` +} + +func (o *ListEventSubscriptionsRequest) GetEventID() string { + if o == nil { + return "" + } + return o.EventID +} + +type ListEventSubscriptionsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for all subscriptions associated with an event. + EventSubscriptionListResponse *components.EventSubscriptionListResponse +} + +func (o *ListEventSubscriptionsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListEventSubscriptionsResponse) GetEventSubscriptionListResponse() *components.EventSubscriptionListResponse { + if o == nil { + return nil + } + return o.EventSubscriptionListResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listhmacauth.go b/tests/mockserver/internal/sdk/models/operations/listhmacauth.go new file mode 100644 index 00000000..1883e134 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listhmacauth.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListHmacAuthRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListHmacAuthRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListHmacAuthRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListHmacAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListHmacAuthRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListHmacAuthRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListHmacAuthRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListHmacAuthResponseBody - A successful response listing HMAC-auth credentials +type ListHmacAuthResponseBody struct { + Data []components.HMACAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListHmacAuthResponseBody) GetData() []components.HMACAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListHmacAuthResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListHmacAuthResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListHmacAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing HMAC-auth credentials + Object *ListHmacAuthResponseBody +} + +func (o *ListHmacAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListHmacAuthResponse) GetObject() *ListHmacAuthResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listhmacauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listhmacauthwithconsumer.go new file mode 100644 index 00000000..413a993d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listhmacauthwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListHmacAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListHmacAuthWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListHmacAuthWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListHmacAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListHmacAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListHmacAuthWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListHmacAuthWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListHmacAuthWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListHmacAuthWithConsumerResponseBody - A successful response listing HMAC-auth credentials +type ListHmacAuthWithConsumerResponseBody struct { + Data []components.HMACAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListHmacAuthWithConsumerResponseBody) GetData() []components.HMACAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListHmacAuthWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListHmacAuthWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListHmacAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing HMAC-auth credentials + Object *ListHmacAuthWithConsumerResponseBody +} + +func (o *ListHmacAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListHmacAuthWithConsumerResponse) GetObject() *ListHmacAuthWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listjwt.go b/tests/mockserver/internal/sdk/models/operations/listjwt.go new file mode 100644 index 00000000..d14583d3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listjwt.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListJwtRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListJwtRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListJwtRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListJwtRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListJwtRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListJwtRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListJwtRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListJwtResponseBody - A successful response listing JWTs +type ListJwtResponseBody struct { + Data []components.Jwt `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListJwtResponseBody) GetData() []components.Jwt { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListJwtResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListJwtResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListJwtResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing JWTs + Object *ListJwtResponseBody +} + +func (o *ListJwtResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListJwtResponse) GetObject() *ListJwtResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listjwtwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listjwtwithconsumer.go new file mode 100644 index 00000000..5523c9f5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listjwtwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListJwtWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListJwtWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListJwtWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListJwtWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListJwtWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListJwtWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListJwtWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListJwtWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListJwtWithConsumerResponseBody - A successful response listing JWTs +type ListJwtWithConsumerResponseBody struct { + Data []components.Jwt `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListJwtWithConsumerResponseBody) GetData() []components.Jwt { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListJwtWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListJwtWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListJwtWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing JWTs + Object *ListJwtWithConsumerResponseBody +} + +func (o *ListJwtWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListJwtWithConsumerResponse) GetObject() *ListJwtWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listkey.go b/tests/mockserver/internal/sdk/models/operations/listkey.go new file mode 100644 index 00000000..27bbd514 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listkey.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListKeyRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListKeyRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListKeyRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListKeyRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListKeyRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListKeyRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListKeyRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListKeyResponseBody - A successful response listing Keys +type ListKeyResponseBody struct { + Data []components.Key `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListKeyResponseBody) GetData() []components.Key { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListKeyResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListKeyResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListKeyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Keys + Object *ListKeyResponseBody +} + +func (o *ListKeyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListKeyResponse) GetObject() *ListKeyResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listkeyauth.go b/tests/mockserver/internal/sdk/models/operations/listkeyauth.go new file mode 100644 index 00000000..89225a30 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listkeyauth.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListKeyAuthRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListKeyAuthRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListKeyAuthRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListKeyAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListKeyAuthRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListKeyAuthRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListKeyAuthRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListKeyAuthResponseBody - A successful response listing API-keys +type ListKeyAuthResponseBody struct { + Data []components.KeyAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListKeyAuthResponseBody) GetData() []components.KeyAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListKeyAuthResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListKeyAuthResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListKeyAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing API-keys + Object *ListKeyAuthResponseBody +} + +func (o *ListKeyAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListKeyAuthResponse) GetObject() *ListKeyAuthResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listkeyauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listkeyauthwithconsumer.go new file mode 100644 index 00000000..0fcb2ea6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listkeyauthwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListKeyAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListKeyAuthWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListKeyAuthWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListKeyAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListKeyAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListKeyAuthWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListKeyAuthWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListKeyAuthWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListKeyAuthWithConsumerResponseBody - A successful response listing API-keys +type ListKeyAuthWithConsumerResponseBody struct { + Data []components.KeyAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListKeyAuthWithConsumerResponseBody) GetData() []components.KeyAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListKeyAuthWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListKeyAuthWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListKeyAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing API-keys + Object *ListKeyAuthWithConsumerResponseBody +} + +func (o *ListKeyAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListKeyAuthWithConsumerResponse) GetObject() *ListKeyAuthWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listkeyset.go b/tests/mockserver/internal/sdk/models/operations/listkeyset.go new file mode 100644 index 00000000..40074c85 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listkeyset.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListKeySetRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListKeySetRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListKeySetRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListKeySetRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListKeySetRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListKeySetResponseBody - A successful response listing KeySets +type ListKeySetResponseBody struct { + Data []components.KeySet `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListKeySetResponseBody) GetData() []components.KeySet { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListKeySetResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListKeySetResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing KeySets + Object *ListKeySetResponseBody +} + +func (o *ListKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListKeySetResponse) GetObject() *ListKeySetResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listkeywithkeyset.go b/tests/mockserver/internal/sdk/models/operations/listkeywithkeyset.go new file mode 100644 index 00000000..c3da11bf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listkeywithkeyset.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListKeyWithKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListKeyWithKeySetRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListKeyWithKeySetRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListKeyWithKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListKeyWithKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *ListKeyWithKeySetRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListKeyWithKeySetRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListKeyWithKeySetRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListKeyWithKeySetResponseBody - A successful response listing Keys +type ListKeyWithKeySetResponseBody struct { + Data []components.Key `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListKeyWithKeySetResponseBody) GetData() []components.Key { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListKeyWithKeySetResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListKeyWithKeySetResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListKeyWithKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Keys + Object *ListKeyWithKeySetResponseBody +} + +func (o *ListKeyWithKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListKeyWithKeySetResponse) GetObject() *ListKeyWithKeySetResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listmtlsauth.go b/tests/mockserver/internal/sdk/models/operations/listmtlsauth.go new file mode 100644 index 00000000..3f0a79b6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listmtlsauth.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListMtlsAuthRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListMtlsAuthRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListMtlsAuthRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListMtlsAuthRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListMtlsAuthRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListMtlsAuthRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListMtlsAuthRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListMtlsAuthResponseBody - A successful response listing MTLS-auth credentials +type ListMtlsAuthResponseBody struct { + Data []components.MTLSAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListMtlsAuthResponseBody) GetData() []components.MTLSAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListMtlsAuthResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListMtlsAuthResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListMtlsAuthResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing MTLS-auth credentials + Object *ListMtlsAuthResponseBody +} + +func (o *ListMtlsAuthResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListMtlsAuthResponse) GetObject() *ListMtlsAuthResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listmtlsauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listmtlsauthwithconsumer.go new file mode 100644 index 00000000..a6dbf387 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listmtlsauthwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListMtlsAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListMtlsAuthWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListMtlsAuthWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListMtlsAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListMtlsAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListMtlsAuthWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListMtlsAuthWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListMtlsAuthWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListMtlsAuthWithConsumerResponseBody - A successful response listing MTLS-auth credentials +type ListMtlsAuthWithConsumerResponseBody struct { + Data []components.MTLSAuth `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListMtlsAuthWithConsumerResponseBody) GetData() []components.MTLSAuth { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListMtlsAuthWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListMtlsAuthWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListMtlsAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing MTLS-auth credentials + Object *ListMtlsAuthWithConsumerResponseBody +} + +func (o *ListMtlsAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListMtlsAuthWithConsumerResponse) GetObject() *ListMtlsAuthWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listnetworkconfigurations.go b/tests/mockserver/internal/sdk/models/operations/listnetworkconfigurations.go new file mode 100644 index 00000000..237cd277 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listnetworkconfigurations.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListNetworkConfigurationsRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListNetworkConfigurationsRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +func (o *ListNetworkConfigurationsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListNetworkConfigurationsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListNetworkConfigurationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of configurations that reference a network. + ListNetworkConfigurationReferencesResponse *components.ListNetworkConfigurationReferencesResponse +} + +func (o *ListNetworkConfigurationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListNetworkConfigurationsResponse) GetListNetworkConfigurationReferencesResponse() *components.ListNetworkConfigurationReferencesResponse { + if o == nil { + return nil + } + return o.ListNetworkConfigurationReferencesResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listnetworks.go b/tests/mockserver/internal/sdk/models/operations/listnetworks.go new file mode 100644 index 00000000..5080dcdc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listnetworks.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListNetworksRequest struct { + // Filters supported for networks. + Filter *components.NetworksFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListNetworksRequest) GetFilter() *components.NetworksFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +func (o *ListNetworksRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListNetworksRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListNetworksResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of networks. + ListNetworksResponse *components.ListNetworksResponse +} + +func (o *ListNetworksResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListNetworksResponse) GetListNetworksResponse() *components.ListNetworksResponse { + if o == nil { + return nil + } + return o.ListNetworksResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listnotifications.go b/tests/mockserver/internal/sdk/models/operations/listnotifications.go new file mode 100644 index 00000000..1b52e614 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listnotifications.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListNotificationsRequest struct { + // Request the next page of data, starting with the item before this parameter. + PageBefore *string `queryParam:"style=form,explode=true,name=page[before]"` + // Request the next page of data, starting with the item after this parameter. + PageAfter *string `queryParam:"style=form,explode=true,name=page[after]"` + // Filters a collection of notifications. + Filter *components.NotificationFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListNotificationsRequest) GetPageBefore() *string { + if o == nil { + return nil + } + return o.PageBefore +} + +func (o *ListNotificationsRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +func (o *ListNotificationsRequest) GetFilter() *components.NotificationFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +type ListNotificationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of notifications + NotificationListResponse *components.NotificationListResponse +} + +func (o *ListNotificationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListNotificationsResponse) GetNotificationListResponse() *components.NotificationListResponse { + if o == nil { + return nil + } + return o.NotificationListResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpartial.go b/tests/mockserver/internal/sdk/models/operations/listpartial.go new file mode 100644 index 00000000..212258a5 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpartial.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPartialRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPartialRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPartialRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPartialRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPartialRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPartialRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPartialRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPartialResponseBody - A successful response listing Partials +type ListPartialResponseBody struct { + Data []components.Partial `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPartialResponseBody) GetData() []components.Partial { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPartialResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPartialResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPartialResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Partials + Object *ListPartialResponseBody +} + +func (o *ListPartialResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPartialResponse) GetObject() *ListPartialResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpartiallink.go b/tests/mockserver/internal/sdk/models/operations/listpartiallink.go new file mode 100644 index 00000000..33dd6057 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpartiallink.go @@ -0,0 +1,126 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPartialLinkRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Partial to lookup + PartialID string `pathParam:"style=simple,explode=false,name=PartialId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPartialLinkRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPartialLinkRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPartialLinkRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPartialLinkRequest) GetPartialID() string { + if o == nil { + return "" + } + return o.PartialID +} + +func (o *ListPartialLinkRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPartialLinkRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPartialLinkRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPartialLinkResponseBody - The plugins linked to the partial +type ListPartialLinkResponseBody struct { + // The total number of plugins linked to the partial + Count *int64 `json:"count,omitempty"` + Data []components.PartialLink `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPartialLinkResponseBody) GetCount() *int64 { + if o == nil { + return nil + } + return o.Count +} + +func (o *ListPartialLinkResponseBody) GetData() []components.PartialLink { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPartialLinkResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPartialLinkResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPartialLinkResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // The plugins linked to the partial + Object *ListPartialLinkResponseBody +} + +func (o *ListPartialLinkResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPartialLinkResponse) GetObject() *ListPartialLinkResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listplugin.go b/tests/mockserver/internal/sdk/models/operations/listplugin.go new file mode 100644 index 00000000..b60d79ab --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listplugin.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPluginRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPluginRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPluginRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPluginRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPluginRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPluginRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPluginResponseBody - A successful response listing Plugins +type ListPluginResponseBody struct { + Data []components.Plugin `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPluginResponseBody) GetData() []components.Plugin { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPluginResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPluginResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Plugins + Object *ListPluginResponseBody +} + +func (o *ListPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPluginResponse) GetObject() *ListPluginResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpluginschemas.go b/tests/mockserver/internal/sdk/models/operations/listpluginschemas.go new file mode 100644 index 00000000..3cf95845 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpluginschemas.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListPluginSchemasRequest 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 *ListPluginSchemasRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPluginSchemasRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListPluginSchemasRequest) GetPageAfter() *string { + if o == nil { + return nil + } + return o.PageAfter +} + +type ListPluginSchemasResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of custom plugin schemas. + ListPluginSchemas *components.ListPluginSchemas +} + +func (o *ListPluginSchemasResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPluginSchemasResponse) GetListPluginSchemas() *components.ListPluginSchemas { + if o == nil { + return nil + } + return o.ListPluginSchemas +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpluginwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/listpluginwithconsumer.go new file mode 100644 index 00000000..cf509c8f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpluginwithconsumer.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPluginWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPluginWithConsumerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPluginWithConsumerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPluginWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPluginWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *ListPluginWithConsumerRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPluginWithConsumerRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPluginWithConsumerRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPluginWithConsumerResponseBody - A successful response listing Plugins +type ListPluginWithConsumerResponseBody struct { + Data []components.Plugin `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPluginWithConsumerResponseBody) GetData() []components.Plugin { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPluginWithConsumerResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPluginWithConsumerResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPluginWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Plugins + Object *ListPluginWithConsumerResponseBody +} + +func (o *ListPluginWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPluginWithConsumerResponse) GetObject() *ListPluginWithConsumerResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpluginwithconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/listpluginwithconsumergroup.go new file mode 100644 index 00000000..74f99013 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpluginwithconsumergroup.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPluginWithConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPluginWithConsumerGroupRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPluginWithConsumerGroupRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPluginWithConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPluginWithConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *ListPluginWithConsumerGroupRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPluginWithConsumerGroupRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPluginWithConsumerGroupRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPluginWithConsumerGroupResponseBody - A successful response listing Plugins +type ListPluginWithConsumerGroupResponseBody struct { + Data []components.Plugin `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPluginWithConsumerGroupResponseBody) GetData() []components.Plugin { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPluginWithConsumerGroupResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPluginWithConsumerGroupResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPluginWithConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Plugins + Object *ListPluginWithConsumerGroupResponseBody +} + +func (o *ListPluginWithConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPluginWithConsumerGroupResponse) GetObject() *ListPluginWithConsumerGroupResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpluginwithroute.go b/tests/mockserver/internal/sdk/models/operations/listpluginwithroute.go new file mode 100644 index 00000000..135f6e46 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpluginwithroute.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPluginWithRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPluginWithRouteRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPluginWithRouteRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPluginWithRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPluginWithRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *ListPluginWithRouteRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPluginWithRouteRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPluginWithRouteRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPluginWithRouteResponseBody - A successful response listing Plugins +type ListPluginWithRouteResponseBody struct { + Data []components.Plugin `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPluginWithRouteResponseBody) GetData() []components.Plugin { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPluginWithRouteResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPluginWithRouteResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPluginWithRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Plugins + Object *ListPluginWithRouteResponseBody +} + +func (o *ListPluginWithRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPluginWithRouteResponse) GetObject() *ListPluginWithRouteResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listpluginwithservice.go b/tests/mockserver/internal/sdk/models/operations/listpluginwithservice.go new file mode 100644 index 00000000..5a071120 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listpluginwithservice.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListPluginWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListPluginWithServiceRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListPluginWithServiceRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListPluginWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListPluginWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *ListPluginWithServiceRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListPluginWithServiceRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListPluginWithServiceRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListPluginWithServiceResponseBody - A successful response listing Plugins +type ListPluginWithServiceResponseBody struct { + Data []components.Plugin `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListPluginWithServiceResponseBody) GetData() []components.Plugin { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListPluginWithServiceResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListPluginWithServiceResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListPluginWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Plugins + Object *ListPluginWithServiceResponseBody +} + +func (o *ListPluginWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListPluginWithServiceResponse) GetObject() *ListPluginWithServiceResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listprovideraccounts.go b/tests/mockserver/internal/sdk/models/operations/listprovideraccounts.go new file mode 100644 index 00000000..a1584324 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listprovideraccounts.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListProviderAccountsRequest struct { + // Filters supported for provider accounts. + Filter *components.ProviderAccountsFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListProviderAccountsRequest) GetFilter() *components.ProviderAccountsFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +func (o *ListProviderAccountsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListProviderAccountsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListProviderAccountsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of provider accounts. + ListProviderAccountsResponse *components.ListProviderAccountsResponse +} + +func (o *ListProviderAccountsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListProviderAccountsResponse) GetListProviderAccountsResponse() *components.ListProviderAccountsResponse { + if o == nil { + return nil + } + return o.ListProviderAccountsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listresourceconfigurations.go b/tests/mockserver/internal/sdk/models/operations/listresourceconfigurations.go new file mode 100644 index 00000000..2456468b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listresourceconfigurations.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListResourceConfigurationsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListResourceConfigurationsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListResourceConfigurationsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListResourceConfigurationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of resource configurations. + ListResourceConfigurationsResponse *components.ListResourceConfigurationsResponse +} + +func (o *ListResourceConfigurationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListResourceConfigurationsResponse) GetListResourceConfigurationsResponse() *components.ListResourceConfigurationsResponse { + if o == nil { + return nil + } + return o.ListResourceConfigurationsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listresourcequotas.go b/tests/mockserver/internal/sdk/models/operations/listresourcequotas.go new file mode 100644 index 00000000..e1f4f790 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listresourcequotas.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListResourceQuotasRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListResourceQuotasRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListResourceQuotasRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListResourceQuotasResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of resource quotas. + ListResourceQuotasResponse *components.ListResourceQuotasResponse +} + +func (o *ListResourceQuotasResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListResourceQuotasResponse) GetListResourceQuotasResponse() *components.ListResourceQuotasResponse { + if o == nil { + return nil + } + return o.ListResourceQuotasResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listroute.go b/tests/mockserver/internal/sdk/models/operations/listroute.go new file mode 100644 index 00000000..3107334b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listroute.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListRouteRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListRouteRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListRouteRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListRouteRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListRouteRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListRouteResponseBody - A successful response listing Routes +type ListRouteResponseBody struct { + Data []components.Route `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListRouteResponseBody) GetData() []components.Route { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListRouteResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListRouteResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Routes + Object *ListRouteResponseBody +} + +func (o *ListRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListRouteResponse) GetObject() *ListRouteResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/listroutewithservice.go new file mode 100644 index 00000000..c828fb0b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listroutewithservice.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListRouteWithServiceRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListRouteWithServiceRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *ListRouteWithServiceRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListRouteWithServiceRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListRouteWithServiceRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListRouteWithServiceResponseBody - A successful response listing Routes +type ListRouteWithServiceResponseBody struct { + Data []components.Route `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListRouteWithServiceResponseBody) GetData() []components.Route { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListRouteWithServiceResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListRouteWithServiceResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Routes + Object *ListRouteWithServiceResponseBody +} + +func (o *ListRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListRouteWithServiceResponse) GetObject() *ListRouteWithServiceResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listservice.go b/tests/mockserver/internal/sdk/models/operations/listservice.go new file mode 100644 index 00000000..3f4b06ef --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listservice.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListServiceRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListServiceRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListServiceRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListServiceRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListServiceRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListServiceResponseBody - A successful response listing Services +type ListServiceResponseBody struct { + Data []components.ServiceOutput `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListServiceResponseBody) GetData() []components.ServiceOutput { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListServiceResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListServiceResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Services + Object *ListServiceResponseBody +} + +func (o *ListServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListServiceResponse) GetObject() *ListServiceResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listsni.go b/tests/mockserver/internal/sdk/models/operations/listsni.go new file mode 100644 index 00000000..5fc9e834 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listsni.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListSniRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListSniRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListSniRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListSniRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListSniRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListSniRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListSniRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListSniResponseBody - A successful response listing SNIs +type ListSniResponseBody struct { + Data []components.Sni `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListSniResponseBody) GetData() []components.Sni { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListSniResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListSniResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListSniResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing SNIs + Object *ListSniResponseBody +} + +func (o *ListSniResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListSniResponse) GetObject() *ListSniResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listsniwithcertificate.go b/tests/mockserver/internal/sdk/models/operations/listsniwithcertificate.go new file mode 100644 index 00000000..ba71055b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listsniwithcertificate.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListSniWithCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListSniWithCertificateRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListSniWithCertificateRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListSniWithCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListSniWithCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *ListSniWithCertificateRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListSniWithCertificateRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListSniWithCertificateRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListSniWithCertificateResponseBody - A successful response listing SNIs +type ListSniWithCertificateResponseBody struct { + Data []components.Sni `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListSniWithCertificateResponseBody) GetData() []components.Sni { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListSniWithCertificateResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListSniWithCertificateResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListSniWithCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing SNIs + Object *ListSniWithCertificateResponseBody +} + +func (o *ListSniWithCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListSniWithCertificateResponse) GetObject() *ListSniWithCertificateResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listtargetwithupstream.go b/tests/mockserver/internal/sdk/models/operations/listtargetwithupstream.go new file mode 100644 index 00000000..9fe89846 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listtargetwithupstream.go @@ -0,0 +1,117 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListTargetWithUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID or target of the Target to lookup + UpstreamIDForTarget string `pathParam:"style=simple,explode=false,name=UpstreamIdForTarget"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListTargetWithUpstreamRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListTargetWithUpstreamRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListTargetWithUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListTargetWithUpstreamRequest) GetUpstreamIDForTarget() string { + if o == nil { + return "" + } + return o.UpstreamIDForTarget +} + +func (o *ListTargetWithUpstreamRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListTargetWithUpstreamRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListTargetWithUpstreamRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListTargetWithUpstreamResponseBody - A successful response listing Targets +type ListTargetWithUpstreamResponseBody struct { + Data []components.Target `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListTargetWithUpstreamResponseBody) GetData() []components.Target { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListTargetWithUpstreamResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListTargetWithUpstreamResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListTargetWithUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Targets + Object *ListTargetWithUpstreamResponseBody +} + +func (o *ListTargetWithUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListTargetWithUpstreamResponse) GetObject() *ListTargetWithUpstreamResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listteamroles.go b/tests/mockserver/internal/sdk/models/operations/listteamroles.go new file mode 100644 index 00000000..7622dbe7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listteamroles.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListTeamRolesFilter - Filter roles returned in the response. +type ListTeamRolesFilter struct { + // Filters on the given string field value by exact match. + RoleName *string `queryParam:"name=role_name"` + // Filters on the given string field value by exact match. + EntityTypeName *string `queryParam:"name=entity_type_name"` +} + +func (o *ListTeamRolesFilter) GetRoleName() *string { + if o == nil { + return nil + } + return o.RoleName +} + +func (o *ListTeamRolesFilter) GetEntityTypeName() *string { + if o == nil { + return nil + } + return o.EntityTypeName +} + +type ListTeamRolesRequest struct { + // The team ID + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // Filter roles returned in the response. + Filter *ListTeamRolesFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListTeamRolesRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *ListTeamRolesRequest) GetFilter() *ListTeamRolesFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListTeamRolesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of assigned roles. + AssignedRoleCollection *components.AssignedRoleCollection +} + +func (o *ListTeamRolesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListTeamRolesResponse) GetAssignedRoleCollection() *components.AssignedRoleCollection { + if o == nil { + return nil + } + return o.AssignedRoleCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/listteams.go b/tests/mockserver/internal/sdk/models/operations/listteams.go new file mode 100644 index 00000000..670ca4d0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listteams.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListTeamsFilter - Filter teams returned in the response. +type ListTeamsFilter struct { + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` +} + +func (o *ListTeamsFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +type ListTeamsRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter teams returned in the response. + Filter *ListTeamsFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListTeamsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListTeamsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListTeamsRequest) GetFilter() *ListTeamsFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListTeamsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of users. + TeamCollection *components.TeamCollection +} + +func (o *ListTeamsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListTeamsResponse) GetTeamCollection() *components.TeamCollection { + if o == nil { + return nil + } + return o.TeamCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/listteamusers.go b/tests/mockserver/internal/sdk/models/operations/listteamusers.go new file mode 100644 index 00000000..4b8227f7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listteamusers.go @@ -0,0 +1,106 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListTeamUsersFilter - Filter users returned in the response. +type ListTeamUsersFilter struct { + // Filters on the given string field value by exact match. + ID *string `queryParam:"name=id"` + // Filters on the given string field value by exact match inequality. + Email *components.StringFieldFilter `queryParam:"name=email"` + // Filters on the given string field value by exact match inequality. + FullName *components.StringFieldFilter `queryParam:"name=full_name"` + // Filter by a boolean value (true/false). + Active *bool `queryParam:"name=active"` +} + +func (o *ListTeamUsersFilter) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ListTeamUsersFilter) GetEmail() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Email +} + +func (o *ListTeamUsersFilter) GetFullName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.FullName +} + +func (o *ListTeamUsersFilter) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +type ListTeamUsersRequest struct { + // ID of the team. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter users returned in the response. + Filter *ListTeamUsersFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListTeamUsersRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *ListTeamUsersRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListTeamUsersRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListTeamUsersRequest) GetFilter() *ListTeamUsersFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListTeamUsersResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of users. + UserCollection *components.UserCollection +} + +func (o *ListTeamUsersResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListTeamUsersResponse) GetUserCollection() *components.UserCollection { + if o == nil { + return nil + } + return o.UserCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/listtransitgateways.go b/tests/mockserver/internal/sdk/models/operations/listtransitgateways.go new file mode 100644 index 00000000..a3c47fdf --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listtransitgateways.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListTransitGatewaysRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` + // Filters supported for transit gateways. + Filter *components.TransitGatewaysFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` +} + +func (o *ListTransitGatewaysRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +func (o *ListTransitGatewaysRequest) GetFilter() *components.TransitGatewaysFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +func (o *ListTransitGatewaysRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListTransitGatewaysRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +type ListTransitGatewaysResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list for a collection of transit gateways for a network. + ListTransitGatewaysResponse *components.ListTransitGatewaysResponse +} + +func (o *ListTransitGatewaysResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListTransitGatewaysResponse) GetListTransitGatewaysResponse() *components.ListTransitGatewaysResponse { + if o == nil { + return nil + } + return o.ListTransitGatewaysResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listupstream.go b/tests/mockserver/internal/sdk/models/operations/listupstream.go new file mode 100644 index 00000000..52fd8da9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listupstream.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListUpstreamRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListUpstreamRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListUpstreamRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListUpstreamRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListUpstreamRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListUpstreamResponseBody - A successful response listing Upstreams +type ListUpstreamResponseBody struct { + Data []components.Upstream `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListUpstreamResponseBody) GetData() []components.Upstream { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListUpstreamResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListUpstreamResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Upstreams + Object *ListUpstreamResponseBody +} + +func (o *ListUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListUpstreamResponse) GetObject() *ListUpstreamResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/listuserconfigurations.go b/tests/mockserver/internal/sdk/models/operations/listuserconfigurations.go new file mode 100644 index 00000000..fa0f2c9d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listuserconfigurations.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ListUserConfigurationsRequest struct { + // Filters a collection of configurations. + Filter *components.ConfigurationFilterParameters `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListUserConfigurationsRequest) GetFilter() *components.ConfigurationFilterParameters { + if o == nil { + return nil + } + return o.Filter +} + +type ListUserConfigurationsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for all notification events and user subscriptions. + UserConfigurationListResponse *components.UserConfigurationListResponse +} + +func (o *ListUserConfigurationsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListUserConfigurationsResponse) GetUserConfigurationListResponse() *components.UserConfigurationListResponse { + if o == nil { + return nil + } + return o.UserConfigurationListResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/listuserroles.go b/tests/mockserver/internal/sdk/models/operations/listuserroles.go new file mode 100644 index 00000000..f94a964d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listuserroles.go @@ -0,0 +1,70 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListUserRolesFilter - Filter roles returned in the response. +type ListUserRolesFilter struct { + // Filters on the given string field value by exact match. + RoleName *string `queryParam:"name=role_name"` + // Filters on the given string field value by exact match. + EntityTypeName *string `queryParam:"name=entity_type_name"` +} + +func (o *ListUserRolesFilter) GetRoleName() *string { + if o == nil { + return nil + } + return o.RoleName +} + +func (o *ListUserRolesFilter) GetEntityTypeName() *string { + if o == nil { + return nil + } + return o.EntityTypeName +} + +type ListUserRolesRequest struct { + // The user ID + UserID string `pathParam:"style=simple,explode=false,name=userId"` + // Filter roles returned in the response. + Filter *ListUserRolesFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListUserRolesRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +func (o *ListUserRolesRequest) GetFilter() *ListUserRolesFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListUserRolesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of assigned roles. + AssignedRoleCollection *components.AssignedRoleCollection +} + +func (o *ListUserRolesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListUserRolesResponse) GetAssignedRoleCollection() *components.AssignedRoleCollection { + if o == nil { + return nil + } + return o.AssignedRoleCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/listusers.go b/tests/mockserver/internal/sdk/models/operations/listusers.go new file mode 100644 index 00000000..e238cfee --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listusers.go @@ -0,0 +1,97 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListUsersFilter - Filter users returned in the response. +type ListUsersFilter struct { + // Filters on the given string field value by exact match. + ID *string `queryParam:"name=id"` + // Filters on the given string field value by exact match inequality. + Email *components.StringFieldFilter `queryParam:"name=email"` + // Filters on the given string field value by exact match inequality. + FullName *components.StringFieldFilter `queryParam:"name=full_name"` + // Filter by a boolean value (true/false). + Active *bool `queryParam:"name=active"` +} + +func (o *ListUsersFilter) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ListUsersFilter) GetEmail() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Email +} + +func (o *ListUsersFilter) GetFullName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.FullName +} + +func (o *ListUsersFilter) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +type ListUsersRequest struct { + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter users returned in the response. + Filter *ListUsersFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListUsersRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListUsersRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListUsersRequest) GetFilter() *ListUsersFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListUsersResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of users. + UserCollection *components.UserCollection +} + +func (o *ListUsersResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListUsersResponse) GetUserCollection() *components.UserCollection { + if o == nil { + return nil + } + return o.UserCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/listuserteams.go b/tests/mockserver/internal/sdk/models/operations/listuserteams.go new file mode 100644 index 00000000..f429b292 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listuserteams.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +// ListUserTeamsFilter - Filter teams returned in the response. +type ListUserTeamsFilter struct { + // Filters on the given string field value by exact match inequality. + Name *components.StringFieldFilter `queryParam:"name=name"` +} + +func (o *ListUserTeamsFilter) GetName() *components.StringFieldFilter { + if o == nil { + return nil + } + return o.Name +} + +type ListUserTeamsRequest struct { + // The user ID. + UserID string `pathParam:"style=simple,explode=false,name=userId"` + // 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]"` + // Determines which page of the entities to retrieve. + PageNumber *int64 `queryParam:"style=form,explode=true,name=page[number]"` + // Filter teams returned in the response. + Filter *ListUserTeamsFilter `queryParam:"style=deepObject,explode=true,name=filter"` +} + +func (o *ListUserTeamsRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +func (o *ListUserTeamsRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *ListUserTeamsRequest) GetPageNumber() *int64 { + if o == nil { + return nil + } + return o.PageNumber +} + +func (o *ListUserTeamsRequest) GetFilter() *ListUserTeamsFilter { + if o == nil { + return nil + } + return o.Filter +} + +type ListUserTeamsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of users. + TeamCollection *components.TeamCollection +} + +func (o *ListUserTeamsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListUserTeamsResponse) GetTeamCollection() *components.TeamCollection { + if o == nil { + return nil + } + return o.TeamCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/listvault.go b/tests/mockserver/internal/sdk/models/operations/listvault.go new file mode 100644 index 00000000..d23f08ca --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/listvault.go @@ -0,0 +1,108 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/utils" +) + +type ListVaultRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Number of resources to be returned. + Size *int64 `default:"100" queryParam:"style=form,explode=true,name=size"` + // 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 + Offset *string `queryParam:"style=form,explode=true,name=offset"` + // 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. + Tags *string `queryParam:"style=form,explode=true,name=tags"` +} + +func (l ListVaultRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *ListVaultRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ListVaultRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *ListVaultRequest) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *ListVaultRequest) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +func (o *ListVaultRequest) GetTags() *string { + if o == nil { + return nil + } + return o.Tags +} + +// ListVaultResponseBody - A successful response listing Vaults +type ListVaultResponseBody struct { + Data []components.Vault `json:"data,omitempty"` + // URI to the next page (may be null) + Next *string `json:"next,omitempty"` + // Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page + Offset *string `json:"offset,omitempty"` +} + +func (o *ListVaultResponseBody) GetData() []components.Vault { + if o == nil { + return nil + } + return o.Data +} + +func (o *ListVaultResponseBody) GetNext() *string { + if o == nil { + return nil + } + return o.Next +} + +func (o *ListVaultResponseBody) GetOffset() *string { + if o == nil { + return nil + } + return o.Offset +} + +type ListVaultResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A successful response listing Vaults + Object *ListVaultResponseBody +} + +func (o *ListVaultResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ListVaultResponse) GetObject() *ListVaultResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/tests/mockserver/internal/sdk/models/operations/patchsystemaccountsid.go b/tests/mockserver/internal/sdk/models/operations/patchsystemaccountsid.go new file mode 100644 index 00000000..1a7d42f8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/patchsystemaccountsid.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PatchSystemAccountsIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // The request schema for the update system account request. + UpdateSystemAccount *components.UpdateSystemAccount `request:"mediaType=application/json"` +} + +func (o *PatchSystemAccountsIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *PatchSystemAccountsIDRequest) GetUpdateSystemAccount() *components.UpdateSystemAccount { + if o == nil { + return nil + } + return o.UpdateSystemAccount +} + +type PatchSystemAccountsIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single system account. + SystemAccount *components.SystemAccount +} + +func (o *PatchSystemAccountsIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PatchSystemAccountsIDResponse) GetSystemAccount() *components.SystemAccount { + if o == nil { + return nil + } + return o.SystemAccount +} diff --git a/tests/mockserver/internal/sdk/models/operations/patchsystemaccountsidaccesstokensid.go b/tests/mockserver/internal/sdk/models/operations/patchsystemaccountsidaccesstokensid.go new file mode 100644 index 00000000..005b23a7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/patchsystemaccountsidaccesstokensid.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PatchSystemAccountsIDAccessTokensIDRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // ID of the system account access token. + TokenID string `pathParam:"style=simple,explode=false,name=tokenId"` + UpdateSystemAccountAccessToken *components.UpdateSystemAccountAccessToken `request:"mediaType=application/json"` +} + +func (o *PatchSystemAccountsIDAccessTokensIDRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *PatchSystemAccountsIDAccessTokensIDRequest) GetTokenID() string { + if o == nil { + return "" + } + return o.TokenID +} + +func (o *PatchSystemAccountsIDAccessTokensIDRequest) GetUpdateSystemAccountAccessToken() *components.UpdateSystemAccountAccessToken { + if o == nil { + return nil + } + return o.UpdateSystemAccountAccessToken +} + +type PatchSystemAccountsIDAccessTokensIDResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single system account access token. + SystemAccountAccessToken *components.SystemAccountAccessToken +} + +func (o *PatchSystemAccountsIDAccessTokensIDResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PatchSystemAccountsIDAccessTokensIDResponse) GetSystemAccountAccessToken() *components.SystemAccountAccessToken { + if o == nil { + return nil + } + return o.SystemAccountAccessToken +} diff --git a/tests/mockserver/internal/sdk/models/operations/patchteamgroupmappings.go b/tests/mockserver/internal/sdk/models/operations/patchteamgroupmappings.go new file mode 100644 index 00000000..8476e979 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/patchteamgroupmappings.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PatchTeamGroupMappingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated collection of mappings grouped by team_id. + TeamGroupMappingCollection *components.TeamGroupMappingCollection +} + +func (o *PatchTeamGroupMappingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PatchTeamGroupMappingsResponse) GetTeamGroupMappingCollection() *components.TeamGroupMappingCollection { + if o == nil { + return nil + } + return o.TeamGroupMappingCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsadd.go b/tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsadd.go new file mode 100644 index 00000000..bc4f37d6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsadd.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PostControlPlanesIDGroupMembershipsAddRequest struct { + // ID of a control plane group + ID string `pathParam:"style=simple,explode=false,name=id"` + // Request body for adding a list of child control planes to a control plane group membership. + GroupMembership *components.GroupMembership `request:"mediaType=application/json"` +} + +func (o *PostControlPlanesIDGroupMembershipsAddRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *PostControlPlanesIDGroupMembershipsAddRequest) GetGroupMembership() *components.GroupMembership { + if o == nil { + return nil + } + return o.GroupMembership +} + +type PostControlPlanesIDGroupMembershipsAddResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *PostControlPlanesIDGroupMembershipsAddResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsremove.go b/tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsremove.go new file mode 100644 index 00000000..3de902d3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/postcontrolplanesidgroupmembershipsremove.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PostControlPlanesIDGroupMembershipsRemoveRequest struct { + // ID of a control plane group + ID string `pathParam:"style=simple,explode=false,name=id"` + // Request body for removing a list of child control planes from a control plane group membership. + GroupMembership *components.GroupMembership `request:"mediaType=application/json"` +} + +func (o *PostControlPlanesIDGroupMembershipsRemoveRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *PostControlPlanesIDGroupMembershipsRemoveRequest) GetGroupMembership() *components.GroupMembership { + if o == nil { + return nil + } + return o.GroupMembership +} + +type PostControlPlanesIDGroupMembershipsRemoveResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *PostControlPlanesIDGroupMembershipsRemoveResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/postsystemaccounts.go b/tests/mockserver/internal/sdk/models/operations/postsystemaccounts.go new file mode 100644 index 00000000..116bbb2e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/postsystemaccounts.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PostSystemAccountsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single system account. + SystemAccount *components.SystemAccount +} + +func (o *PostSystemAccountsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostSystemAccountsResponse) GetSystemAccount() *components.SystemAccount { + if o == nil { + return nil + } + return o.SystemAccount +} diff --git a/tests/mockserver/internal/sdk/models/operations/postsystemaccountsaccountidassignedroles.go b/tests/mockserver/internal/sdk/models/operations/postsystemaccountsaccountidassignedroles.go new file mode 100644 index 00000000..1b80c6d8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/postsystemaccountsaccountidassignedroles.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PostSystemAccountsAccountIDAssignedRolesRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // The request schema for assigning a role. + AssignRole *components.AssignRole `request:"mediaType=application/json"` +} + +func (o *PostSystemAccountsAccountIDAssignedRolesRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *PostSystemAccountsAccountIDAssignedRolesRequest) GetAssignRole() *components.AssignRole { + if o == nil { + return nil + } + return o.AssignRole +} + +type PostSystemAccountsAccountIDAssignedRolesResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of a single assigned role. + AssignedRole *components.AssignedRole +} + +func (o *PostSystemAccountsAccountIDAssignedRolesResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostSystemAccountsAccountIDAssignedRolesResponse) GetAssignedRole() *components.AssignedRole { + if o == nil { + return nil + } + return o.AssignedRole +} diff --git a/tests/mockserver/internal/sdk/models/operations/postsystemaccountsidaccesstokens.go b/tests/mockserver/internal/sdk/models/operations/postsystemaccountsidaccesstokens.go new file mode 100644 index 00000000..f2b3326c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/postsystemaccountsidaccesstokens.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PostSystemAccountsIDAccessTokensRequest struct { + // ID of the system account. + AccountID string `pathParam:"style=simple,explode=false,name=accountId"` + // The request body to create a system account access token. + CreateSystemAccountAccessToken *components.CreateSystemAccountAccessToken `request:"mediaType=application/json"` +} + +func (o *PostSystemAccountsIDAccessTokensRequest) GetAccountID() string { + if o == nil { + return "" + } + return o.AccountID +} + +func (o *PostSystemAccountsIDAccessTokensRequest) GetCreateSystemAccountAccessToken() *components.CreateSystemAccountAccessToken { + if o == nil { + return nil + } + return o.CreateSystemAccountAccessToken +} + +type PostSystemAccountsIDAccessTokensResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single system account access token with the token. + SystemAccountAccessTokenCreated *components.SystemAccountAccessTokenCreated +} + +func (o *PostSystemAccountsIDAccessTokensResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PostSystemAccountsIDAccessTokensResponse) GetSystemAccountAccessTokenCreated() *components.SystemAccountAccessTokenCreated { + if o == nil { + return nil + } + return o.SystemAccountAccessTokenCreated +} diff --git a/tests/mockserver/internal/sdk/models/operations/postteamsteamidsystemaccounts.go b/tests/mockserver/internal/sdk/models/operations/postteamsteamidsystemaccounts.go new file mode 100644 index 00000000..a56349e2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/postteamsteamidsystemaccounts.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PostTeamsTeamIDSystemAccountsRequest struct { + // ID of the team. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // The request schema for adding a system account to a team. + AddSystemAccountToTeam *components.AddSystemAccountToTeam `request:"mediaType=application/json"` +} + +func (o *PostTeamsTeamIDSystemAccountsRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *PostTeamsTeamIDSystemAccountsRequest) GetAddSystemAccountToTeam() *components.AddSystemAccountToTeam { + if o == nil { + return nil + } + return o.AddSystemAccountToTeam +} + +type PostTeamsTeamIDSystemAccountsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *PostTeamsTeamIDSystemAccountsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/putcontrolplanesidgroupmemberships.go b/tests/mockserver/internal/sdk/models/operations/putcontrolplanesidgroupmemberships.go new file mode 100644 index 00000000..fc4ccbfa --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/putcontrolplanesidgroupmemberships.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PutControlPlanesIDGroupMembershipsRequest struct { + // ID of a control plane group + ID string `pathParam:"style=simple,explode=false,name=id"` + // Request body for upserting a list of child control planes to a control plane group membership. + GroupMembership *components.GroupMembership `request:"mediaType=application/json"` +} + +func (o *PutControlPlanesIDGroupMembershipsRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *PutControlPlanesIDGroupMembershipsRequest) GetGroupMembership() *components.GroupMembership { + if o == nil { + return nil + } + return o.GroupMembership +} + +type PutControlPlanesIDGroupMembershipsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *PutControlPlanesIDGroupMembershipsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/removeallconsumersfromconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/removeallconsumersfromconsumergroup.go new file mode 100644 index 00000000..a4bd35e2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/removeallconsumersfromconsumergroup.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type RemoveAllConsumersFromConsumerGroupRequest struct { + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *RemoveAllConsumersFromConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *RemoveAllConsumersFromConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type RemoveAllConsumersFromConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *RemoveAllConsumersFromConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/removeconsumerfromallconsumergroups.go b/tests/mockserver/internal/sdk/models/operations/removeconsumerfromallconsumergroups.go new file mode 100644 index 00000000..f7ad8053 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/removeconsumerfromallconsumergroups.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type RemoveConsumerFromAllConsumerGroupsRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` +} + +func (o *RemoveConsumerFromAllConsumerGroupsRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *RemoveConsumerFromAllConsumerGroupsRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +type RemoveConsumerFromAllConsumerGroupsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *RemoveConsumerFromAllConsumerGroupsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/removeconsumerfromconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/removeconsumerfromconsumergroup.go new file mode 100644 index 00000000..552a750a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/removeconsumerfromconsumergroup.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type RemoveConsumerFromConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` +} + +func (o *RemoveConsumerFromConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *RemoveConsumerFromConsumerGroupRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +func (o *RemoveConsumerFromConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +type RemoveConsumerFromConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *RemoveConsumerFromConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/removeconsumerfromgroup.go b/tests/mockserver/internal/sdk/models/operations/removeconsumerfromgroup.go new file mode 100644 index 00000000..6d9021ca --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/removeconsumerfromgroup.go @@ -0,0 +1,46 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type RemoveConsumerFromGroupRequest struct { + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` +} + +func (o *RemoveConsumerFromGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *RemoveConsumerFromGroupRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +func (o *RemoveConsumerFromGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +type RemoveConsumerFromGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *RemoveConsumerFromGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/removeuserfromteam.go b/tests/mockserver/internal/sdk/models/operations/removeuserfromteam.go new file mode 100644 index 00000000..446f8aad --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/removeuserfromteam.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type RemoveUserFromTeamRequest struct { + // User ID + UserID string `pathParam:"style=simple,explode=false,name=userId"` + // Team ID. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` +} + +func (o *RemoveUserFromTeamRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +func (o *RemoveUserFromTeamRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +type RemoveUserFromTeamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *RemoveUserFromTeamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/replaceappauthstrategy.go b/tests/mockserver/internal/sdk/models/operations/replaceappauthstrategy.go new file mode 100644 index 00000000..bea2d472 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/replaceappauthstrategy.go @@ -0,0 +1,69 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type ReplaceAppAuthStrategyRequest struct { + // Application auth strategy identifier + AuthStrategyID string `pathParam:"style=simple,explode=false,name=authStrategyId"` + CreateAppAuthStrategyRequest components.CreateAppAuthStrategyRequest `request:"mediaType=application/json"` +} + +func (o *ReplaceAppAuthStrategyRequest) GetAuthStrategyID() string { + if o == nil { + return "" + } + return o.AuthStrategyID +} + +func (o *ReplaceAppAuthStrategyRequest) GetCreateAppAuthStrategyRequest() components.CreateAppAuthStrategyRequest { + if o == nil { + return components.CreateAppAuthStrategyRequest{} + } + return o.CreateAppAuthStrategyRequest +} + +func (o *ReplaceAppAuthStrategyRequest) GetCreateAppAuthStrategyRequestKeyAuth() *components.AppAuthStrategyKeyAuthRequest { + return o.GetCreateAppAuthStrategyRequest().AppAuthStrategyKeyAuthRequest +} + +func (o *ReplaceAppAuthStrategyRequest) GetCreateAppAuthStrategyRequestOpenidConnect() *components.AppAuthStrategyOpenIDConnectRequest { + return o.GetCreateAppAuthStrategyRequest().AppAuthStrategyOpenIDConnectRequest +} + +type ReplaceAppAuthStrategyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing the newly created application auth strategy object. + CreateAppAuthStrategyResponse *components.CreateAppAuthStrategyResponse +} + +func (o *ReplaceAppAuthStrategyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *ReplaceAppAuthStrategyResponse) GetCreateAppAuthStrategyResponse() *components.CreateAppAuthStrategyResponse { + if o == nil { + return nil + } + return o.CreateAppAuthStrategyResponse +} + +func (o *ReplaceAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseKeyAuth() *components.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse + } + return nil +} + +func (o *ReplaceAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseOpenidConnect() *components.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/teamsassignrole.go b/tests/mockserver/internal/sdk/models/operations/teamsassignrole.go new file mode 100644 index 00000000..16f3e1c8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/teamsassignrole.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type TeamsAssignRoleRequest struct { + // The team ID + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // The request schema for assigning a role. + AssignRole *components.AssignRole `request:"mediaType=application/json"` +} + +func (o *TeamsAssignRoleRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *TeamsAssignRoleRequest) GetAssignRole() *components.AssignRole { + if o == nil { + return nil + } + return o.AssignRole +} + +type TeamsAssignRoleResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of a single assigned role. + AssignedRole *components.AssignedRole +} + +func (o *TeamsAssignRoleResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *TeamsAssignRoleResponse) GetAssignedRole() *components.AssignedRole { + if o == nil { + return nil + } + return o.AssignedRole +} diff --git a/tests/mockserver/internal/sdk/models/operations/teamsremoverole.go b/tests/mockserver/internal/sdk/models/operations/teamsremoverole.go new file mode 100644 index 00000000..1dbe4f38 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/teamsremoverole.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type TeamsRemoveRoleRequest struct { + // The team ID. + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // The role ID. + RoleID string `pathParam:"style=simple,explode=false,name=roleId"` +} + +func (o *TeamsRemoveRoleRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *TeamsRemoveRoleRequest) GetRoleID() string { + if o == nil { + return "" + } + return o.RoleID +} + +type TeamsRemoveRoleResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *TeamsRemoveRoleResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateappauthstrategy.go b/tests/mockserver/internal/sdk/models/operations/updateappauthstrategy.go new file mode 100644 index 00000000..d7394b75 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateappauthstrategy.go @@ -0,0 +1,61 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateAppAuthStrategyRequest struct { + // Application auth strategy identifier + AuthStrategyID string `pathParam:"style=simple,explode=false,name=authStrategyId"` + UpdateAppAuthStrategyRequest components.UpdateAppAuthStrategyRequest `request:"mediaType=application/json"` +} + +func (o *UpdateAppAuthStrategyRequest) GetAuthStrategyID() string { + if o == nil { + return "" + } + return o.AuthStrategyID +} + +func (o *UpdateAppAuthStrategyRequest) GetUpdateAppAuthStrategyRequest() components.UpdateAppAuthStrategyRequest { + if o == nil { + return components.UpdateAppAuthStrategyRequest{} + } + return o.UpdateAppAuthStrategyRequest +} + +type UpdateAppAuthStrategyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing a single updated application auth strategy object. + CreateAppAuthStrategyResponse *components.CreateAppAuthStrategyResponse +} + +func (o *UpdateAppAuthStrategyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateAppAuthStrategyResponse) GetCreateAppAuthStrategyResponse() *components.CreateAppAuthStrategyResponse { + if o == nil { + return nil + } + return o.CreateAppAuthStrategyResponse +} + +func (o *UpdateAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseKeyAuth() *components.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyKeyAuthResponse + } + return nil +} + +func (o *UpdateAppAuthStrategyResponse) GetCreateAppAuthStrategyResponseOpenidConnect() *components.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse { + if v := o.GetCreateAppAuthStrategyResponse(); v != nil { + return v.CreateAppAuthStrategyResponseAppAuthStrategyOpenIDConnectResponse + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateauthenticationsettings.go b/tests/mockserver/internal/sdk/models/operations/updateauthenticationsettings.go new file mode 100644 index 00000000..aa4dd339 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateauthenticationsettings.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateAuthenticationSettingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response for authentication settings endpoint + AuthenticationSettings *components.AuthenticationSettings +} + +func (o *UpdateAuthenticationSettingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateAuthenticationSettingsResponse) GetAuthenticationSettings() *components.AuthenticationSettings { + if o == nil { + return nil + } + return o.AuthenticationSettings +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateconfigstore.go b/tests/mockserver/internal/sdk/models/operations/updateconfigstore.go new file mode 100644 index 00000000..d65ba067 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateconfigstore.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // Config Store + ConfigStore *components.ConfigStore +} + +func (o *UpdateConfigStoreResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateConfigStoreResponse) GetConfigStore() *components.ConfigStore { + if o == nil { + return nil + } + return o.ConfigStore +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateconfigstoresecret.go b/tests/mockserver/internal/sdk/models/operations/updateconfigstoresecret.go new file mode 100644 index 00000000..b5b574da --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateconfigstoresecret.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +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 { + HTTPMeta components.HTTPMetadata `json:"-"` + // Config Store Secret + ConfigStoreSecret *components.ConfigStoreSecret +} + +func (o *UpdateConfigStoreSecretResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateConfigStoreSecretResponse) GetConfigStoreSecret() *components.ConfigStoreSecret { + if o == nil { + return nil + } + return o.ConfigStoreSecret +} diff --git a/tests/mockserver/internal/sdk/models/operations/updatecontrolplane.go b/tests/mockserver/internal/sdk/models/operations/updatecontrolplane.go new file mode 100644 index 00000000..30c6ca9c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updatecontrolplane.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateControlPlaneRequest struct { + // The control plane ID + ID string `pathParam:"style=simple,explode=false,name=id"` + UpdateControlPlaneRequest components.UpdateControlPlaneRequest `request:"mediaType=application/json"` +} + +func (o *UpdateControlPlaneRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *UpdateControlPlaneRequest) GetUpdateControlPlaneRequest() components.UpdateControlPlaneRequest { + if o == nil { + return components.UpdateControlPlaneRequest{} + } + return o.UpdateControlPlaneRequest +} + +type UpdateControlPlaneResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response to updating a control plane. + ControlPlane *components.ControlPlane +} + +func (o *UpdateControlPlaneResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateControlPlaneResponse) GetControlPlane() *components.ControlPlane { + if o == nil { + return nil + } + return o.ControlPlane +} diff --git a/tests/mockserver/internal/sdk/models/operations/updatedcrprovider.go b/tests/mockserver/internal/sdk/models/operations/updatedcrprovider.go new file mode 100644 index 00000000..37f947c6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updatedcrprovider.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateDcrProviderRequest struct { + // DCR provider identifier + DcrProviderID string `pathParam:"style=simple,explode=false,name=dcrProviderId"` + UpdateDcrProviderRequest components.UpdateDcrProviderRequest `request:"mediaType=application/json"` +} + +func (o *UpdateDcrProviderRequest) GetDcrProviderID() string { + if o == nil { + return "" + } + return o.DcrProviderID +} + +func (o *UpdateDcrProviderRequest) GetUpdateDcrProviderRequest() components.UpdateDcrProviderRequest { + if o == nil { + return components.UpdateDcrProviderRequest{} + } + return o.UpdateDcrProviderRequest +} + +type UpdateDcrProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing a single DCR provider object. Sensitive fields will be removed from the response. + DcrProviderResponse *components.DcrProviderResponse +} + +func (o *UpdateDcrProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateDcrProviderResponse) GetDcrProviderResponse() *components.DcrProviderResponse { + if o == nil { + return nil + } + return o.DcrProviderResponse +} + +func (o *UpdateDcrProviderResponse) GetDcrProviderResponseDcrProviderAuth0() *components.DCRProviderResponseDCRProviderAuth0 { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderAuth0 + } + return nil +} + +func (o *UpdateDcrProviderResponse) GetDcrProviderResponseDcrProviderAzureAd() *components.DCRProviderResponseDCRProviderAzureAD { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderAzureAD + } + return nil +} + +func (o *UpdateDcrProviderResponse) GetDcrProviderResponseDcrProviderCurity() *components.DCRProviderResponseDCRProviderCurity { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderCurity + } + return nil +} + +func (o *UpdateDcrProviderResponse) GetDcrProviderResponseDcrProviderOkta() *components.DCRProviderResponseDCRProviderOKTA { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderOKTA + } + return nil +} + +func (o *UpdateDcrProviderResponse) GetDcrProviderResponseDcrProviderHTTP() *components.DCRProviderResponseDCRProviderHTTP { + if v := o.GetDcrProviderResponse(); v != nil { + return v.DCRProviderResponseDCRProviderHTTP + } + return nil +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateeventsubscription.go b/tests/mockserver/internal/sdk/models/operations/updateeventsubscription.go new file mode 100644 index 00000000..a65f032b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateeventsubscription.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateEventSubscriptionRequest struct { + // Formatted string ID of the notification event. + EventID string `pathParam:"style=simple,explode=false,name=eventId"` + // Subscription ID of the user configuration. + SubscriptionID string `pathParam:"style=simple,explode=false,name=subscriptionId"` + // Request body schema for creating/updating event subscription. + EventSubscription *components.EventSubscription `request:"mediaType=application/json"` +} + +func (o *UpdateEventSubscriptionRequest) GetEventID() string { + if o == nil { + return "" + } + return o.EventID +} + +func (o *UpdateEventSubscriptionRequest) GetSubscriptionID() string { + if o == nil { + return "" + } + return o.SubscriptionID +} + +func (o *UpdateEventSubscriptionRequest) GetEventSubscription() *components.EventSubscription { + if o == nil { + return nil + } + return o.EventSubscription +} + +type UpdateEventSubscriptionResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response containing specific subscription details associated with an event. + EventSubscriptionResponse *components.EventSubscriptionResponse +} + +func (o *UpdateEventSubscriptionResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateEventSubscriptionResponse) GetEventSubscriptionResponse() *components.EventSubscriptionResponse { + if o == nil { + return nil + } + return o.EventSubscriptionResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateidentityprovider.go b/tests/mockserver/internal/sdk/models/operations/updateidentityprovider.go new file mode 100644 index 00000000..d6320d74 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateidentityprovider.go @@ -0,0 +1,50 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateIdentityProviderRequest struct { + // ID of the identity provider. + ID string `pathParam:"style=simple,explode=false,name=id"` + // An object representing the configuration for updating an identity provider. This configuration may pertain to either an OIDC or a SAML identity provider. + // + UpdateIdentityProvider components.UpdateIdentityProvider `request:"mediaType=application/json"` +} + +func (o *UpdateIdentityProviderRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *UpdateIdentityProviderRequest) GetUpdateIdentityProvider() components.UpdateIdentityProvider { + if o == nil { + return components.UpdateIdentityProvider{} + } + return o.UpdateIdentityProvider +} + +type UpdateIdentityProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // An identity provider configuration. This response represents the configuration of a specific identity provider, which can be either OIDC or SAML. + // + IdentityProvider *components.IdentityProvider +} + +func (o *UpdateIdentityProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateIdentityProviderResponse) GetIdentityProvider() *components.IdentityProvider { + if o == nil { + return nil + } + return o.IdentityProvider +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateidpconfiguration.go b/tests/mockserver/internal/sdk/models/operations/updateidpconfiguration.go new file mode 100644 index 00000000..c53d1d0d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateidpconfiguration.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateIdpConfigurationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of the IdP configuration. + IDP *components.IDP +} + +func (o *UpdateIdpConfigurationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateIdpConfigurationResponse) GetIDP() *components.IDP { + if o == nil { + return nil + } + return o.IDP +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateidpteammappings.go b/tests/mockserver/internal/sdk/models/operations/updateidpteammappings.go new file mode 100644 index 00000000..df9473ff --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateidpteammappings.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateIdpTeamMappingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A paginated list response for a collection of team mappings. + TeamMappingCollection *components.TeamMappingCollection +} + +func (o *UpdateIdpTeamMappingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateIdpTeamMappingsResponse) GetTeamMappingCollection() *components.TeamMappingCollection { + if o == nil { + return nil + } + return o.TeamMappingCollection +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateimpersonationsettings.go b/tests/mockserver/internal/sdk/models/operations/updateimpersonationsettings.go new file mode 100644 index 00000000..417f88b7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateimpersonationsettings.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateImpersonationSettingsResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response for Update Impersonation Settings endpoint + UpdateImpersonationSettingsResponse *components.UpdateImpersonationSettingsResponse +} + +func (o *UpdateImpersonationSettingsResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateImpersonationSettingsResponse) GetUpdateImpersonationSettingsResponse() *components.UpdateImpersonationSettingsResponse { + if o == nil { + return nil + } + return o.UpdateImpersonationSettingsResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/updatenetwork.go b/tests/mockserver/internal/sdk/models/operations/updatenetwork.go new file mode 100644 index 00000000..6bb12a3d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updatenetwork.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateNetworkRequest struct { + // The network to operate on. + NetworkID string `pathParam:"style=simple,explode=false,name=networkId"` + PatchNetworkRequest components.PatchNetworkRequest `request:"mediaType=application/json"` +} + +func (o *UpdateNetworkRequest) GetNetworkID() string { + if o == nil { + return "" + } + return o.NetworkID +} + +func (o *UpdateNetworkRequest) GetPatchNetworkRequest() components.PatchNetworkRequest { + if o == nil { + return components.PatchNetworkRequest{} + } + return o.PatchNetworkRequest +} + +type UpdateNetworkResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Response format for patching a network. + Network *components.Network +} + +func (o *UpdateNetworkResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateNetworkResponse) GetNetwork() *components.Network { + if o == nil { + return nil + } + return o.Network +} diff --git a/tests/mockserver/internal/sdk/models/operations/updatenotification.go b/tests/mockserver/internal/sdk/models/operations/updatenotification.go new file mode 100644 index 00000000..eeb3f7f9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updatenotification.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateNotificationRequest struct { + // ID of the notification. + NotificationID string `pathParam:"style=simple,explode=false,name=notificationId"` + // Request body schema for updating notification status. + NotificationUpdatePayload *components.NotificationUpdatePayload `request:"mediaType=application/json"` +} + +func (o *UpdateNotificationRequest) GetNotificationID() string { + if o == nil { + return "" + } + return o.NotificationID +} + +func (o *UpdateNotificationRequest) GetNotificationUpdatePayload() *components.NotificationUpdatePayload { + if o == nil { + return nil + } + return o.NotificationUpdatePayload +} + +type UpdateNotificationResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // View a single notification. + Notification *components.Notification +} + +func (o *UpdateNotificationResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateNotificationResponse) GetNotification() *components.Notification { + if o == nil { + return nil + } + return o.Notification +} diff --git a/tests/mockserver/internal/sdk/models/operations/updatepluginschemas.go b/tests/mockserver/internal/sdk/models/operations/updatepluginschemas.go new file mode 100644 index 00000000..a1862e01 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updatepluginschemas.go @@ -0,0 +1,56 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdatePluginSchemasRequest 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 custom plugin name + Name string `pathParam:"style=simple,explode=false,name=name"` + CreatePluginSchemas *components.CreatePluginSchemas `request:"mediaType=application/json"` +} + +func (o *UpdatePluginSchemasRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpdatePluginSchemasRequest) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *UpdatePluginSchemasRequest) GetCreatePluginSchemas() *components.CreatePluginSchemas { + if o == nil { + return nil + } + return o.CreatePluginSchemas +} + +type UpdatePluginSchemasResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response for a single custom plugin schema. + PluginSchemas *components.PluginSchemas +} + +func (o *UpdatePluginSchemasResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdatePluginSchemasResponse) GetPluginSchemas() *components.PluginSchemas { + if o == nil { + return nil + } + return o.PluginSchemas +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateteam.go b/tests/mockserver/internal/sdk/models/operations/updateteam.go new file mode 100644 index 00000000..dbdd6702 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateteam.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateTeamRequest struct { + // The team ID + TeamID string `pathParam:"style=simple,explode=false,name=teamId"` + // The request schema for the update team request. + UpdateTeam *components.UpdateTeam `request:"mediaType=application/json"` +} + +func (o *UpdateTeamRequest) GetTeamID() string { + if o == nil { + return "" + } + return o.TeamID +} + +func (o *UpdateTeamRequest) GetUpdateTeam() *components.UpdateTeam { + if o == nil { + return nil + } + return o.UpdateTeam +} + +type UpdateTeamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response including a single team. + Team *components.Team +} + +func (o *UpdateTeamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateTeamResponse) GetTeam() *components.Team { + if o == nil { + return nil + } + return o.Team +} diff --git a/tests/mockserver/internal/sdk/models/operations/updateuser.go b/tests/mockserver/internal/sdk/models/operations/updateuser.go new file mode 100644 index 00000000..3c8670e9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/updateuser.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpdateUserRequest struct { + // The ID of the user being deleted. + UserID string `pathParam:"style=simple,explode=false,name=userId"` + // The request schema for the update user request. + UpdateUser *components.UpdateUser `request:"mediaType=application/json"` +} + +func (o *UpdateUserRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +func (o *UpdateUserRequest) GetUpdateUser() *components.UpdateUser { + if o == nil { + return nil + } + return o.UpdateUser +} + +type UpdateUserResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of a single user. + User *components.User +} + +func (o *UpdateUserResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpdateUserResponse) GetUser() *components.User { + if o == nil { + return nil + } + return o.User +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertaclwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertaclwithconsumer.go new file mode 100644 index 00000000..4ae6ebe7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertaclwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertACLWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the ACL to lookup + ACLID string `pathParam:"style=simple,explode=false,name=ACLId"` + // Description of the ACL + ACLWithoutParents components.ACLWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertACLWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertACLWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertACLWithConsumerRequest) GetACLID() string { + if o == nil { + return "" + } + return o.ACLID +} + +func (o *UpsertACLWithConsumerRequest) GetACLWithoutParents() components.ACLWithoutParents { + if o == nil { + return components.ACLWithoutParents{} + } + return o.ACLWithoutParents +} + +type UpsertACLWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted ACL + ACL *components.ACL +} + +func (o *UpsertACLWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertACLWithConsumerResponse) GetACL() *components.ACL { + if o == nil { + return nil + } + return o.ACL +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertbasicauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertbasicauthwithconsumer.go new file mode 100644 index 00000000..04cb7106 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertbasicauthwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertBasicAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the Basic-auth credential to lookup + BasicAuthID string `pathParam:"style=simple,explode=false,name=BasicAuthId"` + // Description of the Basic-auth credential + BasicAuthWithoutParents components.BasicAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertBasicAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertBasicAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertBasicAuthWithConsumerRequest) GetBasicAuthID() string { + if o == nil { + return "" + } + return o.BasicAuthID +} + +func (o *UpsertBasicAuthWithConsumerRequest) GetBasicAuthWithoutParents() components.BasicAuthWithoutParents { + if o == nil { + return components.BasicAuthWithoutParents{} + } + return o.BasicAuthWithoutParents +} + +type UpsertBasicAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Basic-auth credential + BasicAuth *components.BasicAuth +} + +func (o *UpsertBasicAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertBasicAuthWithConsumerResponse) GetBasicAuth() *components.BasicAuth { + if o == nil { + return nil + } + return o.BasicAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertcacertificate.go b/tests/mockserver/internal/sdk/models/operations/upsertcacertificate.go new file mode 100644 index 00000000..cb03cd42 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertcacertificate.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertCaCertificateRequest struct { + // ID of the CA Certificate to lookup + CACertificateID string `pathParam:"style=simple,explode=false,name=CACertificateId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the CA Certificate + CACertificate components.CACertificate `request:"mediaType=application/json"` +} + +func (o *UpsertCaCertificateRequest) GetCACertificateID() string { + if o == nil { + return "" + } + return o.CACertificateID +} + +func (o *UpsertCaCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertCaCertificateRequest) GetCACertificate() components.CACertificate { + if o == nil { + return components.CACertificate{} + } + return o.CACertificate +} + +type UpsertCaCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted CA Certificate + CACertificate *components.CACertificate +} + +func (o *UpsertCaCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertCaCertificateResponse) GetCACertificate() *components.CACertificate { + if o == nil { + return nil + } + return o.CACertificate +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertcertificate.go b/tests/mockserver/internal/sdk/models/operations/upsertcertificate.go new file mode 100644 index 00000000..6730f00d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertcertificate.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertCertificateRequest struct { + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Certificate + Certificate components.Certificate `request:"mediaType=application/json"` +} + +func (o *UpsertCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *UpsertCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertCertificateRequest) GetCertificate() components.Certificate { + if o == nil { + return components.Certificate{} + } + return o.Certificate +} + +type UpsertCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Certificate + Certificate *components.Certificate +} + +func (o *UpsertCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertCertificateResponse) GetCertificate() *components.Certificate { + if o == nil { + return nil + } + return o.Certificate +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertconsumer.go new file mode 100644 index 00000000..f180e0d1 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertconsumer.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertConsumerRequest struct { + // ID of the Consumer to lookup + ConsumerID string `pathParam:"style=simple,explode=false,name=ConsumerId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Consumer + Consumer components.Consumer `request:"mediaType=application/json"` +} + +func (o *UpsertConsumerRequest) GetConsumerID() string { + if o == nil { + return "" + } + return o.ConsumerID +} + +func (o *UpsertConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertConsumerRequest) GetConsumer() components.Consumer { + if o == nil { + return components.Consumer{} + } + return o.Consumer +} + +type UpsertConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Consumer + Consumer *components.Consumer +} + +func (o *UpsertConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertConsumerResponse) GetConsumer() *components.Consumer { + if o == nil { + return nil + } + return o.Consumer +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/upsertconsumergroup.go new file mode 100644 index 00000000..a9a20c47 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertconsumergroup.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertConsumerGroupRequest struct { + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Consumer Group + ConsumerGroup components.ConsumerGroup `request:"mediaType=application/json"` +} + +func (o *UpsertConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *UpsertConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertConsumerGroupRequest) GetConsumerGroup() components.ConsumerGroup { + if o == nil { + return components.ConsumerGroup{} + } + return o.ConsumerGroup +} + +type UpsertConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Consumer Group + ConsumerGroup *components.ConsumerGroup +} + +func (o *UpsertConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertConsumerGroupResponse) GetConsumerGroup() *components.ConsumerGroup { + if o == nil { + return nil + } + return o.ConsumerGroup +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertcustomplugin.go b/tests/mockserver/internal/sdk/models/operations/upsertcustomplugin.go new file mode 100644 index 00000000..303b81e7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertcustomplugin.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertCustomPluginRequest struct { + // ID of the CustomPlugin to lookup + CustomPluginID string `pathParam:"style=simple,explode=false,name=CustomPluginId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the CustomPlugin + CustomPlugin components.CustomPlugin `request:"mediaType=application/json"` +} + +func (o *UpsertCustomPluginRequest) GetCustomPluginID() string { + if o == nil { + return "" + } + return o.CustomPluginID +} + +func (o *UpsertCustomPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertCustomPluginRequest) GetCustomPlugin() components.CustomPlugin { + if o == nil { + return components.CustomPlugin{} + } + return o.CustomPlugin +} + +type UpsertCustomPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted CustomPlugin + CustomPlugin *components.CustomPlugin +} + +func (o *UpsertCustomPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertCustomPluginResponse) GetCustomPlugin() *components.CustomPlugin { + if o == nil { + return nil + } + return o.CustomPlugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertdegraphqlroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/upsertdegraphqlroutewithservice.go new file mode 100644 index 00000000..082054f8 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertdegraphqlroutewithservice.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertDegraphqlRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Degraphql_route to lookup + DegraphqlRouteID string `pathParam:"style=simple,explode=false,name=Degraphql_routeId"` + // Description of the Degraphql_route + DegraphqlRouteWithoutParents components.DegraphqlRouteWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertDegraphqlRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertDegraphqlRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *UpsertDegraphqlRouteWithServiceRequest) GetDegraphqlRouteID() string { + if o == nil { + return "" + } + return o.DegraphqlRouteID +} + +func (o *UpsertDegraphqlRouteWithServiceRequest) GetDegraphqlRouteWithoutParents() components.DegraphqlRouteWithoutParents { + if o == nil { + return components.DegraphqlRouteWithoutParents{} + } + return o.DegraphqlRouteWithoutParents +} + +type UpsertDegraphqlRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Degraphql_route + DegraphqlRoute *components.DegraphqlRoute +} + +func (o *UpsertDegraphqlRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertDegraphqlRouteWithServiceResponse) GetDegraphqlRoute() *components.DegraphqlRoute { + if o == nil { + return nil + } + return o.DegraphqlRoute +} diff --git a/tests/mockserver/internal/sdk/models/operations/upserthmacauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upserthmacauthwithconsumer.go new file mode 100644 index 00000000..56354067 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upserthmacauthwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertHmacAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the HMAC-auth credential to lookup + HMACAuthID string `pathParam:"style=simple,explode=false,name=HMACAuthId"` + // Description of the HMAC-auth credential + HMACAuthWithoutParents components.HMACAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertHmacAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertHmacAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertHmacAuthWithConsumerRequest) GetHMACAuthID() string { + if o == nil { + return "" + } + return o.HMACAuthID +} + +func (o *UpsertHmacAuthWithConsumerRequest) GetHMACAuthWithoutParents() components.HMACAuthWithoutParents { + if o == nil { + return components.HMACAuthWithoutParents{} + } + return o.HMACAuthWithoutParents +} + +type UpsertHmacAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted HMAC-auth credential + HMACAuth *components.HMACAuth +} + +func (o *UpsertHmacAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertHmacAuthWithConsumerResponse) GetHMACAuth() *components.HMACAuth { + if o == nil { + return nil + } + return o.HMACAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertjwtwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertjwtwithconsumer.go new file mode 100644 index 00000000..69b18fe6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertjwtwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertJwtWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the JWT to lookup + JWTID string `pathParam:"style=simple,explode=false,name=JWTId"` + // Description of the JWT + JWTWithoutParents *components.JWTWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertJwtWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertJwtWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertJwtWithConsumerRequest) GetJWTID() string { + if o == nil { + return "" + } + return o.JWTID +} + +func (o *UpsertJwtWithConsumerRequest) GetJWTWithoutParents() *components.JWTWithoutParents { + if o == nil { + return nil + } + return o.JWTWithoutParents +} + +type UpsertJwtWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted JWT + Jwt *components.Jwt +} + +func (o *UpsertJwtWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertJwtWithConsumerResponse) GetJwt() *components.Jwt { + if o == nil { + return nil + } + return o.Jwt +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertkey.go b/tests/mockserver/internal/sdk/models/operations/upsertkey.go new file mode 100644 index 00000000..0aa1c286 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertkey.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertKeyRequest struct { + // ID of the Key to lookup + KeyID string `pathParam:"style=simple,explode=false,name=KeyId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Key + Key components.Key `request:"mediaType=application/json"` +} + +func (o *UpsertKeyRequest) GetKeyID() string { + if o == nil { + return "" + } + return o.KeyID +} + +func (o *UpsertKeyRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertKeyRequest) GetKey() components.Key { + if o == nil { + return components.Key{} + } + return o.Key +} + +type UpsertKeyResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Key + Key *components.Key +} + +func (o *UpsertKeyResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertKeyResponse) GetKey() *components.Key { + if o == nil { + return nil + } + return o.Key +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertkeyauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertkeyauthwithconsumer.go new file mode 100644 index 00000000..929e7521 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertkeyauthwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertKeyAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the API-key to lookup + KeyAuthID string `pathParam:"style=simple,explode=false,name=KeyAuthId"` + // Description of the API-key + KeyAuthWithoutParents *components.KeyAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertKeyAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertKeyAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertKeyAuthWithConsumerRequest) GetKeyAuthID() string { + if o == nil { + return "" + } + return o.KeyAuthID +} + +func (o *UpsertKeyAuthWithConsumerRequest) GetKeyAuthWithoutParents() *components.KeyAuthWithoutParents { + if o == nil { + return nil + } + return o.KeyAuthWithoutParents +} + +type UpsertKeyAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted API-key + KeyAuth *components.KeyAuth +} + +func (o *UpsertKeyAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertKeyAuthWithConsumerResponse) GetKeyAuth() *components.KeyAuth { + if o == nil { + return nil + } + return o.KeyAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertkeyset.go b/tests/mockserver/internal/sdk/models/operations/upsertkeyset.go new file mode 100644 index 00000000..dcd0ea4e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertkeyset.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertKeySetRequest struct { + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the KeySet + KeySet components.KeySet `request:"mediaType=application/json"` +} + +func (o *UpsertKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *UpsertKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertKeySetRequest) GetKeySet() components.KeySet { + if o == nil { + return components.KeySet{} + } + return o.KeySet +} + +type UpsertKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted KeySet + KeySet *components.KeySet +} + +func (o *UpsertKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertKeySetResponse) GetKeySet() *components.KeySet { + if o == nil { + return nil + } + return o.KeySet +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertkeywithkeyset.go b/tests/mockserver/internal/sdk/models/operations/upsertkeywithkeyset.go new file mode 100644 index 00000000..2675102b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertkeywithkeyset.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertKeyWithKeySetRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the KeySet to lookup + KeySetID string `pathParam:"style=simple,explode=false,name=KeySetId"` + // ID of the Key to lookup + KeyID string `pathParam:"style=simple,explode=false,name=KeyId"` + // Description of the Key + KeyWithoutParents components.KeyWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertKeyWithKeySetRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertKeyWithKeySetRequest) GetKeySetID() string { + if o == nil { + return "" + } + return o.KeySetID +} + +func (o *UpsertKeyWithKeySetRequest) GetKeyID() string { + if o == nil { + return "" + } + return o.KeyID +} + +func (o *UpsertKeyWithKeySetRequest) GetKeyWithoutParents() components.KeyWithoutParents { + if o == nil { + return components.KeyWithoutParents{} + } + return o.KeyWithoutParents +} + +type UpsertKeyWithKeySetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Key + Key *components.Key +} + +func (o *UpsertKeyWithKeySetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertKeyWithKeySetResponse) GetKey() *components.Key { + if o == nil { + return nil + } + return o.Key +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertmtlsauthwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertmtlsauthwithconsumer.go new file mode 100644 index 00000000..92ebbd93 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertmtlsauthwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertMtlsAuthWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the MTLS-auth credential to lookup + MTLSAuthID string `pathParam:"style=simple,explode=false,name=MTLSAuthId"` + // Description of the MTLS-auth credential + MTLSAuthWithoutParents components.MTLSAuthWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertMtlsAuthWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertMtlsAuthWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertMtlsAuthWithConsumerRequest) GetMTLSAuthID() string { + if o == nil { + return "" + } + return o.MTLSAuthID +} + +func (o *UpsertMtlsAuthWithConsumerRequest) GetMTLSAuthWithoutParents() components.MTLSAuthWithoutParents { + if o == nil { + return components.MTLSAuthWithoutParents{} + } + return o.MTLSAuthWithoutParents +} + +type UpsertMtlsAuthWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted MTLS-auth credential + MTLSAuth *components.MTLSAuth +} + +func (o *UpsertMtlsAuthWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertMtlsAuthWithConsumerResponse) GetMTLSAuth() *components.MTLSAuth { + if o == nil { + return nil + } + return o.MTLSAuth +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertpartial.go b/tests/mockserver/internal/sdk/models/operations/upsertpartial.go new file mode 100644 index 00000000..8896a6df --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertpartial.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertPartialRequest struct { + // ID of the Partial to lookup + PartialID string `pathParam:"style=simple,explode=false,name=PartialId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Partial + Partial components.Partial `request:"mediaType=application/json"` +} + +func (o *UpsertPartialRequest) GetPartialID() string { + if o == nil { + return "" + } + return o.PartialID +} + +func (o *UpsertPartialRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertPartialRequest) GetPartial() components.Partial { + if o == nil { + return components.Partial{} + } + return o.Partial +} + +type UpsertPartialResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Partial + Partial *components.Partial +} + +func (o *UpsertPartialResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertPartialResponse) GetPartial() *components.Partial { + if o == nil { + return nil + } + return o.Partial +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertplugin.go b/tests/mockserver/internal/sdk/models/operations/upsertplugin.go new file mode 100644 index 00000000..08edb02d --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertplugin.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertPluginRequest struct { + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Plugin + Plugin components.Plugin `request:"mediaType=application/json"` +} + +func (o *UpsertPluginRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +func (o *UpsertPluginRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertPluginRequest) GetPlugin() components.Plugin { + if o == nil { + return components.Plugin{} + } + return o.Plugin +} + +type UpsertPluginResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Plugin + Plugin *components.Plugin +} + +func (o *UpsertPluginResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertPluginResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumer.go b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumer.go new file mode 100644 index 00000000..2dfefa2f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumer.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertPluginWithConsumerRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Consumer ID for nested entities + ConsumerIDForNestedEntities string `pathParam:"style=simple,explode=false,name=ConsumerIdForNestedEntities"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` + // Description of the Plugin + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertPluginWithConsumerRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertPluginWithConsumerRequest) GetConsumerIDForNestedEntities() string { + if o == nil { + return "" + } + return o.ConsumerIDForNestedEntities +} + +func (o *UpsertPluginWithConsumerRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +func (o *UpsertPluginWithConsumerRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type UpsertPluginWithConsumerResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Plugin + Plugin *components.Plugin +} + +func (o *UpsertPluginWithConsumerResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertPluginWithConsumerResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumergroup.go b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumergroup.go new file mode 100644 index 00000000..f7deda7a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithconsumergroup.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertPluginWithConsumerGroupRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Consumer Group to lookup + ConsumerGroupID string `pathParam:"style=simple,explode=false,name=ConsumerGroupId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` + // Description of the Plugin + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertPluginWithConsumerGroupRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertPluginWithConsumerGroupRequest) GetConsumerGroupID() string { + if o == nil { + return "" + } + return o.ConsumerGroupID +} + +func (o *UpsertPluginWithConsumerGroupRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +func (o *UpsertPluginWithConsumerGroupRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type UpsertPluginWithConsumerGroupResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Plugin + Plugin *components.Plugin +} + +func (o *UpsertPluginWithConsumerGroupResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertPluginWithConsumerGroupResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertpluginwithroute.go b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithroute.go new file mode 100644 index 00000000..ff55f8a3 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithroute.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertPluginWithRouteRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` + // Description of the Plugin + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertPluginWithRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertPluginWithRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *UpsertPluginWithRouteRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +func (o *UpsertPluginWithRouteRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type UpsertPluginWithRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Plugin + Plugin *components.Plugin +} + +func (o *UpsertPluginWithRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertPluginWithRouteResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertpluginwithservice.go b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithservice.go new file mode 100644 index 00000000..4eeb90ae --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertpluginwithservice.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertPluginWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Plugin to lookup + PluginID string `pathParam:"style=simple,explode=false,name=PluginId"` + // Description of the Plugin + PluginWithoutParents components.PluginWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertPluginWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertPluginWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *UpsertPluginWithServiceRequest) GetPluginID() string { + if o == nil { + return "" + } + return o.PluginID +} + +func (o *UpsertPluginWithServiceRequest) GetPluginWithoutParents() components.PluginWithoutParents { + if o == nil { + return components.PluginWithoutParents{} + } + return o.PluginWithoutParents +} + +type UpsertPluginWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Plugin + Plugin *components.Plugin +} + +func (o *UpsertPluginWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertPluginWithServiceResponse) GetPlugin() *components.Plugin { + if o == nil { + return nil + } + return o.Plugin +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertroute.go b/tests/mockserver/internal/sdk/models/operations/upsertroute.go new file mode 100644 index 00000000..cb425db2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertroute.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertRouteRequest struct { + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Route + Route components.Route `request:"mediaType=application/json"` +} + +func (o *UpsertRouteRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *UpsertRouteRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertRouteRequest) GetRoute() components.Route { + if o == nil { + return components.Route{} + } + return o.Route +} + +type UpsertRouteResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Route + Route *components.Route +} + +func (o *UpsertRouteResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertRouteResponse) GetRoute() *components.Route { + if o == nil { + return nil + } + return o.Route +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertroutewithservice.go b/tests/mockserver/internal/sdk/models/operations/upsertroutewithservice.go new file mode 100644 index 00000000..7ca4123b --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertroutewithservice.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertRouteWithServiceRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // ID of the Route to lookup + RouteID string `pathParam:"style=simple,explode=false,name=RouteId"` + // Description of the Route + RouteWithoutParents components.RouteWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertRouteWithServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertRouteWithServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *UpsertRouteWithServiceRequest) GetRouteID() string { + if o == nil { + return "" + } + return o.RouteID +} + +func (o *UpsertRouteWithServiceRequest) GetRouteWithoutParents() components.RouteWithoutParents { + if o == nil { + return components.RouteWithoutParents{} + } + return o.RouteWithoutParents +} + +type UpsertRouteWithServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Route + Route *components.Route +} + +func (o *UpsertRouteWithServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertRouteWithServiceResponse) GetRoute() *components.Route { + if o == nil { + return nil + } + return o.Route +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertservice.go b/tests/mockserver/internal/sdk/models/operations/upsertservice.go new file mode 100644 index 00000000..1e66fab7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertservice.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertServiceRequest struct { + // ID of the Service to lookup + ServiceID string `pathParam:"style=simple,explode=false,name=ServiceId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Service + Service components.Service `request:"mediaType=application/json"` +} + +func (o *UpsertServiceRequest) GetServiceID() string { + if o == nil { + return "" + } + return o.ServiceID +} + +func (o *UpsertServiceRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertServiceRequest) GetService() components.Service { + if o == nil { + return components.Service{} + } + return o.Service +} + +type UpsertServiceResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Service + Service *components.ServiceOutput +} + +func (o *UpsertServiceResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertServiceResponse) GetService() *components.ServiceOutput { + if o == nil { + return nil + } + return o.Service +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertsni.go b/tests/mockserver/internal/sdk/models/operations/upsertsni.go new file mode 100644 index 00000000..7cd15fe2 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertsni.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertSniRequest struct { + // ID of the SNI to lookup + SNIID string `pathParam:"style=simple,explode=false,name=SNIId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the SNI + Sni components.Sni `request:"mediaType=application/json"` +} + +func (o *UpsertSniRequest) GetSNIID() string { + if o == nil { + return "" + } + return o.SNIID +} + +func (o *UpsertSniRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertSniRequest) GetSni() components.Sni { + if o == nil { + return components.Sni{} + } + return o.Sni +} + +type UpsertSniResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted SNI + Sni *components.Sni +} + +func (o *UpsertSniResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertSniResponse) GetSni() *components.Sni { + if o == nil { + return nil + } + return o.Sni +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertsniwithcertificate.go b/tests/mockserver/internal/sdk/models/operations/upsertsniwithcertificate.go new file mode 100644 index 00000000..1b05ca9f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertsniwithcertificate.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertSniWithCertificateRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID of the Certificate to lookup + CertificateID string `pathParam:"style=simple,explode=false,name=CertificateId"` + // ID of the SNI to lookup + SNIID string `pathParam:"style=simple,explode=false,name=SNIId"` + // Description of the SNI + SNIWithoutParents components.SNIWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertSniWithCertificateRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertSniWithCertificateRequest) GetCertificateID() string { + if o == nil { + return "" + } + return o.CertificateID +} + +func (o *UpsertSniWithCertificateRequest) GetSNIID() string { + if o == nil { + return "" + } + return o.SNIID +} + +func (o *UpsertSniWithCertificateRequest) GetSNIWithoutParents() components.SNIWithoutParents { + if o == nil { + return components.SNIWithoutParents{} + } + return o.SNIWithoutParents +} + +type UpsertSniWithCertificateResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted SNI + Sni *components.Sni +} + +func (o *UpsertSniWithCertificateResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertSniWithCertificateResponse) GetSni() *components.Sni { + if o == nil { + return nil + } + return o.Sni +} diff --git a/tests/mockserver/internal/sdk/models/operations/upserttargetwithupstream.go b/tests/mockserver/internal/sdk/models/operations/upserttargetwithupstream.go new file mode 100644 index 00000000..4f4ad025 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upserttargetwithupstream.go @@ -0,0 +1,66 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertTargetWithUpstreamRequest struct { + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // ID or target of the Target to lookup + UpstreamIDForTarget string `pathParam:"style=simple,explode=false,name=UpstreamIdForTarget"` + // ID of the Target to lookup + TargetID string `pathParam:"style=simple,explode=false,name=TargetId"` + // Description of the Target + TargetWithoutParents components.TargetWithoutParents `request:"mediaType=application/json"` +} + +func (o *UpsertTargetWithUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertTargetWithUpstreamRequest) GetUpstreamIDForTarget() string { + if o == nil { + return "" + } + return o.UpstreamIDForTarget +} + +func (o *UpsertTargetWithUpstreamRequest) GetTargetID() string { + if o == nil { + return "" + } + return o.TargetID +} + +func (o *UpsertTargetWithUpstreamRequest) GetTargetWithoutParents() components.TargetWithoutParents { + if o == nil { + return components.TargetWithoutParents{} + } + return o.TargetWithoutParents +} + +type UpsertTargetWithUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Target + Target *components.Target +} + +func (o *UpsertTargetWithUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertTargetWithUpstreamResponse) GetTarget() *components.Target { + if o == nil { + return nil + } + return o.Target +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertupstream.go b/tests/mockserver/internal/sdk/models/operations/upsertupstream.go new file mode 100644 index 00000000..29b88e84 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertupstream.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertUpstreamRequest struct { + // ID of the Upstream to lookup + UpstreamID string `pathParam:"style=simple,explode=false,name=UpstreamId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Upstream + Upstream components.Upstream `request:"mediaType=application/json"` +} + +func (o *UpsertUpstreamRequest) GetUpstreamID() string { + if o == nil { + return "" + } + return o.UpstreamID +} + +func (o *UpsertUpstreamRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertUpstreamRequest) GetUpstream() components.Upstream { + if o == nil { + return components.Upstream{} + } + return o.Upstream +} + +type UpsertUpstreamResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Upstream + Upstream *components.Upstream +} + +func (o *UpsertUpstreamResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertUpstreamResponse) GetUpstream() *components.Upstream { + if o == nil { + return nil + } + return o.Upstream +} diff --git a/tests/mockserver/internal/sdk/models/operations/upsertvault.go b/tests/mockserver/internal/sdk/models/operations/upsertvault.go new file mode 100644 index 00000000..48fb5f22 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/upsertvault.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UpsertVaultRequest struct { + // ID of the Vault to lookup + VaultID string `pathParam:"style=simple,explode=false,name=VaultId"` + // The UUID of your control plane. This variable is available in the Konnect manager. + ControlPlaneID string `pathParam:"style=simple,explode=false,name=controlPlaneId"` + // Description of the Vault + Vault components.Vault `request:"mediaType=application/json"` +} + +func (o *UpsertVaultRequest) GetVaultID() string { + if o == nil { + return "" + } + return o.VaultID +} + +func (o *UpsertVaultRequest) GetControlPlaneID() string { + if o == nil { + return "" + } + return o.ControlPlaneID +} + +func (o *UpsertVaultRequest) GetVault() components.Vault { + if o == nil { + return components.Vault{} + } + return o.Vault +} + +type UpsertVaultResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successfully upserted Vault + Vault *components.Vault +} + +func (o *UpsertVaultResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UpsertVaultResponse) GetVault() *components.Vault { + if o == nil { + return nil + } + return o.Vault +} diff --git a/tests/mockserver/internal/sdk/models/operations/usersassignrole.go b/tests/mockserver/internal/sdk/models/operations/usersassignrole.go new file mode 100644 index 00000000..6cfc39ea --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/usersassignrole.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UsersAssignRoleRequest struct { + // The user ID + UserID string `pathParam:"style=simple,explode=false,name=userId"` + // The request schema for assigning a role. + AssignRole *components.AssignRole `request:"mediaType=application/json"` +} + +func (o *UsersAssignRoleRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +func (o *UsersAssignRoleRequest) GetAssignRole() *components.AssignRole { + if o == nil { + return nil + } + return o.AssignRole +} + +type UsersAssignRoleResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A get action response of a single assigned role. + AssignedRole *components.AssignedRole +} + +func (o *UsersAssignRoleResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *UsersAssignRoleResponse) GetAssignedRole() *components.AssignedRole { + if o == nil { + return nil + } + return o.AssignedRole +} diff --git a/tests/mockserver/internal/sdk/models/operations/usersremoverole.go b/tests/mockserver/internal/sdk/models/operations/usersremoverole.go new file mode 100644 index 00000000..b754a8cc --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/usersremoverole.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type UsersRemoveRoleRequest struct { + // ID of the user. + UserID string `pathParam:"style=simple,explode=false,name=userId"` + // ID of the role. + RoleID string `pathParam:"style=simple,explode=false,name=roleId"` +} + +func (o *UsersRemoveRoleRequest) GetUserID() string { + if o == nil { + return "" + } + return o.UserID +} + +func (o *UsersRemoveRoleRequest) GetRoleID() string { + if o == nil { + return "" + } + return o.RoleID +} + +type UsersRemoveRoleResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` +} + +func (o *UsersRemoveRoleResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} diff --git a/tests/mockserver/internal/sdk/models/operations/verifydcrprovider.go b/tests/mockserver/internal/sdk/models/operations/verifydcrprovider.go new file mode 100644 index 00000000..7205d8b0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/verifydcrprovider.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type VerifyDcrProviderRequest struct { + // DCR provider identifier + DcrProviderID string `pathParam:"style=simple,explode=false,name=dcrProviderId"` +} + +func (o *VerifyDcrProviderRequest) GetDcrProviderID() string { + if o == nil { + return "" + } + return o.DcrProviderID +} + +type VerifyDcrProviderResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A response containing the result of attempting to verify a DCR provider configuration. + VerifyDcrProviderResponse *components.VerifyDcrProviderResponse +} + +func (o *VerifyDcrProviderResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *VerifyDcrProviderResponse) GetVerifyDcrProviderResponse() *components.VerifyDcrProviderResponse { + if o == nil { + return nil + } + return o.VerifyDcrProviderResponse +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/badrequesterror.go b/tests/mockserver/internal/sdk/models/sdkerrors/badrequesterror.go new file mode 100644 index 00000000..7289591e --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/badrequesterror.go @@ -0,0 +1,44 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// BadRequestError - standard error +type BadRequestError struct { + // The HTTP status code of the error. Useful when passing the response + // body to child properties in a frontend UI. Must be returned as an integer. + // + Status int64 `json:"status"` + // A short, human-readable summary of the problem. It should not + // change between occurences of a problem, except for localization. + // Should be provided as "Sentence case" for direct use in the UI. + // + Title string `json:"title"` + // The error type. + Type *string `json:"type,omitempty"` + // Used to return the correlation ID back to the user, in the format + // kong:trace:. This helps us find the relevant logs + // when a customer reports an issue. + // + Instance string `json:"instance"` + // A human readable explanation specific to this occurence of the problem. + // This field may contain request/entity data to help the user understand + // what went wrong. Enclose variable values in square brackets. Should be + // provided as "Sentence case" for direct use in the UI. + // + Detail string `json:"detail"` + // invalid parameters + InvalidParameters []components.InvalidParameters `json:"invalid_parameters"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &BadRequestError{} + +func (e *BadRequestError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/baseerror.go b/tests/mockserver/internal/sdk/models/sdkerrors/baseerror.go new file mode 100644 index 00000000..2ba78c59 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/baseerror.go @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// BaseError - standard error +type BaseError struct { + // The HTTP status code of the error. Useful when passing the response + // body to child properties in a frontend UI. Must be returned as an integer. + // + Status int64 `json:"status"` + // A short, human-readable summary of the problem. It should not + // change between occurences of a problem, except for localization. + // Should be provided as "Sentence case" for direct use in the UI. + // + Title string `json:"title"` + // The error type. + Type *string `json:"type,omitempty"` + // Used to return the correlation ID back to the user, in the format + // kong:trace:. This helps us find the relevant logs + // when a customer reports an issue. + // + Instance string `json:"instance"` + // A human readable explanation specific to this occurence of the problem. + // This field may contain request/entity data to help the user understand + // what went wrong. Enclose variable values in square brackets. Should be + // provided as "Sentence case" for direct use in the UI. + // + Detail string `json:"detail"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &BaseError{} + +func (e *BaseError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/conflicterror.go b/tests/mockserver/internal/sdk/models/sdkerrors/conflicterror.go new file mode 100644 index 00000000..646df2ed --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/conflicterror.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// ConflictError - standard error +type ConflictError struct { + Status any `json:"status"` + Title any `json:"title"` + Type any `json:"type,omitempty"` + Instance any `json:"instance"` + Detail any `json:"detail"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ConflictError{} + +func (e *ConflictError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/forbiddenerror.go b/tests/mockserver/internal/sdk/models/sdkerrors/forbiddenerror.go new file mode 100644 index 00000000..2dd729d9 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/forbiddenerror.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// ForbiddenError - standard error +type ForbiddenError struct { + Status any `json:"status"` + Title any `json:"title"` + Type any `json:"type,omitempty"` + Instance any `json:"instance"` + Detail any `json:"detail"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ForbiddenError{} + +func (e *ForbiddenError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/gatewayunauthorizederror.go b/tests/mockserver/internal/sdk/models/sdkerrors/gatewayunauthorizederror.go new file mode 100644 index 00000000..99dce292 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/gatewayunauthorizederror.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// GatewayUnauthorizedError - Unauthorized +type GatewayUnauthorizedError struct { + Message string `json:"message"` + Status int64 `json:"status"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GatewayUnauthorizedError{} + +func (e *GatewayUnauthorizedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/internalservererror.go b/tests/mockserver/internal/sdk/models/sdkerrors/internalservererror.go new file mode 100644 index 00000000..cc8763e0 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/internalservererror.go @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// InternalServerError - The error response object. +type InternalServerError struct { + // The HTTP status code. + Status components.InternalServerErrorStatus `json:"status"` + // The error response code. + Title string `json:"title"` + // The Konnect traceback code + Instance string `json:"instance"` + // Details about the error. + Detail *string `json:"detail,omitempty"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &InternalServerError{} + +func (e *InternalServerError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/notfounderror.go b/tests/mockserver/internal/sdk/models/sdkerrors/notfounderror.go new file mode 100644 index 00000000..f2b98991 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/notfounderror.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// NotFoundError - standard error +type NotFoundError struct { + Status any `json:"status"` + Title any `json:"title"` + Type any `json:"type,omitempty"` + Instance any `json:"instance"` + Detail any `json:"detail"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &NotFoundError{} + +func (e *NotFoundError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/preconditionfailederror.go b/tests/mockserver/internal/sdk/models/sdkerrors/preconditionfailederror.go new file mode 100644 index 00000000..6c6cb418 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/preconditionfailederror.go @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// PreconditionFailedError - The error response object. +type PreconditionFailedError struct { + // The HTTP status code. + Status *int64 `json:"status,omitempty"` + // The error response code. + Title *string `json:"title,omitempty"` + // The Konnect traceback code. + Instance *string `json:"instance,omitempty"` + // Details about the error response. + Detail *string `json:"detail,omitempty"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &PreconditionFailedError{} + +func (e *PreconditionFailedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/ratelimitederror.go b/tests/mockserver/internal/sdk/models/sdkerrors/ratelimitederror.go new file mode 100644 index 00000000..8f4354ea --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/ratelimitederror.go @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// RateLimitedError - The error object +type RateLimitedError struct { + // The HTTP response code + Status *int64 `json:"status,omitempty"` + // The Error response + Title *string `json:"title,omitempty"` + // The Konnect traceback ID. + Instance *string `json:"instance,omitempty"` + // Detailed explanation of the error response. + Detail *string `json:"detail,omitempty"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &RateLimitedError{} + +func (e *RateLimitedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/serviceunavailableerror.go b/tests/mockserver/internal/sdk/models/sdkerrors/serviceunavailableerror.go new file mode 100644 index 00000000..ca744d93 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/serviceunavailableerror.go @@ -0,0 +1,28 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// ServiceUnavailableError - Error response for temporary service unavailability. +type ServiceUnavailableError struct { + // The HTTP status code. + Status components.ServiceUnavailableStatus `json:"status"` + // The error response code. + Title string `json:"title"` + // The Konnect traceback code + Instance string `json:"instance"` + // Details about the error. + Detail *string `json:"detail,omitempty"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &ServiceUnavailableError{} + +func (e *ServiceUnavailableError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/unauthorizederror.go b/tests/mockserver/internal/sdk/models/sdkerrors/unauthorizederror.go new file mode 100644 index 00000000..0620b304 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/unauthorizederror.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// UnauthorizedError - standard error +type UnauthorizedError struct { + Status any `json:"status"` + Title any `json:"title"` + Type any `json:"type,omitempty"` + Instance any `json:"instance"` + Detail any `json:"detail"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &UnauthorizedError{} + +func (e *UnauthorizedError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/models/sdkerrors/unsupportedmediatypeerror.go b/tests/mockserver/internal/sdk/models/sdkerrors/unsupportedmediatypeerror.go new file mode 100644 index 00000000..aa0bb6fa --- /dev/null +++ b/tests/mockserver/internal/sdk/models/sdkerrors/unsupportedmediatypeerror.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "mockserver/internal/sdk/models/components" +) + +// 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"` + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &UnsupportedMediaTypeError{} + +func (e *UnsupportedMediaTypeError) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/tests/mockserver/internal/sdk/types/bigint.go b/tests/mockserver/internal/sdk/types/bigint.go new file mode 100644 index 00000000..9c6a086d --- /dev/null +++ b/tests/mockserver/internal/sdk/types/bigint.go @@ -0,0 +1,21 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package types + +import ( + "fmt" + "math/big" +) + +// MustNewBigIntFromString returns an instance of big.Int from a string +// The string is assumed to be base 10 and if it is not a valid big.Int +// then the function panics. +// Avoid using this function in production code. +func MustNewBigIntFromString(s string) *big.Int { + i, ok := new(big.Int).SetString(s, 10) + if !ok { + panic(fmt.Errorf("failed to parse string as big.Int")) + } + + return i +} diff --git a/tests/mockserver/internal/sdk/types/date.go b/tests/mockserver/internal/sdk/types/date.go new file mode 100644 index 00000000..5b2782f2 --- /dev/null +++ b/tests/mockserver/internal/sdk/types/date.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package types + +import ( + "encoding/json" + "fmt" + "strings" + "time" +) + +// Date is a wrapper around time.Time that allows for JSON marshaling a date string formatted as "2006-01-02". +type Date struct { + time.Time +} + +var ( + _ json.Marshaler = &Date{} + _ json.Unmarshaler = &Date{} + _ fmt.Stringer = &Date{} +) + +// NewDate returns an instance of Date from a time.Time. +func NewDate(t time.Time) *Date { + d := DateFromTime(t) + return &d +} + +// DateFromTime returns a Date from a time.Time. +func DateFromTime(t time.Time) Date { + return Date{t} +} + +// NewDateFromString returns an instance of Date from a string formatted as "2006-01-02". +func NewDateFromString(str string) (*Date, error) { + d, err := DateFromString(str) + if err != nil { + return nil, err + } + + return &d, nil +} + +// DateFromString returns a Date from a string formatted as "2006-01-02". +func DateFromString(str string) (Date, error) { + var d Date + var err error + + d.Time, err = time.Parse("2006-01-02", str) + return d, err +} + +// MustNewDateFromString returns an instance of Date from a string formatted as "2006-01-02" or panics. +// Avoid using this function in production code. +func MustNewDateFromString(str string) *Date { + d := MustDateFromString(str) + return &d +} + +// MustDateFromString returns a Date from a string formatted as "2006-01-02" or panics. +// Avoid using this function in production code. +func MustDateFromString(str string) Date { + d, err := DateFromString(str) + if err != nil { + panic(err) + } + return d +} + +func (d Date) GetTime() time.Time { + return d.Time +} + +func (d Date) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(`"%s"`, d.Time.Format("2006-01-02"))), nil +} + +func (d *Date) UnmarshalJSON(data []byte) error { + var err error + + str := string(data) + str = strings.Trim(str, `"`) + + d.Time, err = time.Parse("2006-01-02", str) + return err +} + +func (d Date) String() string { + return d.Time.Format("2006-01-02") +} diff --git a/tests/mockserver/internal/sdk/types/datetime.go b/tests/mockserver/internal/sdk/types/datetime.go new file mode 100644 index 00000000..3eff332d --- /dev/null +++ b/tests/mockserver/internal/sdk/types/datetime.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package types + +import "time" + +// MustTimeFromString returns a time.Time from a string formatted as "2006-01-02T15:04:05Z07:00" or panics. +// Avoid using this function in production code. +func MustTimeFromString(str string) time.Time { + t, err := time.Parse(time.RFC3339, str) + if err != nil { + panic(err) + } + + return t +} + +// MustNewTimeFromString returns an instance of time.Time from a string formatted as "2006-01-02T15:04:05Z07:00" or panics. +// Avoid using this function in production code. +func MustNewTimeFromString(str string) *time.Time { + t := MustTimeFromString(str) + return &t +} diff --git a/tests/mockserver/internal/sdk/types/decimal.go b/tests/mockserver/internal/sdk/types/decimal.go new file mode 100644 index 00000000..d8429bc6 --- /dev/null +++ b/tests/mockserver/internal/sdk/types/decimal.go @@ -0,0 +1,20 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package types + +import ( + "fmt" + + "github.com/ericlagergren/decimal" +) + +// MustNewDecimalFromString returns an instance of Decimal from a string +// Avoid using this function in production code. +func MustNewDecimalFromString(s string) *decimal.Big { + d, ok := new(decimal.Big).SetString(s) + if !ok { + panic(fmt.Errorf("failed to parse string as decimal.Big")) + } + + return d +} diff --git a/tests/mockserver/internal/sdk/types/jsonl/jsonl.go b/tests/mockserver/internal/sdk/types/jsonl/jsonl.go new file mode 100644 index 00000000..26df95cf --- /dev/null +++ b/tests/mockserver/internal/sdk/types/jsonl/jsonl.go @@ -0,0 +1,7 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package jsonl + +type JsonLStream[T any] struct { + // TODO to be implemented +} diff --git a/tests/mockserver/internal/sdk/types/pointers.go b/tests/mockserver/internal/sdk/types/pointers.go new file mode 100644 index 00000000..35c439d2 --- /dev/null +++ b/tests/mockserver/internal/sdk/types/pointers.go @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package types + +func String(s string) *string { return &s } +func Bool(b bool) *bool { return &b } +func Int(i int) *int { return &i } +func Int64(i int64) *int64 { return &i } +func Float32(f float32) *float32 { return &f } +func Float64(f float64) *float64 { return &f } +func Pointer[T any](v T) *T { return &v } diff --git a/tests/mockserver/internal/sdk/utils/json.go b/tests/mockserver/internal/sdk/utils/json.go new file mode 100644 index 00000000..ca93aa5b --- /dev/null +++ b/tests/mockserver/internal/sdk/utils/json.go @@ -0,0 +1,675 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package utils + +import ( + "bytes" + "encoding/json" + "fmt" + "math/big" + "reflect" + "strconv" + "strings" + "time" + "unsafe" + + "mockserver/internal/sdk/types" + + "github.com/ericlagergren/decimal" +) + +func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, error) { + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + + switch { + case isModelType(typ): + if topLevel { + return json.Marshal(v) + } + + if isNil(typ, val) { + return []byte("null"), nil + } + + out := map[string]json.RawMessage{} + + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + fieldName := field.Name + + omitEmpty := false + jsonTag := field.Tag.Get("json") + if jsonTag != "" { + for _, tag := range strings.Split(jsonTag, ",") { + if tag == "omitempty" { + omitEmpty = true + } else { + fieldName = tag + } + } + } + + if (isNil(field.Type, fieldVal) || isEmpty(field.Type, fieldVal)) && field.Tag.Get("const") == "" { + if omitEmpty { + continue + } + } + + if !field.IsExported() && field.Tag.Get("const") == "" { + continue + } + + additionalProperties := field.Tag.Get("additionalProperties") + if fieldName == "-" && additionalProperties == "" { + continue + } + + if additionalProperties == "true" { + if isNil(field.Type, fieldVal) { + continue + } + fieldVal := trueReflectValue(fieldVal) + if fieldVal.Type().Kind() != reflect.Map { + return nil, fmt.Errorf("additionalProperties must be a map") + } + + for _, key := range fieldVal.MapKeys() { + r, err := marshalValue(fieldVal.MapIndex(key).Interface(), field.Tag) + if err != nil { + return nil, err + } + + out[key.String()] = r + } + + continue + } + + var fv interface{} + + if field.IsExported() { + fv = fieldVal.Interface() + } else { + pt := reflect.New(typ).Elem() + pt.Set(val) + + pf := pt.Field(i) + + fv = reflect.NewAt(pf.Type(), unsafe.Pointer(pf.UnsafeAddr())).Elem().Interface() + } + + r, err := marshalValue(fv, field.Tag) + if err != nil { + return nil, err + } + + out[fieldName] = r + } + + return json.Marshal(out) + default: + return marshalValue(v, tag) + } +} + +func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error { + if reflect.TypeOf(v).Kind() != reflect.Ptr { + return fmt.Errorf("v must be a pointer") + } + + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + + switch { + case isModelType(typ): + if topLevel || bytes.Equal(b, []byte("null")) { + d := json.NewDecoder(bytes.NewReader(b)) + if disallowUnknownFields { + d.DisallowUnknownFields() + } + return d.Decode(v) + } + + var unmarhsaled map[string]json.RawMessage + + if err := json.Unmarshal(b, &unmarhsaled); err != nil { + return err + } + + var additionalPropertiesField *reflect.StructField + var additionalPropertiesValue *reflect.Value + + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + fieldName := field.Name + + jsonTag := field.Tag.Get("json") + if jsonTag != "" { + for _, tag := range strings.Split(jsonTag, ",") { + if tag != "omitempty" { + fieldName = tag + } + } + } + + if field.Tag.Get("additionalProperties") == "true" { + additionalPropertiesField = &field + additionalPropertiesValue = &fieldVal + continue + } + + // If we receive a value for a const field ignore it but mark it as unmarshaled + if field.Tag.Get("const") != "" { + if r, ok := unmarhsaled[fieldName]; ok { + val := string(r) + + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { + var err error + val, err = strconv.Unquote(val) + if err != nil { + return fmt.Errorf("failed to unquote const field `%s` value `%s`: %w", fieldName, val, err) + } + } + constValue := field.Tag.Get("const") + if val != constValue { + return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) + } + + delete(unmarhsaled, fieldName) + } + } else if !field.IsExported() { + continue + } + + value, ok := unmarhsaled[fieldName] + if !ok { + defaultTag := field.Tag.Get("default") + if defaultTag != "" { + value = handleDefaultConstValue(defaultTag, fieldVal.Interface(), field.Tag) + ok = true + } + } else { + delete(unmarhsaled, fieldName) + } + + if ok { + if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil { + return err + } + } + } + + keys := make([]string, 0, len(unmarhsaled)) + for k := range unmarhsaled { + keys = append(keys, k) + } + + if len(keys) > 0 { + if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) { + return fmt.Errorf("unknown fields: %v", keys) + } + + if additionalPropertiesField != nil && additionalPropertiesValue != nil { + typeOfMap := additionalPropertiesField.Type + if additionalPropertiesValue.Type().Kind() == reflect.Interface { + typeOfMap = reflect.TypeOf(map[string]interface{}{}) + } else if additionalPropertiesValue.Type().Kind() != reflect.Map { + return fmt.Errorf("additionalProperties must be a map") + } + + mapValue := reflect.MakeMap(typeOfMap) + + for key, value := range unmarhsaled { + val := reflect.New(typeOfMap.Elem()) + + if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil { + return err + } + + if val.Elem().Type().String() == typeOfMap.Elem().String() { + mapValue.SetMapIndex(reflect.ValueOf(key), val.Elem()) + } else { + mapValue.SetMapIndex(reflect.ValueOf(key), trueReflectValue(val)) + } + + } + if additionalPropertiesValue.Type().Kind() == reflect.Interface { + additionalPropertiesValue.Set(mapValue) + } else { + additionalPropertiesValue.Set(mapValue) + } + } + } + default: + return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields) + } + + return nil +} + +func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) { + constTag := tag.Get("const") + if constTag != "" { + return handleDefaultConstValue(constTag, v, tag), nil + } + + if isNil(reflect.TypeOf(v), reflect.ValueOf(v)) { + defaultTag := tag.Get("default") + if defaultTag != "" { + return handleDefaultConstValue(defaultTag, v, tag), nil + } + + return []byte("null"), nil + } + + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + switch typ.Kind() { + case reflect.Int64: + format := tag.Get("integer") + if format == "string" { + b := val.Interface().(int64) + return []byte(fmt.Sprintf(`"%d"`, b)), nil + } + case reflect.Float64: + format := tag.Get("number") + if format == "string" { + b := val.Interface().(float64) + return []byte(fmt.Sprintf(`"%g"`, b)), nil + } + case reflect.Map: + if isNil(typ, val) { + return []byte("null"), nil + } + + out := map[string]json.RawMessage{} + + for _, key := range val.MapKeys() { + itemVal := val.MapIndex(key) + + if isNil(itemVal.Type(), itemVal) { + out[key.String()] = []byte("null") + continue + } + + r, err := marshalValue(itemVal.Interface(), tag) + if err != nil { + return nil, err + } + + out[key.String()] = r + } + + return json.Marshal(out) + case reflect.Slice, reflect.Array: + if isNil(typ, val) { + return []byte("null"), nil + } + + out := []json.RawMessage{} + + for i := 0; i < val.Len(); i++ { + itemVal := val.Index(i) + + if isNil(itemVal.Type(), itemVal) { + out = append(out, []byte("null")) + continue + } + + r, err := marshalValue(itemVal.Interface(), tag) + if err != nil { + return nil, err + } + + out = append(out, r) + } + + return json.Marshal(out) + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + return []byte(fmt.Sprintf(`"%s"`, val.Interface().(time.Time).Format(time.RFC3339Nano))), nil + case reflect.TypeOf(big.Int{}): + format := tag.Get("bigint") + if format == "string" { + b := val.Interface().(big.Int) + return []byte(fmt.Sprintf(`"%s"`, (&b).String())), nil + } + case reflect.TypeOf(decimal.Big{}): + format := tag.Get("decimal") + if format == "number" { + b := val.Interface().(decimal.Big) + f, ok := (&b).Float64() + if ok { + return []byte(b.String()), nil + } + + return []byte(fmt.Sprintf(`%f`, f)), nil + } + } + } + + return json.Marshal(v) +} + +func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.StructTag) json.RawMessage { + if tagValue == "null" { + return []byte("null") + } + + typ := dereferenceTypePointer(reflect.TypeOf(val)) + switch typ { + case reflect.TypeOf(time.Time{}): + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + case reflect.TypeOf(big.Int{}): + bigIntTag := tag.Get("bigint") + if bigIntTag == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(int64(0)): + format := tag.Get("integer") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(float64(0)): + format := tag.Get("number") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(decimal.Big{}): + decimalTag := tag.Get("decimal") + if decimalTag != "number" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(types.Date{}): + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + default: + if typ.Kind() == reflect.String { + return []byte(fmt.Sprintf("%q", tagValue)) + } + } + + return []byte(tagValue) +} + +func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error { + if bytes.Equal(value, []byte("null")) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + typ := dereferenceTypePointer(v.Type()) + + switch typ.Kind() { + case reflect.Int64: + var b int64 + + format := tag.Get("integer") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseInt(s, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse string as int64: %w", err) + } + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } + case reflect.Float64: + var b float64 + + format := tag.Get("number") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseFloat(s, 64) + if err != nil { + return fmt.Errorf("failed to parse string as float64: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } + case reflect.Map: + if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + var unmarhsaled map[string]json.RawMessage + + if err := json.Unmarshal(value, &unmarhsaled); err != nil { + return err + } + + m := reflect.MakeMap(typ) + + for k, value := range unmarhsaled { + itemVal := reflect.New(typ.Elem()) + + if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + return err + } + + m.SetMapIndex(reflect.ValueOf(k), itemVal.Elem()) + } + + v.Set(m) + return nil + case reflect.Slice, reflect.Array: + var unmarshaled []json.RawMessage + + if err := json.Unmarshal(value, &unmarshaled); err != nil { + return err + } + + arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) + + for index, value := range unmarshaled { + itemVal := reflect.New(typ.Elem()) + + if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + return err + } + + arrVal.Index(index).Set(itemVal.Elem()) + } + + if v.Kind() == reflect.Pointer { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(arrVal) + return nil + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + t, err := time.Parse(time.RFC3339Nano, s) + if err != nil { + return fmt.Errorf("failed to parse string as time.Time: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(t)) + return nil + case reflect.TypeOf(big.Int{}): + var b *big.Int + + format := tag.Get("bigint") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var ok bool + b, ok = new(big.Int).SetString(s, 10) + if !ok { + return fmt.Errorf("failed to parse string as big.Int") + } + } else { + if err := json.Unmarshal(value, &b); err != nil { + return err + } + } + + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + case reflect.TypeOf(decimal.Big{}): + var d *decimal.Big + format := tag.Get("decimal") + if format == "number" { + var ok bool + d, ok = new(decimal.Big).SetString(string(value)) + if !ok { + return fmt.Errorf("failed to parse number as decimal.Big") + } + } else { + if err := json.Unmarshal(value, &d); err != nil { + return err + } + } + + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { + v = v.Elem() + } + + v.Set(reflect.ValueOf(d)) + return nil + case reflect.TypeOf(types.Date{}): + var s string + + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + d, err := types.DateFromString(s) + if err != nil { + return fmt.Errorf("failed to parse string as types.Date: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(d)) + return nil + } + } + + var val interface{} + + if v.CanAddr() { + val = v.Addr().Interface() + } else { + val = v.Interface() + } + + d := json.NewDecoder(bytes.NewReader(value)) + if disallowUnknownFields { + d.DisallowUnknownFields() + } + return d.Decode(val) +} + +func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) { + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return typ, val + } + + return dereferencePointers(typ, val) +} + +func dereferenceTypePointer(typ reflect.Type) reflect.Type { + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } else { + return typ + } + + return dereferenceTypePointer(typ) +} + +func isComplexValueType(typ reflect.Type) bool { + switch typ.Kind() { + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + fallthrough + case reflect.TypeOf(big.Int{}): + fallthrough + case reflect.TypeOf(decimal.Big{}): + fallthrough + case reflect.TypeOf(types.Date{}): + return true + } + } + + return false +} + +func isModelType(typ reflect.Type) bool { + if isComplexValueType(typ) { + return false + } + + if typ.Kind() == reflect.Struct { + return true + } + + return false +} diff --git a/tests/mockserver/internal/sdk/utils/reflect.go b/tests/mockserver/internal/sdk/utils/reflect.go new file mode 100644 index 00000000..255f3dd7 --- /dev/null +++ b/tests/mockserver/internal/sdk/utils/reflect.go @@ -0,0 +1,49 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package utils + +import ( + "reflect" +) + +func isNil(typ reflect.Type, val reflect.Value) bool { + // `reflect.TypeOf(nil) == nil` so calling typ.Kind() will cause a nil pointer + // dereference panic. Catch it and return early. + // https://github.com/golang/go/issues/51649 + // https://github.com/golang/go/issues/54208 + if typ == nil { + return true + } + + if typ.Kind() == reflect.Ptr || typ.Kind() == reflect.Map || typ.Kind() == reflect.Slice || typ.Kind() == reflect.Interface { + return val.IsNil() + } + + return false +} + +func isEmpty(typ reflect.Type, val reflect.Value) bool { + if typ == nil { + return true + } + + switch typ.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return val.Len() == 0 + } + + return false +} + +func trueReflectValue(val reflect.Value) reflect.Value { + kind := val.Type().Kind() + for kind == reflect.Interface || kind == reflect.Ptr { + innerVal := val.Elem() + if !innerVal.IsValid() { + break + } + val = innerVal + kind = val.Type().Kind() + } + return val +} diff --git a/tests/mockserver/internal/sdk/utils/sort.go b/tests/mockserver/internal/sdk/utils/sort.go new file mode 100644 index 00000000..6b265be7 --- /dev/null +++ b/tests/mockserver/internal/sdk/utils/sort.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package utils + +import ( + "regexp" + "sort" + "strings" +) + +// SortSerializedMaps will sort a given string, []string, or map[string]string +// such that all keys are ordered. This should only be used to simplify testing +// logic. +func SortSerializedMaps(input interface{}, regex string, delim string) interface{} { + sortString := func(input string) string { + r := regexp.MustCompile(regex) + + return replaceAllStringSubmatchFunc(r, input, func(matches []string) string { + result := matches[0] + + for i := 1; i < len(matches); i++ { + match := matches[i] + + pairs := []string{} + if strings.Contains(match, "=") { + pairs = strings.Split(match, delim) + + sort.SliceStable(pairs, func(i, j int) bool { + return strings.Split(pairs[i], "=")[0] < strings.Split(pairs[j], "=")[0] + }) + } else { + values := strings.Split(match, delim) + + if len(values) == 1 { + pairs = values + } else { + pairs = make([]string, len(values)/2) + for i := 0; i < len(values); i += 2 { + pairs[i/2] = values[i] + delim + values[i+1] + } + } + + sort.SliceStable(pairs, func(i, j int) bool { + return strings.Split(pairs[i], delim)[0] < strings.Split(pairs[j], delim)[0] + }) + } + + match = strings.Join(pairs, delim) + + result = strings.Replace(result, matches[i], match, 1) + } + + return result + }) + } + + switch input := input.(type) { + case string: + return sortString(input) + case []string: + for i, v := range input { + input[i] = sortString(v) + } + return input + case map[string]string: + for k, v := range input { + input[k] = sortString(v) + } + return input + default: + panic("unsupported type") + } +} + +func replaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func([]string) string) string { + result := "" + lastIndex := 0 + + for _, v := range re.FindAllSubmatchIndex([]byte(str), -1) { + groups := []string{} + for i := 0; i < len(v); i += 2 { + if v[i] == -1 || v[i+1] == -1 { + groups = append(groups, "") + } else { + groups = append(groups, str[v[i]:v[i+1]]) + } + } + + result += str[lastIndex:v[0]] + repl(groups) + lastIndex = v[1] + } + + return result + str[lastIndex:] +} diff --git a/tests/mockserver/internal/server/doc.go b/tests/mockserver/internal/server/doc.go new file mode 100644 index 00000000..666dc109 --- /dev/null +++ b/tests/mockserver/internal/server/doc.go @@ -0,0 +1,4 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +// Package server implements the HTTP server. +package server diff --git a/tests/mockserver/internal/server/generated_handlers.go b/tests/mockserver/internal/server/generated_handlers.go new file mode 100644 index 00000000..1ea16355 --- /dev/null +++ b/tests/mockserver/internal/server/generated_handlers.go @@ -0,0 +1,17 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package server + +import ( + "context" + + "mockserver/internal/handler" +) + +func (s *Server) registerGeneratedHandlers(ctx context.Context) { + s.logger.Debug("registering generated handlers") + + for _, h := range handler.GeneratedHandlers(ctx, s.httpFileDir, s.requestTracker) { + s.RegisterHandlerFunc(ctx, []string{h.Method}, h.Path, h.HandlerFunc()) + } +} diff --git a/tests/mockserver/internal/server/internal_handlers.go b/tests/mockserver/internal/server/internal_handlers.go new file mode 100644 index 00000000..1c248615 --- /dev/null +++ b/tests/mockserver/internal/server/internal_handlers.go @@ -0,0 +1,343 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package server + +import ( + "bytes" + "context" + "fmt" + "html/template" + "io" + "net/http" + "path/filepath" + "strings" +) + +const ( + // Mock server internal route prefix to prevent naming collisions. + internalPathPrefix = "/_mockserver" +) + +// registerInternalHandlers adds any internal handlers, such as healthcheck +// endpoints and fallback handling. +func (s *Server) registerInternalHandlers(ctx context.Context) { + s.logger.Debug("registering internal handlers") + + // Healthcheck endpoint + s.RegisterHandlerFunc(ctx, []string{http.MethodGet}, internalPathPrefix+"/health", healthcheckHandler) + + // HTTP log index endpoint + s.RegisterHandlerFunc(ctx, []string{http.MethodGet}, internalPathPrefix+"/log", s.httpFileIndexHandler) + + // HTTP log operation endpoint + s.RegisterHandlerFunc(ctx, []string{http.MethodGet}, internalPathPrefix+"/log/{operationId}", s.httpOperationHandler) + + // Default all other requests to 404 Not Found + s.RegisterHandlerFunc(ctx, []string{}, "/", rootHandler) +} + +// healthcheckHandler returns a simple OK response. +func healthcheckHandler(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusOK) + fmt.Fprintln(w, "OK") +} + +// httpFileIndexHandler returns a HTML index page for all logged HTTP operations +// written to the HTTP file directory. +func (s *Server) httpFileIndexHandler(w http.ResponseWriter, _ *http.Request) { + operations, err := s.httpFileDir.Operations() + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation log error: %s", err), + http.StatusInternalServerError, + ) + + return + } + + type operationModel struct { + CallCount int64 + ID string + LogURL string + Method string + Path string + } + + type indexModel struct { + Operations []operationModel + } + + var index indexModel + + for _, operation := range operations { + index.Operations = append(index.Operations, operationModel{ + CallCount: operation.CallCount(), + ID: operation.Id(), + LogURL: internalPathPrefix + "/log/" + operation.Id(), + Method: operation.Method(), + Path: operation.Path(), + }) + } + + tmpl := template.New("index.html.tmpl") + tmpl.Funcs(template.FuncMap{ + "mod": func(i, j int) bool { return i%j == 0 }, + }) + _, err = tmpl.ParseFiles( + filepath.Join("internal", "server", "templates", "log", "style.css.tmpl"), + filepath.Join("internal", "server", "templates", "log", "index.html.tmpl"), + ) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation log template error: %s", err), + http.StatusInternalServerError, + ) + + return + } + + var wBuf bytes.Buffer + + err = tmpl.Execute(&wBuf, index) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation log template execution error: %s", err), + http.StatusInternalServerError, + ) + + return + } + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.WriteHeader(http.StatusOK) + _, _ = wBuf.WriteTo(w) +} + +// httpOperationHandler returns a HTML page for HTTP request and response log files +// written to _debug. +func (s *Server) httpOperationHandler(w http.ResponseWriter, req *http.Request) { + operationId := req.PathValue("operationId") + + if operationId == "" { + http.Error(w, "operation logs not found", http.StatusNotFound) + + return + } + + operation, err := s.httpFileDir.Operation(operationId) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s log error: %s", operationId, err), + http.StatusInternalServerError, + ) + + return + } + + type headerModel struct { + Key string + Values template.HTML + } + + type queryParameterModel struct { + Key string + Values template.HTML + } + + type operationCallModel struct { + Call int64 + ID string + LogOperationURL string + + RawRequest template.HTML + RawResponse template.HTML + + RequestBody string + RequestHeaders []headerModel + RequestQueryParameters []queryParameterModel + + ResponseBody string + ResponseHeaders []headerModel + ResponseStatus string + } + + type operationDataModel struct { + Calls []operationCallModel + ID string + LogIndexURL string + RequestMethod string + RequestPath string + } + + operationData := operationDataModel{ + ID: operationId, + LogIndexURL: internalPathPrefix + "/log", + RequestMethod: operation.Method(), + RequestPath: operation.Path(), + } + + for i := range operation.CallCount() { + call := i + 1 + + callReqRaw, err := operation.RawRequest(call) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s call %d log raw request error: %s", operationId, call, err), + http.StatusInternalServerError, + ) + + return + } + + callReq, err := operation.Request(call) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s call %d log request error: %s", operationId, call, err), + http.StatusInternalServerError, + ) + + return + } + + callReqBody, err := io.ReadAll(callReq.Body) + defer callReq.Body.Close() + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s call %d log request body error: %s", operationId, call, err), + http.StatusInternalServerError, + ) + + return + } + + callRespRaw, err := operation.RawResponse(call) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s call %d log response error: %s", operationId, call, err), + http.StatusInternalServerError, + ) + + return + } + + callResp, err := operation.Response(call) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s call %d log response error: %s", operationId, call, err), + http.StatusInternalServerError, + ) + + return + } + + callRespBody, err := io.ReadAll(callResp.Body) + defer callReq.Body.Close() + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation %s call %d log response body error: %s", operationId, call, err), + http.StatusInternalServerError, + ) + + return + } + + operationCall := operationCallModel{ + Call: call, + LogOperationURL: internalPathPrefix + "/log/" + operationId, + + RawRequest: template.HTML(strings.ReplaceAll(string(callReqRaw), "\r\n", "
")), + RawResponse: template.HTML(strings.ReplaceAll(string(callRespRaw), "\r\n", "
")), + + RequestBody: string(callReqBody), + ResponseBody: string(callRespBody), + ResponseStatus: callResp.Status, + } + + for key, values := range callReq.URL.Query() { + operationCall.RequestQueryParameters = append(operationCall.RequestQueryParameters, queryParameterModel{ + Key: key, + Values: template.HTML(strings.Join(values, "
")), + }) + } + + for key, values := range callReq.Header { + operationCall.RequestHeaders = append(operationCall.RequestHeaders, headerModel{ + Key: key, + Values: template.HTML(strings.Join(values, "
")), + }) + } + + for key, values := range callResp.Header { + operationCall.ResponseHeaders = append(operationCall.ResponseHeaders, headerModel{ + Key: key, + Values: template.HTML(strings.Join(values, "
")), + }) + } + + operationData.Calls = append(operationData.Calls, operationCall) + } + + tmpl := template.New("operation.html.tmpl") + tmpl.Funcs(template.FuncMap{ + "mod": func(i, j int) bool { return i%j == 0 }, + }) + _, err = tmpl.ParseFiles( + filepath.Join("internal", "server", "templates", "log", "style.css.tmpl"), + filepath.Join("internal", "server", "templates", "log", "operation.html.tmpl"), + ) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation log template error: %s", err), + http.StatusInternalServerError, + ) + + return + } + + var wBuf bytes.Buffer + + err = tmpl.Execute(&wBuf, operationData) + + if err != nil { + http.Error( + w, + fmt.Sprintf("operation log template execution error: %s", err), + http.StatusInternalServerError, + ) + + return + } + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.WriteHeader(http.StatusOK) + _, _ = wBuf.WriteTo(w) +} + +// rootHandler returns a slightly customized [http.NotFoundHandler], saying +// "path" instead of "page". +func rootHandler(w http.ResponseWriter, _ *http.Request) { + http.Error(w, "path not found", http.StatusNotFound) +} diff --git a/tests/mockserver/internal/server/server.go b/tests/mockserver/internal/server/server.go new file mode 100644 index 00000000..12239611 --- /dev/null +++ b/tests/mockserver/internal/server/server.go @@ -0,0 +1,134 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package server + +import ( + "context" + "errors" + "fmt" + "log/slog" + "mockserver/internal/logging" + "mockserver/internal/tracking" + "net/http" + "strings" + "time" + + "github.com/gorilla/mux" +) + +const ( + // Default address for server listening. + DefaultAddress = ":18080" +) + +// Server implements the HTTP server. +type Server struct { + // Address for server listening. + address string + + // Directory for raw HTTP request and response files. + httpFileDir *logging.HTTPFileDirectory + + // Logger implementation. + logger *slog.Logger + + // Underlying mux implementation. + // Based on gorilla mux as the native mux suffered from issues with ambiguous paths and different http methods + // eg - panic: pattern "HEAD /v8/artifacts/{hash}" (registered at /usr/src/app/internal/server/server.go:104) conflicts with pattern "GET /v8/artifacts/status" (registered at /usr/src/app/internal/server/server.go:104): HEAD /v8/artifacts/{hash} matches fewer methods than GET /v8/artifacts/status, but has a more general path pattern + mux *mux.Router + + // Underlying server implementation. + server *http.Server + + requestTracker *tracking.RequestTracker +} + +// NewServer creates a new Server instance. +func NewServer(ctx context.Context, opts ...ServerOption) (*Server, error) { + // Initialize with defaults. + result := &Server{ + address: DefaultAddress, + logger: slog.Default(), + mux: mux.NewRouter(), + requestTracker: tracking.New(), + } + + // Customize based on ServerOption. + for _, opt := range opts { + err := opt(result) + + if err != nil { + return result, err + } + } + + result.server = &http.Server{ + Addr: result.address, + Handler: logging.HTTPLoggerHandler(result.logger, result.mux), + ErrorLog: slog.NewLogLogger(result.logger.Handler(), slog.LevelError), + } + + httpFileDir, err := logging.NewHTTPFileDirectory("") + + if err != nil { + return result, err + } + + err = httpFileDir.Clean() + + if err != nil { + return result, err + } + + result.httpFileDir = httpFileDir + + result.registerGeneratedHandlers(ctx) + result.registerInternalHandlers(ctx) + + return result, err +} + +// Address returns the server address including protocol, hostname, and port. +func (s *Server) Address() string { + return "http://localhost" + s.address +} + +// RegisterHandlerFunc adds a new HTTP handler function for the given methods and path. +func (s *Server) RegisterHandlerFunc(ctx context.Context, methods []string, path string, handlerFunc http.HandlerFunc) { + s.logger.DebugContext(ctx, fmt.Sprintf("registering handler for %s %s", strings.Join(methods, ", "), path)) + + r := s.mux.HandleFunc(path, handlerFunc) + if len(methods) > 0 { + r.Methods(methods...) + } +} + +// Serve starts the server. +func (s *Server) Serve(ctx context.Context) error { + s.logger.InfoContext(ctx, "starting server with address "+s.server.Addr) + + err := s.server.ListenAndServe() + + if errors.Is(err, http.ErrServerClosed) { + return nil + } + + return fmt.Errorf("error running server: %w", err) +} + +// Shutdown gracefully stops the server. +func (s *Server) Shutdown(ctx context.Context) error { + s.logger.WarnContext(ctx, "shutting down server") + s.server.SetKeepAlivesEnabled(false) + + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + + err := s.server.Shutdown(ctx) + + if err != nil { + return fmt.Errorf("error shutting down server: %w", err) + } + + return nil +} diff --git a/tests/mockserver/internal/server/server_option.go b/tests/mockserver/internal/server/server_option.go new file mode 100644 index 00000000..ff85a678 --- /dev/null +++ b/tests/mockserver/internal/server/server_option.go @@ -0,0 +1,30 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package server + +import ( + "log/slog" +) + +// ServerOption is a function which modifies the Server. +type ServerOption func(*Server) error + +// WithAddress sets the listening address for a Server. By default, the server +// address is :18080. +func WithAddress(address string) ServerOption { + return func(s *Server) error { + s.address = address + + return nil + } +} + +// WithLogger sets the logger implementation for a Server. By default, the +// server logger is [slog.Default]. +func WithLogger(logger *slog.Logger) ServerOption { + return func(s *Server) error { + s.logger = logger + + return nil + } +} diff --git a/tests/mockserver/internal/server/templates/log/index.html.tmpl b/tests/mockserver/internal/server/templates/log/index.html.tmpl new file mode 100644 index 00000000..8b1124e5 --- /dev/null +++ b/tests/mockserver/internal/server/templates/log/index.html.tmpl @@ -0,0 +1,22 @@ + + + Operation Logs + + + +

// Speakeasy

+

Operation Logs

+ + + {{ range $idx, $o := .Operations }} + + + + + + {{ end }} +
OperationRequestCalls
{{ .ID }}{{ .Method }} {{ .Path }}{{ .CallCount }}
+ + diff --git a/tests/mockserver/internal/server/templates/log/operation.html.tmpl b/tests/mockserver/internal/server/templates/log/operation.html.tmpl new file mode 100644 index 00000000..a54a2adc --- /dev/null +++ b/tests/mockserver/internal/server/templates/log/operation.html.tmpl @@ -0,0 +1,93 @@ + + + Operation Logs: {{ .ID }} + + + +

// Speakeasy

+

Operation Logs: {{ .ID }}

+

{{ .RequestMethod }} {{ .RequestPath }}

+

Back to All Operation Logs

+
+ {{ range $idx, $c := .Calls }} +
+ {{ if (ne (len $.Calls) 1) }} +

Call {{ .Call }}

+ {{ end }} +
+

Request

+ + {{ if (gt (len .RequestQueryParameters) 0) }} +
+

Query Parameters

+ + + {{ range $idx, $p := .RequestQueryParameters }} + + + + + {{ end }} +
KeyValue
{{ .Key }}{{ .Values }}
+
+ {{ end }} +
+

Headers

+ + + {{ range $idx, $h := .RequestHeaders }} + + + + + {{ end }} +
KeyValue(s)
{{ .Key }}{{ .Values }}
+
+ {{ if (gt (len .RequestBody) 0) }} +
+

Body

+

{{ .RequestBody }}

+
+ {{ end }} +

+

+ Raw Request +
{{ .RawRequest }}
+
+

+
+
+

Response

+

{{ .ResponseStatus }}

+
+

Headers

+ + + {{ range $idx, $h := .ResponseHeaders }} + + + + + {{ end }} +
KeyValue(s)
{{ .Key }}{{ .Values }}
+
+ {{ if (gt (len .ResponseBody) 0) }} +
+

Body

+

{{ .ResponseBody }}

+
+ {{ end }} +

+

+ Raw Response +
{{ .RawResponse }}
+
+

+
+
+ {{ end }} +
+ + diff --git a/tests/mockserver/internal/server/templates/log/style.css.tmpl b/tests/mockserver/internal/server/templates/log/style.css.tmpl new file mode 100644 index 00000000..5490930e --- /dev/null +++ b/tests/mockserver/internal/server/templates/log/style.css.tmpl @@ -0,0 +1,64 @@ +{{ define "style" }} +a { + color: rgba(251, 227, 50, 1.0); +} +body { + background: black; + font-family: Arial, Helvetica, sans-serif; +} +code { + color: white; +} +details > div { + border-left: 1px solid gray; + margin-left: 10px; + padding: 10px; +} +div { + width: fit-content; +} +div.operation-call.odd { + background-color: rgba(251, 227, 50, 0.1); +} +h1 { + color: hsl(53, 96%, 59%); +} +h2 { + color: rgba(255, 255, 255, 1.0); +} +h3 { + color: rgba(255, 255, 255, 0.75); +} +h4 { + color: rgba(255, 255, 255, 0.50); +} +p { + color: white; + padding-left: 10px; +} +summary { + color: gray; + font-weight: bold; + margin-bottom: 5px; +} +table { + border-collapse: collapse; + margin: 5px; +} +th { + border-bottom: 1px solid gray; + color: white; + padding: 10px; + text-align: left; +} +td { + color: white; + padding: 10px; +} +tr.even { + background-color: rgba(255, 255, 255, 0.0); +} +tr.odd { + background-color: rgba(255, 255, 255, 0.1); +} +{{ end }} diff --git a/tests/mockserver/internal/tracking/requesttracker.go b/tests/mockserver/internal/tracking/requesttracker.go new file mode 100644 index 00000000..1d9131d0 --- /dev/null +++ b/tests/mockserver/internal/tracking/requesttracker.go @@ -0,0 +1,47 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package tracking + +import ( + "fmt" + "time" + + cache "github.com/go-pkgz/expirable-cache/v3" +) + +type RequestTracker struct { + cache cache.Cache[string, *testEntry] +} + +type testEntry struct { + name string + id string + count int + created time.Time +} + +func New() *RequestTracker { + return &RequestTracker{ + cache: cache.NewCache[string, *testEntry]().WithTTL(5 * time.Minute), + } +} + +func (t *RequestTracker) GetRequestCount(testName, instanceID string) int { + key := fmt.Sprintf("%s-%s", testName, instanceID) + + entry, ok := t.cache.Get(key) + if !ok { + entry = &testEntry{ + name: testName, + id: instanceID, + count: 0, + created: time.Now(), + } + } + + count := entry.count + entry.count++ + t.cache.Set(key, entry, 0) + + return count +} diff --git a/tests/mockserver/main.go b/tests/mockserver/main.go new file mode 100644 index 00000000..2270443b --- /dev/null +++ b/tests/mockserver/main.go @@ -0,0 +1,74 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package main + +import ( + "context" + "flag" + "fmt" + "os" + "os/signal" + "strings" + + "mockserver/internal/logging" + "mockserver/internal/server" +) + +func main() { + ctx := context.Background() + + address := flag.String("address", server.DefaultAddress, fmt.Sprintf("server listen address (default: %s)", server.DefaultAddress)) + logFormat := flag.String("log-format", logging.DefaultFormat, fmt.Sprintf("logging format (default: %s, supported: %s)", logging.DefaultFormat, strings.Join(logging.Formats(), ", "))) + logLevel := flag.String("log-level", logging.DefaultLevel, fmt.Sprintf("logging level (default: %s, supported: %s)", logging.DefaultLevel, strings.Join(logging.Levels(), ", "))) + + flag.Parse() + + logger, err := logging.NewLogger(os.Stdout, *logFormat, *logLevel) + + if err != nil { + fmt.Fprintf(os.Stderr, "error setting up logging: %s", err) + os.Exit(1) + } + + serverOpts := []server.ServerOption{ + server.WithAddress(*address), + server.WithLogger(logger), + } + + s, err := server.NewServer(ctx, serverOpts...) + + if err != nil { + logger.ErrorContext(ctx, err.Error()) + os.Exit(1) + } + + finishedShutdown := make(chan struct{}) + startShutdown := make(chan os.Signal, 1) + signal.Notify(startShutdown, os.Interrupt) + + go func() { + <-startShutdown + + logger.WarnContext(ctx, "server received interrupt") + + err := s.Shutdown(ctx) + + if err != nil { + logger.Error(err.Error()) + os.Exit(1) + } + + close(finishedShutdown) + }() + + err = s.Serve(ctx) + + if err != nil { + logger.ErrorContext(ctx, err.Error()) + os.Exit(1) + } + + <-finishedShutdown + + logger.InfoContext(ctx, "server stopped") +} diff --git a/upstreams.go b/upstreams.go index 660ff3bf..d47a5eba 100644 --- a/upstreams.go +++ b/upstreams.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -20,12 +21,16 @@ import ( // An upstream also includes a [health checker](https://docs.konghq.com/gateway/latest/how-kong-works/health-checks/), which can enable and disable targets based on their ability or inability to serve requests. // The configuration for the health checker is stored in the upstream object, and applies to all of its targets. type Upstreams struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newUpstreams(sdkConfig sdkConfiguration) *Upstreams { +func newUpstreams(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Upstreams { return &Upstreams{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -56,11 +61,13 @@ func (s *Upstreams) ListUpstream(ctx context.Context, request operations.ListUps } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -113,15 +120,17 @@ func (s *Upstreams) ListUpstream(ctx context.Context, request operations.ListUps "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -138,7 +147,7 @@ func (s *Upstreams) ListUpstream(ctx context.Context, request operations.ListUps err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -146,13 +155,13 @@ func (s *Upstreams) ListUpstream(ctx context.Context, request operations.ListUps if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -165,17 +174,17 @@ func (s *Upstreams) ListUpstream(ctx context.Context, request operations.ListUps err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -287,11 +296,13 @@ func (s *Upstreams) CreateUpstream(ctx context.Context, controlPlaneID string, u } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Upstream", "json", `request:"mediaType=application/json"`) if err != nil { @@ -347,15 +358,17 @@ func (s *Upstreams) CreateUpstream(ctx context.Context, controlPlaneID string, u "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -372,7 +385,7 @@ func (s *Upstreams) CreateUpstream(ctx context.Context, controlPlaneID string, u err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -380,13 +393,13 @@ func (s *Upstreams) CreateUpstream(ctx context.Context, controlPlaneID string, u if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -399,17 +412,17 @@ func (s *Upstreams) CreateUpstream(ctx context.Context, controlPlaneID string, u err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -521,11 +534,13 @@ func (s *Upstreams) DeleteUpstream(ctx context.Context, controlPlaneID string, u } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -574,15 +589,17 @@ func (s *Upstreams) DeleteUpstream(ctx context.Context, controlPlaneID string, u "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -599,7 +616,7 @@ func (s *Upstreams) DeleteUpstream(ctx context.Context, controlPlaneID string, u err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -607,13 +624,13 @@ func (s *Upstreams) DeleteUpstream(ctx context.Context, controlPlaneID string, u if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -626,17 +643,17 @@ func (s *Upstreams) DeleteUpstream(ctx context.Context, controlPlaneID string, u err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -728,11 +745,13 @@ func (s *Upstreams) GetUpstream(ctx context.Context, upstreamID string, controlP } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -781,15 +800,17 @@ func (s *Upstreams) GetUpstream(ctx context.Context, upstreamID string, controlP "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -806,7 +827,7 @@ func (s *Upstreams) GetUpstream(ctx context.Context, upstreamID string, controlP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -814,13 +835,13 @@ func (s *Upstreams) GetUpstream(ctx context.Context, upstreamID string, controlP if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -833,17 +854,17 @@ func (s *Upstreams) GetUpstream(ctx context.Context, upstreamID string, controlP err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -952,11 +973,13 @@ func (s *Upstreams) UpsertUpstream(ctx context.Context, request operations.Upser } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-upstream", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-upstream", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Upstream", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1012,15 +1035,17 @@ func (s *Upstreams) UpsertUpstream(ctx context.Context, request operations.Upser "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1037,7 +1062,7 @@ func (s *Upstreams) UpsertUpstream(ctx context.Context, request operations.Upser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1045,13 +1070,13 @@ func (s *Upstreams) UpsertUpstream(ctx context.Context, request operations.Upser if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1064,17 +1089,17 @@ func (s *Upstreams) UpsertUpstream(ctx context.Context, request operations.Upser err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/users.go b/users.go index ba00d0f0..7af0513a 100644 --- a/users.go +++ b/users.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -17,12 +18,16 @@ import ( ) type Users struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newUsers(sdkConfig sdkConfiguration) *Users { +func newUsers(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Users { return &Users{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -52,11 +57,13 @@ func (s *Users) ListUsers(ctx context.Context, request operations.ListUsersReque } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-users", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-users", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -109,15 +116,17 @@ func (s *Users) ListUsers(ctx context.Context, request operations.ListUsersReque "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -134,7 +143,7 @@ func (s *Users) ListUsers(ctx context.Context, request operations.ListUsersReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -142,13 +151,13 @@ func (s *Users) ListUsers(ctx context.Context, request operations.ListUsersReque if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -161,17 +170,17 @@ func (s *Users) ListUsers(ctx context.Context, request operations.ListUsersReque err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -281,11 +290,13 @@ func (s *Users) GetUser(ctx context.Context, userID string, opts ...operations.O } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-user", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-user", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -334,15 +345,17 @@ func (s *Users) GetUser(ctx context.Context, userID string, opts ...operations.O "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -359,7 +372,7 @@ func (s *Users) GetUser(ctx context.Context, userID string, opts ...operations.O err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -367,13 +380,13 @@ func (s *Users) GetUser(ctx context.Context, userID string, opts ...operations.O if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -386,17 +399,17 @@ func (s *Users) GetUser(ctx context.Context, userID string, opts ...operations.O err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -528,11 +541,13 @@ func (s *Users) UpdateUser(ctx context.Context, userID string, updateUser *compo } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "update-user", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "update-user", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateUser", "json", `request:"mediaType=application/json"`) if err != nil { @@ -588,15 +603,17 @@ func (s *Users) UpdateUser(ctx context.Context, userID string, updateUser *compo "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -613,7 +630,7 @@ func (s *Users) UpdateUser(ctx context.Context, userID string, updateUser *compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -621,13 +638,13 @@ func (s *Users) UpdateUser(ctx context.Context, userID string, updateUser *compo if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -640,17 +657,17 @@ func (s *Users) UpdateUser(ctx context.Context, userID string, updateUser *compo err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -802,11 +819,13 @@ func (s *Users) DeleteUser(ctx context.Context, userID string, opts ...operation } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-user", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-user", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -855,15 +874,17 @@ func (s *Users) DeleteUser(ctx context.Context, userID string, opts ...operation "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -880,7 +901,7 @@ func (s *Users) DeleteUser(ctx context.Context, userID string, opts ...operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -888,13 +909,13 @@ func (s *Users) DeleteUser(ctx context.Context, userID string, opts ...operation if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -907,17 +928,17 @@ func (s *Users) DeleteUser(ctx context.Context, userID string, opts ...operation err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } diff --git a/vaults.go b/vaults.go index cecc2a9d..6b064739 100644 --- a/vaults.go +++ b/vaults.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "fmt" + "github.com/Kong/sdk-konnect-go/internal/config" "github.com/Kong/sdk-konnect-go/internal/hooks" "github.com/Kong/sdk-konnect-go/internal/utils" "github.com/Kong/sdk-konnect-go/models/components" @@ -23,12 +24,16 @@ import ( //

// Secrets rotation can be managed using [TTLs](https://docs.konghq.com/gateway/latest/kong-enterprise/secrets-management/advanced-usage/). type Vaults struct { - sdkConfiguration sdkConfiguration + rootSDK *SDK + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks } -func newVaults(sdkConfig sdkConfiguration) *Vaults { +func newVaults(rootSDK *SDK, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Vaults { return &Vaults{ + rootSDK: rootSDK, sdkConfiguration: sdkConfig, + hooks: hooks, } } @@ -59,11 +64,13 @@ func (s *Vaults) ListVault(ctx context.Context, request operations.ListVaultRequ } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "list-vault", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "list-vault", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -116,15 +123,17 @@ func (s *Vaults) ListVault(ctx context.Context, request operations.ListVaultRequ "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -141,7 +150,7 @@ func (s *Vaults) ListVault(ctx context.Context, request operations.ListVaultRequ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -149,13 +158,13 @@ func (s *Vaults) ListVault(ctx context.Context, request operations.ListVaultRequ if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -168,17 +177,17 @@ func (s *Vaults) ListVault(ctx context.Context, request operations.ListVaultRequ err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -290,11 +299,13 @@ func (s *Vaults) CreateVault(ctx context.Context, controlPlaneID string, vault c } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "create-vault", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "create-vault", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Vault", "json", `request:"mediaType=application/json"`) if err != nil { @@ -350,15 +361,17 @@ func (s *Vaults) CreateVault(ctx context.Context, controlPlaneID string, vault c "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -375,7 +388,7 @@ func (s *Vaults) CreateVault(ctx context.Context, controlPlaneID string, vault c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -383,13 +396,13 @@ func (s *Vaults) CreateVault(ctx context.Context, controlPlaneID string, vault c if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -402,17 +415,17 @@ func (s *Vaults) CreateVault(ctx context.Context, controlPlaneID string, vault c err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -524,11 +537,13 @@ func (s *Vaults) DeleteVault(ctx context.Context, controlPlaneID string, vaultID } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "delete-vault", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "delete-vault", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -577,15 +592,17 @@ func (s *Vaults) DeleteVault(ctx context.Context, controlPlaneID string, vaultID "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -602,7 +619,7 @@ func (s *Vaults) DeleteVault(ctx context.Context, controlPlaneID string, vaultID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -610,13 +627,13 @@ func (s *Vaults) DeleteVault(ctx context.Context, controlPlaneID string, vaultID if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -629,17 +646,17 @@ func (s *Vaults) DeleteVault(ctx context.Context, controlPlaneID string, vaultID err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -731,11 +748,13 @@ func (s *Vaults) GetVault(ctx context.Context, vaultID string, controlPlaneID st } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "get-vault", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "get-vault", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } timeout := o.Timeout @@ -784,15 +803,17 @@ func (s *Vaults) GetVault(ctx context.Context, vaultID string, controlPlaneID st "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -809,7 +830,7 @@ func (s *Vaults) GetVault(ctx context.Context, vaultID string, controlPlaneID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -817,13 +838,13 @@ func (s *Vaults) GetVault(ctx context.Context, vaultID string, controlPlaneID st if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -836,17 +857,17 @@ func (s *Vaults) GetVault(ctx context.Context, vaultID string, controlPlaneID st err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } @@ -955,11 +976,13 @@ func (s *Vaults) UpsertVault(ctx context.Context, request operations.UpsertVault } hookCtx := hooks.HookContext{ - BaseURL: baseURL, - Context: ctx, - OperationID: "upsert-vault", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "upsert-vault", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, } bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Vault", "json", `request:"mediaType=application/json"`) if err != nil { @@ -1015,15 +1038,17 @@ func (s *Vaults) UpsertVault(ctx context.Context, request operations.UpsertVault "504", }, }, func() (*http.Response, error) { - if req.Body != nil { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != 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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { return nil, err @@ -1040,7 +1065,7 @@ func (s *Vaults) UpsertVault(ctx context.Context, request operations.UpsertVault err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } return httpRes, err }) @@ -1048,13 +1073,13 @@ func (s *Vaults) UpsertVault(ctx context.Context, request operations.UpsertVault if err != nil { return nil, err } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + httpRes, err = s.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) + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } @@ -1067,17 +1092,17 @@ func (s *Vaults) UpsertVault(ctx context.Context, request operations.UpsertVault err = fmt.Errorf("error sending request: no response") } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + _, err = s.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) + _httpRes, err := s.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) + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err }