Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix g3doc for refs #3398

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apis/bigquery/v1beta1/dataset_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &BigQueryDatasetRef{}
// holds the GCP identifier for the KRM object.
type BigQueryDatasetRef struct {
// A reference to an externally managed BigQueryDataset resource.
// Should be in the format "projects/<projectID>/locations/<location>/datasets/<datasetID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/datasets/{{datasetID}}".
External string `json:"external,omitempty"`

// The name of a BigQueryDataset resource.
Expand Down Expand Up @@ -164,7 +164,7 @@ func ParseBigQueryDatasetExternal(external string) (parent *BigQueryDatasetParen
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 4 || tokens[0] != "projects" || tokens[2] != "datasets" {
return nil, "", fmt.Errorf("format of BigQueryDataset external=%q was not known (use projects/<projectId>/datasets/<datasetID>)", external)
return nil, "", fmt.Errorf("format of BigQueryDataset external=%q was not known (use projects/{{projectID}}/datasets/{{datasetID}})", external)
}
parent = &BigQueryDatasetParent{
ProjectID: tokens[1],
Expand Down
4 changes: 2 additions & 2 deletions apis/bigqueryanalyticshub/v1alpha1/dataexchange_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &BigQueryAnalyticsHubDataExchangeRef{}
// holds the GCP identifier for the KRM object.
type BigQueryAnalyticsHubDataExchangeRef struct {
// A reference to an externally managed BigQueryAnalyticsHubDataExchange resource.
// Should be in the format "projects/<projectID>/locations/<location>/dataexchanges/<dataexchangeID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/dataexchanges/{{dataexchangeID}}".
External string `json:"external,omitempty"`

// The name of a BigQueryAnalyticsHubDataExchange resource.
Expand Down Expand Up @@ -168,7 +168,7 @@ func parseBigQueryAnalyticsHubDataExchangeExternal(external string) (parent *Big
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "dataexchange" {
return nil, "", fmt.Errorf("format of BigQueryAnalyticsHubDataExchange external=%q was not known (use projects/<projectId>/locations/<location>/dataexchanges/<dataexchangeID>)", external)
return nil, "", fmt.Errorf("format of BigQueryAnalyticsHubDataExchange external=%q was not known (use projects/{{projectID}}/locations/{{location}}/dataexchanges/{{dataexchangeID}})", external)
}
parent = &BigQueryAnalyticsHubDataExchangeParent{
ProjectID: tokens[1],
Expand Down
4 changes: 2 additions & 2 deletions apis/bigqueryanalyticshub/v1alpha1/listing_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ refsv1beta1.ExternalNormalizer = &BigQueryAnalyticsHubListingRef{}
// holds the GCP identifier for the KRM object.
type BigQueryAnalyticsHubListingRef struct {
// A reference to an externally managed BigQueryAnalyticsHubListing resource.
// Should be in the format "projects/<projectID>/locations/<location>/listings/<listingID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/listings/{{listingID}}".
External string `json:"external,omitempty"`

// The name of a BigQueryAnalyticsHubListing resource.
Expand Down Expand Up @@ -187,7 +187,7 @@ func parseBigQueryAnalyticsHubListingExternal(external string) (parent *BigQuery
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 8 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "dataExchanges" || tokens[6] != "listings" {
return nil, "", fmt.Errorf("format of BigQueryAnalyticsHubListing external=%q was not known (use projects/<projectID>/locations/<location>/dataExchanges/<dataExchangeID>/listings/<listingID>)", external)
return nil, "", fmt.Errorf("format of BigQueryAnalyticsHubListing external=%q was not known (use projects/{{projectID}}/locations/{{location}}/dataExchanges/{{dataExchangeID}}/listings/{{listingID}})", external)
}
parent = &BigQueryAnalyticsHubListingParent{
ProjectID: tokens[1],
Expand Down
4 changes: 2 additions & 2 deletions apis/bigqueryanalyticshub/v1beta1/dataexchange_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &BigQueryAnalyticsHubDataExchangeRef{}
// holds the GCP identifier for the KRM object.
type BigQueryAnalyticsHubDataExchangeRef struct {
// A reference to an externally managed BigQueryAnalyticsHubDataExchange resource.
// Should be in the format "projects/<projectID>/locations/<location>/dataexchanges/<dataexchangeID>".
// Should be in the format "projects/{{projectID}}/locations/{{ocation}}/dataexchanges/{{dataexchangeID}}".
External string `json:"external,omitempty"`

// The name of a BigQueryAnalyticsHubDataExchange resource.
Expand Down Expand Up @@ -87,7 +87,7 @@ func ParseDataExchangeIdentity(external string) (identity *DataExchangeIdentity,
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "dataExchanges" {
return nil, fmt.Errorf("format of BigQueryAnalyticsHubDataExchange external=%q was not known (use projects/<projectId>/locations/<location>/dataExchanges/<dataExchangeID>)", external)
return nil, fmt.Errorf("format of BigQueryAnalyticsHubDataExchange external=%q was not known (use projects/{{projectId}}/locations/{{location}}/dataExchanges/{{dataExchangeID}})", external)
}

return &DataExchangeIdentity{
Expand Down
8 changes: 4 additions & 4 deletions apis/bigqueryconnection/v1alpha1/connection_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewBigQueryConnectionConnectionRef(ctx context.Context, reader client.Reade
tokens := strings.Split(externalRef, "/")

if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "connections" {
return nil, fmt.Errorf("externalRef should be projects/<project>/locations/<location>/connections/<Connection>, got %s", externalRef)
return nil, fmt.Errorf("externalRef should be projects/{{project}}/locations/{{location}}/connections/{{Connection}}, got %s", externalRef)
}
id.parent = "projects/" + tokens[1] + "/locations/" + tokens[3]

Expand Down Expand Up @@ -93,7 +93,7 @@ var _ refsv1beta1.ExternalNormalizer = &BigQueryConnectionConnectionRef{}
// holds the GCP identifier for the KRM object.
type BigQueryConnectionConnectionRef struct {
// A reference to an externally managed BigQueryConnectionConnection resource.
// Should be in the format `projects/<projectID>/locations/<location>/connections/<connectionID>`.
// Should be in the format `projects/{{projectID}}/locations/{{location}}/connections/{{connectionID}}`.
External string `json:"external,omitempty"`

// The `name` of a `BigQueryConnectionConnection` resource.
Expand All @@ -112,7 +112,7 @@ func (r *BigQueryConnectionConnectionRef) Parent() (string, error) {
r.External = strings.TrimPrefix(r.External, "/")
tokens := strings.Split(r.External, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "connections" {
return "", fmt.Errorf("format of BigQueryConnectionConnection external=%q was not known (use projects/<projectId>/locations/<location>/connections/<connectionID>)", r.External)
return "", fmt.Errorf("format of BigQueryConnectionConnection external=%q was not known (use projects/{{projectId}}/locations/{{location}}/connections/{{connectionID}})", r.External)
}
r.parent = "projects/" + tokens[1] + "/locations/" + tokens[3]
return r.parent, nil
Expand All @@ -130,7 +130,7 @@ func (r *BigQueryConnectionConnectionRef) NormalizedExternal(ctx context.Context
r.External = strings.TrimPrefix(r.External, "/")
tokens := strings.Split(r.External, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "connections" {
return "", fmt.Errorf("format of BigQueryConnectionConnection external=%q was not known (use projects/<projectId>/locations/<location>/connections/<connectionID>)", r.External)
return "", fmt.Errorf("format of BigQueryConnectionConnection external=%q was not known (use projects/{{projectId}}/locations/{{location}}/connections/{{connectionID}})", r.External)
}
return r.External, nil
}
Expand Down
6 changes: 3 additions & 3 deletions apis/bigqueryconnection/v1beta1/connection_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ refsv1beta1.ExternalNormalizer = &BigQueryConnectionConnectionRef{}
// holds the GCP identifier for the KRM object.
type BigQueryConnectionConnectionRef struct {
// A reference to an externally managed BigQueryConnectionConnection resource.
// Should be in the format `projects/<projectID>/locations/<location>/connections/<connectionID>`.
// Should be in the format `projects/{{projectID}}/locations/{{location}}/connections/{{connectionID}}`.
External string `json:"external,omitempty"`

// The `name` of a `BigQueryConnectionConnection` resource.
Expand All @@ -91,7 +91,7 @@ type BigQueryConnectionConnectionRef struct {
func parseExternal(external string) (string, string, string, error) {
tokens := strings.Split(external, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "connections" {
return "", "", "", fmt.Errorf("external should be projects/<project>/locations/<location>/connections/<Connection>, got %s", external)
return "", "", "", fmt.Errorf("external should be projects/{{project}}/locations/{{location}}/connections/{{Connection}}, got %s", external)
}
return tokens[1], tokens[3], tokens[5], nil
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func (r *BigQueryConnectionConnectionRef) NormalizedExternal(ctx context.Context
r.External = strings.TrimPrefix(r.External, "/")
tokens := strings.Split(r.External, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "connections" {
return "", fmt.Errorf("format of BigQueryConnectionConnection external=%q was not known (use projects/<projectId>/locations/<location>/connections/<connectionID>)", r.External)
return "", fmt.Errorf("format of BigQueryConnectionConnection external=%q was not known (use projects/{{projectId}}/locations/{{location}}/connections/{{connectionID}})", r.External)
}
return r.External, nil
}
Expand Down
4 changes: 2 additions & 2 deletions apis/compute/v1beta1/computefirewallpolicyrule_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ refsv1beta1.ExternalNormalizer = &ComputeFirewallPolicyRuleRef{}
// holds the GCP identifier for the KRM object.
type ComputeFirewallPolicyRuleRef struct {
// A reference to an externally managed ComputeFirewallPolicyRule resource.
// Should be in the format "locations/global/firewallPolicies/<firewallPolicy>/rules/<priority>".
// Should be in the format "locations/global/firewallPolicies/{{firewallPolicy}}/rules/{{priority}}".
External string `json:"external,omitempty"`

// The name of a ComputeFirewallPolicyRule resource.
Expand Down Expand Up @@ -158,7 +158,7 @@ func asComputeFirewallPolicyRuleExternal(parent *ComputeFirewallPolicyRuleParent
func parseComputeFirewallPolicyRuleExternal(external string) (parent *ComputeFirewallPolicyRuleParent, priority int64, err error) {
tokens := strings.Split(external, "/")
if len(tokens) != 6 || tokens[0] != "locations" || tokens[2] != "firewallPolicies" || tokens[4] != "rules" {
return nil, -1, fmt.Errorf("format of ComputeFirewallPolicyRule external=%q was not known (use firewallPolicies/<firewallPolicy>/rules/<priority>)", external)
return nil, -1, fmt.Errorf("format of ComputeFirewallPolicyRule external=%q was not known (use firewallPolicies/{{firewallPolicy}}/rules/{{priority}})", external)
}
parent = &ComputeFirewallPolicyRuleParent{
FirewallPolicy: tokens[3],
Expand Down
4 changes: 2 additions & 2 deletions apis/compute/v1beta1/targettcpproxy_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ var _ refsv1beta1.ExternalNormalizer = &ComputeTargetTCPProxyRef{}
// holds the GCP identifier for the KRM object.
type ComputeTargetTCPProxyRef struct {
// A reference to an externally managed ComputeTargetTCPProxy resource.
// Should be in the format "projects/<projectID>/global/targetTcpProxies/<targettcpproxyID>"
// or "projects/<projectID>/regions/<region>/targetTcpProxies/<targettcpproxyID>".
// Should be in the format "projects/{{projectID}}/global/targetTcpProxies/{{targettcpproxyID}}"
// or "projects/{{projectID}}/regions/{{region}}/targetTcpProxies/{{targettcpproxyID}}".
External string `json:"external,omitempty"`

// The name of a ComputeTargetTCPProxy resource.
Expand Down
4 changes: 2 additions & 2 deletions apis/discoveryengine/v1alpha1/datastore_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &DiscoveryEngineDataStoreRef{}
// holds the GCP identifier for the KRM object.
type DiscoveryEngineDataStoreRef struct {
// A reference to an externally managed DiscoveryEngineDataStore resource.
// Should be in the format "projects/<projectID>/locations/<location>/datastores/<datastoreID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/datastores/{{datastoreID}}".
External string `json:"external,omitempty"`

// The name of a DiscoveryEngineDataStore resource.
Expand Down Expand Up @@ -190,7 +190,7 @@ func ParseDiscoveryEngineDataStoreExternal(external string) (*DiscoveryEngineDat
DataStore: tokens[7],
}, nil
}
return nil, fmt.Errorf("format of DiscoveryEngineDataStore external=%q was not known (use projects/<projectId>/locations/<location>/collections/<collectionID>/dataStores/<dataStoreID>)", external)
return nil, fmt.Errorf("format of DiscoveryEngineDataStore external=%q was not known (use projects/{{projectId}}/locations/{{location}}/collections/{{collectionID}}/dataStores/{{dataStoreID}})", external)
}

func valueOf[T any](t *T) T {
Expand Down
4 changes: 2 additions & 2 deletions apis/discoveryengine/v1alpha1/engine_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &DiscoveryEngineEngineRef{}
// holds the GCP identifier for the KRM object.
type DiscoveryEngineEngineRef struct {
// A reference to an externally managed DiscoveryEngineEngine resource.
// Should be in the format "projects/<projectID>/locations/<location>/engines/<engineID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/engines/{{engineID}}".
External string `json:"external,omitempty"`

// The name of a DiscoveryEngineEngine resource.
Expand Down Expand Up @@ -189,5 +189,5 @@ func parseDiscoveryEngineEngineExternal(external string) (*DiscoveryEngineEngine
DataStore: tokens[7],
}, nil
}
return nil, fmt.Errorf("format of DiscoveryEngineEngine external=%q was not known (use projects/<projectId>/locations/<location>/collections/<collectionID>/engines/<engineID>)", external)
return nil, fmt.Errorf("format of DiscoveryEngineEngine external=%q was not known (use projects/{{projectId}}/locations/{{location}}/collections/{{collectionID}}/engines/{{engineID}})", external)
}
4 changes: 2 additions & 2 deletions apis/kms/v1alpha1/autokeyconfig_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &KMSAutokeyConfigRef{}
// holds the GCP identifier for the KRM object.
type KMSAutokeyConfigRef struct {
// A reference to an externally managed KMSAutokeyConfig resource.
// Should be in the format "folders/<folderID>/autokeyConfig".
// Should be in the format "folders/{{folderID}}/autokeyConfig".
External string `json:"external,omitempty"`

// The name of a KMSAutokeyConfig resource.
Expand Down Expand Up @@ -150,7 +150,7 @@ func ParseKMSAutokeyConfigExternal(external string) (parent *KMSAutokeyConfigPar
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 3 || tokens[0] != "folders" || tokens[2] != "autokeyConfig" {
return nil, fmt.Errorf("format of KMSAutokeyConfig external=%q was not known (use folders/<folderID>/autokeyConfig)", external)
return nil, fmt.Errorf("format of KMSAutokeyConfig external=%q was not known (use folders/{{folderID}}/autokeyConfig)", external)
}
parent = &KMSAutokeyConfigParent{
FolderID: tokens[1],
Expand Down
8 changes: 4 additions & 4 deletions apis/kms/v1alpha1/keyhandle_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &KMSKeyHandleRef{}
// holds the GCP identifier for the KRM object.
type KMSKeyHandleRef struct {
// A reference to an externally managed KMSKeyHandle resource.
// Should be in the format "projects/<projectID>/locations/<location>/keyHandles/<keyhandleID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/keyHandles/{{keyhandleID}}".
External string `json:"external,omitempty"`

// The name of a KMSKeyHandle resource.
Expand Down Expand Up @@ -106,7 +106,7 @@ func NewKMSKeyHandleRef(ctx context.Context, reader client.Reader, obj *KMSKeyHa

// At this point we are expecting desiredHandleID to be either empty or valid uuid
// 1. if desiredHandleID empty:
// id.external will be projects/<pid>/locations/<loc>/keyHandles/. i.e without resourceID.
// id.external will be projects/{{pid}}/locations/{{loc}}/keyHandles/. i.e without resourceID.
// A call will be made to find() with invalid externalID which will return false.
// 2. if desiredHandleID is a valid UUID: id.external will be valid.

Expand Down Expand Up @@ -178,7 +178,7 @@ func ParseKMSKeyHandleExternal(external string) (parent *KMSKeyHandleParent, res
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "keyHandles" {
return nil, "", fmt.Errorf("format of KMSKeyHandle external=%q was not known (use projects/<projectId>/locations/<location>/keyHandles/<keyhandleID>)", external)
return nil, "", fmt.Errorf("format of KMSKeyHandle external=%q was not known (use projects/{{projectId}}/locations/{{location}}/keyHandles/{{keyhandleID}})", external)
}
parent = &KMSKeyHandleParent{
ProjectID: tokens[1],
Expand All @@ -192,7 +192,7 @@ func AsKMSKeyHandleExternal_FromSpec(spec *KMSKeyHandleSpec) (parent *KMSKeyHand
external := strings.TrimPrefix(spec.ProjectRef.External, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 2 || tokens[0] != "projects" {
return nil, "", fmt.Errorf("invalid projectRef found in KMSKeyHandle=%q was not known (use projects/<projectId>)", external)
return nil, "", fmt.Errorf("invalid projectRef found in KMSKeyHandle=%q was not known (use projects/{{projectId}})", external)
}
parent = &KMSKeyHandleParent{
ProjectID: tokens[1],
Expand Down
8 changes: 4 additions & 4 deletions apis/kms/v1beta1/keyhandle_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ refsv1beta1.ExternalNormalizer = &KMSKeyHandleRef{}
// holds the GCP identifier for the KRM object.
type KMSKeyHandleRef struct {
// A reference to an externally managed KMSKeyHandle resource.
// Should be in the format "projects/<projectID>/locations/<location>/keyHandles/<keyhandleID>".
// Should be in the format "projects/{{projectID}}/locations/{{location}}/keyHandles/{{keyhandleID}}".
External string `json:"external,omitempty"`

// The name of a KMSKeyHandle resource.
Expand Down Expand Up @@ -106,7 +106,7 @@ func NewKMSKeyHandleRef(ctx context.Context, reader client.Reader, obj *KMSKeyHa

// At this point we are expecting desiredHandleID to be either empty or valid uuid
// 1. if desiredHandleID empty:
// id.external will be projects/<pid>/locations/<loc>/keyHandles/. i.e without resourceID.
// id.external will be projects/{{pid}}/locations/{{loc}}/keyHandles/. i.e without resourceID.
// A call will be made to find() with invalid externalID which will return false.
// 2. if desiredHandleID is a valid UUID: id.external will be valid.

Expand Down Expand Up @@ -178,7 +178,7 @@ func ParseKMSKeyHandleExternal(external string) (parent *KMSKeyHandleParent, res
external = strings.TrimPrefix(external, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "keyHandles" {
return nil, "", fmt.Errorf("format of KMSKeyHandle external=%q was not known (use projects/<projectId>/locations/<location>/keyHandles/<keyhandleID>)", external)
return nil, "", fmt.Errorf("format of KMSKeyHandle external=%q was not known (use projects/{{projectId}}/locations/{{location}}/keyHandles/{{keyhandleID}})", external)
}
parent = &KMSKeyHandleParent{
ProjectID: tokens[1],
Expand All @@ -192,7 +192,7 @@ func AsKMSKeyHandleExternal_FromSpec(spec *KMSKeyHandleSpec) (parent *KMSKeyHand
external := strings.TrimPrefix(spec.ProjectRef.External, "/")
tokens := strings.Split(external, "/")
if len(tokens) != 2 || tokens[0] != "projects" {
return nil, "", fmt.Errorf("invalid projectRef found in KMSKeyHandle=%q was not known (use projects/<projectId>)", external)
return nil, "", fmt.Errorf("invalid projectRef found in KMSKeyHandle=%q was not known (use projects/{{projectId}})", external)
}
parent = &KMSKeyHandleParent{
ProjectID: tokens[1],
Expand Down
Loading
Loading