konnect

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: Apache-2.0 Imports: 13 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"`
}

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
	ControlPlanes         *ControlPlaneService
	ControlPlaneRelations *ControlPlaneRelationsService
	// contains filtered or unexported fields
}

Client talks to the Konnect API.

func NewClient

func NewClient(httpClient *http.Client) (*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 ControlPlane

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

+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"`
}

+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"`
}

+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 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 ServicePackage

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

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

+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.

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"`
}

+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.

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)

List 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