|
| 1 | +// Copyright 2025 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 | +package v1beta1 |
| 16 | + |
| 17 | +import ( |
| 18 | + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" |
| 19 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 20 | +) |
| 21 | + |
| 22 | +var TagsTagBindingGVK = GroupVersion.WithKind("TagsTagBinding") |
| 23 | + |
| 24 | +// TagsTagBindingSpec defines the desired state of TagsTagBinding |
| 25 | +// +kcc:spec:proto=google.cloud.resourcemanager.v3.TagBinding |
| 26 | +type TagsTagBindingSpec struct { |
| 27 | + // +kcc:ref=Project |
| 28 | + ParentRef *ParentRef `json:"parentRef"` |
| 29 | + |
| 30 | + // +kcc:ref=TagsTagValue |
| 31 | + TagValueRef *TagsTagValueRef `json:"tagValueRef"` |
| 32 | + |
| 33 | + // The service-generated name of the resource. Used for acquisition only. Leave unset to create a new |
| 34 | + // resource. |
| 35 | + ResourceID *string `json:"resourceID,omitempty"` |
| 36 | +} |
| 37 | + |
| 38 | +// ParentRef is a reference to a parent resource. |
| 39 | +// +kcc:ref=Project |
| 40 | +type ParentRef struct { |
| 41 | + // Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names |
| 42 | + Name string `json:"name,omitempty"` |
| 43 | + |
| 44 | + // Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ |
| 45 | + Namespace string `json:"namespace,omitempty"` |
| 46 | + |
| 47 | + // Allowed value: string of the format `//cloudresourcemanager.googleapis.com/projects/{{value}}`, |
| 48 | + // where {{value}} is the `number` field of a `Project` resource. |
| 49 | + External string `json:"external,omitempty"` |
| 50 | +} |
| 51 | + |
| 52 | +// TagsTagBindingStatus defines the config connector machine state of TagsTagBinding |
| 53 | +type TagsTagBindingStatus struct { |
| 54 | + /* Conditions represent the latest available observations of the |
| 55 | + object's current state. */ |
| 56 | + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` |
| 57 | + |
| 58 | + // ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. |
| 59 | + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` |
| 60 | + |
| 61 | + // The generated id for the TagBinding. This is a string of the form: tagBindings/{full-resource-name}/{tag-value-name}. |
| 62 | + Name *string `json:"name,omitempty"` |
| 63 | + |
| 64 | + // A unique specifier for the TagsTagBinding resource in GCP. |
| 65 | + ExternalRef *string `json:"externalRef,omitempty"` |
| 66 | + |
| 67 | + // ObservedState is the state of the resource as most recently observed in GCP. |
| 68 | + // ObservedState *TagsTagBindingObservedState `json:"observedState,omitempty"` |
| 69 | +} |
| 70 | + |
| 71 | +// TagsTagBindingObservedState is the state of the TagsTagBinding resource as most recently observed in GCP. |
| 72 | +// +kcc:observedstate:proto=google.cloud.resourcemanager.v3.TagBinding |
| 73 | +type TagsTagBindingObservedState struct { |
| 74 | + // Output only. The name of the TagBinding. This is a String of the form: |
| 75 | + // `tagBindings/{full-resource-name}/{tag-value-name}` |
| 76 | + // (e.g. `tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456`). |
| 77 | + Name *string `json:"name,omitempty"` |
| 78 | +} |
| 79 | + |
| 80 | +// +genclient |
| 81 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 82 | +// +kubebuilder:resource:categories=gcp,shortName=gcptagstagbinding;gcptagstagbindings |
| 83 | +// +kubebuilder:subresource:status |
| 84 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/stability-level=alpha";"cnrm.cloud.google.com/system=true";"cnrm.cloud.google.com/tf2crd=true" |
| 85 | +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" |
| 86 | +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" |
| 87 | +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" |
| 88 | +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" |
| 89 | + |
| 90 | +// TagsTagBinding is the Schema for the TagsTagBinding API |
| 91 | +// +k8s:openapi-gen=true |
| 92 | +type TagsTagBinding struct { |
| 93 | + metav1.TypeMeta `json:",inline"` |
| 94 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 95 | + |
| 96 | + // +required |
| 97 | + Spec TagsTagBindingSpec `json:"spec,omitempty"` |
| 98 | + Status TagsTagBindingStatus `json:"status,omitempty"` |
| 99 | +} |
| 100 | + |
| 101 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 102 | +// TagsTagBindingList contains a list of TagsTagBinding |
| 103 | +type TagsTagBindingList struct { |
| 104 | + metav1.TypeMeta `json:",inline"` |
| 105 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 106 | + Items []TagsTagBinding `json:"items"` |
| 107 | +} |
| 108 | + |
| 109 | +func init() { |
| 110 | + SchemeBuilder.Register(&TagsTagBinding{}, &TagsTagBindingList{}) |
| 111 | +} |
0 commit comments