Skip to content

Commit

Permalink
fix: Add helper comment for ResourceID validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvigil committed Dec 19, 2024
1 parent 9553959 commit 7d5756a
Show file tree
Hide file tree
Showing 45 changed files with 75 additions and 31 deletions.
1 change: 1 addition & 0 deletions apis/bigquerydatatransfer/v1alpha1/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type BigQueryDataTransferConfigSpec struct {
Parent `json:",inline"`

// The BigQueryDataTransferConfig name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Data transfer schedule.
Expand Down
1 change: 1 addition & 0 deletions apis/bigquerydatatransfer/v1beta1/transferconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type BigQueryDataTransferConfigSpec struct {
Parent `json:",inline"`

// The BigQueryDataTransferConfig name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Data transfer schedule.
Expand Down
1 change: 1 addition & 0 deletions apis/certificatemanager/v1alpha1/dnsauthorization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type CertificateManagerDNSAuthorizationSpec struct {
ProjectRef refs.ProjectRef `json:"projectRef"`

/* Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. */
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
// +optional
ResourceID *string `json:"resourceID,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions apis/certificatemanager/v1beta1/dnsauthorization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type CertificateManagerDNSAuthorizationSpec struct {
Location string `json:"location"`

/* Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. */
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
// +optional
ResourceID *string `json:"resourceID,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions apis/compute/v1beta1/targettcpproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type ComputeTargetTCPProxySpec struct {
ProxyHeader *string `json:"proxyHeader,omitempty"`

// The ComputeTargetTCPProxy name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions apis/containerattached/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ContainerAttachedClusterSpec struct {

// Optional.
// The ContainerAttachedCluster name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Location field is immutable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var DiscoveryEngineDataStoreGVK = GroupVersion.WithKind("DiscoveryEngineDataStor
// +kcc:proto=google.cloud.discoveryengine.v1.DataStore
type DiscoveryEngineDataStoreSpec struct {
// The DiscoveryEngineDataStore name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Required. The data store display name.
Expand Down
1 change: 1 addition & 0 deletions apis/kms/v1alpha1/keyhandle_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type KMSKeyHandleSpec struct {
// The KMS Key Handle ID used for resource creation or acquisition.
// For creation: If specified, this value is used as the key handle ID. If not provided, a UUID will be generated and assigned as the key handle ID.
// For acquisition: This field must be provided to identify the key handle resource to acquire.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Project hosting KMSKeyHandle
Expand Down
1 change: 1 addition & 0 deletions apis/kms/v1beta1/keyhandle_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type KMSKeyHandleSpec struct {
// The KMS Key Handle ID used for resource creation or acquisition.
// For creation: If specified, this value is used as the key handle ID. If not provided, a UUID will be generated and assigned as the key handle ID.
// For acquisition: This field must be provided to identify the key handle resource to acquire.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Project hosting KMSKeyHandle
Expand Down
1 change: 1 addition & 0 deletions apis/privilegedaccessmanager/v1alpha1/entitlement_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type PrivilegedAccessManagerEntitlementSpec struct {

// The PrivilegedAccessManagerEntitlement name. If not given, the
// 'metadata.name' will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
// +optional
ResourceID *string `json:"resourceID,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type PrivilegedAccessManagerEntitlementSpec struct {
// Immutable.
// The PrivilegedAccessManagerEntitlement name. If not given, the
// 'metadata.name' will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
// +optional
ResourceID *string `json:"resourceID,omitempty"`

Expand Down
1 change: 1 addition & 0 deletions apis/secretmanager/v1beta1/secret_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var SecretManagerSecretGVK = GroupVersion.WithKind("SecretManagerSecret")
// +kcc:proto=google.cloud.secretmanager.v1.Secret
type SecretManagerSecretSpec struct {
// The SecretManagerSecret name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Immutable. The replication policy of the secret data attached to
Expand Down
1 change: 1 addition & 0 deletions apis/securesourcemanager/v1alpha1/repository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type SecureSourceManagerRepositorySpec struct {
Location string `json:"location"`

// The SecureSourceManagerRepository name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// The name of the instance in which the repository is hosted, formatted as
Expand Down
1 change: 1 addition & 0 deletions apis/spanner/v1beta1/instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type SpannerInstanceSpec struct {
ProcessingUnits *int32 `json:"processingUnits,omitempty"`

// The SpannerInstance name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions apis/workstations/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type WorkstationClusterSpec struct {
Location string `json:"location,omitempty"`

// The WorkstationCluster name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Human-readable name for this workstation cluster.
Expand Down
1 change: 1 addition & 0 deletions apis/workstations/v1alpha1/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ type WorkstationConfigSpec struct {
Parent *WorkstationClusterRef `json:"parentRef"`

// The WorkstationConfig name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Human-readable name for this workstation configuration.
Expand Down
1 change: 1 addition & 0 deletions apis/workstations/v1alpha1/workstation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type WorkstationSpec struct {
Parent *WorkstationConfigRef `json:"parentRef"`

// The Workstation name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Human-readable name for this workstation.
Expand Down
1 change: 1 addition & 0 deletions apis/workstations/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type WorkstationClusterSpec struct {
Location string `json:"location,omitempty"`

// The WorkstationCluster name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Human-readable name for this workstation cluster.
Expand Down
1 change: 1 addition & 0 deletions apis/workstations/v1beta1/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ type WorkstationConfigSpec struct {
Parent *WorkstationClusterRef `json:"parentRef"`

// The WorkstationConfig name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Human-readable name for this workstation configuration.
Expand Down
1 change: 1 addition & 0 deletions apis/workstations/v1beta1/workstation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type WorkstationSpec struct {
Parent *WorkstationConfigRef `json:"parentRef"`

// The Workstation name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string `json:"resourceID,omitempty"`

// Optional. Human-readable name for this workstation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ spec:
type: object
resourceID:
description: The BigQueryDataTransferConfig name. If not given, the
metadata.name will be used.
metadata.name will be used. Cannot be changed after create, except
for updating from empty string to the actual resource ID.
type: string
schedule:
description: |-
Expand Down Expand Up @@ -619,7 +620,8 @@ spec:
type: object
resourceID:
description: The BigQueryDataTransferConfig name. If not given, the
metadata.name will be used.
metadata.name will be used. Cannot be changed after create, except
for updating from empty string to the actual resource ID.
type: string
schedule:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ spec:
resourceID:
description: Optional. The name of the resource. Used for creation
and acquisition. When unset, the value of `metadata.name` is used
as the default.
as the default. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
required:
- domain
Expand Down Expand Up @@ -269,7 +270,8 @@ spec:
resourceID:
description: Optional. The name of the resource. Used for creation
and acquisition. When unset, the value of `metadata.name` is used
as the default.
as the default. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
required:
- domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ spec:
type: string
resourceID:
description: The ComputeTargetTCPProxy name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
required:
- backendServiceRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ spec:
type: object
resourceID:
description: Optional. The ContainerAttachedCluster name. If not given,
the metadata.name will be used.
the metadata.name will be used. Cannot be changed after create,
except for updating from empty string to the actual resource ID.
type: string
required:
- distribution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ spec:
type: object
resourceID:
description: The DiscoveryEngineDataStore name. If not given, the
metadata.name will be used.
metadata.name will be used. Cannot be changed after create, except
for updating from empty string to the actual resource ID.
type: string
solutionTypes:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ spec:
acquisition. For creation: If specified, this value is used as the
key handle ID. If not provided, a UUID will be generated and assigned
as the key handle ID. For acquisition: This field must be provided
to identify the key handle resource to acquire.'
to identify the key handle resource to acquire. Cannot be changed
after create, except for updating from empty string to the actual
resource ID.'
type: string
resourceTypeSelector:
description: Indicates the resource type that the resulting [CryptoKey][]
Expand Down Expand Up @@ -240,7 +242,9 @@ spec:
acquisition. For creation: If specified, this value is used as the
key handle ID. If not provided, a UUID will be generated and assigned
as the key handle ID. For acquisition: This field must be provided
to identify the key handle resource to acquire.'
to identify the key handle resource to acquire. Cannot be changed
after create, except for updating from empty string to the actual
resource ID.'
type: string
resourceTypeSelector:
description: Indicates the resource type that the resulting [CryptoKey][]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ spec:
type: object
resourceID:
description: The PrivilegedAccessManagerEntitlement name. If not given,
the 'metadata.name' will be used.
the 'metadata.name' will be used. Cannot be changed after create,
except for updating from empty string to the actual resource ID.
type: string
required:
- eligibleUsers
Expand Down Expand Up @@ -668,7 +669,9 @@ spec:
type: object
resourceID:
description: Immutable. The PrivilegedAccessManagerEntitlement name.
If not given, the 'metadata.name' will be used.
If not given, the 'metadata.name' will be used. Cannot be changed
after create, except for updating from empty string to the actual
resource ID.
type: string
required:
- eligibleUsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ spec:
type: object
resourceID:
description: The SecretManagerSecret name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
rotation:
description: Optional. Rotation policy attached to the [Secret][google.cloud.secretmanager.v1.Secret].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ spec:
type: object
resourceID:
description: The SecureSourceManagerRepository name. If not given,
the metadata.name will be used.
the metadata.name will be used. Cannot be changed after create,
except for updating from empty string to the actual resource ID.
type: string
required:
- instanceRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ spec:
type: integer
resourceID:
description: The SpannerInstance name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
required:
- config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ spec:
rule: self == oldSelf
resourceID:
description: The WorkstationCluster name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
subnetworkRef:
description: Immutable. Reference to the Compute Engine subnetwork
Expand Down Expand Up @@ -546,7 +547,8 @@ spec:
rule: self == oldSelf
resourceID:
description: The WorkstationCluster name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
subnetworkRef:
description: Immutable. Reference to the Compute Engine subnetwork
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ spec:
type: array
resourceID:
description: The WorkstationConfig name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
runningTimeout:
description: |-
Expand Down Expand Up @@ -1134,7 +1135,8 @@ spec:
type: array
resourceID:
description: The WorkstationConfig name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
runningTimeout:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ spec:
type: object
resourceID:
description: The Workstation name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
required:
- parentRef
Expand Down Expand Up @@ -308,7 +309,8 @@ spec:
type: object
resourceID:
description: The Workstation name. If not given, the metadata.name
will be used.
will be used. Cannot be changed after create, except for updating
from empty string to the actual resource ID.
type: string
required:
- parentRef
Expand Down
1 change: 1 addition & 0 deletions dev/tools/controllerbuilder/template/apis/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var {{ .Kind }}GVK = GroupVersion.WithKind("{{ .Kind }}")
{{- end }}
type {{ .Kind }}Spec struct {
// The {{ .Kind }} name. If not given, the metadata.name will be used.
// Cannot be changed after create, except for updating from empty string to the actual resource ID.
ResourceID *string ` + "`" + `json:"resourceID,omitempty"` + "`" + `
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ serviceAccountRef:
</td>
<td>
<p><code class="apitype">string</code></p>
<p>{% verbatim %}The BigQueryDataTransferConfig name. If not given, the metadata.name will be used.{% endverbatim %}</p>
<p>{% verbatim %}The BigQueryDataTransferConfig name. If not given, the metadata.name will be used. Cannot be changed after create, except for updating from empty string to the actual resource ID.{% endverbatim %}</p>
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ resourceID: string
</td>
<td>
<p><code class="apitype">string</code></p>
<p>{% verbatim %}Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default.{% endverbatim %}</p>
<p>{% verbatim %}Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. Cannot be changed after create, except for updating from empty string to the actual resource ID.{% endverbatim %}</p>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ resourceID: string
</td>
<td>
<p><code class="apitype">string</code></p>
<p>{% verbatim %}The ComputeTargetTCPProxy name. If not given, the metadata.name will be used.{% endverbatim %}</p>
<p>{% verbatim %}The ComputeTargetTCPProxy name. If not given, the metadata.name will be used. Cannot be changed after create, except for updating from empty string to the actual resource ID.{% endverbatim %}</p>
</td>
</tr>
</tbody>
Expand Down
Loading

0 comments on commit 7d5756a

Please sign in to comment.