Documentation
¶
Index ¶
- func BaseURL() string
- func IsNotFoundErr(e error) bool
- type APIError
- type AuthResponse
- type AuthService
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) NewRequest(method, endpoint string, qs interface{}, body interface{}) (*http.Request, error)
- func (c *Client) SetControlPlaneID(cpID string)
- func (c *Client) SetDebugMode(enableDebug bool)
- func (c *Client) SetLogger(w io.Writer)
- type ClientOpts
- type ControlPlane
- type ControlPlaneRelationsService
- func (s *ControlPlaneRelationsService) Create(ctx context.Context, relation *ControlPlaneServiceRelationCreateRequest) (*ControlPlaneServiceRelation, error)
- func (s *ControlPlaneRelationsService) Delete(ctx context.Context, relationID *string) error
- func (s *ControlPlaneRelationsService) List(ctx context.Context, opt *ListOpt) ([]*ControlPlaneServiceRelation, *ListOpt, error)
- func (s *ControlPlaneRelationsService) ListAll(ctx context.Context) ([]*ControlPlaneServiceRelation, error)
- func (s ControlPlaneRelationsService) Update(ctx context.Context, relation *ControlPlaneServiceRelationUpdateRequest) (*ServiceVersion, error)
- type ControlPlaneService
- type ControlPlaneServiceRelation
- type ControlPlaneServiceRelationCreateRequest
- type ControlPlaneServiceRelationUpdateRequest
- type ControlPlaneType
- type Document
- type DocumentService
- func (d *DocumentService) Create(ctx context.Context, doc *Document) (*Document, error)
- func (d *DocumentService) Delete(ctx context.Context, doc *Document) error
- func (d *DocumentService) ListAllForParent(ctx context.Context, parent ParentInfoer) ([]*Document, error)
- func (d *DocumentService) Update(ctx context.Context, doc *Document) (*Document, error)
- type ListOpt
- type ParentInfoer
- type ServicePackage
- type ServicePackageService
- func (s *ServicePackageService) Create(ctx context.Context, sp *ServicePackage) (*ServicePackage, error)
- func (s *ServicePackageService) Delete(ctx context.Context, id *string) error
- func (s *ServicePackageService) List(ctx context.Context, opt *ListOpt) ([]*ServicePackage, *ListOpt, error)
- func (s *ServicePackageService) ListAll(ctx context.Context) ([]*ServicePackage, error)
- func (s *ServicePackageService) Update(ctx context.Context, sp *ServicePackage) (*ServicePackage, error)
- type ServiceVersion
- type ServiceVersionService
- func (s *ServiceVersionService) Create(ctx context.Context, sv *ServiceVersion) (*ServiceVersion, error)
- func (s *ServiceVersionService) Delete(ctx context.Context, id *string) error
- func (s *ServiceVersionService) ListForPackage(ctx context.Context, servicePackageID *string) ([]ServiceVersion, error)
- func (s *ServiceVersionService) Update(ctx context.Context, sv *ServiceVersion) (*ServiceVersion, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFoundErr ¶
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.
type AuthResponse ¶
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) 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 ¶
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 ¶
SetDebugMode enables or disables logging of the request to the logger set by SetLogger(). By default, debug logging is disabled.
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"`
}
+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 ¶
func (s *ControlPlaneRelationsService) Create(ctx context.Context, relation *ControlPlaneServiceRelationCreateRequest) (*ControlPlaneServiceRelation, error)
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 ¶
func (s *ControlPlaneRelationsService) List(ctx context.Context, opt *ListOpt) ([]*ControlPlaneServiceRelation, *ListOpt, error)
List fetches a list of control_plane_service_relations.
func (*ControlPlaneRelationsService) ListAll ¶
func (s *ControlPlaneRelationsService) ListAll(ctx context.Context) ([]*ControlPlaneServiceRelation, error)
ListAll fetches all control_plane_service_relations.
func (ControlPlaneRelationsService) Update ¶
func (s ControlPlaneRelationsService) Update(ctx context.Context, relation *ControlPlaneServiceRelationUpdateRequest) (*ServiceVersion, error)
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"`
}
+k8s:deepcopy-gen=true
func (*ControlPlaneServiceRelation) DeepCopy ¶
func (in *ControlPlaneServiceRelation) DeepCopy() *ControlPlaneServiceRelation
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneServiceRelation.
func (*ControlPlaneServiceRelation) DeepCopyInto ¶
func (in *ControlPlaneServiceRelation) DeepCopyInto(out *ControlPlaneServiceRelation)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
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 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) ShallowCopy ¶ added in v1.7.0
ShallowCopy is a shallowcopy function, copying the receiver, creating a new Document.
func (*Document) ShallowCopyInto ¶ added in v1.7.0
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) 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.
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 ServicePackage ¶
type ServicePackage struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description"`
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.
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 ¶
func (s *ServicePackageService) Create(ctx context.Context, sp *ServicePackage) (*ServicePackage, error)
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 ¶
func (s *ServicePackageService) List(ctx context.Context, opt *ListOpt) ([]*ServicePackage, *ListOpt, error)
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 ¶
func (s *ServicePackageService) Update(ctx context.Context, sp *ServicePackage) (*ServicePackage, error)
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.
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 ¶
func (s *ServiceVersionService) Create(ctx context.Context, sv *ServiceVersion) (*ServiceVersion, error)
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 ¶
func (s *ServiceVersionService) Update(ctx context.Context, sv *ServiceVersion) (*ServiceVersion, error)
Update updates a ServiceVersion in Konnect.