konnect

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KonnectManagedPluginTag is used by Konnect to tag internally-managed plugins
	KonnectManagedPluginTag = "konnect-managed-plugin"
)

Variables

This section is empty.

Functions

func BaseURL

func BaseURL() string

func CreateConsumerGroup added in v1.17.0

func CreateConsumerGroup(ctx context.Context, client *kong.Client, entity interface{}) (*kong.ConsumerGroup, error)

func CreateConsumerGroupMember added in v1.17.0

func CreateConsumerGroupMember(
	ctx context.Context, client *kong.Client, cgID, consumer *string,
) error

func CreateRateLimitingAdvancedPlugin added in v1.17.0

func CreateRateLimitingAdvancedPlugin(
	ctx context.Context, client *kong.Client, cgID *string, config kong.Configuration,
) (*kong.ConsumerGroupRLA, error)

func DeleteConsumerGroup added in v1.17.0

func DeleteConsumerGroup(
	ctx context.Context, client *kong.Client, cgID *string,
) error

DeleteConsumerGroup deletes a ConsumerGroup in Kong

func DeleteConsumerGroupMember added in v1.17.0

func DeleteConsumerGroupMember(
	ctx context.Context, client *kong.Client, cgID, consumer *string,
) error

func DeleteRateLimitingAdvancedPlugin added in v1.17.0

func DeleteRateLimitingAdvancedPlugin(
	ctx context.Context, client *kong.Client, cgID *string,
) error

DeleteRateLimitingAdvancedPlugin deletes a ConsumerGroup plugin in Kong

func GetConsumerGroup added in v1.17.0

func GetConsumerGroup(ctx context.Context,
	client *kong.Client, nameOrID *string,
) (*kong.ConsumerGroup, error)

GetConsumerGroup fetches a ConsumerGroup from Konnect.

func GetConsumerGroupObject added in v1.17.0

func GetConsumerGroupObject(ctx context.Context,
	client *kong.Client, cgID *string,
) (*kong.ConsumerGroupObject, error)

GetConsumerGroupObject Get fetches a ConsumerGroup from Kong.

func GetConsumerGroupRateLimitingAdvancedPlugin added in v1.17.0

func GetConsumerGroupRateLimitingAdvancedPlugin(
	ctx context.Context, client *kong.Client, cgID *string,
) (*kong.ConsumerGroupPlugin, error)

GetConsumerGroupRateLimitingAdvancedPlugin fetches the RLA override for a ConsumerGroup from Konnect.

func IsNotFoundErr

func IsNotFoundErr(e error) bool

IsNotFoundErr returns true if the error or it's cause is a 404 response from Kong.

func IsUnauthorizedErr added in v1.12.0

func IsUnauthorizedErr(e error) bool

IsUnauthorizedErr returns true if the error or it's cause is a 401 response from Konnect.

func ListAllConsumerGroupMembers added in v1.17.0

func ListAllConsumerGroupMembers(
	ctx context.Context, client *kong.Client, cgID *string,
) ([]*kong.Consumer, error)

ListAllConsumerGroupMembers fetches all ConsumerGroups members from Konnect.

func ListAllConsumerGroups added in v1.17.0

func ListAllConsumerGroups(ctx context.Context, client *kong.Client, tags []*string) ([]*kong.ConsumerGroup, error)

ListAll fetches all ConsumerGroup in Kong.

func UpdateConsumerGroup added in v1.17.2

func UpdateConsumerGroup(ctx context.Context, client *kong.Client,
	cgID *string, entity interface{},
) (*kong.ConsumerGroup, error)

func UpdateConsumerGroupMember added in v1.17.2

func UpdateConsumerGroupMember(
	ctx context.Context, client *kong.Client, cgID, consumer *string,
) error

func UpdateRateLimitingAdvancedPlugin added in v1.17.0

func UpdateRateLimitingAdvancedPlugin(
	ctx context.Context, client *kong.Client, cgID *string, config kong.Configuration,
) (*kong.ConsumerGroupRLA, error)

Types

type APIError

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

APIError is used for Kong Admin API errors.

func (*APIError) Code

func (e *APIError) Code() int

Code returns the HTTP status code for the error.

func (*APIError) Error

func (e *APIError) Error() string

type AuthResponse

