client

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthenticationSettingsId   = "authentication-settings"
	AuthenticationSettingsPath = "v3/" + AuthenticationSettingsId
)
View Source
const (
	CertificatePathCreate = ControlPlanePathGet + "/core-entities/certificates"
	CertificatePathGet    = CertificatePathCreate + "/%s"
)
View Source
const (
	ApplicationJson              = "application/json"
	Bearer                       = "Bearer"
	KonnectDomain                = "api.konghq.com"
	GlobalRegion                 = "global"
	IdSeparator                  = ":"
	FilterName                   = "filter[name]"
	FilterNameContains           = "filter[name][contains]"
	FilterFullName               = "filter[full_name]"
	FilterFullNameContains       = "filter[full_name][contains]"
	FilterEmail                  = "filter[email]"
	FilterEmailContains          = "filter[email][contains]"
	FilterActive                 = "filter[active]"
	FilterRoleName               = "filter[role_name]"
	FilterRoleNameContains       = "filter[role_name][contains]"
	FilterEntityTypeName         = "filter[entity_type_name]"
	FilterEntityTypeNameContains = "filter[entity_type_name][contains]"
)
View Source
const (
	ConsumerPath    = ControlPlanePathGet + "/core-entities/consumers"
	ConsumerPathGet = ConsumerPath + "/%s"
)
View Source
const (
	ConsumerACLPath    = ControlPlanePathGet + "/core-entities/consumers/%s/acls"
	ConsumerACLPathGet = ConsumerACLPath + "/%s"
)
View Source
const (
	ConsumerBasicPath    = ControlPlanePathGet + "/core-entities/consumers/%s/basic-auth"
	ConsumerBasicPathGet = ConsumerBasicPath + "/%s"
)
View Source
const (
	ConsumerHMACPath    = ControlPlanePathGet + "/core-entities/consumers/%s/hmac-auth"
	ConsumerHMACPathGet = ConsumerHMACPath + "/%s"
)
View Source
const (
	ConsumerJWTPath    = ControlPlanePathGet + "/core-entities/consumers/%s/jwt"
	ConsumerJWTPathGet = ConsumerJWTPath + "/%s"
)
View Source
const (
	ConsumerKeyPath    = ControlPlanePathGet + "/core-entities/consumers/%s/key-auth"
	ConsumerKeyPathGet = ConsumerKeyPath + "/%s"
)
View Source
const (
	ControlPlanePath    = "v2/control-planes"
	ControlPlanePathGet = ControlPlanePath + "/%s"
)
View Source
const (
	DataPlanePathCreate = ControlPlanePathGet + "/dp-client-certificates"
	DataPlanePathGet    = DataPlanePathCreate + "/%s"
)
View Source
const (
	IdentityProviderId   = "identity-provider"
	IdentityProviderPath = "v3/" + IdentityProviderId
	EmailClaim           = "email"
	NameClaim            = "name"
	GroupsClaim          = "groups"
)
View Source
const (
	NodePath    = ControlPlanePathGet + "/nodes"
	NodePathGet = NodePath + "/%s"
)
View Source
const (
	PluginPath       = ControlPlanePathGet + "/core-entities/plugins"
	PluginPathGet    = PluginPath + "/%s"
	PluginSchemaPath = ControlPlanePathGet + "/core-entities/schemas/plugins/%s"
)
View Source
const (
	RolePath                 = "v3/roles"
	ControlPlanesDisplayName = "Control Planes"
	ServicesDisplayName      = "Services"
)
View Source
const (
	RoutePath    = ControlPlanePathGet + "/core-entities/routes"
	RoutePathGet = RoutePath + "/%s"
)
View Source
const (
	ServicePath    = ControlPlanePathGet + "/core-entities/services"
	ServicePathGet = ServicePath + "/%s"
)
View Source
const (
	TeamPath    = "v3/teams"
	TeamPathGet = TeamPath + "/%s"
)
View Source
const (
	TeamMappingsId   = "team-mappings"
	TeamMappingsPath = IdentityProviderPath + "/" + TeamMappingsId
)
View Source
const (
	TeamRolePath       = "v3/teams/%s/assigned-roles"
	TeamRolePathCreate = TeamRolePath
	TeamRolePathDelete = TeamRolePath + "/%s"
)
View Source
const (
	TeamUserPath       = "v3/teams/%s/users"
	TeamUserPathCreate = TeamUserPath
	TeamUserPathDelete = TeamUserPath + "/%s"
)
View Source
const (
	UserPath    = "v3/users"
	UserPathGet = UserPath + "/%s"
)
View Source
const (
	UserRolePath       = "v3/users/%s/assigned-roles"
	UserRolePathCreate = UserRolePath
	UserRolePathDelete = UserRolePath + "/%s"
)

