Documentation ¶
Index ¶
- Constants
- Variables
- func GetListMapKeys(definition spec.Schema) ([]string, error)
- func GetListType(definition spec.Schema) (*string, error)
- func GetPatchMergeKeyExtension(extensions spec.Extensions) (*string, error)
- func GetPatchStrategyExtension(extensions spec.Extensions) (*string, error)
- func ParameterInAnnex(param spec.Parameter) bool
- type APIGroup
- type APIKind
- type APIVersion
- type ActionExtension
- type ActionInfo
- type ActionInfoList
- type ActionPath
- type Actions
- type GVKExtension
- type GVToKeyMap
- type Key
- type LinkEnds
- type ParameterIn
- type ParametersList
- type Property
- type Resource
- type ResourceList
- type ResourceMap
- type ResourcesMap
- type Spec
- type VersionStage
Constants ¶
const ( // ActionConnect is the "connect" Kubernetes action // DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT ActionConnect = "connect" // ActionDelete is the "delete" Kubernetes action // DELETE ActionDelete = "delete" // ActionDeleteCollection is the "deletecollection" Kubernetes action // DELETE ActionDeleteCollection = "deletecollection" // ActionGet is the "get" Kubernetes action // GET ActionGet = "get" // ActionList is the "list" Kubernetes action // GET ActionList = "list" // ActionPatch is the "patch" Kubernetes action // PATCH ActionPatch = "patch" // ActionCreate is the "post" Kubernetes action // POST ActionCreate = "post" // ActionUpdate is the "put" Kubernetes action // PUT ActionUpdate = "put" // ActionWatch is the "watch" Kubernetes action // GET ActionWatch = "watch" // ActionWatchList is the "watchlist" Kubernetes action // GET ActionWatchList = "watchlist" )
Variables ¶
var ParametersAnnex = map[string]struct{}{}
ParametersAnnex indicates the common parameters that are displayed in an annex
var ResourcesDescriptions = ResourcesMap{}
Functions ¶
func GetListMapKeys ¶
GetListMapKeys returns the ListMapKeys extension of a definition, or nil if not found
func GetListType ¶
GetListType returns the ListType extension of a definition, or nil if not found
func GetPatchMergeKeyExtension ¶
func GetPatchMergeKeyExtension(extensions spec.Extensions) (*string, error)
GetPatchMergeKeyExtension returns the GetPatchMergeKey extension of a definition, or nil if not found
func GetPatchStrategyExtension ¶
func GetPatchStrategyExtension(extensions spec.Extensions) (*string, error)
GetPatchStrategyExtension returns the PatchStrategy extension of a definition, or nil if not found
func ParameterInAnnex ¶
ParameterInAnnex returns true if param is displayed in annex
Types ¶
type APIGroup ¶
type APIGroup string
APIGroup represents the group of a Kubernetes API
type APIVersion ¶
type APIVersion struct { // Version is the *1* in v1alpha2 Version int // Stage is *alpha* in v1alpha2 Stage VersionStage // StageVersion is *2* in v1alpha2, or nil in v1 StageVersion *int }
APIVersion represents the version of a Kubernetes API (v1aplha1, v1beta2, v1, v2, etc)
func NewAPIVersion ¶
func NewAPIVersion(literal string) (apiversion *APIVersion, err error)
NewAPIVersion creates a new APIVersion struct from the literal version (for example v1alpha1)
func (*APIVersion) Equals ¶
func (o *APIVersion) Equals(p *APIVersion) bool
Equals returns true if 'o' and 'p' represent the same version
func (*APIVersion) LessThan ¶
func (o *APIVersion) LessThan(p *APIVersion) bool
LessThan returns true if 'o' version comes before 'p' version
func (*APIVersion) Replaces ¶
func (o *APIVersion) Replaces(p *APIVersion) bool
Replaces returns true if 'o' version replaces 'p' version
func (*APIVersion) String ¶
func (o *APIVersion) String() string
String returns the literal representation of an APIVersion
func (*APIVersion) UnmarshalYAML ¶
func (o *APIVersion) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML helps unmarshal APIVersion values from YAML
type ActionExtension ¶
type ActionExtension string
ActionExtension represents the OpenAPI extension x-bubernetes-action
func (ActionExtension) LessThan ¶
func (o ActionExtension) LessThan(p ActionExtension) bool
LessThan returns true if o appears before p in natural order
func (ActionExtension) String ¶
func (o ActionExtension) String() string
String returns the string representation of an ActionExtension
func (ActionExtension) Verb ¶
func (o ActionExtension) Verb() string
Verb returns the verb associated with the action
type ActionInfo ¶
type ActionInfo struct { // Path of the endpoint Path ActionPath // Kubernetes action mapped to the endpoint Action ActionExtension // Definition of the action Operation *spec.Operation // HTTP Method HTTPMethod string // Parameters of the actions at path level plus operation level Parameters ParametersList }
ActionInfo contains information about a specific endpoint
type ActionInfoList ¶
type ActionInfoList []ActionInfo
ActionInfoList represents a list of actions info
func (ActionInfoList) Len ¶
func (a ActionInfoList) Len() int
func (ActionInfoList) Less ¶
func (a ActionInfoList) Less(i, j int) bool
func (ActionInfoList) Swap ¶
func (a ActionInfoList) Swap(i, j int)
type ActionPath ¶
type ActionPath string
ActionPath represents the path of an action
func (ActionPath) LessThan ¶
func (o ActionPath) LessThan(p ActionPath) bool
LessThan returns true if o appears before p in natural order
func (ActionPath) String ¶
func (o ActionPath) String() string
type Actions ¶
type Actions map[string]ActionInfoList
Actions represents a map of ActionInfo, mapped by GVK
func (Actions) Add ¶
func (o Actions) Add(specParameters map[string]spec.Parameter, key string, operation *spec.Operation, httpMethod string, pathParameters []spec.Parameter)
Add an action to the collection of actions
func (Actions) Get ¶
func (o Actions) Get(gvk string) ActionInfoList
Get the actions for a specific GVK
type GVKExtension ¶
type GVKExtension struct { Group APIGroup Version APIVersion Kind APIKind }
GVKExtension represents the OpenAPI extension x-kubernetes-group-version-kind
type GVToKeyMap ¶
GVToKeyMap maps Kubernetes resource Group/Version with Spec Definition key (without Kind) e.g. GVToKey["v1"]: "io.k8s.api.core.v1"
func (GVToKeyMap) Add ¶
func (o GVToKeyMap) Add(key string, resource *Resource)
Add adds a new match between key and resource GV
type Key ¶
type Key string
Key of the resource in the OpenAPI definition (e.g. io.k8s.api.core.v1.Pod)
func GetTypeNameAndKey ¶
GetTypeNameAndKey returns the display name of a Schema. This is the api kind for definitions and the type for primitive types.
func (Key) GoImportPrefix ¶
GoImportPrefix returns the path to use for this group in go import
func (Key) RemoveResourceName ¶
RemoveResourceName removes the last part of the key corresponding to the resource name
func (Key) ResourceName ¶
ResourceName returns the resource name part of a key
type LinkEnds ¶
LinkEnds maps definition key to a link-end
type ParameterIn ¶
type ParameterIn string
ParameterIn represenets the position of a parameter of an operation
func (ParameterIn) LessThan ¶
func (o ParameterIn) LessThan(p ParameterIn) bool
LessThan returns true if o appears before p in the natural order
type ParametersList ¶
ParametersList is a list of parameters
func (ParametersList) Len ¶
func (a ParametersList) Len() int
func (ParametersList) Less ¶
func (a ParametersList) Less(i, j int) bool
func (ParametersList) Swap ¶
func (a ParametersList) Swap(i, j int)
type Property ¶
type Property struct { Name string Type string TypeKey *Key Description string Required bool RetainKeysStrategy bool MergeStrategyKey *string ListType *string ListMapKeys []string HardCodedValue *string }
Property represents a property of a definition
func NewHardCodedValueProperty ¶
NewHardCodedValueProperty returns a property with an hardcoded value (useful for apiVersion, Kind)
type Resource ¶
type Resource struct { Key Key GVKExtension Definition spec.Schema // Replaced indicates if this version is replaced by another one ReplacedBy *Key // Documented indicates if this resource was included in the TOC Documented bool }
Resource represent a Kubernetes API resource
func (*Resource) Equals ¶
func (o *Resource) Equals(group APIGroup, version APIVersion, kind APIKind) bool
Equals returns true if a resource is referenced by group/version/kind
type ResourceList ¶
type ResourceList []*Resource
ResourceList is the list of resources for a given Kind
func (ResourceList) Len ¶
func (a ResourceList) Len() int
func (ResourceList) Less ¶
func (a ResourceList) Less(i, j int) bool
func (ResourceList) Swap ¶
func (a ResourceList) Swap(i, j int)
type ResourceMap ¶
type ResourceMap map[APIKind]ResourceList
ResourceMap contains a map of resources, classified by Kind
func (*ResourceMap) Add ¶
func (o *ResourceMap) Add(resource *Resource)
Add a resource to the resource list
type ResourcesMap ¶
type ResourcesMap map[string][]descriptionInfo
type Spec ¶
type Spec struct { // Swagger is the openAPI representation of the k8s spec // populated by calling getSwagger Swagger *spec.Swagger // Resources is the list of K8s resources // populated by calling getResources Resources *ResourceMap // Actions is the list of endpoints defined in the API Actions Actions // GVToKey maps beetween Kubernetes Group/Version and Swagger definition key GVToKey GVToKeyMap }
Spec represents the Kubernetes API Specification
func (*Spec) GetDefinition ¶
GetDefinition returns the definition referenced by key
func (*Spec) GetResource ¶
func (o *Spec) GetResource(group APIGroup, version APIVersion, kind APIKind, markAsDocumented bool) (Key, *spec.Schema)
GetResource returns the resource referenced by group/version/kind, or nil if not found
type VersionStage ¶
type VersionStage int
VersionStage represents the stage of the version: alpha, beta, ga
const ( // StageAlpha is the first stage during development StageAlpha VersionStage = iota // StageBeta is the next stage StageBeta // StageGA is the latest stage StageGA )