type AuthResponse struct {
	Name           string `json:"name"`
	OrganizationID string `json:"org_id"`

	// deprecated fields
	Organization string `json:"org_name"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	FullName     string `json:"full_name"`
}

AuthResponse is authentication response wrapper for login.

type AuthService

type AuthService service

func (*AuthService) Login

func (s *AuthService) Login(ctx context.Context, email,
	password string,
) (AuthResponse, error)

func (*AuthService) LoginV2 added in v1.12.0

func (s *AuthService) LoginV2(ctx context.Context, email,
	password, token string,
) (AuthResponse, error)

func (*AuthService) OrgUserInfo added in v1.18.0

func (s *AuthService) OrgUserInfo(ctx context.Context) (*OrgUserInfo, error)

type Client

type Client struct {
	Auth                  *AuthService
	ServicePackages       *ServicePackageService
	ServiceVersions       *ServiceVersionService
	Documents             *DocumentService
	ControlPlanes         *ControlPlaneService
	ControlPlaneRelations *ControlPlaneRelationsService

	RuntimeGroups *RuntimeGroupService
	// contains filtered or unexported fields
}

Client talks to the Konnect API.

func NewClient

func NewClient(httpClient *http.Client, opts ClientOpts) (*Client, error)

NewClient returns a Client which talks to Konnect's API.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do executes a HTTP request and returns a response

func (*Client) NewRequest

func (c *Client) NewRequest(method, endpoint string, qs interface{},
	body interface{},
) (*http.Request, error)

NewRequest creates a request based on the inputs. endpoint should be relative to the baseURL specified during client creation. body is always marshaled into JSON.

func (*Client) SetControlPlaneID

func (c *Client) SetControlPlaneID(cpID string)

SetControlPlaneID sets the kong control-plane ID in the client. This is used to inject the control-plane ID in requests as needed.

func (*Client) SetDebugMode

func (c *Client) SetDebugMode(enableDebug bool)

SetDebugMode enables or disables logging of the request to the logger set by SetLogger(). By default, debug logging is disabled.

func (*Client) SetLogger

func (c *Client) SetLogger(w io.Writer)

SetLogger sets the debug logger, defaults to os.StdErr

func (*Client) SetRuntimeGroupID added in v1.12.0

func (c *Client) SetRuntimeGroupID(rgID string)

SetControlPlaneID sets the konnect runtime-group ID in the client.

type ClientOpts added in v1.7.0

type ClientOpts struct {
	BaseURL string
}

ClientOpts contains configuration options for a new Client.

type ControlPlane

type ControlPlane struct {
	ID   *string           `json:"id"`
	Type *ControlPlaneType `json:"type"`
}

ControlPlane identifies a specific control plane in Konnect. +k8s:deepcopy-gen=true

func (*ControlPlane) DeepCopy

func (in *ControlPlane) DeepCopy() *ControlPlane

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlane.

func (*ControlPlane) DeepCopyInto

func (in *ControlPlane) DeepCopyInto(out *ControlPlane)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ControlPlaneRelationsService

type ControlPlaneRelationsService service

func (*ControlPlaneRelationsService) Create

Create creates a ControlPlaneServiceRelation in Konnect.

func (*ControlPlaneRelationsService) Delete

func (s *ControlPlaneRelationsService) Delete(ctx context.Context,
	relationID *string,
) error

Delete deletes a ControlPlaneServiceRelation in Konnect.

func (*ControlPlaneRelationsService) List

List fetches a list of control_plane_service_relations.

func (*ControlPlaneRelationsService) ListAll

ListAll fetches all control_plane_service_relations.

func (ControlPlaneRelationsService) Update

Update updates a ControlPlaneServiceRelation in Konnect.

type ControlPlaneService

type ControlPlaneService service

func (*ControlPlaneService) List

func (s *ControlPlaneService) List(ctx context.Context,
	opt *ListOpt,
) ([]ControlPlane, *ListOpt, error)

List fetches a list of control planes. No pagination is being performed because the number of control planes is expected to be very small.

type ControlPlaneServiceRelation

type ControlPlaneServiceRelation struct {
	ID                   *string       `json:"id,omitempty"`
	ControlPlaneEntityID *string       `json:"control_plane_entity_id,omitempty"`
	ControlPlane         *ControlPlane `json:"control_plane,omitempty"`
}

ControlPlaneServiceRelation represents relationship between Control plane implementation and a Service version. +k8s:deepcopy-gen=true

func (*ControlPlaneServiceRelation) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneServiceRelation.

func (*ControlPlaneServiceRelation) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ControlPlaneServiceRelationCreateRequest

type ControlPlaneServiceRelationCreateRequest struct {
	ServiceVersionID     string `json:"service_version"`
	ControlPlaneEntityID string `json:"control_plane_entity_id"`
	ControlPlane         string `json:"control_plane"`
}

type ControlPlaneServiceRelationUpdateRequest

type ControlPlaneServiceRelationUpdateRequest struct {
	ID string
	ControlPlaneServiceRelationCreateRequest
}

type ControlPlaneType

type ControlPlaneType struct {
	Name *string `json:"name"`
}

ControlPlaneType represents control plane associated information. +k8s:deepcopy-gen=true

func (*ControlPlaneType) DeepCopy

func (in *ControlPlaneType) DeepCopy() *ControlPlaneType

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneType.

func (*ControlPlaneType) DeepCopyInto

func (in *ControlPlaneType) DeepCopyInto(out *ControlPlaneType)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Document added in v1.7.0

type Document struct {
	ID        *string      `json:"id,omitempty"`
	Path      *string      `json:"path,omitempty"`
	Content   *string      `json:"content,omitempty"`
	Published *bool        `json:"published,omitempty"`
	Parent    ParentInfoer `json:"-"`
}

func (*Document) ParentKey added in v1.7.0

func (d *Document) ParentKey() string

func (*Document) ShallowCopy added in v1.7.0

func (d *Document) ShallowCopy() *Document

ShallowCopy is a shallowcopy function, copying the receiver, creating a new Document.

func (*Document) ShallowCopyInto added in v1.7.0

func (d *Document) ShallowCopyInto(out *Document)

ShallowCopyInto is a shallowcopy function, copying the receiver, writing into out. d must be non-nil.

type DocumentService added in v1.7.0

type DocumentService service

func (*DocumentService) Create added in v1.7.0

func (d *DocumentService) Create(ctx context.Context, doc *Document) (*Document, error)

Create creates a Document in Konnect.

func (*DocumentService) Delete added in v1.7.0

func (d *DocumentService) Delete(ctx context.Context, doc *Document) error

Delete deletes a Document in Konnect.

func (*DocumentService) ListAllForParent added in v1.7.0

func (d *DocumentService) ListAllForParent(ctx context.Context, parent ParentInfoer) ([]*Document, error)

ListAllForParent fetches all Documents in Konnect for a parent entity.

func (*DocumentService) Update added in v1.7.0

func (d *DocumentService) Update(ctx context.Context, doc *Document) (*Document, error)

Update updates a Document in Konnect.

type KonnectListOpt added in v1.17.0

type KonnectListOpt struct {
	// Size of the page
	Page *PageOpt

	// Tags to use for filtering the list.
	Tags []*string `url:"tags,omitempty"`
}

func ListConsumerGroupMembers added in v1.17.0

func ListConsumerGroupMembers(ctx context.Context,
	client *kong.Client, endpoint string, opt *KonnectListOpt,
) ([]*kong.Consumer, *KonnectListOpt, error)

ListConsumerGroupMembers fetches a page members for a ConsumerGroup from Konnect.

func ListConsumerGroups added in v1.17.0

func ListConsumerGroups(ctx context.Context,
	client *kong.Client, opt *KonnectListOpt,
) ([]*kong.ConsumerGroup, *KonnectListOpt, error)

List fetches a list of ConsumerGroup in Kong. opt can be used to control pagination.

type ListOpt

type ListOpt struct {
	// Size of the page
	Size int `url:"size,omitempty"`
	// Page number to fetch
	Page int `url:"page,omitempty"`
}

ListOpt aids in paginating through list endpoints.

type OrgUserInfo added in v1.18.0

type OrgUserInfo struct {
	Name  string `json:"name,omitempty"`
	OrgID string `json:"id,omitempty"`
}

type PageOpt added in v1.17.0

type PageOpt struct {
	// request
	Size   int  `url:"size,omitempty"`
	Number *int `url:"number,omitempty"`

	// response
	NextPageNum *int `url:"next_page_num,omitempty"`
	TotalCount  *int `url:"total_count,omitempty"`
}

type ParentInfoer added in v1.7.0

type ParentInfoer interface {
	URL() string
	Key() string
}

type RLAOverride added in v1.17.0

type RLAOverride struct {
	ID    *string            `json:"id,omitempty" yaml:"id,omitempty"`
	Value kong.Configuration `json:"value,omitempty" yaml:"value,omitempty"`
}

type RuntimeGroup added in v1.12.0

type RuntimeGroup struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

RuntimeGroup represents a Runtime Group in Konnect. +k8s:deepcopy-gen=true

func (*RuntimeGroup) DeepCopy added in v1.12.0

func (in *RuntimeGroup) DeepCopy() *RuntimeGroup

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeGroup.

func (*RuntimeGroup) DeepCopyInto added in v1.12.0

func (in *RuntimeGroup) DeepCopyInto(out *RuntimeGroup)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RuntimeGroupService added in v1.12.0

type RuntimeGroupService service

func (*RuntimeGroupService) List added in v1.12.0

func (s *RuntimeGroupService) List(ctx context.Context,
	opt *ListOpt,
) ([]*RuntimeGroup, *ListOpt, error)

List fetches a list of Service packages.

type ServicePackage

type ServicePackage struct {
	ID          *string `json:"id,omitempty"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description"`

	Versions []ServiceVersion `json:"versions,omitempty"`
}