Variables

This section is empty.

Functions

func CertificateDecodeId added in v0.0.4

func CertificateDecodeId(s string) (string, string)

func ConsumerACLDecodeId

func ConsumerACLDecodeId(s string) (string, string, string)

func ConsumerBasicDecodeId

func ConsumerBasicDecodeId(s string) (string, string, string)

func ConsumerDecodeId

func ConsumerDecodeId(s string) (string, string)

func ConsumerHMACDecodeId

func ConsumerHMACDecodeId(s string) (string, string, string)

func ConsumerJWTDecodeId

func ConsumerJWTDecodeId(s string) (string, string, string)

func ConsumerKeyDecodeId

func ConsumerKeyDecodeId(s string) (string, string, string)

func DataPlaneCertificateDecodeId added in v0.0.4

func DataPlaneCertificateDecodeId(s string) (string, string)

func PluginDecodeId

func PluginDecodeId(s string) (string, string)

func RouteDecodeId

func RouteDecodeId(s string) (string, string)

func ServiceDecodeId

func ServiceDecodeId(s string) (string, string)

func TeamRoleDecodeId

func TeamRoleDecodeId(s string) (string, string)

func TeamUserDecodeId

func TeamUserDecodeId(s string) (string, string)

func UserRoleDecodeId

func UserRoleDecodeId(s string) (string, string)

Types

type AuthenticationSettings

type AuthenticationSettings struct {
	BasicAuthEnabled      bool `json:"basic_auth_enabled"`
	OIDCAuthEnabled       bool `json:"oidc_auth_enabled"`
	IDPMappingEnabled     bool `json:"idp_mapping_enabled"`
	KonnectMappingEnabled bool `json:"konnect_mapping_enabled"`
}

type Certificate

type Certificate struct {
	Id                   string   `json:"id,omitempty"`
	Certificate          string   `json:"cert"`
	Key                  string   `json:"key"`
	AlternateCertificate string   `json:"cert_alt,omitempty"`
	AlternateKey         string   `json:"key_alt,omitempty"`
	Tags                 []string `json:"tags,omitempty"`
	ControlPlaneId       string   `json:"-"`
}

func (*Certificate) CertificateEncodeId added in v0.0.4

func (s *Certificate) CertificateEncodeId() string

type CertificateCollection

type CertificateCollection struct {
	Certificates []Certificate `json:"data"`
}

type Client

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

func NewClient

func NewClient(pat string, region string) (*Client, error)

