Documentation ¶
Index ¶
- Constants
- func GetPluralFromKind(kind string) (p string, ok bool)
- func GetResource(gv GroupKind) (r string, ok bool)
- func GetScope(gv GroupKind) (k string, ok bool)
- func RegisterGVK(gvk GroupVersionKind, scopeKind, resource string)
- type AuditMetadata
- type Error
- type ErrorResponse
- type Event
- type EventPayload
- type EventType
- type Finalizer
- type GroupKind
- type GroupVersionKind
- type Interface
- type Meta
- type Metadata
- type MetadataScope
- type Organization
- type Owner
- type OwnerType
- type Reference
- type ResourceInstance
- func (ri *ResourceInstance) AsInstance() (*ResourceInstance, error)
- func (ri *ResourceInstance) FromInstance(from *ResourceInstance) error
- func (ri *ResourceInstance) GetRawResource() json.RawMessage
- func (ri *ResourceInstance) MarshalJSON() ([]byte, error)
- func (ri *ResourceInstance) UnmarshalJSON(data []byte) error
- type ResourceMeta
- func (rm *ResourceMeta) GetAttributes() map[string]string
- func (rm *ResourceMeta) GetGroupVersionKind() GroupVersionKind
- func (rm *ResourceMeta) GetKindLink() string
- func (rm *ResourceMeta) GetMetadata() Metadata
- func (rm *ResourceMeta) GetName() string
- func (rm *ResourceMeta) GetReferenceByGVK(gvk GroupVersionKind) Reference
- func (rm *ResourceMeta) GetReferenceByIDAndGVK(id string, gvk GroupVersionKind) Reference
- func (rm *ResourceMeta) GetReferenceByNameAndGVK(name string, gvk GroupVersionKind) Reference
- func (rm *ResourceMeta) GetSelfLink() string
- func (rm *ResourceMeta) GetSubResource(key string) interface{}
- func (rm *ResourceMeta) GetTags() []string
- func (rm *ResourceMeta) MarshalJSON() ([]byte, error)
- func (rm *ResourceMeta) SetAttributes(attrs map[string]string)
- func (rm *ResourceMeta) SetName(name string)
- func (rm *ResourceMeta) SetScopeName(name string)
- func (rm *ResourceMeta) SetSubResource(name string, value interface{})
- func (rm *ResourceMeta) SetTags(tags []string)
- func (rm *ResourceMeta) UnmarshalJSON(data []byte) error
- type ResourceStatus
- type ResourceStatusReason
- type Time
Constants ¶
const ( ResourceDeleting = "DELETING" Inactive = "inactive" Active = "active" )
const ( // APIServerTimeFormat - api-server time lacks the colon in timezone APIServerTimeFormat = "2006-01-02T15:04:05.000-0700" // APIServerTimeFormatAlt - api-server time with colon in timezone APIServerTimeFormatAlt = "2006-01-02T15:04:05.000-07:00" )
Variables ¶
This section is empty.
Functions ¶
func GetResource ¶
GetResource returns the resource name of a Kind
func RegisterGVK ¶
func RegisterGVK(gvk GroupVersionKind, scopeKind, resource string)
RegisterGVK registers a GroupVersionKind with optional scope and mandatory resource
Types ¶
type AuditMetadata ¶
type AuditMetadata struct { // The creation time. CreateTimestamp Time `json:"createTimestamp,omitempty"` // Id of the user that created the entity. CreateUserID string `json:"createUserId,omitempty"` // The last modification time. ModifyTimestamp Time `json:"modifyTimestamp,omitempty"` // Id of the user that last modified the entity. ModifyUserID string `json:"modifyUserId,omitempty"` }
AuditMetadata Read-only metadata for the record.
type Error ¶
type Error struct { Status int `json:"status,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Meta map[string]interface{} `json:"meta:,omitempty"` }
Error an error in an ErrorResponse
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors,omitempty"`
}
ErrorResponse Detail for standard error responses.
type Event ¶
type Event struct { ID string Type EventType Payload EventPayload }
Event is an API Server event concerning a resource
type EventPayload ¶
type EventPayload struct { GroupKind Scope MetadataScope `json:"scope"` Tags []string `json:"tags"` Attributes map[string]string `json:"attributes"` ID string `json:"id"` Name string `json:"name"` References []Reference `json:"references"` }
EventPayload -
type EventType ¶
type EventType string
EventType -
const ( // ResourceEntryCreatedEvent - ResourceEntryCreatedEvent EventType = "ResourceEntryCreatedEvent" // ResourceEntryDeletedEvent - ResourceEntryDeletedEvent EventType = "ResourceEntryDeletedEvent" // ResourceEntryUpdatedEvent - ResourceEntryUpdatedEvent EventType = "ResourceEntryUpdatedEvent" )
type Finalizer ¶
type Finalizer struct { Name string `json:"name"` Description string `json:"description,omitempty"` }
Finalizer Finalizer on the API server resource.
type GroupKind ¶
type GroupKind struct { // Defines the group from which the resource belongs to. The server infers this from the endpoint the client submits the request to. Group string `json:"group,omitempty"` // Defines the kind of the resource. The server infers this from the endpoint the client submits the request to. Kind string `json:"kind,omitempty"` }
GroupKind the Group and Kind of the resource
type GroupVersionKind ¶
GroupVersionKind - The group, version & kind of the resource
type Interface ¶
type Interface interface { Meta AsInstance() (*ResourceInstance, error) FromInstance(from *ResourceInstance) error }
Interface describes API Server & catalog resources
type Meta ¶
type Meta interface { GetName() string GetGroupVersionKind() GroupVersionKind GetMetadata() Metadata SetScopeName(string) GetAttributes() map[string]string SetAttributes(map[string]string) GetTags() []string SetTags([]string) GetSubResource(key string) interface{} SetSubResource(key string, resource interface{}) GetReferenceByGVK(GroupVersionKind) Reference }
Meta interface for API Server resource metadata
type Metadata ¶
type Metadata struct { // Internal id of the resource. ID string `json:"id,omitempty"` Audit AuditMetadata `json:"audit,omitempty"` Scope MetadataScope `json:"scope,omitempty"` // Internal version of this object that can be used by clients to determine when objects have changed. ResourceVersion string `json:"resourceVersion,omitempty"` References []Reference `json:"references,omitempty"` // The URL to access the resource. SelfLink string `json:"selfLink,omitempty"` // Defines the state of the resource. If present, indicates if the resource is in Deleting state. State string `json:"state,omitempty"` }
Metadata that all server resources have. Data is generated by the server.
type MetadataScope ¶
type MetadataScope struct { // Internal id of the scope resource where the resource is defined. ID string `json:"id,omitempty"` // The kind of the scope resource where the resource is defined. Kind string `json:"kind,omitempty"` // The name of the scope where the resource is defined. Name string `json:"name,omitempty"` // The URL to access the scope resource. SelfLink string `json:"selfLink,omitempty"` }
MetadataScope The scope where this resource was defined.
type Organization ¶ added in v1.1.58
type Organization struct {
ID string `json:"id"`
}
type Owner ¶
type Owner struct { Type OwnerType `json:"type,omitempty"` ID string `json:"id"` Organization Organization `json:"organization,omitempty"` }
Owner is the owner of a resource
func (*Owner) MarshalJSON ¶
MarshalJSON marshals the owner to JSON
func (*Owner) UnmarshalJSON ¶
UnmarshalJSON unmarshalls the owner from JSON to convert the owner type to a string
type Reference ¶
type Reference struct { // Unique id generated by the server. ID string `json:"id,omitempty"` // The group of the resource that it is referring to. Group string `json:"group,omitempty"` // The kind of the resource that it is referring to. Kind string `json:"kind,omitempty"` // The name of the resource that it is referring to. Name string `json:"name,omitempty"` // The kind of the scope of the resource that it is referring to. ScopeKind string `json:"scopeKind,omitempty"` // The name of the scope of the resource that it is referring to. ScopeName string `json:"scopeName,omitempty"` // The URL to access the resource that it is referring to. SelfLink string `json:"selfLink,omitempty"` // Defines the type of the reference: * soft - spec property that has this reference will get nulled out if the referenced resource gets removed. * hard - dictates that the current resource will get removed when the referenced resource gets removed. Type string `json:"type,omitempty"` }
Reference List of objects dependent by this object.
type ResourceInstance ¶
type ResourceInstance struct { ResourceMeta Owner *Owner `json:"owner"` // Resource instance specs. Spec map[string]interface{} `json:"spec"` // contains filtered or unexported fields }
ResourceInstance API Server generic resource structure.
func (*ResourceInstance) AsInstance ¶
func (ri *ResourceInstance) AsInstance() (*ResourceInstance, error)
AsInstance returns the ResourceInstance
func (*ResourceInstance) FromInstance ¶
func (ri *ResourceInstance) FromInstance(from *ResourceInstance) error
FromInstance sets the underlying ResourceInstance
func (*ResourceInstance) GetRawResource ¶
func (ri *ResourceInstance) GetRawResource() json.RawMessage
GetRawResource gets the resource as bytes
func (*ResourceInstance) MarshalJSON ¶
func (ri *ResourceInstance) MarshalJSON() ([]byte, error)
MarshalJSON - custom marshaller for ResourceInstance to save the rawResource json to unmarshal specific types
func (*ResourceInstance) UnmarshalJSON ¶
func (ri *ResourceInstance) UnmarshalJSON(data []byte) error
UnmarshalJSON - custom unmarshaler for ResourceInstance struct to additionally use a custom subscriptionField
type ResourceMeta ¶
type ResourceMeta struct { GroupVersionKind Name string `json:"name,omitempty"` Title string `json:"title,omitempty"` // Metadata the metadata for the resource Metadata Metadata `json:"metadata,omitempty"` // Custom attributes for a resource. Attributes map[string]string `json:"attributes"` // List of tags. Tags []string `json:"tags"` // Finalizer on the API server resource Finalizers []Finalizer `json:"finalizers"` // SubResources contains all of the unique sub resources that may be added to a resource SubResources map[string]interface{} `json:"-"` }
ResourceMeta metadata for a ResourceInstance
func (*ResourceMeta) GetAttributes ¶
func (rm *ResourceMeta) GetAttributes() map[string]string
GetAttributes gets the attributes of a resource
func (*ResourceMeta) GetGroupVersionKind ¶
func (rm *ResourceMeta) GetGroupVersionKind() GroupVersionKind
GetGroupVersionKind gets the group, version, and kind of the resource
func (*ResourceMeta) GetKindLink ¶
func (rm *ResourceMeta) GetKindLink() string
GetKindLink gets the link to resource kind
func (*ResourceMeta) GetMetadata ¶
func (rm *ResourceMeta) GetMetadata() Metadata
GetMetadata gets the resource metadata
func (*ResourceMeta) GetName ¶
func (rm *ResourceMeta) GetName() string
GetName gets the name of a resource
func (*ResourceMeta) GetReferenceByGVK ¶
func (rm *ResourceMeta) GetReferenceByGVK(gvk GroupVersionKind) Reference
GetReferenceByGVK returns the first found reference that matches the GroupKind argument.
func (*ResourceMeta) GetReferenceByIDAndGVK ¶ added in v1.1.105
func (rm *ResourceMeta) GetReferenceByIDAndGVK(id string, gvk GroupVersionKind) Reference
GetReferenceByIDAndGVK returns the first found reference that matches the ID and GroupKind arguments.
func (*ResourceMeta) GetReferenceByNameAndGVK ¶ added in v1.1.105
func (rm *ResourceMeta) GetReferenceByNameAndGVK(name string, gvk GroupVersionKind) Reference
GetReferenceByNameAndGVK returns the first found reference that matches the Name and GroupKind arguments.
func (*ResourceMeta) GetSelfLink ¶
func (rm *ResourceMeta) GetSelfLink() string
GetSelfLink gets the resource metadata selflink
func (*ResourceMeta) GetSubResource ¶
func (rm *ResourceMeta) GetSubResource(key string) interface{}
GetSubResource get a sub resource by name
func (*ResourceMeta) GetTags ¶
func (rm *ResourceMeta) GetTags() []string
GetTags gets the tags of the resource
func (*ResourceMeta) MarshalJSON ¶
func (rm *ResourceMeta) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ResourceMeta to properly set the SubResources
func (*ResourceMeta) SetAttributes ¶
func (rm *ResourceMeta) SetAttributes(attrs map[string]string)
SetAttributes sets the attributes of a resource
func (*ResourceMeta) SetName ¶
func (rm *ResourceMeta) SetName(name string)
SetName sets the name of a resource
func (*ResourceMeta) SetScopeName ¶
func (rm *ResourceMeta) SetScopeName(name string)
SetScopeName sets the name of a resource
func (*ResourceMeta) SetSubResource ¶
func (rm *ResourceMeta) SetSubResource(name string, value interface{})
SetSubResource saves a value to a sub resource by name and overrides the current value. To update a SubResource first call GetSubResource and modify it, then save it.
func (*ResourceMeta) SetTags ¶
func (rm *ResourceMeta) SetTags(tags []string)
SetTags adds tags to the resource
func (*ResourceMeta) UnmarshalJSON ¶
func (rm *ResourceMeta) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshalls the ResourceMeta to properly set the SubResources
type ResourceStatus ¶
type ResourceStatus struct { Level string `json:"level"` // Details of the warning. Reasons []ResourceStatusReason `json:"reasons,omitempty"` }
ResourceStatus struct to represent status
type ResourceStatusReason ¶
type ResourceStatusReason struct { Type string `json:"type"` // Details of the warning. Detail string `json:"detail"` // Time when the update occurred. Timestamp Time `json:"timestamp"` Meta map[string]interface{} `json:"meta,omitempty"` }
ResourceStatusReason struct for reason oneOfs