kong

package module
v0.0.0-...-5a3a4da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2017 License: MIT Imports: 3 Imported by: 0

README

Kong

About

Kong is a Go library for interacting with the Kong API management system.

Status

Work in progress. Several use cases work, but are missing extensive tests. Quick prototype used sling and should be removed in the near future.

License

MIT Licensed - see LICENSE.txt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Id           string `json:"id,omitempty"`
	CreatedAt    int    `json:"created_at,omitempty"`
	Name         string `json:"name,omitempty"`
	PreserveHost bool   `json:"preserve_host,omitempty"`
	Hosts        string `json:"hosts,omitempty"`
	Uris         string `json:"uris,omitempty"`
	StripUri     bool   `json:"strip_uri,omitempty"`
	UpstreamURL  string `json:"upstream_url"`
}

type APIList

type APIList struct {
	Data  []API  `json:"data"`
	Next  string `json:"next"`
	Total int    `json:"total"`
}

type APIService

type APIService struct {
	// contains filtered or unexported fields
}

func NewAPIService

func NewAPIService(httpClient *http.Client, baseUrl string) *APIService

func (*APIService) Add

func (s *APIService) Add(name, Hosts, Uris, upstreamURL string, stripUri, preserveHost bool) (*API, *http.Response, error)

func (*APIService) AddOrUpdate

func (s *APIService) AddOrUpdate(id, name, Hosts, Uris, upstreamURL string, stripUri, preserveHost bool, createdAt int) (*API, *http.Response, error)

func (*APIService) AddPlugin

func (s *APIService) AddPlugin(name string, plugin interface{}) (*http.Response, error)

func (*APIService) Delete

func (s *APIService) Delete(name string) (*http.Response, error)

func (*APIService) Get

func (s *APIService) Get(name string) (*API, *http.Response, error)

func (*APIService) List

func (s *APIService) List() (*APIList, *http.Response, error)

type Client

type Client struct {
	BaseURL         string
	NodeService     *NodeService
	ClusterService  *ClusterService
	APIService      *APIService
	ConsumerService *ConsumerService
}

Client is a tiny Kong client

func NewClient

func NewClient(httpClient *http.Client, baseUrl string) *Client

NewClient returns a new Client

type ClusterService

type ClusterService struct {
	// contains filtered or unexported fields
}

func NewClusterService

func NewClusterService(httpClient *http.Client, baseUrl string) *ClusterService

NewIssueService returns a new IssueService.

func (*ClusterService) Status

func (s *ClusterService) Status() (*ClusterStatus, *http.Response, error)

type ClusterStatus

type ClusterStatus struct {
	Data []struct {
		Address string `json:"address"`
		Name    string `json:"name"`
		Status  string `json:"status"`
	} `json:"data"`
	Total int `json:"total"`
}

type Consumer

type Consumer struct {
	CreatedAt int    `json:"created_at"`
	ID        string `json:"id"`
	CustomID  string `json:"custom_id"`
	Username  string `json:"username"`
}

type ConsumerList

type ConsumerList struct {
	Data  []Consumer `json:"data"`
	Next  string     `json:"next"`
	Total int        `json:"total"`
}

type ConsumerService

type ConsumerService struct {
	// contains filtered or unexported fields
}

func NewConsumerService

func NewConsumerService(httpClient *http.Client, baseUrl string) *ConsumerService

func (*ConsumerService) BasicAuth

func (s *ConsumerService) BasicAuth(cons, username, password string) (*Consumer, *http.Response, error)

func (*ConsumerService) Create

func (s *ConsumerService) Create(customID, username string) (*Consumer, *http.Response, error)

func (*ConsumerService) Get

func (s *ConsumerService) Get(name string) (*Consumer, *http.Response, error)

func (*ConsumerService) List

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Node

