Skip to content

Commit

Permalink
chore(dlp): fix ordering of Connection resource patterns (#26544)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] authored Aug 5, 2024
1 parent d4af3c1 commit 09e6398
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 178 deletions.
123 changes: 74 additions & 49 deletions google-cloud-dlp-v2/lib/google/cloud/dlp/v2/dlp_service/client.rb

Large diffs are not rendered by default.

42 changes: 33 additions & 9 deletions google-cloud-dlp-v2/lib/google/cloud/dlp/v2/dlp_service/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,44 @@ def column_data_profile_path **args
##
# Create a fully-qualified Connection resource string.
#
# The resource will be in the following format:
# @overload connection_path(project:, location:, connection:)
# The resource will be in the following format:
#
# `projects/{project}/locations/{location}/connections/{connection}`
# `projects/{project}/locations/{location}/connections/{connection}`
#
# @param project [String]
# @param location [String]
# @param connection [String]
# @param project [String]
# @param location [String]
# @param connection [String]
#
# @overload connection_path(organization:, location:, connection:)
# The resource will be in the following format:
#
# `organizations/{organization}/locations/{location}/connections/{connection}`
#
# @param organization [String]
# @param location [String]
# @param connection [String]
#
# @return [::String]
def connection_path project:, location:, connection:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
def connection_path **args
resources = {
"connection:location:project" => (proc do |project:, location:, connection:|
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

"projects/#{project}/locations/#{location}/connections/#{connection}"
end),
"connection:location:organization" => (proc do |organization:, location:, connection:|
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

"projects/#{project}/locations/#{location}/connections/#{connection}"
"organizations/#{organization}/locations/#{location}/connections/#{connection}"
end)
}

resource = resources[args.keys.sort.join(":")]
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
resource.call(**args)
end

##
Expand Down
123 changes: 74 additions & 49 deletions google-cloud-dlp-v2/lib/google/cloud/dlp/v2/dlp_service/rest/client.rb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2313,7 +2313,7 @@ def self.transcode_create_inspect_template_request request_pb
uri_template: "/v2/{parent}/inspectTemplates",
body: "*",
matches: [
["parent", %r{^organizations/[^/]+/?$}, false]
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
]
)
.with_bindings(
Expand All @@ -2337,7 +2337,7 @@ def self.transcode_create_inspect_template_request request_pb
uri_template: "/v2/{parent}/inspectTemplates",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
["parent", %r{^organizations/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
Expand All @@ -2359,7 +2359,7 @@ def self.transcode_update_inspect_template_request request_pb
uri_template: "/v2/{name}",
body: "*",
matches: [
["name", %r{^organizations/[^/]+/inspectTemplates/[^/]+/?$}, false]
["name", %r{^projects/[^/]+/locations/[^/]+/inspectTemplates/[^/]+/?$}, false]
]
)
.with_bindings(
Expand All @@ -2383,7 +2383,7 @@ def self.transcode_update_inspect_template_request request_pb
uri_template: "/v2/{name}",
body: "*",
matches: [
["name", %r{^projects/[^/]+/locations/[^/]+/inspectTemplates/[^/]+/?$}, false]
["name", %r{^organizations/[^/]+/inspectTemplates/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
Expand All @@ -2404,7 +2404,7 @@ def self.transcode_get_inspect_template_request request_pb
uri_method: :get,
uri_template: "/v2/{name}",
matches: [
["name", %r{^organizations/[^/]+/inspectTemplates/[^/]+/?$}, false]
["name", %r{^projects/[^/]+/locations/[^/]+/inspectTemplates/[^/]+/?$}, false]
]
)
.with_bindings(
Expand All @@ -2425,7 +2425,7 @@ def self.transcode_get_inspect_template_request request_pb
uri_method: :get,
uri_template: "/v2/{name}",
matches: [
["name", %r{^projects/[^/]+/locations/[^/]+/inspectTemplates/[^/]+/?$}, false]
["name", %r{^organizations/[^/]+/inspectTemplates/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
Expand All @@ -2446,7 +2446,7 @@ def self.transcode_list_inspect_templates_request request_pb
uri_method: :get,
uri_template: "/v2/{parent}/inspectTemplates",
matches: [
["parent", %r{^organizations/[^/]+/?$}, false]
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
]
)
.with_bindings(
Expand All @@ -2467,7 +2467,7 @@ def self.transcode_list_inspect_templates_request request_pb
uri_method: :get,
uri_template: "/v2/{parent}/inspectTemplates",
matches: [
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
["parent", %r{^organizations/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
Expand All @@ -2488,7 +2488,7 @@ def self.transcode_delete_inspect_template_request request_pb
uri_method: :delete,
uri_template: "/v2/{name}",
matches: [
["name", %r{^organizations/[^/]+/inspectTemplates/[^/]+/?$}, false]
["name", %r{^projects/[^/]+/locations/[^/]+/inspectTemplates/[^/]+/?$}, false]
]
)
.with_bindings(
Expand All @@ -2509,7 +2509,7 @@ def self.transcode_delete_inspect_template_request request_pb
uri_method: :delete,
uri_template: "/v2/{name}",
matches: [
["name", %r{^projects/[^/]+/locations/[^/]+/inspectTemplates/[^/]+/?$}, false]
["name", %r{^organizations/[^/]+/inspectTemplates/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
Expand Down Expand Up @@ -3822,6 +3822,14 @@ def self.transcode_create_connection_request request_pb
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
]
)
.with_bindings(
uri_method: :post,
uri_template: "/v2/{parent}/connections",
body: "*",
matches: [
["parent", %r{^organizations/[^/]+/locations/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

Expand All @@ -3843,6 +3851,13 @@ def self.transcode_get_connection_request request_pb
["name", %r{^projects/[^/]+/locations/[^/]+/connections/[^/]+/?$}, false]
]
)
.with_bindings(
uri_method: :get,
uri_template: "/v2/{name}",
matches: [
["name", %r{^organizations/[^/]+/locations/[^/]+/connections/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

Expand All @@ -3864,6 +3879,13 @@ def self.transcode_list_connections_request request_pb
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
]
)
.with_bindings(
uri_method: :get,
uri_template: "/v2/{parent}/connections",
matches: [
["parent", %r{^organizations/[^/]+/locations/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

Expand Down Expand Up @@ -3913,6 +3935,13 @@ def self.transcode_delete_connection_request request_pb
["name", %r{^projects/[^/]+/locations/[^/]+/connections/[^/]+/?$}, false]
]
)
.with_bindings(
uri_method: :delete,
uri_template: "/v2/{name}",
matches: [
["name", %r{^organizations/[^/]+/locations/[^/]+/connections/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end

Expand All @@ -3935,6 +3964,14 @@ def self.transcode_update_connection_request request_pb
["name", %r{^projects/[^/]+/locations/[^/]+/connections/[^/]+/?$}, false]
]
)
.with_bindings(
uri_method: :patch,
uri_template: "/v2/{name}",
body: "*",
matches: [
["name", %r{^organizations/[^/]+/locations/[^/]+/connections/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end
end
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-dlp-v2/lib/google/privacy/dlp/v2/dlp_pb.rb

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 09e6398

Please sign in to comment.