ServicePackage represents a Service Package in Konnect. +k8s:deepcopy-gen=true

func (*ServicePackage) DeepCopy

func (in *ServicePackage) DeepCopy() *ServicePackage

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePackage.

func (*ServicePackage) DeepCopyInto

func (in *ServicePackage) DeepCopyInto(out *ServicePackage)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ServicePackage) Key added in v1.7.0

func (p *ServicePackage) Key() string

func (*ServicePackage) URL added in v1.7.0

func (p *ServicePackage) URL() string

type ServicePackageService

type ServicePackageService service

func (*ServicePackageService) Create

Create creates a ServicePackage in Konnect.

func (*ServicePackageService) Delete

func (s *ServicePackageService) Delete(ctx context.Context, id *string) error

Delete deletes a ServicePackage in Konnect.

func (*ServicePackageService) List

List fetches a list of Service packages.

func (*ServicePackageService) ListAll

func (s *ServicePackageService) ListAll(ctx context.Context) ([]*ServicePackage,
	error,
)

ListAll fetches all Service packages.

func (*ServicePackageService) Update

Update updates a ServicePackage in Konnect.

type ServiceVersion

type ServiceVersion struct {
	ID      *string `json:"id,omitempty"`
	Version *string `json:"version,omitempty"`

	ServicePackage *ServicePackage `json:"service_package,omitempty"`

	ControlPlaneServiceRelation *ControlPlaneServiceRelation `json:"control_plane_service_relation,omitempty"`
}

ServiceVersion represents a Service Version in Konnect. +k8s:deepcopy-gen=true

func (*ServiceVersion) DeepCopy

func (in *ServiceVersion) DeepCopy() *ServiceVersion

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceVersion.

func (*ServiceVersion) DeepCopyInto

func (in *ServiceVersion) DeepCopyInto(out *ServiceVersion)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ServiceVersion) Key added in v1.7.0

func (v *ServiceVersion) Key() string

func (*ServiceVersion) URL added in v1.7.0

func (v *ServiceVersion) URL() string

type ServiceVersionService

type ServiceVersionService service

func (*ServiceVersionService) Create

Create creates a ServiceVersion in Konnect.

func (*ServiceVersionService) Delete

func (s *ServiceVersionService) Delete(ctx context.Context, id *string) error

Delete deletes a ServiceVersion in Konnect.

func (*ServiceVersionService) ListForPackage

func (s *ServiceVersionService) ListForPackage(ctx context.Context,
	servicePackageID *string,
) ([]ServiceVersion, error)

ListForPackage fetches a list of Service Versions for a given servicePackageID.

func (*ServiceVersionService) Update

Update updates a ServiceVersion in Konnect.

Jump to

Keyboard shortcuts

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