type Node struct {
	Configuration struct {
		AdminAPIListen string `json:"admin_api_listen"`
		Cassandra      struct {
			ContactPoints       []string `json:"contact_points"`
			DataCenters         struct{} `json:"data_centers"`
			Keyspace            string   `json:"keyspace"`
			ReplicationFactor   int      `json:"replication_factor"`
			ReplicationStrategy string   `json:"replication_strategy"`
			Ssl                 struct {
				Enabled bool `json:"enabled"`
				Verify  bool `json:"verify"`
			} `json:"ssl"`
			Timeout int `json:"timeout"`
		} `json:"cassandra"`
		Cluster struct {
			Auto_join bool   `json:"auto-join"`
			Profile   string `json:"profile"`
		} `json:"cluster"`
		ClusterListen    string   `json:"cluster_listen"`
		ClusterListenRPC string   `json:"cluster_listen_rpc"`
		CustomPlugins    struct{} `json:"custom_plugins"`
		DaoConfig        struct {
			ContactPoints       []string `json:"contact_points"`
			DataCenters         struct{} `json:"data_centers"`
			Keyspace            string   `json:"keyspace"`
			ReplicationFactor   int      `json:"replication_factor"`
			ReplicationStrategy string   `json:"replication_strategy"`
			Ssl                 struct {
				Enabled bool `json:"enabled"`
				Verify  bool `json:"verify"`
			} `json:"ssl"`
			Timeout int `json:"timeout"`
		} `json:"dao_config"`
		Database    string `json:"database"`
		DNSResolver struct {
			Address string `json:"address"`
			Dnsmasq bool   `json:"dnsmasq"`
			Port    int    `json:"port"`
		} `json:"dns_resolver"`
		DNSResolversAvailable struct {
			Dnsmasq struct {
				Port int `json:"port"`
			} `json:"dnsmasq"`
			Server struct {
				Address string `json:"address"`
			} `json:"server"`
		} `json:"dns_resolvers_available"`
		MemoryCacheSize      int      `json:"memory_cache_size"`
		Nginx                string   `json:"nginx"`
		NginxWorkingDir      string   `json:"nginx_working_dir"`
		PidFile              string   `json:"pid_file"`
		Plugins              []string `json:"plugins"`
		ProxyListen          string   `json:"proxy_listen"`
		ProxyListenSsl       string   `json:"proxy_listen_ssl"`
		SendAnonymousReports bool     `json:"send_anonymous_reports"`
	} `json:"configuration"`
	Hostname   string `json:"hostname"`
	LuaVersion string `json:"lua_version"`
	Plugins    struct {
		AvailableOnServer []string `json:"available_on_server"`
		EnabledInCluster  []string `json:"enabled_in_cluster"`
	} `json:"plugins"`
	Tagline string `json:"tagline"`
	Version string `json:"version"`
}

type NodeService

type NodeService struct {
	// contains filtered or unexported fields
}

IssueService provides methods for creating and reading issues.

func NewNodeService

func NewNodeService(httpClient *http.Client, baseUrl string) *NodeService

NewIssueService returns a new IssueService.

func (*NodeService) Information

func (s *NodeService) Information() (*Node, *http.Response, error)

func (*NodeService) Status

func (s *NodeService) Status() (*NodeStatus, *http.Response, error)

type NodeStatus

type NodeStatus struct {
	Database struct {
		Acls                        int `json:"acls"`
		Apis                        int `json:"apis"`
		BasicauthCredentials        int `json:"basicauth_credentials"`
		Consumers                   int `json:"consumers"`
		HmacauthCredentials         int `json:"hmacauth_credentials"`
		JwtSecrets                  int `json:"jwt_secrets"`
		KeyauthCredentials          int `json:"keyauth_credentials"`
		Nodes                       int `json:"nodes"`
		Oauth2AuthorizationCodes    int `json:"oauth2_authorization_codes"`
		Oauth2Credentials           int `json:"oauth2_credentials"`
		Oauth2Tokens                int `json:"oauth2_tokens"`
		Plugins                     int `json:"plugins"`
		RatelimitingMetrics         int `json:"ratelimiting_metrics"`
		ResponseRatelimitingMetrics int `json:"response_ratelimiting_metrics"`
	} `json:"database"`
	Server struct {
		ConnectionsAccepted int `json:"connections_accepted"`
		ConnectionsActive   int `json:"connections_active"`
		ConnectionsHandled  int `json:"connections_handled"`
		ConnectionsReading  int `json:"connections_reading"`
		ConnectionsWaiting  int `json:"connections_waiting"`
		ConnectionsWriting  int `json:"connections_writing"`
		TotalRequests       int `json:"total_requests"`
	} `json:"server"`
}

type RequestTransformer

type RequestTransformer struct {
	Name               string `url:"name"`
	ConsumerId         string `url:"consumer_id,omitempty"`
	RemoveHeaders      string `url:"config.remove.headers,omitempty"`
	RemoveQuerystring  string `url:"config.remove.querystring,omitempty"`
	RemoveBody         string `url:"config.remove.body,omitempty"`
	ReplaceHeaders     string `url:"config.replace.headers,omitempty"`
	ReplaceQuerystring string `url:"config.replace.querystring,omitempty"`
	ReplaceBody        string `url:"config.replace.body,omitempty"`
	AddHeaders         string `url:"config.add.headers,omitempty"`
	AddQuerystring     string `url:"config.add.querystring,omitempty"`
	AddBody            string `url:"config.add.body,omitempty"`
	AppendHeaders      string `url:"config.append.headers,omitempty"`
	AppendQuerystring  string `url:"config.append.querystring,omitempty"`
	AppendBody         string `url:"config.append.body,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL