v1alpha1

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceKind     = "Device"
	DeviceListKind = "DeviceList"

	DeviceSingular  = "device"
	DevicePlural    = "devices"
	DeviceShortName = "dev"

	DeviceProtocolNETCONF DeviceProtocol = "netconf"
)
View Source
const Version = "v1alpha1"

+k8s:deepcopy-gen=package +groupName=candice.cloud

Variables

View Source
var AddToScheme = schemeBuilder.AddToScheme

Registers this API group and version to a scheme Note: Generator *requires* it to be called "AddToScheme"

View Source
var DeviceCustomResourceDefinition = apiextensions.CustomResourceDefinition{
	ObjectMeta: meta.ObjectMeta{
		Name: DeviceResourcesName,
	},
	Spec: apiextensions.CustomResourceDefinitionSpec{
		Group: group.GroupName,
		Names: apiextensions.CustomResourceDefinitionNames{
			Singular: DeviceSingular,
			Plural:   DevicePlural,
			Kind:     DeviceKind,
			ListKind: DeviceListKind,
			ShortNames: []string{
				DeviceShortName,
			},
			Categories: []string{
				"all",
			},
		},
		Scope: apiextensions.NamespaceScoped,
		Versions: []apiextensions.CustomResourceDefinitionVersion{
			{
				Name:    Version,
				Served:  true,
				Storage: true,
				Subresources: &apiextensions.CustomResourceSubresources{
					Status: &apiextensions.CustomResourceSubresourceStatus{},
				},
				Schema: &apiextensions.CustomResourceValidation{
					OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
						Description: "Candice device",
						Type:        "object",
						Required:    []string{"spec"},
						Properties: map[string]apiextensions.JSONSchemaProps{
							"spec": {
								Type:     "object",
								Required: []string{"protocol"},
								Properties: map[string]apiextensions.JSONSchemaProps{
									"protocol": {
										Description: "Device protocol",
										Type:        "string",
										Enum: []apiextensions.JSON{
											kubernetes.JSONString(DeviceProtocolNETCONF),
										},
									},
									"direct": {
										Description: "Direct reference to device",
										Type:        "object",
										Required:    []string{"host"},
										Properties: map[string]apiextensions.JSONSchemaProps{
											"host": {
												Description: "Device host (either \"host:port\" or \"host\")",
												Type:        "string",
											},
										},
									},
									"indirect": {
										Description: "Indirect reference to device",
										Type:        "object",
										Required:    []string{"service", "port"},
										Properties: map[string]apiextensions.JSONSchemaProps{
											"namespace": {
												Description: "Namespace for service resource (optional; defaults to same namespace as this device)",
												Type:        "string",
											},
											"service": {
												Description: "Name of service resource",
												Type:        "string",
											},
											"port": {
												Description: "Port to use with service",
												Type:        "integer",
											},
										},
									},
								},
								OneOf: []apiextensions.JSONSchemaProps{
									{
										Required: []string{"direct"},
									},
									{
										Required: []string{"indirect"},
									},
								},
							},
							"status": {
								Type: "object",
								Properties: map[string]apiextensions.JSONSchemaProps{
									"lastError": {
										Description: "Last error message on the device",
										Type:        "string",
									},
								},
							},
						},
					},
				},
				AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
					{
						Name:     "Protocol",
						Type:     "string",
						JSONPath: ".spec.protocol",
					},
				},
			},
		},
	},
}
View Source
var DeviceGVK = SchemeGroupVersion.WithKind(DeviceKind)
View Source
var DeviceResourcesName = fmt.Sprintf("%s.%s", DevicePlural, group.GroupName)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: group.GroupName, Version: Version}

Group version used to register these objects Note: Generator *requires* it to be called "SchemeGroupVersion"

Functions

func DeviceToARD

func DeviceToARD(device *Device) ard.StringMap

func Kind

func Kind(kind string) schema.GroupKind

Takes an unqualified kind and returns a group-qualified GroupKind Note: Generator *requires* it to be called "Kind"

func Resource

func Resource(resource string) schema.GroupResource

Takes an unqualified resource and returns a group-qualified GroupResource Note: Generator *requires* it to be called "Resource"

Types

type Device

type Device struct {
	meta.TypeMeta   `json:",inline"`
	meta.ObjectMeta `json:"metadata,omitempty"`

	Spec   DeviceSpec   `json:"spec"`
	Status DeviceStatus `json:"status"`
}

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*Device) DeepCopy

func (in *Device) DeepCopy() *Device

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Device.

func (*Device) DeepCopyInto

func (in *Device) DeepCopyInto(out *Device)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Device) DeepCopyObject

func (in *Device) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DeviceDirect

type DeviceDirect struct {
	Host string `json:"host"` // Device host (either "host:port" or "host")
}

func (*DeviceDirect) DeepCopy

func (in *DeviceDirect) DeepCopy() *DeviceDirect

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceDirect.

func (*DeviceDirect) DeepCopyInto

func (in *DeviceDirect) DeepCopyInto(out *DeviceDirect)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DeviceIndirect

type DeviceIndirect struct {
	Namespace string `json:"namespace,omitempty"` // Namespace for service resource (optional; defaults to same namespace as this device)
	Service   string `json:"service"`             // Name of service resource
	Port      uint64 `json:"port"`                // Port to use with service
}

func (*DeviceIndirect) DeepCopy

func (in *DeviceIndirect) DeepCopy() *DeviceIndirect

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceIndirect.

func (*DeviceIndirect) DeepCopyInto

func (in *DeviceIndirect) DeepCopyInto(out *DeviceIndirect)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DeviceList

type DeviceList struct {
	meta.TypeMeta `json:",inline"`
	meta.ListMeta `json:"metadata"`

	Items []Device `json:"items"`
}

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*DeviceList) DeepCopy

func (in *DeviceList) DeepCopy() *DeviceList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceList.

func (*DeviceList) DeepCopyInto

func (in *DeviceList) DeepCopyInto(out *DeviceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DeviceList) DeepCopyObject

func (in *DeviceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DeviceProtocol

type DeviceProtocol string

type DeviceSpec

type DeviceSpec struct {
	Protocol DeviceProtocol  `json:"protocol"`           // Device protocol
	Direct   *DeviceDirect   `json:"direct,omitempty"`   // Direct reference to device
	Indirect *DeviceIndirect `json:"indirect,omitempty"` // Indirect reference to device
}

func (*DeviceSpec) DeepCopy

func (in *DeviceSpec) DeepCopy() *DeviceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceSpec.

func (*DeviceSpec) DeepCopyInto

func (in *DeviceSpec) DeepCopyInto(out *DeviceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DeviceStatus

type DeviceStatus struct {
	LastError string `json:"lastError"` // Last error message on the device
}

func (*DeviceStatus) DeepCopy

func (in *DeviceStatus) DeepCopy() *DeviceStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceStatus.

func (*DeviceStatus) DeepCopyInto

func (in *DeviceStatus) DeepCopyInto(out *DeviceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL