Documentation
¶
Index ¶
- Constants
- func AddExtToFilename(filename, ext string) string
- func CleanAddress(address string) string
- func CleanKongVersion(version string) (string, error)
- func Confirm(message string) (bool, error)
- func ConfirmFileOverwrite(filename string, ext string, assumeYes bool) (bool, error)
- func Empty(s *string) bool
- func FilenameToName(filename string) string
- func GetKongClient(opt KongClientConfig) (*kong.Client, error)
- func GetKonnectClient(httpClient *http.Client, config KonnectConfig) (*konnect.Client, error)
- func HTTPClient() *http.Client
- func MergeTags(obj interface{}, tags []string) error
- func MustMergeTags(obj interface{}, tags []string)
- func MustRemoveTags(obj interface{}, tags []string)
- func NameToFilename(name string) string
- func RemoveTags(obj interface{}, tags []string) error
- func SendAnalytics(cmd, deckVersion, kongVersion string) error
- func UUID() string
- func ZeroOutID(obj interface{}, altName *string, withID bool)
- func ZeroOutTimestamps(obj interface{})
- type AtomicInt32Counter
- type Defaulter
- type ErrArray
- type KongClientConfig
- type KongRawState
- type KonnectConfig
- type KonnectRawState
Constants ¶
const (
// ImplementationTypeKongGateway indicates an implementation backed by Kong Gateway.
ImplementationTypeKongGateway = "kong-gateway"
)
Variables ¶
This section is empty.
Functions ¶
func AddExtToFilename ¶ added in v1.6.0
func CleanAddress ¶
CleanAddress removes trailling / from a URL.
func CleanKongVersion ¶
CleanKongVersion takes a version of Kong and returns back a string in the form of `/major.minor` version. There are various dashes and dots and other descriptors in Kong version strings, which has often created confusion in code and incorrect parsing, and hence this function does not return the patch version (on which shouldn't rely on anyways).
func Confirm ¶ added in v1.7.0
Confirm prompts a user for a confirmation with message and returns true with no error if input is "yes" or "y" (case-insensitive), otherwise false.
func ConfirmFileOverwrite ¶ added in v1.7.0
ConfirmFileOverwrite is a helper function to determine whether or not the program should truncate and overwrite a file given its name and extension. If the file doesn't already exist in the filesystem, then this will return true, otherwise it will prompt the user for confirmation.
func FilenameToName ¶ added in v1.7.0
FilenameToName (partially) reverses NameToFilename, replacing all URL-encoded path separator characters with the path separator character. It does not re-add a leading separator, because there is no way to know if that separator was included originally, and only some names (document paths) typically include one.
func GetKongClient ¶
func GetKongClient(opt KongClientConfig) (*kong.Client, error)
GetKongClient returns a Kong client
func GetKonnectClient ¶ added in v1.5.0
func HTTPClient ¶ added in v1.7.0
HTTPClient returns a new Go stdlib's net/http.Client with sane default timeouts.
func MustMergeTags ¶
func MustMergeTags(obj interface{}, tags []string)
MustMergeTags is same as MergeTags but panics if there is an error.
func MustRemoveTags ¶
func MustRemoveTags(obj interface{}, tags []string)
MustRemoveTags is same as RemoveTags but panics if there is an error.
func NameToFilename ¶ added in v1.7.0
NameToFilename clears path separators from strings. Some entity names in Kong and Konnect allow path directory separators. Some decK operations write files using entity names, which is not compatible with names that contain path separators. NameToFilename strips leading separator characters and replaces other instances of the separator with its URL-encoded representation.
func RemoveTags ¶
RemoveTags removes tags from the Tags in obj.
func SendAnalytics ¶ added in v1.7.0
func ZeroOutTimestamps ¶ added in v1.5.1
func ZeroOutTimestamps(obj interface{})
Types ¶
type AtomicInt32Counter ¶ added in v1.8.0
type AtomicInt32Counter struct {
// contains filtered or unexported fields
}
func (*AtomicInt32Counter) Count ¶ added in v1.8.0
func (a *AtomicInt32Counter) Count() int32
func (*AtomicInt32Counter) Increment ¶ added in v1.8.0
func (a *AtomicInt32Counter) Increment(delta int32)
type Defaulter ¶
type Defaulter struct {
// contains filtered or unexported fields
}
Defaulter registers types and fills in struct fields with default values.
func GetKongDefaulter ¶
GetKongDefaulter returns a defaulter which can set default values for Kong entities.
func (*Defaulter) MustSet ¶
func (d *Defaulter) MustSet(arg interface{})
MustSet is like Set but panics if there is an error.
type KongClientConfig ¶
type KongClientConfig struct { Address string Workspace string TLSServerName string TLSCACert string TLSSkipVerify bool Debug bool SkipWorkspaceCrud bool Headers []string HTTPClient *http.Client Timeout int }
KongClientConfig holds config details to use to talk to a Kong server.
func (*KongClientConfig) ForWorkspace ¶ added in v1.2.3
func (kc *KongClientConfig) ForWorkspace(name string) KongClientConfig
ForWorkspace returns a copy of KongClientConfig that produces a KongClient for the workspace specified by argument.
type KongRawState ¶
type KongRawState struct { Services []*kong.Service Routes []*kong.Route Plugins []*kong.Plugin Upstreams []*kong.Upstream Targets []*kong.Target Certificates []*kong.Certificate SNIs []*kong.SNI CACertificates []*kong.CACertificate Consumers []*kong.Consumer CustomEntities []*custom.Entity KeyAuths []*kong.KeyAuth HMACAuths []*kong.HMACAuth JWTAuths []*kong.JWTAuth BasicAuths []*kong.BasicAuth ACLGroups []*kong.ACLGroup Oauth2Creds []*kong.Oauth2Credential MTLSAuths []*kong.MTLSAuth RBACRoles []*kong.RBACRole RBACEndpointPermissions []*kong.RBACEndpointPermission }
KongRawState contains all of Kong Data
type KonnectConfig ¶ added in v1.5.0
type KonnectRawState ¶ added in v1.5.0
type KonnectRawState struct { ServicePackages []*konnect.ServicePackage Documents []*konnect.Document }
KonnectRawState contains all of Konnect resources.