func NewClient(pat string, region string, defaultTags []string) (*Client, error) {

func (*Client) HttpRequest

func (c *Client) HttpRequest(ctx context.Context, isRegion bool, method string, path string, query url.Values, headerMap http.Header, body *bytes.Buffer) (*bytes.Buffer, error)

func (*Client) RequestPath

func (c *Client) RequestPath(isRegion bool, path string) string

type Consumer

type Consumer struct {
	ControlPlaneId string `json:"-"`
	Id             string `json:"id"`
	Username       string `json:"username"`
	CustomId       string `json:"custom_id"`
}

func (*Consumer) ConsumerEncodeId

func (c *Consumer) ConsumerEncodeId() string

type ConsumerACL

type ConsumerACL struct {
	ControlPlaneId string `json:"-"`
	ConsumerId     string `json:"-"`
	Id             string `json:"id"`
	Group          string `json:"group"`
}

func (*ConsumerACL) ConsumerACLEncodeId

func (ca *ConsumerACL) ConsumerACLEncodeId() string

type ConsumerBasic

type ConsumerBasic struct {
	ControlPlaneId string `json:"-"`
	ConsumerId     string `json:"-"`
	Id             string `json:"id"`
	Username       string `json:"username"`
	Password       string `json:"password"`
	PasswordHash   string `json:"-"`
}

func (*ConsumerBasic) ConsumerBasicEncodeId

func (cb *ConsumerBasic) ConsumerBasicEncodeId() string

type ConsumerCollection

type ConsumerCollection struct {
	Consumers []Consumer `json:"data"`
}

type ConsumerHMAC

type ConsumerHMAC struct {
	ControlPlaneId string `json:"-"`
	ConsumerId     string `json:"-"`
	Id             string `json:"id"`
	Username       string `json:"username"`
	Secret         string `json:"secret,omitempty"`
}

func (*ConsumerHMAC) ConsumerHMACEncodeId

func (ch *ConsumerHMAC) ConsumerHMACEncodeId() string

type ConsumerJWT

type ConsumerJWT struct {
	ControlPlaneId string `json:"-"`
	ConsumerId     string `json:"-"`
	Id             string `json:"id"`
	Key            string `json:"key,omitempty"`
	Algorithm      string `json:"algorithm"`
	RSAPublicKey   string `json:"rsa_public_key,omitempty"`
	Secret         string `json:"secret,omitempty"`
}

func (*ConsumerJWT) ConsumerJWTEncodeId

func (cj *ConsumerJWT) ConsumerJWTEncodeId() string

type ConsumerKey

type ConsumerKey struct {
	ControlPlaneId string `json:"-"`
	ConsumerId     string `json:"-"`
	Id             string `json:"id"`
	Key            string `json:"key,omitempty"`
}

func (*ConsumerKey) ConsumerKeyEncodeId

func (ck *ConsumerKey) ConsumerKeyEncodeId() string

type ControlPlane

type ControlPlane struct {
	Id          string              `json:"id,omitempty"`
	Name        string              `json:"name,omitempty"`
	Description string              `json:"description"`
	Config      *ControlPlaneConfig `json:"config,omitempty"`
}

type ControlPlaneCollection

type ControlPlaneCollection struct {
	ControlPlanes []ControlPlane `json:"data"`
}

type ControlPlaneConfig

type ControlPlaneConfig struct {
	ClusterType          string `json:"cluster_type,omitempty"`
	ControlPlaneEndpoint string `json:"control_plane_endpoint,omitempty"`
	TelemetryEndpoint    string `json:"telemetry_endpoint,omitempty"`
}

type DataPlaneCertificate

type DataPlaneCertificate struct {
	Id             string `json:"id,omitempty"`
	CreatedAt      int    `json:"created_at,omitempty"`
	UpdatedAt      int    `json:"updated_at,omitempty"`
	Cert           string `json:"cert"`
	ControlPlaneId string `json:"-"`
}

func (*DataPlaneCertificate) DataPlaneCertificateEncodeId added in v0.0.4

func (s *DataPlaneCertificate) DataPlaneCertificateEncodeId() string

type DataPlaneCertificateCollection

type DataPlaneCertificateCollection struct {
	DataPlaneCertificates []DataPlaneCertificate `json:"data"`
}

type DataPlaneCertificateResponse

type DataPlaneCertificateResponse struct {
	Item DataPlaneCertificate `json:"item"`
}

type EntityId

type EntityId struct {
	Id string `json:"id"`
}

type IdentityProvider

type IdentityProvider struct {
	Issuer        string            `json:"issuer,omitempty"`
	LoginPath     string            `json:"login_path,omitempty"`
	ClientId      string            `json:"client_id,omitempty"`
	ClientSecret  string            `json:"client_secret,omitempty"`
	Scopes        []string          `json:"scopes,omitempty"`
	ClaimMappings map[string]string `json:"claim_mappings,omitempty"`
}

type Node

type Node struct {
	ControlPlaneId  string `json:"-"`
	Id              string `json:"id"`
	Version         string `json:"version"`
	Hostname        string `json:"hostname"`
	LastPing        int64  `json:"last_ping"`
	Type            string `json:"type"`
	ConfigHash      string `json:"config_hash"`
	DataPlaneCertId string `json:"data_plane_cert_id"`
}

type NodeCollection

type NodeCollection struct {
	Nodes []Node `json:"items"`
}

type Plugin

type Plugin struct {
	ControlPlaneId string                 `json:"-"`
	Id             string                 `json:"id"`
	Name           string                 `json:"name"`
	InstanceName   string                 `json:"instance_name"`
	Protocols      []string               `json:"protocols"`
	Enabled        bool                   `json:"enabled"`
	Config         map[string]interface{} `json:"config"`
	ConfigAll      map[string]interface{} `json:"-"`
	Route          *EntityId              `json:"route,omitempty"`
	Service        *EntityId              `json:"service,omitempty"`
	Consumer       *EntityId              `json:"consumer,omitempty"`
}

func (*Plugin) PluginEncodeId

func (s *Plugin) PluginEncodeId() string

type PluginCollection

type PluginCollection struct {
	Plugins []Plugin `json:"data"`
}

type PluginField

type PluginField struct {
	Type    string                   `json:"type"`
	Default interface{}              `json:"default"`
	Fields  []map[string]PluginField `json:"fields"`
}

type PluginSchema

type PluginSchema struct {
	Fields []map[string]PluginField `json:"fields"`
}

type RequestError

type RequestError struct {
	StatusCode int
	Err        error
}

func (*RequestError) Error

func (r *RequestError) Error() string

type Role

type Role struct {
	DisplayName string `json:"name"`
	Description string `json:"description"`
}

type RoleCollection

type RoleCollection map[string]RoleGroup

type RoleGroup

type RoleGroup struct {
	DisplayName string          `json:"name"`
	RoleMap     map[string]Role `json:"roles"`
}

type Route

type Route struct {
	ControlPlaneId          string              `json:"-"`
	Id                      string              `json:"id"`
	Name                    string              `json:"name"`
	Protocols               []string            `json:"protocols"`
	Methods                 []string            `json:"methods"`
	Hosts                   []string            `json:"hosts"`
	Paths                   []string            `json:"paths"`
	Headers                 map[string][]string `json:"headers"`
	HTTPSRedirectStatusCode int                 `json:"https_redirect_status_code"`
	RegexPriority           int                 `json:"regex_priority"`
	StripPath               bool                `json:"strip_path"`
	PathHandling            string              `json:"path_handling"`
	PreserveHost            bool                `json:"preserve_host"`
	RequestBuffering        bool                `json:"request_buffering"`
	ResponseBuffering       bool                `json:"response_buffering"`
	Service                 *EntityId           `json:"service,omitempty"`
}

func (*Route) RouteEncodeId

func (s *Route) RouteEncodeId() string

type RouteCollection

type RouteCollection struct {
	Routes []Route `json:"data"`
}

type Service

type Service struct {
	ControlPlaneId string   `json:"-"`
	Id             string   `json:"id"`
	Name           string   `json:"name"`
	Retries        int      `json:"retries"`
	Protocol       string   `json:"protocol"`
	Host           string   `json:"host"`
	Port           int      `json:"port"`
	Path           string   `json:"path"`
	ConnectTimeout int      `json:"connect_timeout"`
	ReadTimeout    int      `json:"read_timeout"`
	WriteTimeout   int      `json:"write_timeout"`
	Enabled        bool     `json:"enabled"`
	CaCertificates []string `json:"ca_certificates,omitempty"`
}

func (*Service) ServiceEncodeId

func (s *Service) ServiceEncodeId() string

type ServiceCollection

type ServiceCollection struct {
	Services []Service `json:"data"`
}

type Team

type Team struct {
	Id           string `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Description  string `json:"description"`
	IsPredefined bool   `json:"system_team,omitempty"`
}

type TeamCollection

type TeamCollection struct {
	Teams []Team `json:"data"`
}

type TeamMapping

type TeamMapping struct {
	Group   string   `json:"group,omitempty"`
	TeamIds []string `json:"team_ids,omitempty"`
}

type TeamMappings

type TeamMappings struct {
	MappingsRead  []TeamMapping `json:"data,omitempty"`
	MappingsWrite []TeamMapping `json:"mappings,omitempty"`
}

type TeamRole

type TeamRole struct {
	Id                    string `json:"id,omitempty"`
	TeamId                string `json:"-"`
	RoleDisplayName       string `json:"role_name,omitempty"`
	EntityId              string `json:"entity_id,omitempty"`
	EntityTypeDisplayName string `json:"entity_type_name,omitempty"`
	EntityRegion          string `json:"entity_region,omitempty"`
}

func (*TeamRole) TeamRoleEncodeId

func (tr *TeamRole) TeamRoleEncodeId() string

type TeamRoleCollection

type TeamRoleCollection struct {
	TeamRoles []TeamRole `json:"data"`
}

type TeamUser

type TeamUser struct {
	TeamId string `json:"-"`
	UserId string `json:"id"`
}

func (*TeamUser) TeamUserEncodeId

func (tu *TeamUser) TeamUserEncodeId() string

type User

type User struct {
	Id            string `json:"id,omitempty"`
	Email         string `json:"email,omitempty"`
	FullName      string `json:"full_name"`
	PreferredName string `json:"preferred_name"`
	Active        bool   `json:"active,omitempty"`
}

type UserCollection

type UserCollection struct {
	Users []User `json:"data"`
}

type UserRole

type UserRole struct {
	Id                    string `json:"id,omitempty"`
	UserId                string `json:"-"`
	RoleDisplayName       string `json:"role_name,omitempty"`
	EntityId              string `json:"entity_id,omitempty"`
	EntityTypeDisplayName string `json:"entity_type_name,omitempty"`
	EntityRegion          string `json:"entity_region,omitempty"`
}

func (*UserRole) UserRoleEncodeId

func (ur *UserRole) UserRoleEncodeId() string

type UserRoleCollection

type UserRoleCollection struct {
	UserRoles []UserRole `json:"data"`
}

Jump to

Keyboard shortcuts

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