kubesphere.io/api@v0.0.0-20231107125330-c9a03957060c/iam/v1alpha2/register.go (about)

     1  /*
     2  Copyright 2019 The KubeSphere 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 v1alpha2 contains API Schema definitions for the iam v1alpha2 API group
    20  // +k8s:openapi-gen=true
    21  // +kubebuilder:object:generate=true
    22  // +groupName=iam.kubesphere.io
    23  package v1alpha2
    24  
    25  import (
    26  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    27  	"k8s.io/apimachinery/pkg/runtime"
    28  	"k8s.io/apimachinery/pkg/runtime/schema"
    29  )
    30  
    31  var (
    32  	// SchemeGroupVersion is group version used to register these objects
    33  	SchemeGroupVersion = schema.GroupVersion{Group: "iam.kubesphere.io", Version: "v1alpha2"}
    34  
    35  	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
    36  	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
    37  
    38  	// AddToScheme is required by pkg/client/...
    39  	AddToScheme = SchemeBuilder.AddToScheme
    40  )
    41  
    42  // Resource is required by pkg/client/listers/...
    43  func Resource(resource string) schema.GroupResource {
    44  	return SchemeGroupVersion.WithResource(resource).GroupResource()
    45  }
    46  
    47  // Adds the list of known types to the given scheme.
    48  func addKnownTypes(scheme *runtime.Scheme) error {
    49  	scheme.AddKnownTypes(SchemeGroupVersion,
    50  		&User{},
    51  		&UserList{},
    52  		&LoginRecord{},
    53  		&LoginRecordList{},
    54  		&GlobalRole{},
    55  		&GlobalRoleList{},
    56  		&GlobalRoleBinding{},
    57  		&GlobalRoleBindingList{},
    58  		&WorkspaceRole{},
    59  		&WorkspaceRoleList{},
    60  		&WorkspaceRoleBinding{},
    61  		&WorkspaceRoleBindingList{},
    62  		&RoleBase{},
    63  		&RoleBaseList{},
    64  		&Group{},
    65  		&GroupList{},
    66  		&GroupBinding{},
    67  		&GroupBindingList{},
    68  	)
    69  	metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
    70  	return nil
    71  }