Documentation ¶
Index ¶
- Constants
- Variables
- func Get(ctx context.Context, fileContent *Content, opt RenderConfig, ...) (*utils.KongRawState, error)
- func GetForKonnect(ctx context.Context, fileContent *Content, opt RenderConfig, ...) (*utils.KongRawState, *utils.KonnectRawState, error)
- func KongStateToFile(kongState *state.KongState, config WriteConfig) error
- func KonnectStateToFile(kongState *state.KongState, config WriteConfig) error
- func WriteContentToFile(content *Content, filename string, format Format) error
- type Content
- type FCACertificate
- type FCertificate
- type FConsumer
- type FConsumerGroupObject
- type FDocument
- type FLicense
- type FPlugin
- func (in *FPlugin) DeepCopy() *FPlugin
- func (in *FPlugin) DeepCopyInto(out *FPlugin)
- func (p FPlugin) MarshalJSON() ([]byte, error)
- func (p FPlugin) MarshalYAML() (interface{}, error)
- func (p *FPlugin) UnmarshalJSON(b []byte) error
- func (p *FPlugin) UnmarshalYAML(unmarshal func(interface{}) error) error
- type FRBACEndpointPermission
- type FRBACRole
- type FRoute
- type FService
- func (in *FService) DeepCopy() *FService
- func (in *FService) DeepCopyInto(out *FService)
- func (s FService) MarshalJSON() ([]byte, error)
- func (s FService) MarshalYAML() (interface{}, error)
- func (s *FService) UnmarshalJSON(b []byte) error
- func (s *FService) UnmarshalYAML(unmarshal func(interface{}) error) error
- type FServicePackage
- type FServiceVersion
- type FTarget
- type FUpstream
- type FVault
- type Format
- type Implementation
- type Info
- type Kong
- type KongDefaults
- type Konnect
- type RenderConfig
- type ValidationError
- type WriteConfig
Constants ¶
const ( // JSON is JSON file format. JSON = "JSON" // YAML if YAML file format. YAML = "YAML" )
Variables ¶
var ( // ErrorTransformFalseNotSupported indicates that no transform mode is not supported ErrorTransformFalseNotSupported = fmt.Errorf("_transform: false is not supported") // ErrorFilenameEmpty indicates that you must provide a filename ErrorFilenameEmpty = fmt.Errorf("filename cannot be empty") )
var ErrWorkspaceNotFound = fmt.Errorf("workspace not found")
Functions ¶
func Get ¶
func Get(ctx context.Context, fileContent *Content, opt RenderConfig, dumpConfig dump.Config, wsClient *kong.Client) ( *utils.KongRawState, error, )
Get process the fileContent and renders a RawState. IDs of entities are matches based on currentState.
func GetForKonnect ¶ added in v1.5.0
func GetForKonnect(ctx context.Context, fileContent *Content, opt RenderConfig, client *kong.Client, ) (*utils.KongRawState, *utils.KonnectRawState, error)
GetForKonnect processes the fileContent and renders a RawState and KonnectRawState
func KongStateToFile ¶
func KongStateToFile(kongState *state.KongState, config WriteConfig) error
KongStateToFile writes a state object to file with filename. See KongStateToContent for the State generation
func KonnectStateToFile ¶ added in v1.5.0
func KonnectStateToFile(kongState *state.KongState, config WriteConfig) error
Types ¶
type Content ¶
type Content struct { FormatVersion string `json:"_format_version,omitempty" yaml:"_format_version,omitempty"` Transform *bool `json:"_transform,omitempty" yaml:"_transform,omitempty"` Info *Info `json:"_info,omitempty" yaml:"_info,omitempty"` Workspace string `json:"_workspace,omitempty" yaml:"_workspace,omitempty"` Konnect *Konnect `json:"_konnect,omitempty" yaml:"_konnect,omitempty"` Services []FService `json:"services,omitempty" yaml:",omitempty"` Routes []FRoute `json:"routes,omitempty" yaml:",omitempty"` Consumers []FConsumer `json:"consumers,omitempty" yaml:",omitempty"` ConsumerGroups []FConsumerGroupObject `json:"consumer_groups,omitempty" yaml:",omitempty"` Plugins []FPlugin `json:"plugins,omitempty" yaml:",omitempty"` Upstreams []FUpstream `json:"upstreams,omitempty" yaml:",omitempty"` Certificates []FCertificate `json:"certificates,omitempty" yaml:",omitempty"` CACertificates []FCACertificate `json:"ca_certificates,omitempty" yaml:"ca_certificates,omitempty"` RBACRoles []FRBACRole `json:"rbac_roles,omitempty" yaml:"rbac_roles,omitempty"` PluginConfigs map[string]kong.Configuration `json:"_plugin_configs,omitempty" yaml:"_plugin_configs,omitempty"` ServicePackages []FServicePackage `json:"service_packages,omitempty" yaml:"service_packages,omitempty"` Vaults []FVault `json:"vaults,omitempty" yaml:"vaults,omitempty"` Licenses []FLicense `json:"licenses,omitempty" yaml:"licenses,omitempty"` }
Content represents a serialized Kong state. +k8s:deepcopy-gen=true
func GetContentFromFiles ¶
GetContentFromFiles reads in a file with a slice of filenames and constructs a state. If filename is `-`, then it will read from os.Stdin. If filename represents a directory, it will traverse the tree rooted at filename, read all the files with .yaml, .yml and .json extensions and generate a content after a merge of the content from all the files.
It will return an error if the file representation is invalid or if there is any error during processing.
func KongStateToContent ¶ added in v1.25.0
func KongStateToContent(kongState *state.KongState, config WriteConfig) (*Content, error)
KongStateToFile generates a state object to file.Content. It will omit timestamps and IDs while writing.
func (*Content) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Content.
func (*Content) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (Content) PopulateDocumentContent ¶ added in v1.7.0
PopulateDocumentContent updates the Documents contained within a Content with the contents of their files on disk. Document files are stored at <root>/ServicePackage.Name/Document.Path and <root>/ServicePackage.Name/ServiceVersion.Version/Document.Path, where <root> is the directory containing the first state file.
func (Content) StripLocalDocumentPath ¶ added in v1.7.0
func (c Content) StripLocalDocumentPath()
StripLocalDocumentPath removes local path information from a target state document, returning the base path with a prepended slash. These path values match typical path values for documents created in the Konnect GUI, whereas path values in decK state files are local relative paths with service package and service version directories.
type FCACertificate ¶
type FCACertificate struct {
kong.CACertificate `yaml:",inline,omitempty"`
}
FCACertificate represents a Kong CACertificate. +k8s:deepcopy-gen=true
func (*FCACertificate) DeepCopy ¶ added in v1.7.0
func (in *FCACertificate) DeepCopy() *FCACertificate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FCACertificate.
func (*FCACertificate) DeepCopyInto ¶ added in v1.7.0
func (in *FCACertificate) DeepCopyInto(out *FCACertificate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FCertificate ¶
type FCertificate struct { ID *string `json:"id,omitempty" yaml:"id,omitempty"` Cert *string `json:"cert,omitempty" yaml:"cert,omitempty"` Key *string `json:"key,omitempty" yaml:"key,omitempty"` CreatedAt *int64 `json:"created_at,omitempty" yaml:"created_at,omitempty"` Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"` SNIs []kong.SNI `json:"snis,omitempty" yaml:"snis,omitempty"` }
FCertificate represents a Kong Certificate. +k8s:deepcopy-gen=true
func (*FCertificate) DeepCopy ¶ added in v1.7.0
func (in *FCertificate) DeepCopy() *FCertificate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FCertificate.
func (*FCertificate) DeepCopyInto ¶ added in v1.7.0
func (in *FCertificate) DeepCopyInto(out *FCertificate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FConsumer ¶
type FConsumer struct { kong.Consumer `yaml:",inline,omitempty"` Plugins []*FPlugin `json:"plugins,omitempty" yaml:",omitempty"` KeyAuths []*kong.KeyAuth `json:"keyauth_credentials,omitempty" yaml:"keyauth_credentials,omitempty"` HMACAuths []*kong.HMACAuth `json:"hmacauth_credentials,omitempty" yaml:"hmacauth_credentials,omitempty"` JWTAuths []*kong.JWTAuth `json:"jwt_secrets,omitempty" yaml:"jwt_secrets,omitempty"` BasicAuths []*kong.BasicAuth `json:"basicauth_credentials,omitempty" yaml:"basicauth_credentials,omitempty"` Oauth2Creds []*kong.Oauth2Credential `json:"oauth2_credentials,omitempty" yaml:"oauth2_credentials,omitempty"` ACLGroups []*kong.ACLGroup `json:"acls,omitempty" yaml:"acls,omitempty"` MTLSAuths []*kong.MTLSAuth `json:"mtls_auth_credentials,omitempty" yaml:"mtls_auth_credentials,omitempty"` Groups []*kong.ConsumerGroup `json:"groups,omitempty" yaml:"groups,omitempty"` }
FConsumer represents a consumer in Kong. +k8s:deepcopy-gen=true
func (*FConsumer) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FConsumer.
func (*FConsumer) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FConsumerGroupObject ¶ added in v1.17.0
type FConsumerGroupObject struct { kong.ConsumerGroup `yaml:",inline,omitempty"` Consumers []*kong.Consumer `json:"consumers,omitempty" yaml:",omitempty"` Plugins []*kong.ConsumerGroupPlugin `json:"plugins,omitempty" yaml:",omitempty"` }
FConsumerGroupObject represents a Kong ConsumerGroup and its associated consumers and plugins. +k8s:deepcopy-gen=true
func (*FConsumerGroupObject) DeepCopy ¶ added in v1.17.0
func (in *FConsumerGroupObject) DeepCopy() *FConsumerGroupObject
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FConsumerGroupObject.
func (*FConsumerGroupObject) DeepCopyInto ¶ added in v1.17.0
func (in *FConsumerGroupObject) DeepCopyInto(out *FConsumerGroupObject)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FDocument ¶ added in v1.7.0
type FDocument struct { ID *string `json:"id,omitempty" yaml:"id,omitempty"` Path *string `json:"path,omitempty" yaml:"path,omitempty"` Published *bool `json:"published,omitempty" yaml:"published,omitempty"` Content *string `json:"-" yaml:"-"` }
FDocument represents a document in Konnect. The type has been duplicated because the documents are altered before they are exported to the state file for better user experience. +k8s:deepcopy-gen=true
func (*FDocument) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FDocument.
func (*FDocument) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FLicense ¶ added in v1.20.0
FLicense represents a Kong License. +k8s:deepcopy-gen=true
func (*FLicense) DeepCopy ¶ added in v1.20.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FLicense.
func (*FLicense) DeepCopyInto ¶ added in v1.20.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FPlugin ¶
type FPlugin struct { kong.Plugin `yaml:",inline,omitempty"` ConfigSource *string `json:"_config,omitempty" yaml:"_config,omitempty"` }
FPlugin represents a plugin in Kong. +k8s:deepcopy-gen=true
func (*FPlugin) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FPlugin.
func (*FPlugin) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (FPlugin) MarshalJSON ¶
MarshalJSON is a custom marshal method to handle foreign references.
func (FPlugin) MarshalYAML ¶
MarshalYAML is a custom marshal method to handle foreign references.
func (*FPlugin) UnmarshalJSON ¶
UnmarshalJSON is a custom marshal method to handle foreign references.
func (*FPlugin) UnmarshalYAML ¶
UnmarshalYAML is a custom marshal method to handle foreign references.
type FRBACEndpointPermission ¶ added in v1.5.0
type FRBACEndpointPermission struct {
kong.RBACEndpointPermission `yaml:",inline,omitempty"`
}
FRBACEndpointPermission is a wrapper type for RBACEndpointPermission. +k8s:deepcopy-gen=true
func (*FRBACEndpointPermission) DeepCopy ¶ added in v1.7.0
func (in *FRBACEndpointPermission) DeepCopy() *FRBACEndpointPermission
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FRBACEndpointPermission.
func (*FRBACEndpointPermission) DeepCopyInto ¶ added in v1.7.0
func (in *FRBACEndpointPermission) DeepCopyInto(out *FRBACEndpointPermission)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (FRBACEndpointPermission) MarshalJSON ¶ added in v1.12.0
func (frbac FRBACEndpointPermission) MarshalJSON() ([]byte, error)
type FRBACRole ¶ added in v1.5.0
type FRBACRole struct { kong.RBACRole `yaml:",inline,omitempty"` EndpointPermissions []*FRBACEndpointPermission `json:"endpoint_permissions,omitempty" yaml:"endpoint_permissions,omitempty"` //nolint }
FRBACRole represents an RBACRole in Kong +k8s:deepcopy-gen=true
func (*FRBACRole) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FRBACRole.
func (*FRBACRole) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FRoute ¶
type FRoute struct { kong.Route `yaml:",inline,omitempty"` Plugins []*FPlugin `json:"plugins,omitempty" yaml:",omitempty"` }
FRoute represents a Kong Route and it's associated plugins. +k8s:deepcopy-gen=true
func (*FRoute) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FRoute.
func (*FRoute) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FService ¶
type FService struct { kong.Service Routes []*FRoute `json:"routes,omitempty" yaml:",omitempty"` Plugins []*FPlugin `json:"plugins,omitempty" yaml:",omitempty"` // sugar property URL *string `json:"url,omitempty" yaml:",omitempty"` }
FService represents a Kong Service and it's associated routes and plugins. +k8s:deepcopy-gen=true
func (*FService) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FService.
func (*FService) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (FService) MarshalJSON ¶
MarshalJSON is a custom marshal method to handle foreign references.
func (FService) MarshalYAML ¶
MarshalYAML is a custom marshal to handle SNI.
func (*FService) UnmarshalJSON ¶
UnmarshalJSON is a custom marshal method to handle foreign references.
func (*FService) UnmarshalYAML ¶
UnmarshalYAML is a custom marshal method to handle foreign references.
type FServicePackage ¶ added in v1.5.0
type FServicePackage struct { ID *string `json:"id,omitempty" yaml:"id,omitempty"` Name *string `json:"name,omitempty" yaml:"name,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` Versions []FServiceVersion `json:"versions,omitempty" yaml:"versions,omitempty"` Document *FDocument `json:"document,omitempty" yaml:"document,omitempty"` }
FServicePackage represents a Service package and its associated entities. +k8s:deepcopy-gen=true
func (*FServicePackage) DeepCopy ¶ added in v1.7.0
func (in *FServicePackage) DeepCopy() *FServicePackage
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FServicePackage.
func (*FServicePackage) DeepCopyInto ¶ added in v1.7.0
func (in *FServicePackage) DeepCopyInto(out *FServicePackage)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FServiceVersion ¶ added in v1.5.0
type FServiceVersion struct { ID *string `json:"id,omitempty" yaml:"id,omitempty"` Version *string `json:"version,omitempty" yaml:"version,omitempty"` Implementation *Implementation `json:"implementation,omitempty" yaml:"implementation,omitempty"` Document *FDocument `json:"document,omitempty" yaml:"document,omitempty"` }
FServiceVersion represents a Service version in Konnect. The type is duplicated because only a single document is exported in file while the API allows for multiple documents. +k8s:deepcopy-gen=true
func (*FServiceVersion) DeepCopy ¶ added in v1.7.0
func (in *FServiceVersion) DeepCopy() *FServiceVersion
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FServiceVersion.
func (*FServiceVersion) DeepCopyInto ¶ added in v1.7.0
func (in *FServiceVersion) DeepCopyInto(out *FServiceVersion)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FTarget ¶
FTarget represents a Kong Target. +k8s:deepcopy-gen=true
func (*FTarget) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FTarget.
func (*FTarget) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FUpstream ¶
type FUpstream struct { kong.Upstream `yaml:",inline,omitempty"` Targets []*FTarget `json:"targets,omitempty" yaml:",omitempty"` }
FUpstream represents a Kong Upstream and it's associated targets. +k8s:deepcopy-gen=true
func (*FUpstream) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FUpstream.
func (*FUpstream) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FVault ¶ added in v1.16.0
FVault represents a vault in Kong. +k8s:deepcopy-gen=true
func (*FVault) DeepCopy ¶ added in v1.16.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FVault.
func (*FVault) DeepCopyInto ¶ added in v1.16.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Implementation ¶ added in v1.5.0
type Implementation struct { Type string `json:"type,omitempty" yaml:"type,omitempty"` Kong *Kong `json:"kong,omitempty" yaml:"kong,omitempty"` }
Implementation represents an implementation of a Service version in Konnect. +k8s:deepcopy-gen=true
func (*Implementation) DeepCopy ¶ added in v1.7.0
func (in *Implementation) DeepCopy() *Implementation
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Implementation.
func (*Implementation) DeepCopyInto ¶ added in v1.7.0
func (in *Implementation) DeepCopyInto(out *Implementation)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Info ¶
type Info struct { SelectorTags []string `json:"select_tags,omitempty" yaml:"select_tags,omitempty"` Defaults KongDefaults `json:"defaults,omitempty" yaml:"defaults,omitempty"` }
Info contains meta-data of the file. +k8s:deepcopy-gen=true
func (*Info) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Info.
func (*Info) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Kong ¶ added in v1.5.0
type Kong struct {
Service *FService `json:"service,omitempty" yaml:"service,omitempty"`
}
Kong represents Kong implementation of a Service in Konnect. +k8s:deepcopy-gen=true
func (*Kong) DeepCopy ¶ added in v1.7.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Kong.
func (*Kong) DeepCopyInto ¶ added in v1.7.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type KongDefaults ¶ added in v1.8.0
type KongDefaults struct { Service *kong.Service `json:"service,omitempty" yaml:"service,omitempty"` Route *kong.Route `json:"route,omitempty" yaml:"route,omitempty"` Upstream *kong.Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"` Target *kong.Target `json:"target,omitempty" yaml:"target,omitempty"` }
KongDefaults represents default values that are filled in for entities with corresponding missing properties. +k8s:deepcopy-gen=true
func (*KongDefaults) DeepCopy ¶ added in v1.8.0
func (in *KongDefaults) DeepCopy() *KongDefaults
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongDefaults.
func (*KongDefaults) DeepCopyInto ¶ added in v1.8.0
func (in *KongDefaults) DeepCopyInto(out *KongDefaults)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Konnect ¶ added in v1.12.0
type Konnect struct { RuntimeGroupName string `json:"runtime_group_name,omitempty" yaml:"runtime_group_name,omitempty"` ControlPlaneName string `json:"control_plane_name,omitempty" yaml:"control_plane_name,omitempty"` }
Konnect contains configuration specific to Konnect. +k8s:deepcopy-gen=true
func (*Konnect) DeepCopy ¶ added in v1.12.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Konnect.
func (*Konnect) DeepCopyInto ¶ added in v1.12.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RenderConfig ¶
RenderConfig contains necessary information to render a correct KongConfig from a file.
type ValidationError ¶ added in v1.24.0
func (*ValidationError) Error ¶ added in v1.24.0
func (e *ValidationError) Error() string