kong

package
v0.3.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupName      = "platform.koli.io"
	ResourceKind   = "Domain"
	ResourcePlural = "domains"
)
View Source
const (
	Finalizer = "kolihub.io/kong"
)

Variables

View Source
var (
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
	ResourceName       = ResourcePlural + "." + GroupName
)
View Source
var (
	// SchemeBuilder collects functions that add things to a scheme. It's to allow
	// code to compile without explicitly referencing generated types. You should
	// declare one in each package that will have generated deep copy or conversion
	// functions.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme applies all the stored functions to the scheme. A non-nil error
	// indicates that one function failed and the attempt was abandoned.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type API

type API struct {
	UID          string    `json:"id,omitempty"`
	Name         string    `json:"name,omitempty"`
	Hosts        []string  `json:"hosts,omitempty"`
	URIs         []string  `json:"uris,omitempty"`
	PreserveHost bool      `json:"preserve_host"`
	UpstreamURL  string    `json:"upstream_url"`
	CreatedAt    Timestamp `json:"created_at,omitempty"`
	StripUri     bool      `json:"strip_uri"`
}

API represents a kong api object ref: https://getkong.org/docs/0.10.x/admin-api/#api-object

type APIGetter

type APIGetter interface {
	API() APIInterface
}

APIGetter has a method to return an ApiInterface A group's client should implement this interface.

type APIInterface

type APIInterface interface {
	List(params url.Values) (*APIList, error)
	ListByRegexp(params url.Values, pattern string) (*APIList, error)
	Get(name string) (*API, *APIResponse)
	UpdateOrCreate(data *API) (*API, *APIResponse)
	Delete(nameOrID string) error
}

APIInterface has methods to work with Kong Endpoints ref: https://getkong.org/docs/0.9.x/admin-api/#api-object

type APIList

type APIList struct {
	Total    int    `json:"total"`
	Items    []API  `json:"data"`
	NextPage string `json:"next"`
	Offset   string `json:"offset"`
}

APIList is a list of API's ref: https://getkong.org/docs/0.10.x/admin-api/#list-apis

type APIResponse

type APIResponse struct {
	StatusCode int
	Raw        []byte
	// contains filtered or unexported fields
}

APIResponse contains the response from an API call

func (*APIResponse) Error

func (r *APIResponse) Error() error

func (*APIResponse) String

func (r *APIResponse) String() string

type CoreClient

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

CoreClient is used to interact with features provided by the Core group.

func NewKongRESTClient

func NewKongRESTClient(c *rest.Config) (*CoreClient, error)

NewKongRESTClient generates a new *rest.Interface to communicate with the Kong Admin API

func (*CoreClient) API

func (c *CoreClient) API() APIInterface

func (*CoreClient) Plugin

func (c *CoreClient) Plugin(apiNameOrID string) PluginInterface

func (*CoreClient) RESTClient

func (c *CoreClient) RESTClient() rest.Interface

RESTClient returns a RESTClient that is used to communicate with API server by this client implementation.

type CoreInterface

type CoreInterface interface {
	RESTClient() rest.Interface

	APIGetter
	PluginGetter
}

type Domain

type Domain struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DomainSpec   `json:"spec"`
	Status DomainStatus `json:"status"`
}

func (*Domain) DeepCopy

func (in *Domain) DeepCopy() *Domain

func (*Domain) DeepCopyInto

func (in *Domain) DeepCopyInto(out *Domain)

func (*Domain) DeepCopyObject

func (in *Domain) DeepCopyObject() runtime.Object

func (*Domain) GetDomain

func (d *Domain) GetDomain() string

func (*Domain) GetDomainType

func (d *Domain) GetDomainType() string

GetDomainType returns the type of the resource: 'primary' or 'shared'

func (*Domain) GetPrimaryDomain

func (d *Domain) GetPrimaryDomain() string

GetPrimaryDomain returns the primary domain of the resource

func (*Domain) HasKongFinalizer

func (d *Domain) HasKongFinalizer() bool

HasKongFinalizer verify if the kong finalizer is set on the resource

func (*Domain) IsMarkedForDeletion

func (d *Domain) IsMarkedForDeletion() bool

IsMarkedForDeletion validates if the resource is set for deletion

func (*Domain) IsPrimary

func (d *Domain) IsPrimary() bool

IsPrimary validates if it's a primary domain

func (*Domain) IsUpdateExpired

func (c *Domain) IsUpdateExpired(expireAfter time.Duration) bool

IsUpdateExpired validates if the last update of the resource is expired

func (*Domain) IsValidDomain

func (d *Domain) IsValidDomain() bool

func (*Domain) IsValidSharedDomain

func (d *Domain) IsValidSharedDomain() bool

IsValidSharedDomain verifies if the shared domain it's a subdomain from the primary

type DomainList

type DomainList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []Domain `json:"items"`
}

func (*DomainList) DeepCopy

func (in *DomainList) DeepCopy() *DomainList

func (*DomainList) DeepCopyInto

func (in *DomainList) DeepCopyInto(out *DomainList)

