client

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthenticationSettingsId   = "authentication-settings"
	AuthenticationSettingsPath = "v3/" + AuthenticationSettingsId
)
View Source
const (
	ApplicationJson              = "application/json"
	Bearer                       = "Bearer"
	KonnectDomain                = "api.konghq.com"
	GlobalRegion                 = "global"
	IdSeparator                  = ":"
	FilterName                   = "filter[name]"
	FilterNameContains           = "filter[name][contains]"
	FilterNameEquals             = "filter[name][eq]"
	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 (
	CustomPluginSchemaPath    = ControlPlanePathGet + "/core-entities/plugin-schemas"
	CustomPluginSchemaPathGet = CustomPluginSchemaPath + "/%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 ConsumerACLDecodeId added in v0.1.17

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

func ConsumerBasicDecodeId added in v0.1.17

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

func ConsumerDecodeId added in v0.1.6

func ConsumerDecodeId(s string) (string, string)

func ConsumerHMACDecodeId added in v0.1.17

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

func ConsumerJWTDecodeId added in v0.1.17

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

func ConsumerKeyDecodeId added in v0.1.17

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

func CustomPluginSchemaDecodeId added in v0.2.4

func CustomPluginSchemaDecodeId(s string) (string, string)

func PluginDecodeId added in v0.1.6

func PluginDecodeId(s string) (string, string)

func RouteDecodeId added in v0.1.5

func RouteDecodeId(s string) (string, string)

func ServiceDecodeId added in v0.1.4

func ServiceDecodeId(s string) (string, string)

func TeamRoleDecodeId added in v0.1.3

func TeamRoleDecodeId(s string) (string, string)

func TeamUserDecodeId added in v0.1.2

func TeamUserDecodeId(s string) (string, string)

func UserRoleDecodeId added in v0.1.3

func UserRoleDecodeId(s string) (string, string)

Types

type AuthenticationSettings added in v0.1.2

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 Client

type Client struct {
	DefaultTags []string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(pat string, region string, numRetries int, retryDelay int, 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 added in v0.1.6

type Consumer struct {
	ControlPlaneId string   `json:"-"`
	Id             string   `json:"id"`
	Username       string   `json:"username"`
	CustomId       string   `json:"custom_id"`
	AllTags        []string `json:"tags"`
	Tags           []string `json:"-"`
}

func (*Consumer) ConsumerEncodeId added in v0.1.6

func (c *Consumer) ConsumerEncodeId() string

type ConsumerACL added in v0.1.17

type ConsumerACL struct {
	ControlPlaneId string   `json:"-"`
	ConsumerId     string   `json:"-"`
	Id             string   `json:"id"`
	Group          string   `json:"group"`
	AllTags        []string `json:"tags"`
	Tags           []string `json:"-"`
}

func (*ConsumerACL) ConsumerACLEncodeId added in v0.1.17

func (ca *ConsumerACL) ConsumerACLEncodeId() string

type ConsumerBasic added in v0.1.17

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

func (*ConsumerBasic) ConsumerBasicEncodeId added in v0.1.17

func (cb *ConsumerBasic) ConsumerBasicEncodeId() string

type ConsumerCollection added in v0.1.6

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

type ConsumerHMAC added in v0.1.17

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

func (*ConsumerHMAC) ConsumerHMACEncodeId added in v0.1.17

func (ch *ConsumerHMAC) ConsumerHMACEncodeId() string

type ConsumerJWT added in v0.1.17

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"`
	AllTags        []string `json:"tags"`
	Tags           []string `json:"-"`
}

func (*ConsumerJWT) ConsumerJWTEncodeId added in v0.1.17

func (cj *ConsumerJWT) ConsumerJWTEncodeId() string

type ConsumerKey added in v0.1.17

type ConsumerKey struct {
	ControlPlaneId string   `json:"-"`
	ConsumerId     string   `json:"-"`
	Id             string   `json:"id"`
	Key            string   `json:"key,omitempty"`
	AllTags        []string `json:"tags"`
	Tags           []string `json:"-"`
}

func (*ConsumerKey) ConsumerKeyEncodeId added in v0.1.17

func (ck *ConsumerKey) ConsumerKeyEncodeId() string

type ControlPlane added in v0.1.15

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

type ControlPlaneCollection added in v0.1.15

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

type ControlPlaneConfig added in v0.1.15

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

type CustomPluginSchema added in v0.2.4

type CustomPluginSchema struct {
	ControlPlaneId string `json:"-"`
	Name           string `json:"name"`
	SchemaLua      string `json:"lua_schema"`
}

func (*CustomPluginSchema) CustomPluginSchemaEncodeId added in v0.2.4

func (s *CustomPluginSchema) CustomPluginSchemaEncodeId() string

type CustomPluginSchemaItem added in v0.2.4

type CustomPluginSchemaItem struct {
	Item CustomPluginSchema `json:"item"`
}

type EntityId added in v0.1.6

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

type IdentityProvider added in v0.1.2

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 ListService added in v0.2.10

type ListService 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"`
	AllTags        []string `json:"tags"`
	Tags           []string `json:"-"`
}

func (*ListService) ServiceEncodeId added in v0.2.10

func (s *ListService) ServiceEncodeId() string

type ListServiceCollection added in v0.2.10

type ListServiceCollection struct {
	Services []ListService `json:"data"`
}

type Node added in v0.1.4

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 added in v0.1.4

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

type Plugin added in v0.1.6

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"`
	AllTags        []string               `json:"tags"`
	Tags           []string               `json:"-"`
}

func (*Plugin) PluginEncodeId added in v0.1.6

func (s *Plugin) PluginEncodeId() string

type PluginCollection added in v0.1.6

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

type PluginField added in v0.1.6

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

type PluginSchema added in v0.1.6

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 added in v0.1.3

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

type RoleCollection added in v0.1.3

type RoleCollection map[string]RoleGroup

type RoleGroup added in v0.1.3

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

type Route added in v0.1.5

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"`
	AllTags                 []string            `json:"tags"`
	Tags                    []string            `json:"-"`
}

func (*Route) RouteEncodeId added in v0.1.5

func (s *Route) RouteEncodeId() string

type RouteCollection added in v0.1.5

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

type Service added in v0.1.4

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"`
	AllTags        []string `json:"tags"`
	Tags           []string `json:"-"`
}

func (*Service) ServiceEncodeId added in v0.1.4

func (s *Service) ServiceEncodeId() string

type ServiceCollection added in v0.1.4

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

type Team added in v0.1.2

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 added in v0.1.2

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

type TeamMapping added in v0.1.9

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

type TeamMappings added in v0.1.9

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

type TeamRole added in v0.1.3

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 added in v0.1.3

func (tr *TeamRole) TeamRoleEncodeId() string

type TeamRoleCollection added in v0.1.3

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

type TeamUser added in v0.1.2

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

func (*TeamUser) TeamUserEncodeId added in v0.1.2

func (tu *TeamUser) TeamUserEncodeId() string

type User added in v0.1.2

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 added in v0.1.2

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

type UserRole added in v0.1.3

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 added in v0.1.3

func (ur *UserRole) UserRoleEncodeId() string

type UserRoleCollection added in v0.1.3

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