### Get ACL With Consumer Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/acls/README.md Demonstrates how to initialize the SDK with a bearer token and retrieve an ACL for a consumer. Ensure you replace '' with your actual token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.ACLs.GetACLWithConsumer(ctx, operations.GetACLWithConsumerRequest{ ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", ConsumerIDForNestedEntities: "f28acbfa-c866-4587-b688-0208ac24df21", ACLID: "f28acbfa-c866-4587-b688-0208ac24df21", }) if err != nil { log.Fatal(err) } if res.ACL != nil { // handle response } } ``` -------------------------------- ### Get Specific App Details using Go SDK Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/openmeterapps/README.md Retrieve detailed information about a specific installed app by its ID. This example demonstrates how to initialize the SDK client and make the API call. The response handling includes checking the app type and accessing type-specific data. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.OpenMeterApps.GetApp(ctx, "01G65Z755AFWAKHE12NY0CQ9FH") if err != nil { log.Fatal(err) } if res.BillingApp != nil { switch res.BillingApp.Type { case components.BillingAppTypeStripe: // res.BillingApp.BillingAppStripe is populated case components.BillingAppTypeSandbox: // res.BillingApp.BillingAppSandbox is populated case components.BillingAppTypeExternalInvoicing: // res.BillingApp.BillingAppExternalInvoicing is populated } } } ``` -------------------------------- ### Get API Package Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/apipackages/README.md This example shows how to retrieve details for a specific API package using its ID. Remember to substitute the placeholder bearer token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.APIPackages.GetAPIPackage(ctx, "9f5061ce-78f6-4452-9108-ad7c02821fd5") if err != nil { log.Fatal(err) } if res.APIPackageResponseSchema != nil { // handle response } } ``` -------------------------------- ### Create Team - Example Request Body Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/teams/README.md This example demonstrates creating a team with additional labels in the request body. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Teams.CreateTeam(ctx, &components.CreateTeam{ Name: "IDM - Developers", Description: sdkkonnectgo.Pointer("The Identity Management (IDM) team."), Labels: map[string]string{ "env": "test", "service": "test", }, }) if err != nil { log.Fatal(err) } if res.Team != nil { // handle response } } ``` -------------------------------- ### Update Portal Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portals/README.md This example demonstrates how to update a portal, disabling authentication. Ensure you replace '' with your actual token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Portals.UpdatePortal(ctx, "efe853b6-a55c-4929-9b80-c39a22b01c7a", components.UpdatePortal{ AuthenticationEnabled: sdkkonnectgo.Pointer(false), }) if err != nil { log.Fatal(err) } if res.PortalResponse != nil { // handle response } } ``` -------------------------------- ### Create API Document (Minimal Request Example) Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/apidocumentation/README.md A minimal example for creating an API document, focusing on essential fields. Remember to substitute '' with your actual token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.APIDocumentation.CreateAPIDocument(ctx, "9f5061ce-78f6-4452-9108-ad7c02821fd5", components.CreateAPIDocumentRequest{ Content: "# API Document Header", Title: sdkkonnectgo.Pointer("API Document"), Slug: sdkkonnectgo.Pointer("api-document"), Status: components.APIDocumentStatusPublished.ToPointer(), }) if err != nil { log.Fatal(err) } if res.APIDocumentResponse != nil { // handle response } } ``` -------------------------------- ### Create Email Domain - Not Found Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portalemails/README.md Example demonstrating how to create an email domain. Ensure your bearer token is valid and replace placeholder values. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.PortalEmails.CreateEmailDomain(ctx, components.EmailDomainPayload{ Domain: "milky-advertisement.biz", }) if err != nil { log.Fatal(err) } if res.EmailDomain != nil { // handle response } } ``` -------------------------------- ### Example Portal Email Config Response Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portalemails/README.md This example demonstrates handling a successful response when creating a portal email configuration. It checks if the `PortalEmailConfig` field is not nil. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.PortalEmails.CreatePortalEmailConfig(ctx, "f32d905a-ed33-46a3-a093-d8f536af9a8a", components.PostPortalEmailConfig{}) if err != nil { log.Fatal(err) } if res.PortalEmailConfig != nil { // handle response } } ``` -------------------------------- ### Update Team - Example Request Body Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/teams/README.md This Go example shows how to construct and send a request to update a team. It includes setting the team's name, description, and labels. Note the specific label value used in this example. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Teams.UpdateTeam(ctx, "d32d905a-ed33-46a3-a093-d8f536af9a8a", &components.UpdateTeam{ Name: sdkkonnectgo.Pointer("IDM - Developers"), Description: sdkkonnectgo.Pointer("The Identity Management (IDM) API team."), Labels: map[string]*string{ "env": sdkkonnectgo.Pointer("prod"), }, }) if err != nil { log.Fatal(err) } if res.Team != nil { // handle response } } ``` -------------------------------- ### Example Header Configuration for Multi-Key Auth Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/components/createmultikeyauthcredentialconfig.md Provides an example of how to structure the 'Headers' field for multi-key authentication. This includes the header name and the corresponding API key. ```json [ { "name": "x-api-key", "key": "9f2a3b4c8d6e7f00112233445566778899aabbccddeeff001122334455667788" } ] ``` -------------------------------- ### Update OpenID Connect Auth Strategy (Unauthorized Example) Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/appauthstrategies/README.md This example demonstrates updating an OpenID Connect authentication strategy. It includes placeholder values that need to be replaced with actual data. Note the use of specific values like "Aliyah_Fadel" which might be indicative of a test or example scenario. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.AppAuthStrategies.ReplaceAppAuthStrategy(ctx, "5f9fd312-a987-4628-b4c5-bb4f4fddd5f7", components.CreateCreateAppAuthStrategyRequestOpenidConnect( components.AppAuthStrategyOpenIDConnectRequest{ Name: "", DisplayName: "Aliyah_Fadel", StrategyType: components.AppAuthStrategyOpenIDConnectRequestStrategyTypeOpenidConnect, Configs: components.AppAuthStrategyOpenIDConnectRequestConfigs{ OpenidConnect: components.AppAuthStrategyConfigOpenIDConnect{ Issuer: "https://tedious-tinderbox.org/", CredentialClaim: []string{ "", "", "", }, Scopes: []string{}, AuthMethods: []string{}, }, }, }, )) if err != nil { log.Fatal(err) } if res.CreateAppAuthStrategyResponse != nil { switch res.CreateAppAuthStrategyResponse.Type { case components.CreateAppAuthStrategyResponseTypeKeyAuth: // res.CreateAppAuthStrategyResponse.AppAuthStrategyKeyAuthResponse is populated case components.CreateAppAuthStrategyResponseTypeOpenidConnect: // res.CreateAppAuthStrategyResponse.AppAuthStrategyOpenIDConnectResponse is populated } } } ``` -------------------------------- ### Create Config Store Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/configstores/README.md Demonstrates how to create a new config store. Ensure you replace '' with your actual bearer token and provide a valid control plane ID. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.ConfigStores.CreateConfigStore(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", components.CreateConfigStore{ Name: sdkkonnectgo.Pointer("Config Store"), }) if err != nil { log.Fatal(err) } if res.ConfigStore != nil { // handle response } } ``` -------------------------------- ### Fetch API Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/api/README.md Demonstrates how to fetch a specific API using its ID. Ensure you have set up the SDK client with your authentication token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.API.FetchAPI(ctx, "9f5061ce-78f6-4452-9108-ad7c02821fd5") if err != nil { log.Fatal(err) } if res.APIResponseSchema != nil { // handle response } } ``` -------------------------------- ### GET /service-catalog-integrations/github/app/pending-installs Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/components/pendingappinstallsendpoint.md Retrieves a list of in-progress or unlinked GitHub App installations awaiting user confirmation. ```APIDOC ## GET /service-catalog-integrations/github/app/pending-installs ### Description This endpoint returns a list of in-progress or unlinked GitHub App installations awaiting user confirmation. ### Method GET ### Endpoint https://global.api.konghq.com/service-catalog-integrations/github/app/pending-installs ### Parameters #### Query Parameters - **URL** (string) - Required - The endpoint used to return a list of in-progress or unlinked GitHub App installations awaiting user confirmation. ### Response #### Success Response (200) - **body** (object) - The response body containing a list of pending app installations. #### Response Example { "example": "{\"data\": [{\"id\": \"some-install-id\", \"account\": {\"id\": 123, \"login\": \"some-org\"}, \"permissions\": [\"read-only\"], \"events\": [\"push\"], \"created_at\": \"2023-01-01T12:00:00Z\"}]}" } ``` -------------------------------- ### Example: Fetching a Specific Pre-release Version Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/pre-release-implementation-plan.md Use this command to fetch a specific pre-release version of the SDK. This is necessary because `@latest` will not fetch pre-releases. ```bash go get github.com/Kong/sdk-konnect-go@v0.13.0-rc.1 ``` -------------------------------- ### Update Application Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/applications/README.md Demonstrates how to update an application using the `UpdateApplication` method. Ensure you replace placeholder values with your actual token and IDs. The response handling shows how to differentiate between application types. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Applications.UpdateApplication(ctx, operations.UpdateApplicationRequest{ PortalID: "f32d905a-ed33-46a3-a093-d8f536af9a8a", ApplicationID: "9162a78a-62d3-429d-bb0f-d113e634fa68", UpdateApplicationRequest: components.UpdateApplicationRequest{}, }) if err != nil { log.Fatal(err) } if res.GetApplicationResponse != nil { switch res.GetApplicationResponse.Type { case components.GetApplicationResponseTypeClientCredentialsApplication: // res.GetApplicationResponse.ClientCredentialsApplication is populated case components.GetApplicationResponseTypeKeyAuthApplication: // res.GetApplicationResponse.KeyAuthApplication is populated } } } ``` -------------------------------- ### Get Event Gateway Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/eventgateways/README.md This example demonstrates how to retrieve information for a specific Event Gateway using its ID. Replace '9524ec7d-36d9-465d-a8c5-83a3c9390458' with the actual ID of the gateway you want to fetch. The SDK requires a valid bearer token for authentication. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.EventGateways.GetEventGateway(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458") if err != nil { log.Fatal(err) } if res.EventGatewayInfo != nil { // handle response } } ``` -------------------------------- ### Get Portal Team Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portalteams/README.md Use this snippet to retrieve details of a specific team within a portal. Ensure you have a valid bearer token for authentication. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.PortalTeams.GetPortalTeam(ctx, "d32d905a-ed33-46a3-a093-d8f536af9a8a", "f32d905a-ed33-46a3-a093-d8f536af9a8a") if err != nil { log.Fatal(err) } if res.PortalTeamResponse != nil { // handle response } } ``` -------------------------------- ### Create Portal with Labels Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portals/README.md This example shows how to create a portal and assign labels to it. Replace '' with the desired portal name and '' with your token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Portals.CreatePortal(ctx, components.CreatePortal{ Name: "", Labels: map[string]*string{ "env": sdkkonnectgo.Pointer("test"), }, }) if err != nil { log.Fatal(err) } if res.PortalResponse != nil { // handle response } } ``` -------------------------------- ### UpsertPlugin Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/plugins/README.md Demonstrates how to create or update a plugin using the UpsertPlugin method. Ensure you replace placeholder values with your actual token and IDs. This example configures a key-auth plugin with specific settings and partials. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Plugins.UpsertPlugin(ctx, operations.UpsertPluginRequest{ PluginID: "3473c251-5b6c-4f45-b1ff-7ede735a366d", ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", Plugin: components.Plugin{ Config: map[string]any{ "anonymous": "", "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": []any{ "apikey", }, "run_on_preflight": true, }, ID: sdkkonnectgo.Pointer("3fd1eea1-885a-4011-b986-289943ff8177"), Name: "key-auth", Partials: []components.Partials{ components.Partials{ ID: sdkkonnectgo.Pointer("cff1230a-00f7-4ae8-b376-c370f0eb4dae"), Name: sdkkonnectgo.Pointer("foo-partial"), Path: sdkkonnectgo.Pointer("config.redis"), }, components.Partials{ ID: sdkkonnectgo.Pointer("129ee345-cba8-4e55-9d6d-93c223ff91ae"), Name: sdkkonnectgo.Pointer("bar-partial"), Path: sdkkonnectgo.Pointer("config.redis"), }, }, Protocols: []components.Protocols{ components.ProtocolsGrpc, components.ProtocolsGrpcs, components.ProtocolsHTTP, components.ProtocolsHTTPS, }, }, }) if err != nil { log.Fatal(err) } if res.Plugin != nil { // handle response } } ``` -------------------------------- ### Get Event Gateway Virtual Cluster Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/eventgatewayvirtualclusters/README.md Use this snippet to retrieve information about a specific virtual cluster. Ensure you have your Bearer Token configured for authentication. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.EventGatewayVirtualClusters.GetEventGatewayVirtualCluster(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", "0b2723a8-8eff-4698-8224-0c823cd13fbf") if err != nil { log.Fatal(err) } if res.VirtualCluster != nil { // handle response } } ``` -------------------------------- ### Get Portal Asset Logo Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/assets/README.md This Go code snippet demonstrates how to fetch the logo associated with a portal. It requires the portal ID and authentication credentials. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Assets.GetPortalAssetLogo(ctx, "f32d905a-ed33-46a3-a093-d8f536af9a8a") if err != nil { log.Fatal(err) } if res.PortalAssetResponse != nil { // handle response } } ``` -------------------------------- ### Service Labels Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/components/createcatalogservice.md Use labels to store metadata for filtering and searching entities. Keys must be 1-63 characters and cannot start with 'kong', 'konnect', 'mesh', 'kic', or '_'. ```json { "env": "test" } ``` -------------------------------- ### Get a Specific User by ID Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/users/README.md This example shows how to fetch a single user's details using their unique ID. The SDK client must be initialized with authentication credentials. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Users.GetUser(ctx, "d32d905a-ed33-46a3-a093-d8f536af9a8a") if err != nil { log.Fatal(err) } if res.User != nil { // handle response } } ``` -------------------------------- ### Create Vault Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/vaults/README.md Demonstrates how to create a new Vault using the SDK. Ensure you have a valid Bearer Token for authentication. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Vaults.DeleteVault(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", "9d4d6d19-77c6-428e-a965-9bc9647633e9") if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` -------------------------------- ### List App Auth Strategies Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/appauthstrategies/README.md Use this snippet to list application auth strategies. Ensure you have set up the SDK client with your bearer token and provide pagination parameters if needed. The response will contain a paginated collection of strategies or an error. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.AppAuthStrategies.ListAppAuthStrategies(ctx, operations.ListAppAuthStrategiesRequest{ PageSize: sdkkonnectgo.Pointer[int64](10), PageNumber: sdkkonnectgo.Pointer[int64](1), }) if err != nil { log.Fatal(err) } if res.ListAppAuthStrategiesResponse != nil { // handle response } } ``` -------------------------------- ### Get Portal Asset Favicon Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/assets/README.md Use this snippet to retrieve the favicon for a specific portal. Ensure you have the correct portal ID and a valid bearer token for authentication. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Assets.GetPortalAssetFaviconRaw(ctx, "f32d905a-ed33-46a3-a093-d8f536af9a8a") if err != nil { log.Fatal(err) } if res.PortalAssetResponse != nil { // handle response } } ``` -------------------------------- ### Get Plugin with Service Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/plugins/README.md Use this snippet to retrieve a plugin associated with a service by its ID. Ensure you have your bearer token and the correct IDs for the control plane, service, and plugin. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Plugins.GetPluginWithService(ctx, operations.GetPluginWithServiceRequest{ ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", ServiceID: "7fca84d6-7d37-4a74-a7b0-93e576089a41", PluginID: "3473c251-5b6c-4f45-b1ff-7ede735a366d", ExpandPartials: sdkkonnectgo.Pointer(true), }) if err != nil { log.Fatal(err) } if res.Plugin != nil { // handle response } } ``` -------------------------------- ### Get System Account by ID with Go SDK Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/systemaccounts/README.md This example shows how to retrieve a specific system account using its ID. Remember to replace '' with the actual system account ID and '' with your token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.SystemAccounts.GetSystemAccountsID(ctx, "") if err != nil { log.Fatal(err) } if res.SystemAccount != nil { // handle response } } ``` -------------------------------- ### Create Certificate Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/certificates/README.md Demonstrates how to create a certificate using the SDK. Ensure you replace placeholder values with your actual bearer token and certificate details. This example is relevant for scenarios involving DuplicateApiKey, InvalidAuthCred, and NoAPIKey, as the underlying API call is the same. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Certificates.CreateCertificate(ctx, "9524ec7d-36d9-465d-a8c5-83a3c9390458", components.Certificate{ Cert: "-----BEGIN CERTIFICATE-----\ncertificate-content\n-----END CERTIFICATE-----", ID: sdkkonnectgo.Pointer("b2f34145-0343-41a4-9602-4c69dec2f269"), Key: "-----BEGIN PRIVATE KEY-----\nprivate-key-content\n-----END PRIVATE KEY-----", }) if err != nil { log.Fatal(err) } if res.Certificate != nil { // handle response } } ``` -------------------------------- ### Get a Key using Go SDK Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/keys/README.md This example shows how to retrieve a key by its ID using the Konnect Go SDK. Replace placeholders with your actual bearer token, control plane ID, and key ID. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Keys.GetKey(ctx, "bba22c06-a632-42be-a018-1b9ff357b5b9", "9524ec7d-36d9-465d-a8c5-83a3c9390458") if err != nil { log.Fatal(err) } if res.Key != nil { // handle response } } ``` -------------------------------- ### Fetch Plugin Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/operations/getpluginresponse.md This snippet demonstrates how to fetch a Plugin's configuration using the Konnect Go SDK. ```APIDOC ## GET /plugins/{plugin_id} ### Description Fetches the details of a specific plugin configuration. ### Method GET ### Endpoint /plugins/{plugin_id} ### Parameters #### Path Parameters - **plugin_id** (string) - Required - The unique identifier of the plugin. ### Response #### Success Response (200) - **config** (object) - The configuration object for the plugin. - **enabled** (boolean) - Indicates if the plugin is enabled. - **id** (string) - The unique identifier of the plugin. - **name** (string) - The name of the plugin. - **partials** (array) - A list of partial configurations associated with the plugin. - **protocols** (array) - A list of protocols the plugin supports. #### Response Example ```json { "config": { "anonymous": null, "hide_credentials": false, "key_in_body": false, "key_in_header": true, "key_in_query": true, "key_names": [ "apikey" ], "run_on_preflight": true }, "enabled": true, "id": "3fd1eea1-885a-4011-b986-289943ff8177", "name": "key-auth", "partials": [ { "id": "cff1230a-00f7-4ae8-b376-c370f0eb4dae", "name": "foo-partial", "path": "config.redis" }, { "id": "129ee345-cba8-4e55-9d6d-93c223ff91ae", "name": "bar-partial", "path": "config.redis" } ], "protocols": [ "grpc", "grpcs", "http", "https" ] } ``` ``` -------------------------------- ### Go Example: Using and Customizing Tiers Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/components/tier.md Demonstrates how to import and use predefined tier constants like TierMicro. Custom tier values can be created by direct type casting. ```go import ( "github.com/Kong/sdk-konnect-go/models/components" ) value := components.TierMicro // Open enum: custom values can be created with a direct type cast custom := components.Tier("custom_value") ``` -------------------------------- ### Get CA Certificate using Go SDK Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/cacertificates/README.md This example shows how to retrieve a specific CA certificate by its ID using the Konnect Go SDK. It requires authentication with a bearer token and the certificate's ID. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.CACertificates.GetCaCertificate(ctx, "3c31f18a-f27a-4f9b-8cd4-bf841554612f", "9524ec7d-36d9-465d-a8c5-83a3c9390458") if err != nil { log.Fatal(err) } if res.CACertificate != nil { // handle response } } ``` -------------------------------- ### Add Developer to Portal Team (Bad Request Example) Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portalteammembership/README.md This Go snippet demonstrates how to add a developer to a portal team. It includes setup for the SDK client and the request payload. Replace '' with your actual token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.PortalTeamMembership.AddDeveloperToPortalTeam(ctx, operations.AddDeveloperToPortalTeamRequest{ PortalID: "f32d905a-ed33-46a3-a093-d8f536af9a8a", TeamID: "d32d905a-ed33-46a3-a093-d8f536af9a8a", AddDeveloperToTeamRequest: &components.AddDeveloperToTeamRequest{ ID: "df120cb4-f60b-47bc-a2f8-6a28e6a3c63b", }, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } } ``` -------------------------------- ### Create Portal with Auto Approve Settings Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portals/README.md This example demonstrates creating a portal with automatic approval enabled for both developers and applications. Replace '' with your token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Portals.CreatePortal(ctx, components.CreatePortal{ Name: "MyDevPortal", AutoApproveDevelopers: sdkkonnectgo.Pointer(true), AutoApproveApplications: sdkkonnectgo.Pointer(true), }) if err != nil { log.Fatal(err) } if res.PortalResponse != nil { // handle response } } ``` -------------------------------- ### Get DCR Provider Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/dcrproviders/README.md Retrieves a specific DCR provider by its ID. Handles different DCR provider types like Auth0, Azure AD, Curity, Okta, and HTTP. Ensure you have your bearer token configured. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.DCRProviders.GetDcrProvider(ctx, "5f9fd312-a987-4628-b4c5-bb4f4fddd5f7") if err != nil { log.Fatal(err) } if res.DcrProviderResponse != nil { switch res.DcrProviderResponse.Type { case components.DcrProviderResponseTypeAuth0: // res.DcrProviderResponse.DCRProviderAuth0DCRProviderAuth0 is populated case components.DcrProviderResponseTypeAzureAd: // res.DcrProviderResponse.DCRProviderAzureADDCRProviderAzureAD is populated case components.DcrProviderResponseTypeCurity: // res.DcrProviderResponse.DCRProviderCurityDCRProviderCurity is populated case components.DcrProviderResponseTypeOkta: // res.DcrProviderResponse.DCRProviderOKTADCRProviderOKTA is populated case components.DcrProviderResponseTypeHTTP: // res.DcrProviderResponse.DCRProviderHTTPDCRProviderHTTP is populated } } } ``` -------------------------------- ### Initialize SDK with Security Configuration Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/operations/option.md Use WithSecurity when initializing the SDK to configure authentication using provided security details. This is for static security configurations. ```go sdkkonnectgo.WithSecurity(/* ... */) ``` -------------------------------- ### Import and Use RolesDashboardsDescription Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/models/components/rolesdashboardsdescription.md Demonstrates how to import and use the RolesDashboardsDescription constant. Ensure the SDK is properly imported. ```go import ( "github.com/Kong/sdk-konnect-go/models/components" ) value := components.RolesDashboardsDescriptionAllowsUsersToEditDeleteAndShareADashboardInKonnectAnalytics ``` -------------------------------- ### Get MCP Server Configuration in Go Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/mcpservers/README.md This example shows how to retrieve the configuration for a specific MCP server using its ID. It requires a valid personal access token for authentication. Replace the placeholder ID with the actual server ID. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.MCPServers.GetMcpServerConfig(ctx, "1913c3b9-3d2d-47ed-978a-14b63dc661a3") if err != nil { log.Fatal(err) } if res.MCPServerInfo != nil { // handle response } } ``` -------------------------------- ### Create Portal Page Go Example Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/portalpages/README.md Demonstrates how to create a new portal page using the Kong Konnect Go SDK. Ensure you replace '' with your actual token. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.PortalPages.CreatePortalPage(ctx, "f32d905a-ed33-46a3-a093-d8f536af9a8a", components.CreatePortalPageRequest{ Slug: "/getting-started", Title: sdkkonnectgo.Pointer("Getting Started"), Content: "Welcome to the Getting Started page. This is where you can learn how to use our APIs.", Visibility: components.PageVisibilityStatusPublic.ToPointer(), Status: components.PublishedStatusPublished.ToPointer(), }) if err != nil { log.Fatal(err) } if res.PortalPageResponse != nil { // handle response } } ``` -------------------------------- ### Get Route with Service using Go SDK Source: https://github.com/kong/sdk-konnect-go/blob/main/docs/sdks/routes/README.md Retrieve a specific route associated with a service in Kong Konnect. This example shows how to initialize the SDK with security credentials and make the API call. The response handling differentiates between route types. ```go package main import( "context" "github.com/Kong/sdk-konnect-go/models/components" sdkkonnectgo "github.com/Kong/sdk-konnect-go" "github.com/Kong/sdk-konnect-go/models/operations" "log" ) func main() { ctx := context.Background() s := sdkkonnectgo.New( sdkkonnectgo.WithSecurity(components.Security{ PersonalAccessToken: sdkkonnectgo.Pointer(""), }), ) res, err := s.Routes.GetRouteWithService(ctx, operations.GetRouteWithServiceRequest{ ControlPlaneID: "9524ec7d-36d9-465d-a8c5-83a3c9390458", ServiceID: "7fca84d6-7d37-4a74-a7b0-93e576089a41", RouteID: "a4326a41-aa12-44e3-93e4-6b6e58bfb9d7", }) if err != nil { log.Fatal(err) } if res.Route != nil { switch res.Route.Type { case components.RouteUnionTypeRouteJSON: // res.Route.RouteJSON is populated case components.RouteUnionTypeRouteExpression: // res.Route.RouteExpression is populated } } } ```