From cc3b089ae17ada1894ba90e6467a09c06c9d348e Mon Sep 17 00:00:00 2001 From: kong-apiops <122612077+kong-apiops@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:54:31 +0000 Subject: [PATCH] feat(sdk): automated oas update (#23) * feat(sdk): automated oas update * Bump .speakeasy/gen.yaml based on label * Update provider based on openapi.yaml changes --------- Co-authored-by: pmalek Co-authored-by: team-k8s-bot --- .speakeasy/gen.lock | 119 +++++- .speakeasy/gen.yaml | 2 +- acls.go | 215 +++++++++++ apikeys.go | 215 +++++++++++ basicauthcredentials.go | 215 +++++++++++ consumergroups.go | 348 ++++++++++++++++++ controlplanegroups.go | 4 +- docs/models/components/getgroupstatus.md | 10 + docs/models/components/vault.md | 2 +- docs/models/components/vaultinput.md | 2 +- docs/models/operations/getaclrequest.md | 9 + docs/models/operations/getaclresponse.md | 11 + docs/models/operations/getbasicauthrequest.md | 9 + .../models/operations/getbasicauthresponse.md | 11 + .../getcontrolplanesidgroupstatusresponse.md | 12 +- docs/models/operations/gethmacauthrequest.md | 9 + docs/models/operations/gethmacauthresponse.md | 11 + docs/models/operations/getjwtrequest.md | 9 + docs/models/operations/getjwtresponse.md | 11 + docs/models/operations/getkeyauthrequest.md | 9 + docs/models/operations/getkeyauthresponse.md | 11 + docs/models/operations/getmtlsauthrequest.md | 9 + docs/models/operations/getmtlsauthresponse.md | 11 + ...oveallconsumersfromconsumergrouprequest.md | 9 + ...veallconsumersfromconsumergroupresponse.md | 10 + ...oveconsumerfromallconsumergroupsrequest.md | 9 + ...veconsumerfromallconsumergroupsresponse.md | 10 + hmacauthcredentials.go | 215 +++++++++++ internal/utils/env.go | 16 + jwts.go | 215 +++++++++++ models/components/getgroupstatus.go | 16 + models/components/vault.go | 4 +- models/components/vaultinput.go | 4 +- models/operations/getacl.go | 68 ++++ models/operations/getbasicauth.go | 68 ++++ .../getcontrolplanesidgroupstatus.go | 6 +- models/operations/gethmacauth.go | 68 ++++ models/operations/getjwt.go | 68 ++++ models/operations/getkeyauth.go | 68 ++++ models/operations/getmtlsauth.go | 68 ++++ .../removeallconsumersfromconsumergroup.go | 57 +++ .../removeconsumerfromallconsumergroups.go | 58 +++ mtlsauthcredentials.go | 215 +++++++++++ openapi.yaml | 161 +++++++- sdk.go | 6 +- 45 files changed, 2653 insertions(+), 30 deletions(-) create mode 100644 docs/models/components/getgroupstatus.md create mode 100644 docs/models/operations/getaclrequest.md create mode 100644 docs/models/operations/getaclresponse.md create mode 100644 docs/models/operations/getbasicauthrequest.md create mode 100644 docs/models/operations/getbasicauthresponse.md create mode 100644 docs/models/operations/gethmacauthrequest.md create mode 100644 docs/models/operations/gethmacauthresponse.md create mode 100644 docs/models/operations/getjwtrequest.md create mode 100644 docs/models/operations/getjwtresponse.md create mode 100644 docs/models/operations/getkeyauthrequest.md create mode 100644 docs/models/operations/getkeyauthresponse.md create mode 100644 docs/models/operations/getmtlsauthrequest.md create mode 100644 docs/models/operations/getmtlsauthresponse.md create mode 100644 docs/models/operations/removeallconsumersfromconsumergrouprequest.md create mode 100644 docs/models/operations/removeallconsumersfromconsumergroupresponse.md create mode 100644 docs/models/operations/removeconsumerfromallconsumergroupsrequest.md create mode 100644 docs/models/operations/removeconsumerfromallconsumergroupsresponse.md create mode 100644 internal/utils/env.go create mode 100644 models/components/getgroupstatus.go create mode 100644 models/operations/getacl.go create mode 100644 models/operations/getbasicauth.go create mode 100644 models/operations/gethmacauth.go create mode 100644 models/operations/getjwt.go create mode 100644 models/operations/getkeyauth.go create mode 100644 models/operations/getmtlsauth.go create mode 100644 models/operations/removeallconsumersfromconsumergroup.go create mode 100644 models/operations/removeconsumerfromallconsumergroups.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 95b98db..1ef3bd5 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,17 +1,17 @@ lockVersion: 2.0.0 id: b81e5def-5b1e-4753-ae7c-0efccc2e6f61 management: - docChecksum: 621f79fe092199d80a95ca5aa0238ebc + docChecksum: 63fbac813a0aa3fa24ffb199de5fa858 docVersion: 0.0.1 - speakeasyVersion: 1.444.4 - generationVersion: 2.461.4 - releaseVersion: 0.1.8 - configChecksum: df33a88d43c66b96ed2dbd72421eaee2 + speakeasyVersion: 1.446.1 + generationVersion: 2.462.1 + releaseVersion: 0.1.9 + configChecksum: ea4943250fc3728ab6d9fca49f8d3212 features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.6 - core: 3.5.16 + core: 3.5.17 deepObjectParams: 0.1.0 defaultEnabledRetries: 0.2.0 envVarSecurityUsage: 0.3.2 @@ -27,7 +27,6 @@ features: responseFormat: 0.1.2 retries: 2.83.1 sdkHooks: 0.1.0 - tests: 0.6.0 unions: 2.85.10 generatedFiles: - .gitattributes @@ -62,6 +61,7 @@ generatedFiles: - /models/components/dataplaneclientcertificate.go - /models/components/dataplaneclientcertificaterequest.go - /models/components/getexpectedconfighashresponse.go + - /models/components/getgroupstatus.go - /models/components/getimpersonationsettingsresponse.go - /models/components/getnode.go - /models/components/groupconflict.go @@ -216,8 +216,10 @@ generatedFiles: - /models/operations/deleteuser.go - /models/operations/deletevault.go - /models/operations/fetchpluginschema.go + - /models/operations/getacl.go - /models/operations/getaclwithconsumer.go - /models/operations/getauthenticationsettings.go + - /models/operations/getbasicauth.go - /models/operations/getbasicauthwithconsumer.go - /models/operations/getcacertificate.go - /models/operations/getcertificate.go @@ -229,15 +231,19 @@ generatedFiles: - /models/operations/getcontrolplanesidgroupstatus.go - /models/operations/getdataplanecertificate.go - /models/operations/getexpectedconfighash.go + - /models/operations/gethmacauth.go - /models/operations/gethmacauthwithconsumer.go - /models/operations/getidpconfiguration.go - /models/operations/getidpteammappings.go - /models/operations/getimpersonationsettings.go + - /models/operations/getjwt.go - /models/operations/getjwtwithconsumer.go - /models/operations/getkey.go + - /models/operations/getkeyauth.go - /models/operations/getkeyauthwithconsumer.go - /models/operations/getkeyset.go - /models/operations/getkeywithkeyset.go + - /models/operations/getmtlsauth.go - /models/operations/getmtlsauthwithconsumer.go - /models/operations/getnodeseol.go - /models/operations/getnodesnodeid.go @@ -323,6 +329,8 @@ generatedFiles: - /models/operations/postsystemaccountsidaccesstokens.go - /models/operations/postteamsteamidsystemaccounts.go - /models/operations/putcontrolplanesidgroupmemberships.go + - /models/operations/removeallconsumersfromconsumergroup.go + - /models/operations/removeconsumerfromallconsumergroups.go - /models/operations/removeconsumerfromconsumergroup.go - /models/operations/removeconsumerfromgroup.go - /models/operations/removeuserfromteam.go @@ -450,6 +458,7 @@ generatedFiles: - docs/models/components/entitytypename.md - docs/models/components/gatewayserviceadmin.md - docs/models/components/getexpectedconfighashresponse.md + - docs/models/components/getgroupstatus.md - docs/models/components/getimpersonationsettingsresponse.md - docs/models/components/getnode.md - docs/models/components/getnodecompatibilitystatus.md @@ -835,9 +844,13 @@ generatedFiles: - docs/models/operations/fetchpluginschemaresponse.md - docs/models/operations/fetchpluginschemaresponsebody.md - docs/models/operations/filter.md + - docs/models/operations/getaclrequest.md + - docs/models/operations/getaclresponse.md - docs/models/operations/getaclwithconsumerrequest.md - docs/models/operations/getaclwithconsumerresponse.md - docs/models/operations/getauthenticationsettingsresponse.md + - docs/models/operations/getbasicauthrequest.md + - docs/models/operations/getbasicauthresponse.md - docs/models/operations/getbasicauthwithconsumerrequest.md - docs/models/operations/getbasicauthwithconsumerresponse.md - docs/models/operations/getcacertificaterequest.md @@ -860,14 +873,20 @@ generatedFiles: - docs/models/operations/getdataplanecertificateresponse.md - docs/models/operations/getexpectedconfighashrequest.md - docs/models/operations/getexpectedconfighashresponse.md + - docs/models/operations/gethmacauthrequest.md + - docs/models/operations/gethmacauthresponse.md - docs/models/operations/gethmacauthwithconsumerrequest.md - docs/models/operations/gethmacauthwithconsumerresponse.md - docs/models/operations/getidpconfigurationresponse.md - docs/models/operations/getidpteammappingsrequest.md - docs/models/operations/getidpteammappingsresponse.md - docs/models/operations/getimpersonationsettingsresponse.md + - docs/models/operations/getjwtrequest.md + - docs/models/operations/getjwtresponse.md - docs/models/operations/getjwtwithconsumerrequest.md - docs/models/operations/getjwtwithconsumerresponse.md + - docs/models/operations/getkeyauthrequest.md + - docs/models/operations/getkeyauthresponse.md - docs/models/operations/getkeyauthwithconsumerrequest.md - docs/models/operations/getkeyauthwithconsumerresponse.md - docs/models/operations/getkeyrequest.md @@ -876,6 +895,8 @@ generatedFiles: - docs/models/operations/getkeysetresponse.md - docs/models/operations/getkeywithkeysetrequest.md - docs/models/operations/getkeywithkeysetresponse.md + - docs/models/operations/getmtlsauthrequest.md + - docs/models/operations/getmtlsauthresponse.md - docs/models/operations/getmtlsauthwithconsumerrequest.md - docs/models/operations/getmtlsauthwithconsumerresponse.md - docs/models/operations/getnodeseolrequest.md @@ -1084,6 +1105,10 @@ generatedFiles: - docs/models/operations/putcontrolplanesidgroupmembershipsrequest.md - docs/models/operations/putcontrolplanesidgroupmembershipsresponse.md - docs/models/operations/queryparamfilter.md + - docs/models/operations/removeallconsumersfromconsumergrouprequest.md + - docs/models/operations/removeallconsumersfromconsumergroupresponse.md + - docs/models/operations/removeconsumerfromallconsumergroupsrequest.md + - docs/models/operations/removeconsumerfromallconsumergroupsresponse.md - docs/models/operations/removeconsumerfromconsumergrouprequest.md - docs/models/operations/removeconsumerfromconsumergroupresponse.md - docs/models/operations/removeconsumerfromgrouprequest.md @@ -1181,6 +1206,7 @@ generatedFiles: - impersonationsettings.go - internal/hooks/hooks.go - internal/utils/contenttype.go + - internal/utils/env.go - internal/utils/form.go - internal/utils/headers.go - internal/utils/json.go @@ -3940,3 +3966,82 @@ 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": 846487} + 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": 812094} + 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": 109949} + remove-all-consumers-from-consumer-group: + speakeasy-default-remove-all-consumers-from-consumer-group: + parameters: + path: + ConsumerGroupId: "" + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + remove-consumer-from-all-consumer-groups: + "": + parameters: + path: + controlPlaneId: "9524ec7d-36d9-465d-a8c5-83a3c9390458" + ConsumerId: "123e4567-e89b-12d3-a456-426614174000" + 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": 9615} + 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": 7837} + 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": 808504} + 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": 955072} +generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 8fa0711..2175c3b 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: false oAuth2PasswordEnabled: false go: - version: 0.1.8 + version: 0.1.9 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/acls.go b/acls.go index 97b4d21..3cb58d6 100644 --- a/acls.go +++ b/acls.go @@ -237,6 +237,221 @@ func (s *ACLs) ListACL(ctx context.Context, request operations.ListACLRequest, o } +// GetACL - Fetch an ACL +// Get an ACL using ID. +func (s *ACLs) GetACL(ctx context.Context, aclID string, controlPlaneID string, opts ...operations.Option) (*operations.GetACLResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-acl", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetACLRequest{ + ACLID: aclID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/acls/{ACLId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetACLResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.ACL + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ACL = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GatewayUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + // ListACLWithConsumer - List all ACLs associated with a Consumer // List all ACLs associated with a Consumer func (s *ACLs) ListACLWithConsumer(ctx context.Context, request operations.ListACLWithConsumerRequest, opts ...operations.Option) (*operations.ListACLWithConsumerResponse, error) { diff --git a/apikeys.go b/apikeys.go index 20868f1..0d0d742 100644 --- a/apikeys.go +++ b/apikeys.go @@ -1169,3 +1169,218 @@ func (s *APIKeys) ListKeyAuth(ctx context.Context, request operations.ListKeyAut return res, nil } + +// GetKeyAuth - Fetch an API-key +// Get an API-key using ID. +func (s *APIKeys) GetKeyAuth(ctx context.Context, keyAuthID string, controlPlaneID string, opts ...operations.Option) (*operations.GetKeyAuthResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-key-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetKeyAuthRequest{ + KeyAuthID: keyAuthID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/key-auths/{KeyAuthId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetKeyAuthResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.KeyAuth + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.KeyAuth = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GatewayUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/basicauthcredentials.go b/basicauthcredentials.go index 8491ad4..0433eb0 100644 --- a/basicauthcredentials.go +++ b/basicauthcredentials.go @@ -237,6 +237,221 @@ func (s *BasicAuthCredentials) ListBasicAuth(ctx context.Context, request operat } +// GetBasicAuth - Fetch a Basic-auth credential +// Get a Basic-auth credential using ID. +func (s *BasicAuthCredentials) GetBasicAuth(ctx context.Context, basicAuthID string, controlPlaneID string, opts ...operations.Option) (*operations.GetBasicAuthResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-basic-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetBasicAuthRequest{ + BasicAuthID: basicAuthID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/basic-auths/{BasicAuthId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetBasicAuthResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.BasicAuth + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.BasicAuth = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GatewayUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + // ListBasicAuthWithConsumer - List all Basic-auth credentials associated with a Consumer // List all Basic-auth credentials associated with a Consumer func (s *BasicAuthCredentials) ListBasicAuthWithConsumer(ctx context.Context, request operations.ListBasicAuthWithConsumerRequest, opts ...operations.Option) (*operations.ListBasicAuthWithConsumerResponse, error) { diff --git a/consumergroups.go b/consumergroups.go index f6fc337..1ad6b43 100644 --- a/consumergroups.go +++ b/consumergroups.go @@ -1080,6 +1080,180 @@ func (s *ConsumerGroups) UpsertConsumerGroup(ctx context.Context, request operat } +// RemoveAllConsumersFromConsumerGroup - Remove consumers from consumer group +// Removes all consumers from a consumer groups. This operation does not delete the consumer group. +func (s *ConsumerGroups) RemoveAllConsumersFromConsumerGroup(ctx context.Context, consumerGroupID string, controlPlaneID string, opts ...operations.Option) (*operations.RemoveAllConsumersFromConsumerGroupResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "remove-all-consumers-from-consumer-group", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.RemoveAllConsumersFromConsumerGroupRequest{ + ConsumerGroupID: consumerGroupID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/consumer_groups/{ConsumerGroupId}/consumers", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "*/*") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.RemoveAllConsumersFromConsumerGroupResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 204: + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + // ListConsumersForConsumerGroup - List all Consumers in a Consumer Group // List all consumers in a consumer group func (s *ConsumerGroups) ListConsumersForConsumerGroup(ctx context.Context, request operations.ListConsumersForConsumerGroupRequest, opts ...operations.Option) (*operations.ListConsumersForConsumerGroupResponse, error) { @@ -1631,6 +1805,180 @@ func (s *ConsumerGroups) RemoveConsumerFromGroup(ctx context.Context, request op } +// RemoveConsumerFromAllConsumerGroups - Remove consumer from consumer group +// Removes a consumer from all consumer groups. This operation does not delete the consumer group. +func (s *ConsumerGroups) RemoveConsumerFromAllConsumerGroups(ctx context.Context, controlPlaneID string, consumerID string, opts ...operations.Option) (*operations.RemoveConsumerFromAllConsumerGroupsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "remove-consumer-from-all-consumer-groups", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.RemoveConsumerFromAllConsumerGroupsRequest{ + ControlPlaneID: controlPlaneID, + ConsumerID: consumerID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/consumers/{ConsumerId}/consumer_groups", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "*/*") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.RemoveConsumerFromAllConsumerGroupsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 204: + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + // ListConsumerGroupsForConsumer - List all Consumer Groups a Consumer belongs to // List all Consumer Groups a Consumer belongs to func (s *ConsumerGroups) ListConsumerGroupsForConsumer(ctx context.Context, request operations.ListConsumerGroupsForConsumerRequest, opts ...operations.Option) (*operations.ListConsumerGroupsForConsumerResponse, error) { diff --git a/controlplanegroups.go b/controlplanegroups.go index df9f264..05da8ad 100644 --- a/controlplanegroups.go +++ b/controlplanegroups.go @@ -1624,12 +1624,12 @@ func (s *ControlPlaneGroups) GetControlPlanesIDGroupStatus(ctx context.Context, return nil, err } - var out components.GroupStatus + var out components.GetGroupStatus if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.GroupStatus = &out + res.GetGroupStatus = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { diff --git a/docs/models/components/getgroupstatus.md b/docs/models/components/getgroupstatus.md new file mode 100644 index 0000000..8be56e8 --- /dev/null +++ b/docs/models/components/getgroupstatus.md @@ -0,0 +1,10 @@ +# GetGroupStatus + +Status of a control plane group, including existing conflicts. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `Item` | [*components.GroupStatus](../../models/components/groupstatus.md) | :heavy_minus_sign: | The Group Status object contains information about the status of a control plane group. | \ No newline at end of file diff --git a/docs/models/components/vault.md b/docs/models/components/vault.md index 0d1fbb7..e8e056f 100644 --- a/docs/models/components/vault.md +++ b/docs/models/components/vault.md @@ -7,7 +7,7 @@ Vault entities are used to configure different Vault connectors. Examples of Vau | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Config` | map[string]*any* | :heavy_minus_sign: | The configuration properties for the Vault which can be found on the vaults' documentation page. | +| `Config` | map[string]*any* | :heavy_check_mark: | The configuration properties for the Vault which can be found on the vaults' documentation page. | | `CreatedAt` | **int64* | :heavy_minus_sign: | Unix epoch when the resource was created. | | `Description` | **string* | :heavy_minus_sign: | The description of the Vault entity. | | `ID` | **string* | :heavy_minus_sign: | N/A | diff --git a/docs/models/components/vaultinput.md b/docs/models/components/vaultinput.md index 5534bb3..03c33cc 100644 --- a/docs/models/components/vaultinput.md +++ b/docs/models/components/vaultinput.md @@ -7,7 +7,7 @@ Vault entities are used to configure different Vault connectors. Examples of Vau | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Config` | map[string]*any* | :heavy_minus_sign: | The configuration properties for the Vault which can be found on the vaults' documentation page. | +| `Config` | map[string]*any* | :heavy_check_mark: | The configuration properties for the Vault which can be found on the vaults' documentation page. | | `Description` | **string* | :heavy_minus_sign: | The description of the Vault entity. | | `ID` | **string* | :heavy_minus_sign: | N/A | | `Name` | *string* | :heavy_check_mark: | The name of the Vault that's going to be added. Currently, the Vault implementation must be installed in every Kong instance. | diff --git a/docs/models/operations/getaclrequest.md b/docs/models/operations/getaclrequest.md new file mode 100644 index 0000000..9d17aee --- /dev/null +++ b/docs/models/operations/getaclrequest.md @@ -0,0 +1,9 @@ +# GetACLRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ACLID` | *string* | :heavy_check_mark: | ID of the ACL to lookup | f28acbfa-c866-4587-b688-0208ac24df21 | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/getaclresponse.md b/docs/models/operations/getaclresponse.md new file mode 100644 index 0000000..ef8e99b --- /dev/null +++ b/docs/models/operations/getaclresponse.md @@ -0,0 +1,11 @@ +# GetACLResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `ACL` | [*components.ACL](../../models/components/acl.md) | :heavy_minus_sign: | Successfully fetched ACL | {
"consumer": {
"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"
},
"group": "foo",
"id": "b1f34145-0343-41a4-9602-4c69dec2f269"
} | \ No newline at end of file diff --git a/docs/models/operations/getbasicauthrequest.md b/docs/models/operations/getbasicauthrequest.md new file mode 100644 index 0000000..6f86275 --- /dev/null +++ b/docs/models/operations/getbasicauthrequest.md @@ -0,0 +1,9 @@ +# GetBasicAuthRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `BasicAuthID` | *string* | :heavy_check_mark: | ID of the Basic-auth credential to lookup | 80db1b58-ca7c-4d21-b92a-64eb07725872 | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/getbasicauthresponse.md b/docs/models/operations/getbasicauthresponse.md new file mode 100644 index 0000000..2d84b51 --- /dev/null +++ b/docs/models/operations/getbasicauthresponse.md @@ -0,0 +1,11 @@ +# GetBasicAuthResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `BasicAuth` | [*components.BasicAuth](../../models/components/basicauth.md) | :heavy_minus_sign: | Successfully fetched Basic-auth credential | {
"consumer": {
"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"
},
"id": "b2f34145-0343-41a4-9602-4c69dec2f269",
"password": "hashedsoopersecretvalue",
"username": "darius"
} | \ No newline at end of file diff --git a/docs/models/operations/getcontrolplanesidgroupstatusresponse.md b/docs/models/operations/getcontrolplanesidgroupstatusresponse.md index 08f3629..543a11e 100644 --- a/docs/models/operations/getcontrolplanesidgroupstatusresponse.md +++ b/docs/models/operations/getcontrolplanesidgroupstatusresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `GroupStatus` | [*components.GroupStatus](../../models/components/groupstatus.md) | :heavy_minus_sign: | Status of a control plane group, including existing conflicts. | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `GetGroupStatus` | [*components.GetGroupStatus](../../models/components/getgroupstatus.md) | :heavy_minus_sign: | Status of a control plane group, including existing conflicts. | \ No newline at end of file diff --git a/docs/models/operations/gethmacauthrequest.md b/docs/models/operations/gethmacauthrequest.md new file mode 100644 index 0000000..cd9154d --- /dev/null +++ b/docs/models/operations/gethmacauthrequest.md @@ -0,0 +1,9 @@ +# GetHmacAuthRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `HMACAuthID` | *string* | :heavy_check_mark: | ID of the HMAC-auth credential to lookup | 70e7b00b-72f2-471b-a5ce-9c4171775360 | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/gethmacauthresponse.md b/docs/models/operations/gethmacauthresponse.md new file mode 100644 index 0000000..ab88bef --- /dev/null +++ b/docs/models/operations/gethmacauthresponse.md @@ -0,0 +1,11 @@ +# GetHmacAuthResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `HMACAuth` | [*components.HMACAuth](../../models/components/hmacauth.md) | :heavy_minus_sign: | Successfully fetched HMAC-auth credential | {
"consumer": {
"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"
},
"id": "75695322-e8a0-4109-aed4-5416b0308d85",
"secret": "wQazJ304DW5huJklHgUfjfiSyCyTAEDZ",
"username": "xerxes"
} | \ No newline at end of file diff --git a/docs/models/operations/getjwtrequest.md b/docs/models/operations/getjwtrequest.md new file mode 100644 index 0000000..7c334f8 --- /dev/null +++ b/docs/models/operations/getjwtrequest.md @@ -0,0 +1,9 @@ +# GetJwtRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `JWTID` | *string* | :heavy_check_mark: | ID of the JWT to lookup | 4a7f5faa-8c96-46d6-8214-c87573ef2ac4 | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/getjwtresponse.md b/docs/models/operations/getjwtresponse.md new file mode 100644 index 0000000..7281352 --- /dev/null +++ b/docs/models/operations/getjwtresponse.md @@ -0,0 +1,11 @@ +# GetJwtResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `Jwt` | [*components.Jwt](../../models/components/jwt.md) | :heavy_minus_sign: | Successfully fetched JWT | {
"algorithm": "HS256",
"consumer": {
"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"
},
"id": "75695322-e8a0-4109-aed4-5416b0308d85",
"key": "YJdmaDvVTJxtcWRCvkMikc8oELgAVNcz",
"secret": "C50k0bcahDhLNhLKSUBSR1OMiFGzNZ7X"
} | \ No newline at end of file diff --git a/docs/models/operations/getkeyauthrequest.md b/docs/models/operations/getkeyauthrequest.md new file mode 100644 index 0000000..51f0d2c --- /dev/null +++ b/docs/models/operations/getkeyauthrequest.md @@ -0,0 +1,9 @@ +# GetKeyAuthRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `KeyAuthID` | *string* | :heavy_check_mark: | ID of the API-key to lookup | | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/getkeyauthresponse.md b/docs/models/operations/getkeyauthresponse.md new file mode 100644 index 0000000..45356a0 --- /dev/null +++ b/docs/models/operations/getkeyauthresponse.md @@ -0,0 +1,11 @@ +# GetKeyAuthResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `KeyAuth` | [*components.KeyAuth](../../models/components/keyauth.md) | :heavy_minus_sign: | Successfully fetched API-key | {
"consumer": {
"id": "84a73fb8-50fc-44a7-a4d5-aa17728ee83f"
},
"id": "b2f34145-0343-41a4-9602-4c69dec2f269",
"key": "IL1deIyHyQA40WpeLeA1bIUXuvTwlGjo"
} | \ No newline at end of file diff --git a/docs/models/operations/getmtlsauthrequest.md b/docs/models/operations/getmtlsauthrequest.md new file mode 100644 index 0000000..693ae01 --- /dev/null +++ b/docs/models/operations/getmtlsauthrequest.md @@ -0,0 +1,9 @@ +# GetMtlsAuthRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `MTLSAuthID` | *string* | :heavy_check_mark: | ID of the MTLS-auth credential to lookup | | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/getmtlsauthresponse.md b/docs/models/operations/getmtlsauthresponse.md new file mode 100644 index 0000000..5fee795 --- /dev/null +++ b/docs/models/operations/getmtlsauthresponse.md @@ -0,0 +1,11 @@ +# GetMtlsAuthResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `MTLSAuth` | [*components.MTLSAuth](../../models/components/mtlsauth.md) | :heavy_minus_sign: | Successfully fetched MTLS-auth credential | {
"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"
} | \ No newline at end of file diff --git a/docs/models/operations/removeallconsumersfromconsumergrouprequest.md b/docs/models/operations/removeallconsumersfromconsumergrouprequest.md new file mode 100644 index 0000000..97b6fd0 --- /dev/null +++ b/docs/models/operations/removeallconsumersfromconsumergrouprequest.md @@ -0,0 +1,9 @@ +# RemoveAllConsumersFromConsumerGroupRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ConsumerGroupID` | *string* | :heavy_check_mark: | N/A | | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | \ No newline at end of file diff --git a/docs/models/operations/removeallconsumersfromconsumergroupresponse.md b/docs/models/operations/removeallconsumersfromconsumergroupresponse.md new file mode 100644 index 0000000..3355cee --- /dev/null +++ b/docs/models/operations/removeallconsumersfromconsumergroupresponse.md @@ -0,0 +1,10 @@ +# RemoveAllConsumersFromConsumerGroupResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/removeconsumerfromallconsumergroupsrequest.md b/docs/models/operations/removeconsumerfromallconsumergroupsrequest.md new file mode 100644 index 0000000..1859cfe --- /dev/null +++ b/docs/models/operations/removeconsumerfromallconsumergroupsrequest.md @@ -0,0 +1,9 @@ +# RemoveConsumerFromAllConsumerGroupsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ControlPlaneID` | *string* | :heavy_check_mark: | The UUID of your control plane. This variable is available in the Konnect manager. | 9524ec7d-36d9-465d-a8c5-83a3c9390458 | +| `ConsumerID` | *string* | :heavy_check_mark: | The UUID of the consumer. | 123e4567-e89b-12d3-a456-426614174000 | \ No newline at end of file diff --git a/docs/models/operations/removeconsumerfromallconsumergroupsresponse.md b/docs/models/operations/removeconsumerfromallconsumergroupsresponse.md new file mode 100644 index 0000000..1a7d1e8 --- /dev/null +++ b/docs/models/operations/removeconsumerfromallconsumergroupsresponse.md @@ -0,0 +1,10 @@ +# RemoveConsumerFromAllConsumerGroupsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/hmacauthcredentials.go b/hmacauthcredentials.go index 5faba39..7795d38 100644 --- a/hmacauthcredentials.go +++ b/hmacauthcredentials.go @@ -1169,3 +1169,218 @@ func (s *HMACAuthCredentials) ListHmacAuth(ctx context.Context, request operatio return res, nil } + +// GetHmacAuth - Fetch a HMAC-auth credential +// Get a HMAC-auth credential using ID. +func (s *HMACAuthCredentials) GetHmacAuth(ctx context.Context, hmacAuthID string, controlPlaneID string, opts ...operations.Option) (*operations.GetHmacAuthResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-hmac-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetHmacAuthRequest{ + HMACAuthID: hmacAuthID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/hmac-auths/{HMACAuthId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetHmacAuthResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.HMACAuth + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.HMACAuth = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GatewayUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/internal/utils/env.go b/internal/utils/env.go new file mode 100644 index 0000000..110d464 --- /dev/null +++ b/internal/utils/env.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package utils + +import ( + "os" +) + +// GetEnv returns the value of the environment variable named by the key or the defaultValue if the environment variable is not set. +func GetEnv(name, defaultValue string) string { + value := os.Getenv(name) + if value == "" { + return defaultValue + } + return value +} diff --git a/jwts.go b/jwts.go index 42bce8c..a422481 100644 --- a/jwts.go +++ b/jwts.go @@ -1169,3 +1169,218 @@ func (s *JWTs) ListJwt(ctx context.Context, request operations.ListJwtRequest, o return res, nil } + +// GetJwt - Fetch a JWT +// Get a JWT using ID. +func (s *JWTs) GetJwt(ctx context.Context, jwtID string, controlPlaneID string, opts ...operations.Option) (*operations.GetJwtResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-jwt", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetJwtRequest{ + JWTID: jwtID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/jwts/{JWTId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetJwtResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.Jwt + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Jwt = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GatewayUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/models/components/getgroupstatus.go b/models/components/getgroupstatus.go new file mode 100644 index 0000000..4db89eb --- /dev/null +++ b/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/models/components/vault.go b/models/components/vault.go index 9cb482f..4b57010 100644 --- a/models/components/vault.go +++ b/models/components/vault.go @@ -5,7 +5,7 @@ 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,omitempty"` + 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. @@ -23,7 +23,7 @@ type Vault struct { func (o *Vault) GetConfig() map[string]any { if o == nil { - return nil + return map[string]any{} } return o.Config } diff --git a/models/components/vaultinput.go b/models/components/vaultinput.go index 9f7581c..e7e07b8 100644 --- a/models/components/vaultinput.go +++ b/models/components/vaultinput.go @@ -5,7 +5,7 @@ package components // VaultInput - 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 VaultInput struct { // The configuration properties for the Vault which can be found on the vaults' documentation page. - Config map[string]any `json:"config,omitempty"` + Config map[string]any `json:"config"` // The description of the Vault entity. Description *string `json:"description,omitempty"` ID *string `json:"id,omitempty"` @@ -19,7 +19,7 @@ type VaultInput struct { func (o *VaultInput) GetConfig() map[string]any { if o == nil { - return nil + return map[string]any{} } return o.Config } diff --git a/models/operations/getacl.go b/models/operations/getacl.go new file mode 100644 index 0000000..cefa04f --- /dev/null +++ b/models/operations/getacl.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successfully fetched ACL + ACL *components.ACL +} + +func (o *GetACLResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetACLResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetACLResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetACLResponse) GetACL() *components.ACL { + if o == nil { + return nil + } + return o.ACL +} diff --git a/models/operations/getbasicauth.go b/models/operations/getbasicauth.go new file mode 100644 index 0000000..907f141 --- /dev/null +++ b/models/operations/getbasicauth.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successfully fetched Basic-auth credential + BasicAuth *components.BasicAuth +} + +func (o *GetBasicAuthResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetBasicAuthResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetBasicAuthResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetBasicAuthResponse) GetBasicAuth() *components.BasicAuth { + if o == nil { + return nil + } + return o.BasicAuth +} diff --git a/models/operations/getcontrolplanesidgroupstatus.go b/models/operations/getcontrolplanesidgroupstatus.go index 78e5692..2c71b95 100644 --- a/models/operations/getcontrolplanesidgroupstatus.go +++ b/models/operations/getcontrolplanesidgroupstatus.go @@ -27,7 +27,7 @@ type GetControlPlanesIDGroupStatusResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Status of a control plane group, including existing conflicts. - GroupStatus *components.GroupStatus + GetGroupStatus *components.GetGroupStatus } func (o *GetControlPlanesIDGroupStatusResponse) GetContentType() string { @@ -51,9 +51,9 @@ func (o *GetControlPlanesIDGroupStatusResponse) GetRawResponse() *http.Response return o.RawResponse } -func (o *GetControlPlanesIDGroupStatusResponse) GetGroupStatus() *components.GroupStatus { +func (o *GetControlPlanesIDGroupStatusResponse) GetGetGroupStatus() *components.GetGroupStatus { if o == nil { return nil } - return o.GroupStatus + return o.GetGroupStatus } diff --git a/models/operations/gethmacauth.go b/models/operations/gethmacauth.go new file mode 100644 index 0000000..79de9db --- /dev/null +++ b/models/operations/gethmacauth.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successfully fetched HMAC-auth credential + HMACAuth *components.HMACAuth +} + +func (o *GetHmacAuthResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetHmacAuthResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetHmacAuthResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetHmacAuthResponse) GetHMACAuth() *components.HMACAuth { + if o == nil { + return nil + } + return o.HMACAuth +} diff --git a/models/operations/getjwt.go b/models/operations/getjwt.go new file mode 100644 index 0000000..070a8d2 --- /dev/null +++ b/models/operations/getjwt.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successfully fetched JWT + Jwt *components.Jwt +} + +func (o *GetJwtResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetJwtResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetJwtResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetJwtResponse) GetJwt() *components.Jwt { + if o == nil { + return nil + } + return o.Jwt +} diff --git a/models/operations/getkeyauth.go b/models/operations/getkeyauth.go new file mode 100644 index 0000000..6318cff --- /dev/null +++ b/models/operations/getkeyauth.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successfully fetched API-key + KeyAuth *components.KeyAuth +} + +func (o *GetKeyAuthResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetKeyAuthResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetKeyAuthResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetKeyAuthResponse) GetKeyAuth() *components.KeyAuth { + if o == nil { + return nil + } + return o.KeyAuth +} diff --git a/models/operations/getmtlsauth.go b/models/operations/getmtlsauth.go new file mode 100644 index 0000000..c848793 --- /dev/null +++ b/models/operations/getmtlsauth.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/Kong/sdk-konnect-go/models/components" + "net/http" +) + +type 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successfully fetched MTLS-auth credential + MTLSAuth *components.MTLSAuth +} + +func (o *GetMtlsAuthResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetMtlsAuthResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetMtlsAuthResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetMtlsAuthResponse) GetMTLSAuth() *components.MTLSAuth { + if o == nil { + return nil + } + return o.MTLSAuth +} diff --git a/models/operations/removeallconsumersfromconsumergroup.go b/models/operations/removeallconsumersfromconsumergroup.go new file mode 100644 index 0000000..3de2966 --- /dev/null +++ b/models/operations/removeallconsumersfromconsumergroup.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *RemoveAllConsumersFromConsumerGroupResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *RemoveAllConsumersFromConsumerGroupResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *RemoveAllConsumersFromConsumerGroupResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/models/operations/removeconsumerfromallconsumergroups.go b/models/operations/removeconsumerfromallconsumergroups.go new file mode 100644 index 0000000..5b1d7e1 --- /dev/null +++ b/models/operations/removeconsumerfromallconsumergroups.go @@ -0,0 +1,58 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +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"` + // The UUID of the consumer. + 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 { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *RemoveConsumerFromAllConsumerGroupsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *RemoveConsumerFromAllConsumerGroupsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *RemoveConsumerFromAllConsumerGroupsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/mtlsauthcredentials.go b/mtlsauthcredentials.go index edd3892..1aae25f 100644 --- a/mtlsauthcredentials.go +++ b/mtlsauthcredentials.go @@ -1169,3 +1169,218 @@ func (s *MTLSAuthCredentials) ListMtlsAuth(ctx context.Context, request operatio return res, nil } + +// GetMtlsAuth - Fetch a MTLS-auth credential +// Get a MTLS-auth credential using ID. +func (s *MTLSAuthCredentials) GetMtlsAuth(ctx context.Context, mtlsAuthID string, controlPlaneID string, opts ...operations.Option) (*operations.GetMtlsAuthResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-mtls-auth", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetMtlsAuthRequest{ + MTLSAuthID: mtlsAuthID, + ControlPlaneID: controlPlaneID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/v2/control-planes/{controlPlaneId}/core-entities/mtls-auths/{MTLSAuthId}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetMtlsAuthResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.MTLSAuth + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.MTLSAuth = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GatewayUnauthorizedError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/openapi.yaml b/openapi.yaml index 607cbd5..1c3d7f8 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -102,6 +102,27 @@ paths: - ACLs parameters: - $ref: '#/components/parameters/controlPlaneId' + /v2/control-planes/{controlPlaneId}/core-entities/acls/{ACLId}: + get: + operationId: get-acl + summary: Fetch an ACL + description: Get an ACL using ID. + responses: + '200': + description: Successfully fetched ACL + content: + application/json: + schema: + $ref: '#/components/schemas/ACL' + '401': + $ref: '#/components/responses/HTTP401Error' + '404': + description: Resource does not exist + tags: + - ACLs + parameters: + - $ref: '#/components/parameters/ACLId' + - $ref: '#/components/parameters/controlPlaneId' /v2/control-planes/{controlPlaneId}/core-entities/basic-auths: get: operationId: list-basic-auth @@ -133,6 +154,27 @@ paths: - Basic-auth credentials parameters: - $ref: '#/components/parameters/controlPlaneId' + /v2/control-planes/{controlPlaneId}/core-entities/basic-auths/{BasicAuthId}: + get: + operationId: get-basic-auth + summary: Fetch a Basic-auth credential + description: Get a Basic-auth credential using ID. + responses: + '200': + description: Successfully fetched Basic-auth credential + content: + application/json: + schema: + $ref: '#/components/schemas/BasicAuth' + '401': + $ref: '#/components/responses/HTTP401Error' + '404': + description: Resource does not exist + tags: + - Basic-auth credentials + parameters: + - $ref: '#/components/parameters/BasicAuthId' + - $ref: '#/components/parameters/controlPlaneId' /v2/control-planes/{controlPlaneId}/core-entities/ca_certificates: get: operationId: list-ca_certificate @@ -569,6 +611,19 @@ paths: tags: - Consumer Groups /v2/control-planes/{controlPlaneId}/core-entities/consumer_groups/{ConsumerGroupId}/consumers: + delete: + operationId: remove-all-consumers-from-consumer-group + summary: Remove consumers from consumer group + description: >- + Removes all consumers from a consumer groups. This operation does not + delete the consumer group. + responses: + '204': + description: Consumers removed from group + '404': + description: Consumer group or consumer association does not exist + tags: + - Consumer Groups get: operationId: list-consumers-for-consumer-group summary: List all Consumers in a Consumer Group @@ -866,6 +921,21 @@ paths: tags: - Consumers /v2/control-planes/{controlPlaneId}/core-entities/consumers/{ConsumerId}/consumer_groups: + delete: + operationId: remove-consumer-from-all-consumer-groups + summary: Remove consumer from consumer group + description: >- + Removes a consumer from all consumer groups. This operation does not + delete the consumer group. + parameters: + - $ref: '#/components/parameters/ConsumerId' + responses: + '204': + description: Consumer removed from all groups + '404': + description: Consumer does not exist + tags: + - Consumer Groups get: operationId: list-consumer-groups-for-consumer summary: List all Consumer Groups a Consumer belongs to @@ -1743,6 +1813,27 @@ paths: - HMAC-auth credentials parameters: - $ref: '#/components/parameters/controlPlaneId' + /v2/control-planes/{controlPlaneId}/core-entities/hmac-auths/{HMACAuthId}: + get: + operationId: get-hmac-auth + summary: Fetch a HMAC-auth credential + description: Get a HMAC-auth credential using ID. + responses: + '200': + description: Successfully fetched HMAC-auth credential + content: + application/json: + schema: + $ref: '#/components/schemas/HMACAuth' + '401': + $ref: '#/components/responses/HTTP401Error' + '404': + description: Resource does not exist + tags: + - HMAC-auth credentials + parameters: + - $ref: '#/components/parameters/HMACAuthId' + - $ref: '#/components/parameters/controlPlaneId' /v2/control-planes/{controlPlaneId}/core-entities/jwts: get: operationId: list-jwt @@ -1774,6 +1865,27 @@ paths: - JWTs parameters: - $ref: '#/components/parameters/controlPlaneId' + /v2/control-planes/{controlPlaneId}/core-entities/jwts/{JWTId}: + get: + operationId: get-jwt + summary: Fetch a JWT + description: Get a JWT using ID. + responses: + '200': + description: Successfully fetched JWT + content: + application/json: + schema: + $ref: '#/components/schemas/JWT' + '401': + $ref: '#/components/responses/HTTP401Error' + '404': + description: Resource does not exist + tags: + - JWTs + parameters: + - $ref: '#/components/parameters/JWTId' + - $ref: '#/components/parameters/controlPlaneId' /v2/control-planes/{controlPlaneId}/core-entities/key-auths: get: operationId: list-key-auth @@ -1805,6 +1917,27 @@ paths: - API-keys parameters: - $ref: '#/components/parameters/controlPlaneId' + /v2/control-planes/{controlPlaneId}/core-entities/key-auths/{KeyAuthId}: + get: + operationId: get-key-auth + summary: Fetch an API-key + description: Get an API-key using ID. + responses: + '200': + description: Successfully fetched API-key + content: + application/json: + schema: + $ref: '#/components/schemas/KeyAuth' + '401': + $ref: '#/components/responses/HTTP401Error' + '404': + description: Resource does not exist + tags: + - API-keys + parameters: + - $ref: '#/components/parameters/KeyAuthId' + - $ref: '#/components/parameters/controlPlaneId' /v2/control-planes/{controlPlaneId}/core-entities/key-sets: get: operationId: list-key-set @@ -2162,6 +2295,27 @@ paths: - MTLS-auth credentials parameters: - $ref: '#/components/parameters/controlPlaneId' + /v2/control-planes/{controlPlaneId}/core-entities/mtls-auths/{MTLSAuthId}: + get: + operationId: get-mtls-auth + summary: Fetch a MTLS-auth credential + description: Get a MTLS-auth credential using ID. + responses: + '200': + description: Successfully fetched MTLS-auth credential + content: + application/json: + schema: + $ref: '#/components/schemas/MTLSAuth' + '401': + $ref: '#/components/responses/HTTP401Error' + '404': + description: Resource does not exist + tags: + - MTLS-auth credentials + parameters: + - $ref: '#/components/parameters/MTLSAuthId' + - $ref: '#/components/parameters/controlPlaneId' /v2/control-planes/{controlPlaneId}/core-entities/plugin-schemas: parameters: - $ref: '#/components/parameters/controlPlaneId' @@ -8816,7 +8970,6 @@ components: vaults' documentation page. type: object additionalProperties: true - nullable: true created_at: description: Unix epoch when the resource was created. type: integer @@ -8864,6 +9017,7 @@ components: required: - name - prefix + - config requestBodies: GroupMembershipAdd: content: @@ -9461,7 +9615,10 @@ components: content: application/json: schema: - $ref: '#/components/schemas/GroupStatus' + type: object + properties: + item: + $ref: '#/components/schemas/GroupStatus' GetGroupMemberStatus: description: Determines the group membership status of a control plane. content: diff --git a/sdk.go b/sdk.go index 887d11a..b7143d3 100644 --- a/sdk.go +++ b/sdk.go @@ -261,9 +261,9 @@ func New(opts ...SDKOption) *SDK { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.1", - SDKVersion: "0.1.8", - GenVersion: "2.461.4", - UserAgent: "speakeasy-sdk/go 0.1.8 2.461.4 0.0.1 github.com/Kong/sdk-konnect-go", + SDKVersion: "0.1.9", + GenVersion: "2.462.1", + UserAgent: "speakeasy-sdk/go 0.1.9 2.462.1 0.0.1 github.com/Kong/sdk-konnect-go", Hooks: hooks.New(), }, }