Documentation
¶
Index ¶
- type Api
- type ApiList
- type ApiRequestParams
- type Plugin
- type PluginList
- type PluginRequestParams
- type ServiceDefinition
- func (p *ServiceDefinition) ApisIndexed() (map[interface{}]interface{}, error)
- func (p *ServiceDefinition) Diff(other ServiceDefinition) (ServiceDefinitionDiff, error)
- func (p *ServiceDefinition) Marshal() (string, error)
- func (p *ServiceDefinition) PluginsIndexed() (map[interface{}]interface{}, error)
- type ServiceDefinitionDiff
- type ServiceDefinitionFile
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" yaml:"-"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Uris interface{} `json:"uris,omitempty" yaml:"uris,omitempty"`
Hosts interface{} `json:"hosts,omitempty" yaml:"hosts,omitempty"`
Methods interface{} `json:"methods,omitempty" yaml:"methods,omitempty"`
PreserveHost bool `json:"preserve_host" yaml:"preserve_host,omitempty"`
StripUri bool `json:"strip_uri" yaml:"strip_uri,omitempty"`
UpstreamUrl string `json:"upstream_url,omitempty" yaml:"upstream_url,omitempty"`
UpstreamConnectTimeout int `json:"upstream_connect_timeout,omitempty" yaml:"upstream_connect_timeout,omitempty"`
UpstreamReadTimeout int `json:"upstream_read_timeout,omitempty" yaml:"upstream_read_timeout,omitempty"`
UpstreamSendTimeout int `json:"upstream_send_timeout,omitempty" yaml:"upstream_send_timeout,omitempty"`
HttpIfTerminated bool `json:"http_if_terminated" yaml:"http_if_terminated,omitempty"`
HttpsOnly bool `json:"https_only" yaml:"https_only,omitempty"`
Retries int `json:"retries,omitempty" yaml:"retries,omitempty"`
CreatedAt int `json:"created_at,omitempty" yaml:"-"`
}
Api represent the Api object we'll get back from the Kong API whenever we make a request.
type ApiList ¶
type ApiList struct {
Total int `json:"total"`
Data []*Api `json:"data"`
Next string `json:"next"`
}
ApiList is an object which represents the response we'll get when we're fetching a list of Apis.
type ApiRequestParams ¶
type ApiRequestParams struct {
ID string `url:"id,omitempty"`
Name string `url:"name,omitempty"`
UpstreamUrl string `url:"upstream_url,omitempty"`
Retries int `url:"retries,omitempty"`
Size int `url:"size_id,omitempty"`
Offset int `url:"offset_id,omitempty"`
}
ApiRequestParams allows us to pass in a query string of parameters to some of the Api requests.
func (*ApiRequestParams) Identifier ¶
func (arp *ApiRequestParams) Identifier() (string, error)
Identifier should grab the identifier we've passed into our request params, favouring the ID over the name.
type Plugin ¶
type Plugin struct {
ID string `json:"id,omitempty" yaml:"-"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
ApiID string `json:"api_id,omitempty" yaml:"api_id,omitempty"`
ConsumerID string `json:"consumer_id,omitempty" yaml:"consumer_id,omitempty"`
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
CreatedAt int `json:"-" yaml:"-"`
ConfigPath string `json:"config.path,omitempty" yaml:"config.path,omitempty"`
ConfigWhitelist string `json:"config.whitelist,omitempty" yaml:"config.whitelist,omitempty"`
}
Plugin represent the Plugin object we'll get back from the Kong API whenever we make a request.
type PluginList ¶
type PluginList struct {
Total int `json:"total"`
Data []*Plugin `json:"data"`
Next string `json:"next"`
}
PluginList is an object which represents the response we'll get when we're fetching a list of Plugins.
func (*PluginList) FilterData ¶
func (pl *PluginList) FilterData(f func(Plugin) bool) []Plugin
FilterData allows you to provide a filter callback to fetch a new filtered sub-set of the Data
type PluginRequestParams ¶
type PluginRequestParams struct {
ID string `url:"id,omitempty"`
Name string `url:"name,omitempty"`
ApiID string `url:"api_id,omitempty"`
ConsumerID string `url:"consumer_id,omitempty"`
Size int `url:"size_id,omitempty"`
Offset int `url:"offset_id,omitempty"`
}
PluginRequestParams allows us to pass in a query string of parameters to some of the plugin requests.
func (*PluginRequestParams) Identifier ¶
func (prp *PluginRequestParams) Identifier() (string, error)
Identifier should grab the identifier we've passed into our request params, favouring the ID over the name.
type ServiceDefinition ¶
The ServiceDefinition represents the struct we'll get once we've unmarshaled a yaml file, we can also create these when we want to compare what we get from Kong with what we've got in files.
func (*ServiceDefinition) ApisIndexed ¶
func (p *ServiceDefinition) ApisIndexed() (map[interface{}]interface{}, error)
ApisIndexed will returbn a list of the Apis indexed by the name of the API.
func (*ServiceDefinition) Diff ¶
func (p *ServiceDefinition) Diff(other ServiceDefinition) (ServiceDefinitionDiff, error)
Diff should return the differences between the two parsed Yaml files. We should get a list of Additions, Deletions & Updates for each of the resources.
func (*ServiceDefinition) Marshal ¶
func (p *ServiceDefinition) Marshal() (string, error)
Marshal converts this object into a yaml string, this way we can create these "parsed" yaml file objects programatically and then output them as a yaml string.
func (*ServiceDefinition) PluginsIndexed ¶
func (p *ServiceDefinition) PluginsIndexed() (map[interface{}]interface{}, error)
PluginsIndexed will returbn a list of the Plugins indexed by the name of the Plugin.
type ServiceDefinitionDiff ¶
The ServiceDefinitionDiff stores a MapDiff for each resource type, this should give us an indication of the differences between our local config & the Kong service config
type ServiceDefinitionFile ¶
type ServiceDefinitionFile struct {
Name string
}
The ServiceDefinitionFile struct will represent a new file that we need to Parse
func (*ServiceDefinitionFile) Unmarshal ¶
func (u *ServiceDefinitionFile) Unmarshal() (*ServiceDefinition, error)
Unmarshal reads a yaml file & unmarshals it into a map so we can easily interact with it