func (*DomainList) DeepCopyObject

func (in *DomainList) DeepCopyObject() runtime.Object

type DomainPhase

type DomainPhase string

DomainPhase is a label for the condition of a domain at the current time.

const (
	// DomainStatusNew means it's a new resource and the phase it's not set
	DomainStatusNew DomainPhase = ""
	// DomainStatusOK means the domain doesn't have no pending operations or prohibitions,
	// and new ingresses could be created using the target domain.
	DomainStatusOK DomainPhase = "OK"
	// DomainStatusPending indicates that a request to create a new domain
	// has been received and is being processed.
	DomainStatusPending DomainPhase = "Pending"
	// DomainStatusFailed means the resource has failed on claiming the domain
	DomainStatusFailed DomainPhase = "Failed"
)

type DomainSpec

type DomainSpec struct {
	// PrimaryDomain is the name of the primary domain, to set the resource as primary,
	// 'name' and 'primary' must have the same value.
	// +required
	PrimaryDomain string `json:"primary"`
	// Sub is the label of the Primary Domain to form a subdomain
	// +optional
	Sub string `json:"sub,omitempty"`
	// Delegates contains a list of namespaces that are allowed to use this domain.
	// New domain resources could be referenced to primary ones using the 'parent' key.
	// A wildcard ("*") allows delegate access to all namespaces in the cluster.
	// +optional
	Delegates []string `json:"delegates,omitempty"`
	// Parent refers to the namespace where the primary domain is in.
	// It only makes sense when the type of the domain is set to 'shared',
	// +optional
	Parent string `json:"parent,omitempty"`
}

DomainSpec represents information about a domain claim

func (*DomainSpec) DeepCopy

func (in *DomainSpec) DeepCopy() *DomainSpec

func (*DomainSpec) DeepCopyInto

func (in *DomainSpec) DeepCopyInto(out *DomainSpec)

type DomainStatus

type DomainStatus struct {
	// The state of the domain, an empty state means it's a new resource
	// +optional
	Phase DomainPhase `json:"phase,omitempty"`
	// A human readable message indicating details about why the domain claim is in this state.
	// +optional
	Message string `json:"message,omitempty"`
	// A brief CamelCase message indicating details about why the domain claim is in this state. e.g. 'AlreadyClaimed'
	// +optional
	Reason string `json:"reason,omitempty"`
	// The last time the resource was updated
	LastUpdateTime time.Time `json:"lastUpdateTime,omitempty"`
	// DeletionTimestamp it's a temporary field to work around the issue:
	// https://github.com/kubernetes/kubernetes/issues/40715, once it's solved,
	// remove this field and use the DeletionTimestamp from metav1.ObjectMeta
	DeletionTimestamp *metav1.Time `json:"deletionTimestamp,omitempty"`
}

DomainStatus represents information about the status of a domain.

func (*DomainStatus) DeepCopy

func (in *DomainStatus) DeepCopy() *DomainStatus

func (*DomainStatus) DeepCopyInto

func (in *DomainStatus) DeepCopyInto(out *DomainStatus)

type KongVersion

type KongVersion struct {
	Major int
	Minor int
	Patch int
}

KongVersion represents the semantic version of a kong node

func (*KongVersion) String

func (k *KongVersion) String() string

String returns the string representation of the KongVersion struct

type Plugin

type Plugin struct {
	UID        string       `json:"id,omitempty"`
	APIUID     string       `json:"api_id,omitempty"`
	Name       PluginName   `json:"name"`
	ConsumerID string       `json:"consumer_id,omitempty"`
	Config     PluginSchema `json:"config"`
	Enabled    bool         `json:"enabled,omitempty"`
	CreatedAt  Timestamp    `json:"created_at,omitempty"`
}

Plugin represents a kong plugin object ref: https://getkong.org/docs/0.10.x/admin-api/#plugin-object

type PluginGetter

type PluginGetter interface {
	Plugin() PluginInterface
}

PluginGetter has a method to return an PluginInterface A group's client should implement this interface.

type PluginInterface

type PluginInterface interface {
	List(selector fields.Selector) (*PluginList, error)
	Get(pluginID string) (*Plugin, error)
	UpdateOrCreate(data *Plugin) (*Plugin, error)
	Delete(pluginID string) error
}

PluginInterface has methods to work with Kong Endpoints ref: https://getkong.org/docs/0.9.x/admin-api/#api-object

type PluginList

type PluginList struct {
	Total    int      `json:"total"`
	Items    []Plugin `json:"data"`
	NextPage string   `json:"next"`
}

PluginList is a list of plugins ref: https://getkong.org/docs/0.10.x/admin-api/#list-all-plugins

type PluginName

type PluginName string

PluginName is an installed plugin on kong ref: https://getkong.org/plugins/

type PluginSchema

type PluginSchema map[string]interface{}

PluginSchema holds the specification of a plugin

type Timestamp

type Timestamp int64

func (Timestamp) GetTime

func (t Timestamp) GetTime() time.Time

Retrieve the creation timestamp in time.Time

Jump to

Keyboard shortcuts

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