Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the types v1alpha1 API group this group is a duck type only package that hosts common objects and interfaces in alauda devops very similar to knative.dev/pkg/apis/duck/v1 or k8s.io/apimachinery/pkg/apis/meta/v1 +kubebuilder:object:generate=true +k8s:deepcopy-gen=package +groupName=meta.alauda.io
Index ¶
- Constants
- Variables
- func CopyAnnotations(object, dest metav1.Object)
- func CopyLabels(object, dest metav1.Object)
- func CopyMapStringString(object, dest map[string]string) map[string]string
- func FilterMapKeys(mapObj map[string]string, ignorePrefixes ...string) map[string]string
- func GetCondition(conditions apis.Conditions, t apis.ConditionType) *apis.Condition
- func GetNamespacedNameFromObject(obj metav1.Object) (named types.NamespacedName)
- func HasAnnotation(obj metav1.Object, key, value string) bool
- func HasAnnotationKey(obj metav1.Object, key string) bool
- func HasLabel(obj metav1.Object, key, value string) bool
- func HasLabelKey(obj metav1.Object, key string) bool
- func IsConditionChanged(current, old apis.ConditionAccessor, conditionType apis.ConditionType) bool
- func MapContainsKey(mapObj map[string]string, key string) bool
- func MapContainsKeyValue(mapObj map[string]string, key, value string) bool
- func PropagateCondition(conditionManager apis.ConditionManager, conditionType apis.ConditionType, ...)
- func ReasonForError(err error) string
- func SetConditionByError(conditionManager apis.ConditionManager, condition apis.ConditionType, ...)
- func SetConditionByErrorReason(conditionManager apis.ConditionManager, condition apis.ConditionType, ...)
- type ConditionType
- type CreatedBy
- func (in *CreatedBy) DeepCopy() *CreatedBy
- func (in *CreatedBy) DeepCopyInto(out *CreatedBy)
- func (by *CreatedBy) FromAnnotation(annotations map[string]string) (*CreatedBy, error)
- func (by *CreatedBy) IsZero() bool
- func (by *CreatedBy) SetIntoAnnotation(annotations map[string]string) (map[string]string, error)
- type DataMap
- func (c DataMap) BoolVal(key string) (*bool, error)
- func (in DataMap) DeepCopy() DataMap
- func (in DataMap) DeepCopyInto(out *DataMap)
- func (c DataMap) IntVal(key string) (*int, error)
- func (c DataMap) MustBoolVal(key string, dft bool) bool
- func (c DataMap) MustIntVal(key string, dft int) int
- func (c DataMap) MustStringVal(key string, dft string) string
- func (c DataMap) MustTimeDurationVal(key string, dft time.Duration) time.Duration
- func (c DataMap) StringVal(key string) *string
- func (c DataMap) TimeDurationVal(key string) (*time.Duration, error)
- type DeletedBy
- func (in *DeletedBy) DeepCopy() *DeletedBy
- func (in *DeletedBy) DeepCopyInto(out *DeletedBy)
- func (by *DeletedBy) FromAnnotation(annotations map[string]string) (*DeletedBy, error)
- func (by *DeletedBy) IsZero() bool
- func (by *DeletedBy) SetIntoAnnotation(annotations map[string]string) (map[string]string, error)
- type ListMeta
- type ListOptions
- type Pager
- type Param
- type ParamSpec
- type ParamSpecs
- type ParamType
- type ParamValue
- type Params
- type PropertySpec
- type TopLevelConditionObject
- type UpdatedBy
- func (in *UpdatedBy) DeepCopy() *UpdatedBy
- func (in *UpdatedBy) DeepCopyInto(out *UpdatedBy)
- func (by *UpdatedBy) FromAnnotation(annotations map[string]string) (*UpdatedBy, error)
- func (by *UpdatedBy) IsZero() bool
- func (by *UpdatedBy) SetIntoAnnotation(annotations map[string]string) (map[string]string, error)
Constants ¶
const ( // DisplayNameAnnotationKey display name for objects DisplayNameAnnotationKey = "cpaas.io/displayName" // CreatedTimeAnnotationKey creation time for objects CreatedTimeAnnotationKey = "cpaas.io/creationTime" // UpdatedTimeAnnotationKey update time for objects UpdatedTimeAnnotationKey = "cpaas.io/updateTime" // DeletedTimeAnnotationKey deletion time for objects DeletedTimeAnnotationKey = "cpaas.io/deletionTime" // NamespaceAnnotationKey namespace of objects NamespaceAnnotationKey = "cpaas.io/namespace" // CreatedByAnnotationKey annotation key to store resource creation username CreatedByAnnotationKey = "cpaas.io/createdBy" // UpdatedByAnnotationKey annotation key to store resource update username UpdatedByAnnotationKey = "cpaas.io/updatedBy" // DeletedByAnnotationKey annotation key to store resource update username DeletedByAnnotationKey = "cpaas.io/deletedBy" // TriggeredByAnnotationKey annotation key to store resource update username TriggeredByAnnotationKey = "cpaas.io/triggeredBy" // UIDescriptorsAnnotationKey annotation for storing ui descriptors in resources UIDescriptorsAnnotationKey = "ui.cpaas.io/descriptors" )
Common Annotations
const (
ConditionReasonNotSet = "NotSet"
)
const (
// MaxConditionMessageLength indicates max message field length in condition
MaxConditionMessageLength = 1000
)
Variables ¶
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "meta.alauda.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
var AllParamTypes = []ParamType{ParamTypeString, ParamTypeArray, ParamTypeObject}
AllParamTypes can be used for ParamType validation.
Functions ¶
func CopyAnnotations ¶
CopyAnnotations from the left side object to the right side will override any existing values
func CopyLabels ¶
CopyLabels from the left side object to the right side will override any existing labels
func CopyMapStringString ¶
CopyMapStringString copies content from a map to another
func FilterMapKeys ¶
FilterMapKeys filters a map[string]string by a list of keys
func GetCondition ¶
func GetCondition(conditions apis.Conditions, t apis.ConditionType) *apis.Condition
GetCondition will return the first condition pointer filter by type in conditions
func GetNamespacedNameFromObject ¶
func GetNamespacedNameFromObject(obj metav1.Object) (named types.NamespacedName)
GetNamespacedNameFromObject returns a types.NamespacedName from an object
func HasAnnotation ¶
HasAnnotation returns true if the object has the annotation and the values matches
func HasAnnotationKey ¶
HasAnnotationKey returns true if the object has the annotation key
func HasLabelKey ¶
HasLabelKey returns true if the object has the label key
func IsConditionChanged ¶
func IsConditionChanged(current, old apis.ConditionAccessor, conditionType apis.ConditionType) bool
IsConditionChanged given two condition accessors and a condition type will check if conditions changed
func MapContainsKey ¶
MapContainsKey checks if a map[string]string has a key
func MapContainsKeyValue ¶
MapContainsKeyValue checks if a map[string]string has a key with a specific value
func PropagateCondition ¶
func PropagateCondition(conditionManager apis.ConditionManager, conditionType apis.ConditionType, condition *apis.Condition)
PropagateCondition propagates a condition based on an external conditions used mainly when a resource depends on another and its conditions needs to be synced
func ReasonForError ¶
ReasonForError returns a string for Reason from an error. If the error is a apimachinery.StatusError will return its reason, otherwise will return unknown
func SetConditionByError ¶
func SetConditionByError(conditionManager apis.ConditionManager, condition apis.ConditionType, err error)
SetConditionByError sets a condition using an error to determine if it is True or False. If the given error is not nil will examine its reason and mark the condition as False otherwise will set condition to True
func SetConditionByErrorReason ¶
func SetConditionByErrorReason(conditionManager apis.ConditionManager, condition apis.ConditionType, err error, reason string)
SetConditionByErrorReason sets a condition with error and reason If the given error is not nil will examine its reason and mark the condition as False otherwise will set condition to True If the given reason is empty, it will parse a string for reason from the error
Types ¶
type ConditionType ¶
type ConditionType string
ConditionType is a camel-cased condition type.
const ( // ConditionReady specifies that the resource is ready. // For long-running resources. ConditionReady ConditionType = "Ready" // ConditionSucceeded specifies that the resource has finished. // For resource which run to completion. ConditionSucceeded ConditionType = "Succeeded" // ConditionPending specifies that the resource is pending. // For resource which run is waiting to be executed. ConditionPending ConditionType = "Pending" // ConditionRunning specifies that the resource is running. // For resource which run is running. ConditionRunning ConditionType = "Running" // ConditionFailed specifies that the resource is failed. // For resource which run to failed. ConditionFailed ConditionType = "Failed" // ConditionDisabled specifies that the resource is disabled. // For resource which can't be run. ConditionDisabled ConditionType = "Disabled" // ConditionCanceled specifies that the resource is canceled. // For resource which run to canceled. ConditionCanceled ConditionType = "Canceled" )
type CreatedBy ¶
type CreatedBy struct {
// Reference to the user that created the object. Any Kubernetes `Subject` is accepted.
// +optional
User *rbacv1.Subject `json:"user,omitempty"`
}
CreatedBy stores a list of created information.
func (*CreatedBy) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CreatedBy.
func (*CreatedBy) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*CreatedBy) FromAnnotation ¶
FromAnnotation will set `by` from annotations it will find CreatedByAnnotationKey and unmarshl content into struct type *CreatedBy if not found CreatedByAnnotationKey, error would be nil, and *CreatedBy would be nil also. if some errors happened, error will not be nil and *CreatedBy will be nil
type DataMap ¶
DataMap describe a map[string]string struct
func (DataMap) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataMap.
func (DataMap) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (DataMap) MustBoolVal ¶
MustBoolVal return bool value with specified key
func (DataMap) MustIntVal ¶
MustIntVal return int value with specified key
func (DataMap) MustStringVal ¶
MustStringVal return string value with specified key
func (DataMap) MustTimeDurationVal ¶
MustTimeDurationVal return time.Duration value with specified key
type DeletedBy ¶
type DeletedBy struct {
// Reference to the user that created the object. Any Kubernetes `Subject` is accepted.
// +optional
User *rbacv1.Subject `json:"user,omitempty"`
}
DeletedBy stores deleted user information.
func (*DeletedBy) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeletedBy.
func (*DeletedBy) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*DeletedBy) FromAnnotation ¶
FromAnnotation will set `by` from annotations it will find DeletedByAnnotationKey and unmarshl content into struct type *DeletedBy if not found DeletedByAnnotationKey, error would be nil, and *DeletedBy would be nil also. if some errors happened, error will not be nil and *DeletedBy will be nil
type ListMeta ¶
type ListMeta struct {
metav1.ListMeta `json:",inline"`
// TotalItems returned in the list
TotalItems int `json:"totalItems"`
// Current page number
// +optional
Page *int `json:"page,omitempty"`
// Current items per page
// +optional
ItemsPerPage *int `json:"itemsPerPage,omitempty"`
// Total number of pages
// +optional
TotalPages *int `json:"totalPages,omitempty"`
}
ListMeta extension of the metav1.ListMeta with paging related data
func (*ListMeta) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListMeta.
func (*ListMeta) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ListOptions ¶
type ListOptions struct {
// ItemsPerPage desired number of items to be returned in each page
ItemsPerPage int `json:"itemsPerPage"`
// Page desired to be returned
Page int `json:"page"`
}
ListOptions options for list
func (*ListOptions) DeepCopy ¶
func (in *ListOptions) DeepCopy() *ListOptions
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListOptions.
func (*ListOptions) DeepCopyInto ¶
func (in *ListOptions) DeepCopyInto(out *ListOptions)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Pager ¶
type Pager struct {
// ItemsPerPage desired number of items to be returned in each page
ItemsPerPage int `json:"itemsPerPage"`
// Page desired to be returned
Page int `json:"page"`
}
Pager describe the paging params
func (*Pager) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pager.
func (*Pager) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Pager) GetPageLimit ¶
GetPageLimit get the limit returned by a single page
type Param ¶
type Param struct {
Name string `json:"name"`
Value ParamValue `json:"value"`
}
Param declares an ParamValues to use for the parameter called name.
func (*Param) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Param.
func (*Param) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ParamSpec ¶
type ParamSpec struct {
// Name declares the name by which a parameter is referenced.
Name string `json:"name"`
// Type is the user-specified type of the parameter. The possible types
// are currently "string", "array" and "object", and "string" is the default.
// +optional
Type ParamType `json:"type,omitempty"`
// Description is a user-facing description of the parameter that may be
// used to populate a UI.
// +optional
Description string `json:"description,omitempty"`
// Properties is the JSON Schema properties to support key-value pairs parameter.
// +optional
Properties map[string]PropertySpec `json:"properties,omitempty"`
// Default is the value a parameter takes if no input value is supplied.
// +optional
Default *ParamValue `json:"default,omitempty"`
// Enum declares a set of allowed param input values.
// If Enum is not set, no input validation is performed for the param.
// +optional
Enum []string `json:"enum,omitempty"`
}
ParamSpec defines arbitrary parameters needed beyond typed inputs (such as resources).
func (*ParamSpec) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParamSpec.
func (*ParamSpec) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ParamSpec) SetDefaults ¶
SetDefaults set the default type
type ParamSpecs ¶
type ParamSpecs []ParamSpec
ParamSpecs is a list of ParamSpec +listType=atomic
func (ParamSpecs) DeepCopy ¶
func (in ParamSpecs) DeepCopy() ParamSpecs
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParamSpecs.
func (ParamSpecs) DeepCopyInto ¶
func (in ParamSpecs) DeepCopyInto(out *ParamSpecs)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (ParamSpecs) GetNames ¶
func (ps ParamSpecs) GetNames() []string
GetNames returns all the names of the declared parameters
func (ParamSpecs) SortByType ¶
func (ps ParamSpecs) SortByType() (ParamSpecs, ParamSpecs, ParamSpecs)
SortByType splits the input params into string params, array params, and object params, in that order
func (ParamSpecs) ValidateNoDuplicateNames ¶
func (ps ParamSpecs) ValidateNoDuplicateNames() *apis.FieldError
ValidateNoDuplicateNames returns an error if any of the params have the same name
type ParamType ¶
type ParamType string
ParamType indicates the type of an input parameter; Used to distinguish between a single string and an array of strings.
type ParamValue ¶
type ParamValue struct {
Type ParamType `json:"type"` // Represents the stored type of ParamValues.
StringVal string `json:"stringVal"`
// +listType=atomic
ArrayVal []string `json:"arrayVal"`
ObjectVal map[string]string `json:"objectVal"`
}
ParamValue is a type that can hold a single string, string array, or string map. Used in JSON unmarshalling so that a single JSON field can accept either an individual string or an array of strings.
func NewObject ¶
func NewObject(pairs map[string]string) *ParamValue
NewObject creates an ParamValues of type ParamTypeObject using the provided key-value pairs
func NewStructuredValues ¶
func NewStructuredValues(value string, values ...string) *ParamValue
NewStructuredValues creates an ParamValues of type ParamTypeString or ParamTypeArray, based on how many inputs are given (>1 input will create an array, not string).
func (*ParamValue) DeepCopy ¶
func (in *ParamValue) DeepCopy() *ParamValue
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParamValue.
func (*ParamValue) DeepCopyInto ¶
func (in *ParamValue) DeepCopyInto(out *ParamValue)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (ParamValue) MarshalJSON ¶
func (paramValues ParamValue) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface.
func (*ParamValue) UnmarshalJSON ¶
func (paramValues *ParamValue) UnmarshalJSON(value []byte) error
UnmarshalJSON implements the json.Unmarshaller interface.
type Params ¶
type Params []Param
Params is a list of Param +listType=atomic
func (Params) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Params.
func (Params) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PropertySpec ¶
type PropertySpec struct {
Type ParamType `json:"type,omitempty"`
}
PropertySpec defines the struct for object keys
func (*PropertySpec) DeepCopy ¶
func (in *PropertySpec) DeepCopy() *PropertySpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PropertySpec.
func (*PropertySpec) DeepCopyInto ¶
func (in *PropertySpec) DeepCopyInto(out *PropertySpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TopLevelConditionObject ¶
type TopLevelConditionObject interface {
metav1.Object
// GetTopLevelCondition finds and returns the top level Condition (happy Condition).
GetTopLevelCondition() *apis.Condition
}
TopLevelConditionObject shoule be an metav1.Object that implement func GetTopLevelCondition() *apis.Condition +k8s:deepcopy-gen=false
type UpdatedBy ¶
type UpdatedBy struct {
// Reference to the user that created the object. Any Kubernetes `Subject` is accepted.
// +optional
User *rbacv1.Subject `json:"user,omitempty"`
}
UpdatedBy stores updated user information.
func (*UpdatedBy) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdatedBy.
func (*UpdatedBy) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*UpdatedBy) FromAnnotation ¶
FromAnnotation will set `by` from annotations it will find UpdatedByAnnotationKey and unmarshl content into struct type *UpdatedBy if not found UpdatedByAnnotationKey, error would be nil, and *UpdatedBy would be nil also. if some errors happened, error will not be nil and *UpdatedBy will be nil