An open API service indexing awesome lists of open source software.

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.

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 main

import (
"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` |