konnect

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL() string

func IsNotFoundErr

func IsNotFoundErr(e error) bool

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

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 {
	Organization   string `json:"org_name"`
	FirstName      string `json:"first_name"`
	LastName       string `json:"last_name"`
	OrganizationID string `json:"org_id"`
}

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)

type Client

type Client struct {
	Auth                  *AuthService
	ServicePackages       *ServicePackageService
	ServiceVersions       *ServiceVersionService
	Documents             *DocumentService
	ControlPlanes         *ControlPlaneService
	ControlPlaneRelations *ControlPlaneRelationsService
	// 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

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

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 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 ParentInfoer added in v1.7.0

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

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

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