1 // Copyright 2022 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // externalonlygvks contains variables and helpers for GroupVersionKinds that 16 // are not supported by KCC, but are commonly referenced by KCC resources. 17 package externalonlygvks 18 19 import "k8s.io/apimachinery/pkg/runtime/schema" 20 21 var ( 22 OrganizationGVK = schema.GroupVersionKind{ 23 Group: "resourcemanager.cnrm.cloud.google.com", 24 Version: "v1beta1", 25 Kind: "Organization", 26 } 27 BillingAccountGVK = schema.GroupVersionKind{ 28 Group: "billing.cnrm.cloud.google.com", 29 Version: "v1beta1", 30 Kind: "BillingAccount", 31 } 32 33 all = map[schema.GroupVersionKind]bool{ 34 OrganizationGVK: true, 35 BillingAccountGVK: true, 36 } 37 ) 38 39 // All returns GroupVersionKinds corresponding to GCP resources not supported 40 // by KCC, but are commonly referenced by KCC resources. 41 func All() []schema.GroupVersionKind { 42 gvks := make([]schema.GroupVersionKind, 0) 43 for gvk := range all { 44 gvks = append(gvks, gvk) 45 } 46 return gvks 47 } 48 49 func IsExternalOnlyGVK(gvk schema.GroupVersionKind) bool { 50 _, ok := all[gvk] 51 return ok 52 } 53