Documentation
¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func GetEnvVarOrDefault(key string, defaultValue string) string
- func IdToString(v *Id) string
- func Int(v int) *int
- func NewClient(config *Config) *kongAdminClient
- func String(v string) *string
- func StringSlice(src []string) []*string
- func StringValueSlice(src []*string) []string
- type ActiveHealthy
- type ActiveUnhealthy
- type Certificate
- type CertificateClient
- type CertificateRequest
- type Certificates
- type Config
- type Consumer
- type ConsumerClient
- type ConsumerPluginConfig
- type ConsumerPluginConfigs
- type ConsumerQueryString
- type ConsumerRequest
- type Consumers
- type Id
- type IpPort
- type KongAdminClient
- type PassiveHealthy
- type PassiveUnhealthy
- type Plugin
- type PluginClient
- type PluginQueryString
- type PluginRequest
- type Plugins
- type Route
- type RouteClient
- type RouteQueryString
- type RouteRequest
- type Routes
- type Service
- type ServiceClient
- type ServiceQueryString
- type ServiceRequest
- type Services
- type Sni
- type Snis
- type SnisClient
- type SnisRequest
- type Status
- type StatusClient
- type Target
- type TargetClient
- type TargetRequest
- type Targets
- type Upstream
- type UpstreamClient
- type UpstreamHealthCheck
- type UpstreamHealthCheckActive
- type UpstreamHealthCheckPassive
- type UpstreamRequest
- type Upstreams
- type Workspace
- type WorkspaceClient
- type WorkspaceEntities
- type WorkspaceEntitiesRequest
- type WorkspaceEntity
- type WorkspaceQueryString
- type WorkspaceRequest
- type Workspaces
Constants ¶
View Source
const CertificatesPath = "/certificates/"
View Source
const ConsumersPath = "/consumers/"
View Source
const EnvKongAdminHostAddress = "KONG_ADMIN_ADDR"
View Source
const EnvKongAdminPassword = "KONG_ADMIN_PASSWORD"
View Source
const EnvKongAdminToken = "KONG_ADMIN_TOKEN"
View Source
const EnvKongAdminUsername = "KONG_ADMIN_USERNAME"
View Source
const EnvKongApiKey = "KONG_API_KEY"
View Source
const EnvKongTLSSkipVerify = "TLS_SKIP_VERIFY"
View Source
const EnvKongWorkspace = "KONG_ADMIN_WORKSPACE"
View Source
const PluginsPath = "/plugins/"
View Source
const RoutesPath = "/routes/"
View Source
const ServicesPath = "/services/"
View Source
const SnisPath = "/snis/"
View Source
const TargetsPath = "/upstreams/%s/targets"
View Source
const UpstreamsPath = "/upstreams/"
View Source
const WorkspacesPath = "/workspaces/"
Variables ¶
This section is empty.
Functions ¶
func GetEnvVarOrDefault ¶
func IdToString ¶
func StringSlice ¶
func StringValueSlice ¶
Types ¶
type ActiveHealthy ¶
type ActiveUnhealthy ¶
type ActiveUnhealthy struct { HttpFailures int `json:"http_failures" yaml:"http_failures"` HttpStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"` Interval int `json:"interval" yaml:"interval"` TcpFailures int `json:"tcp_failures" yaml:"tcp_failures"` Timeouts int `json:"timeouts" yaml:"timeouts"` }
type Certificate ¶
type CertificateClient ¶
type CertificateClient interface { GetById(id string) (*Certificate, error) Create(certificateRequest *CertificateRequest) (*Certificate, error) DeleteById(id string) error List() (*Certificates, error) UpdateById(id string, certificateRequest *CertificateRequest) (*Certificate, error) }
type CertificateRequest ¶
type Certificates ¶
type Certificates struct { Results []*Certificate `json:"data,omitempty" yaml:"data,omitempty"` Total int `json:"total,omitempty" yaml:"total,omitempty"` }
type Config ¶
type Config struct { HostAddress string Username string Password string InsecureSkipVerify bool ApiKey string AdminToken string Workspace string }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type ConsumerClient ¶
type ConsumerClient interface { GetByUsername(username string) (*Consumer, error) GetById(id string) (*Consumer, error) Create(consumerRequest *ConsumerRequest) (*Consumer, error) List(query *ConsumerQueryString) ([]*Consumer, error) DeleteByUsername(username string) error DeleteById(id string) error UpdateByUsername(username string, consumerRequest *ConsumerRequest) (*Consumer, error) UpdateById(id string, consumerRequest *ConsumerRequest) (*Consumer, error) CreatePluginConfig(consumerId string, pluginName string, pluginConfig string) (*ConsumerPluginConfig, error) GetPluginConfig(consumerId string, pluginName string, id string) (*ConsumerPluginConfig, error) GetPluginConfigs(consumerId string, pluginName string) ([]map[string]interface{}, error) DeletePluginConfig(consumerId string, pluginName string, id string) error }
type ConsumerPluginConfig ¶
type ConsumerPluginConfigs ¶
type ConsumerQueryString ¶
type ConsumerRequest ¶
type Id ¶
type Id string
func (*Id) MarshalJSON ¶
func (*Id) MarshalYAML ¶
func (*Id) UnmarshalJSON ¶
func (*Id) UnmarshalYAML ¶
type IpPort ¶
func IpPortSliceSlice ¶
type KongAdminClient ¶
type KongAdminClient interface { Status() StatusClient Consumers() ConsumerClient Plugins() PluginClient Certificates() CertificateClient Snis() SnisClient Upstreams() UpstreamClient Routes() RouteClient Services() ServiceClient Targets() TargetClient Workspaces() WorkspaceClient }
type PassiveHealthy ¶
type PassiveUnhealthy ¶
type Plugin ¶
type Plugin struct { Id string `json:"id" yaml:"id"` Name string `json:"name" yaml:"name"` ConsumerId *Id `json:"consumer,omitempty" yaml:"consumer,omitempty"` ServiceId *Id `json:"service,omitempty" yaml:"service,omitempty"` RouteId *Id `json:"route,omitempty" yaml:"route,omitempty"` RunOn string `json:"run_on,omitempty" yaml:"run_on,omitempty"` Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"` Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` }
type PluginClient ¶
type PluginClient interface { GetById(id string) (*Plugin, error) List(query *PluginQueryString) ([]*Plugin, error) Create(pluginRequest *PluginRequest) (*Plugin, error) UpdateById(id string, pluginRequest *PluginRequest) (*Plugin, error) DeleteById(id string) error GetByConsumerId(id string) (*Plugins, error) GetByRouteId(id string) (*Plugins, error) GetByServiceId(id string) (*Plugins, error) }
type PluginQueryString ¶
type PluginRequest ¶
type PluginRequest struct { Name string `json:"name" yaml:"name"` ConsumerId *Id `json:"consumer" yaml:"consumer"` ServiceId *Id `json:"service" yaml:"service"` RouteId *Id `json:"route" yaml:"route"` RunOn string `json:"run_on,omitempty" yaml:"run_on,omitempty"` Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"` Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` }
type Route ¶
type Route struct { Id *string `json:"id" yaml:"id"` Name *string `json:"name" yaml:"name"` CreatedAt *int `json:"created_at" yaml:"created_at"` UpdatedAt *int `json:"updated_at" yaml:"updated_at"` Protocols []*string `json:"protocols" yaml:"protocols"` Methods []*string `json:"methods" yaml:"methods"` Hosts []*string `json:"hosts" yaml:"hosts"` Paths []*string `json:"paths" yaml:"paths"` RegexPriority *int `json:"regex_priority" yaml:"regex_priority"` StripPath *bool `json:"strip_path" yaml:"strip_path"` PreserveHost *bool `json:"preserve_host" yaml:"preserve_host"` Snis []*string `json:"snis" yaml:"snis"` Sources []*IpPort `json:"sources" yaml:"sources"` Destinations []*IpPort `json:"destinations" yaml:"destinations"` Service *Id `json:"service" yaml:"service"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type RouteClient ¶
type RouteClient interface { GetByName(name string) (*Route, error) GetById(id string) (*Route, error) Create(routeRequest *RouteRequest) (*Route, error) List(query *RouteQueryString) ([]*Route, error) GetRoutesFromServiceName(name string) ([]*Route, error) GetRoutesFromServiceId(id string) ([]*Route, error) UpdateByName(name string, routeRequest *RouteRequest) (*Route, error) UpdateById(id string, routeRequest *RouteRequest) (*Route, error) DeleteByName(name string) error DeleteById(id string) error }
type RouteQueryString ¶
type RouteRequest ¶
type RouteRequest struct { Name *string `json:"name" yaml:"name"` Protocols []*string `json:"protocols" yaml:"protocols"` Methods []*string `json:"methods" yaml:"methods"` Hosts []*string `json:"hosts" yaml:"hosts"` Paths []*string `json:"paths" yaml:"paths"` RegexPriority *int `json:"regex_priority" yaml:"regex_priority"` StripPath *bool `json:"strip_path" yaml:"strip_path"` PreserveHost *bool `json:"preserve_host" yaml:"preserve_host"` Snis []*string `json:"snis" yaml:"snis"` Sources []*IpPort `json:"sources" yaml:"sources"` Destinations []*IpPort `json:"destinations" yaml:"destinations"` Service *Id `json:"service" yaml:"service"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type Service ¶
type Service struct { Id *string `json:"id" yaml:"id"` CreatedAt *int `json:"created_at" yaml:"created_at"` UpdatedAt *int `json:"updated_at" yaml:"updated_at"` Protocol *string `json:"protocol" yaml:"protocol"` Host *string `json:"host" yaml:"host"` Port *int `json:"port" yaml:"port"` Path *string `json:"path" yaml:"path"` Name *string `json:"name" yaml:"name"` Retries *int `json:"retries" yaml:"retries"` ConnectTimeout *int `json:"connect_timeout" yaml:"connect_timeout"` WriteTimeout *int `json:"write_timeout" yaml:"write_timeout"` ReadTimeout *int `json:"read_timeout" yaml:"read_timeout"` Url *string `json:"url" yaml:"url"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type ServiceClient ¶
type ServiceClient interface { Create(serviceRequest *ServiceRequest) (*Service, error) GetServiceByName(name string) (*Service, error) GetServiceById(id string) (*Service, error) GetServiceFromRouteId(id string) (*Service, error) GetServices(query *ServiceQueryString) ([]*Service, error) UpdateServiceByName(name string, serviceRequest *ServiceRequest) (*Service, error) UpdateServiceById(id string, serviceRequest *ServiceRequest) (*Service, error) UpdateServicebyRouteId(id string, serviceRequest *ServiceRequest) (*Service, error) DeleteServiceByName(name string) error DeleteServiceById(id string) error }
type ServiceQueryString ¶
type ServiceRequest ¶
type ServiceRequest struct { Name *string `json:"name" yaml:"name"` Protocol *string `json:"protocol" yaml:"protocol"` Host *string `json:"host" yaml:"host"` Port *int `json:"port,omitempty" yaml:"port,omitempty"` Path *string `json:"path,omitempty" yaml:"path,omitempty"` Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"` ConnectTimeout *int `json:"connect_timeout,omitempty" yaml:"connect_timeout,omitempty"` WriteTimeout *int `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"` ReadTimeout *int `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"` Url *string `json:"url,omitempty" yaml:"url,omitempty"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type SnisClient ¶
type SnisRequest ¶
type Status ¶
type Status struct { Server serverStatus `json:"server" yaml:"server"` Database databaseStatus `json:"database" yaml:"database"` }
type StatusClient ¶
type Target ¶
type Target struct { Id *string `json:"id,omitempty" yaml:"id,omitempty"` CreatedAt *float32 `json:"created_at" yaml:"created_at"` Target *string `json:"target" yaml:"target"` Weight *int `json:"weight" yaml:"weight"` Upstream *Id `json:"upstream" yaml:"upstream"` Health *string `json:"health" yaml:"health"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type TargetClient ¶
type TargetClient interface { CreateFromUpstreamName(name string, targetRequest *TargetRequest) (*Target, error) CreateFromUpstreamId(id string, targetRequest *TargetRequest) (*Target, error) GetTargetsFromUpstreamName(name string) ([]*Target, error) GetTargetsFromUpstreamId(id string) ([]*Target, error) DeleteFromUpstreamByHostPort(upstreamNameOrId string, hostPort string) error DeleteFromUpstreamById(upstreamNameOrId string, id string) error SetTargetFromUpstreamByHostPortAsHealthy(upstreamNameOrId string, hostPort string) error SetTargetFromUpstreamByIdAsHealthy(upstreamNameOrId string, id string) error SetTargetFromUpstreamByHostPortAsUnhealthy(upstreamNameOrId string, hostPort string) error SetTargetFromUpstreamByIdAsUnhealthy(upstreamNameOrId string, id string) error GetTargetsWithHealthFromUpstreamName(name string) ([]*Target, error) GetTargetsWithHealthFromUpstreamId(id string) ([]*Target, error) }
type TargetRequest ¶
type Upstream ¶
type Upstream struct { Id string `json:"id,omitempty" yaml:"id,omitempty"` UpstreamRequest Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type UpstreamClient ¶
type UpstreamClient interface { GetByName(name string) (*Upstream, error) GetById(id string) (*Upstream, error) Create(upstreamRequest *UpstreamRequest) (*Upstream, error) DeleteByName(name string) error DeleteById(id string) error List() (*Upstreams, error) UpdateByName(name string, upstreamRequest *UpstreamRequest) (*Upstream, error) UpdateById(id string, upstreamRequest *UpstreamRequest) (*Upstream, error) }
type UpstreamHealthCheck ¶
type UpstreamHealthCheck struct { Active *UpstreamHealthCheckActive `json:"active,omitempty" yaml:"active,omitempty"` Passive *UpstreamHealthCheckPassive `json:"passive,omitempty" yaml:"passive,omitempty"` }
type UpstreamHealthCheckActive ¶
type UpstreamHealthCheckActive struct { Type string `json:"type,omitempty" yaml:"type,omitempty"` Concurrency int `json:"concurrency,omitempty" yaml:"concurrency,omitempty"` Healthy *ActiveHealthy `json:"healthy,omitempty" yaml:"healthy,omitempty"` HttpPath string `json:"http_path,omitempty" yaml:"http_path,omitempty"` HttpsVerifyCertificate bool `json:"https_verify_certificate" yaml:"https_verify_certificate"` HttpsSni *string `json:"https_sni,omitempty" yaml:"https_sni,omitempty"` Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"` Unhealthy *ActiveUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"` }
type UpstreamHealthCheckPassive ¶
type UpstreamHealthCheckPassive struct { Type string `json:"type,omitempty" yaml:"type,omitempty"` Healthy *PassiveHealthy `json:"healthy,omitempty yaml:"healthy,omitempty"` Unhealthy *PassiveUnhealthy `json:"unhealthy,omitempty yaml:"unhealthy,omitempty"` }
type UpstreamRequest ¶
type UpstreamRequest struct { Name string `json:"name" yaml:"name"` Slots int `json:"slots,omitempty" yaml:"slots,omitempty"` HashOn string `json:"hash_on,omitempty" yaml:"hash_on,omitempty"` HashFallback string `json:"hash_fallback,omitempty" yaml:"hash_fallback,omitempty"` HashOnHeader string `json:"hash_on_header,omitempty" yaml:"hash_on_header,omitempty"` HashFallbackHeader string `json:"hash_fallback_header,omitempty" yaml:"hash_fallback_header,omitempty"` HashOnCookie string `json:"hash_on_cookie,omitempty" yaml:"hash_on_cookie,omitempty"` HashOnCookiePath string `json:"hash_on_cookie_path,omitempty" yaml:"hash_on_cookie_path,omitempty"` HealthChecks *UpstreamHealthCheck `json:"healthchecks,omitempty" yaml:"healthchecks,omitempty"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type WorkspaceClient ¶
type WorkspaceClient interface { GetByName(name string) (*Workspace, error) Get(id string) (*Workspace, error) List(query *WorkspaceQueryString) ([]*Workspace, error) Create(workspaceRequest *WorkspaceRequest) (*Workspace, error) Update(workspaceRequest *WorkspaceRequest) (*Workspace, error) Delete() error ListEntities() ([]*WorkspaceEntity, error) DeleteMultipleEntitiesFromWorkspace(entityIds []string) error }
type WorkspaceEntities ¶
type WorkspaceEntities struct { Data []*WorkspaceEntity `json:"data" yaml:"data,omitempty"` Total int `json:"total,omitempty" yaml:"total,omitempty"` }
type WorkspaceEntitiesRequest ¶
type WorkspaceEntitiesRequest struct {
Entities *string `json:"entities" yaml:"entities"`
}
type WorkspaceEntity ¶
type WorkspaceEntity struct { WorkspaceId *string `json:"workspace_id" yaml:"workspace_id"` WorkspaceName *string `json:"workspace_name" yaml:"workspace_name"` EntityId *string `json:"entity_id" yaml:"entity_id"` EntityType *string `json:"entity_type" yaml:"entity_type"` UniqueFieldName *string `json:"unique_field_name" yaml:"unique_field_name"` UniqueFieldValue *string `json:"unique_field_value" yaml:"unique_field_value"` }
type WorkspaceQueryString ¶
type WorkspaceRequest ¶
type Workspaces ¶
Click to show internal directories.
Click to hide internal directories.