github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/cloud/pkg/apis/devices/v1alpha1/register.go (about)

     1  /*
     2  Copyright 2019 The KubeEdge Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // NOTE: Boilerplate only.  Ignore this file.
    18  
    19  // Package v1alpha1 contains API Schema definitions for the devices v1alpha1 API group
    20  // +k8s:openapi-gen=true
    21  // +k8s:deepcopy-gen=package,register
    22  // +k8s:conversion-gen=kubeedge/cloud/pkg/apis/devices
    23  // +k8s:defaulter-gen=TypeMeta
    24  // +groupName=devices.kubeedge.io
    25  package v1alpha1
    26  
    27  import (
    28  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    29  	"k8s.io/apimachinery/pkg/runtime"
    30  	"k8s.io/apimachinery/pkg/runtime/schema"
    31  )
    32  
    33  var (
    34  	SchemeBuilder      runtime.SchemeBuilder
    35  	localSchemeBuilder = &SchemeBuilder
    36  	AddToScheme        = localSchemeBuilder.AddToScheme
    37  )
    38  
    39  const (
    40  	// GroupName is the group name use in this package.
    41  	GroupName = "reliablesyncs.kubeedge.io"
    42  	// Version is the API version.
    43  	Version = "v1alpha1"
    44  )
    45  
    46  var (
    47  	// SchemeGroupVersion is the group version used to register these objects.
    48  	SchemeGroupVersion = schema.GroupVersion{Group: "devices.kubeedge.io", Version: "v1alpha1"}
    49  )
    50  
    51  func init() {
    52  	// We only register manually written functions here. The registration of the
    53  	// generated functions takes place in the generated files. The separation
    54  	// makes the code compile even when the generated files are missing.
    55  	localSchemeBuilder.Register(addKnownTypes)
    56  }
    57  
    58  // Resource takes an unqualified resource and returns a Group-qualified GroupResource.
    59  func Resource(resource string) schema.GroupResource {
    60  	return SchemeGroupVersion.WithResource(resource).GroupResource()
    61  }
    62  
    63  // addKnownTypes adds the set of types defined in this package to the supplied scheme.
    64  func addKnownTypes(scheme *runtime.Scheme) error {
    65  	scheme.AddKnownTypes(SchemeGroupVersion,
    66  		&Device{},
    67  		&DeviceList{},
    68  		&DeviceModel{},
    69  		&DeviceModelList{},
    70  	)
    71  	metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
    72  	return nil
    73  }