https://github.com/hunter-ji/kong-gateway-go-sdk
Use golang to encapsulate kong gateway api.
https://github.com/hunter-ji/kong-gateway-go-sdk
gateway-api golang kong kong-api kong-api-gateway kong-gateway sdk sdk-go
Last synced: about 2 months ago
JSON representation
Use golang to encapsulate kong gateway api.
- Host: GitHub
- URL: https://github.com/hunter-ji/kong-gateway-go-sdk
- Owner: hunter-ji
- License: mit
- Created: 2020-12-03T05:18:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-10T14:00:00.000Z (over 4 years ago)
- Last Synced: 2025-02-15T14:23:09.513Z (3 months ago)
- Topics: gateway-api, golang, kong, kong-api, kong-api-gateway, kong-gateway, sdk, sdk-go
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kong-gateway-go-sdk
## Intro
Use the api of kong gateway encapsulated by golang.The function is under development.
## Usage
```go
package mainimport (
"os"gatewayGoSdk "github.com/Kuari/kong-gateway-go-sdk"
)func main() {
// Connect the gateway
client := gatewayGoSdk.Connect(os.Getenv("KONG_URL"))// Add a Service
err := client.Services(&gatewayGoSdk.Services{Name: "example_service", Url: "http://mockbin.org"}).Add()
if err != nil {
panic("Failed to add services.")
}// Add a Route
err = client.Route(&gatewayGoSdk.Route{
Name: "mocking", Paths: []string{"/mock"}, Service: map[string]string{"name": "mockServices"}}).Add()
if err != nil {
panic("Failed to add route.")
}// Add a Consumer
err = client.Consumer(&gatewayGoSdk.Consumer{Username: "tom", CustomId: "tom_id"}).Add()
if err != nil {
panic("Failed to add consumer.")
}}
```## Features
The currently completed functions are as follows:
| Module | Method |
| ----------------------- | --------------------- |
| Services | `Add` |
| Consumer | `Add` |
| PluginKeyAuthentication | `CreateKey`、`DelKey` |