Skip to content

Commit d9407b8

Browse files
feat: Support per-repository identity for repositories (#34710)
* feat: Support per-repository identity for repositories feat: Support repository secret scanning with custom DLP inspect templates PiperOrigin-RevId: 942184869 Source-Link: googleapis/googleapis@ba4573a Source-Link: googleapis/googleapis-gen@853de32 Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLXNlY3VyZV9zb3VyY2VfbWFuYWdlci12MS8uT3dsQm90LnlhbWwiLCJoIjoiODUzZGUzMmMzMWM5ZTIyNjYzZGFmNTVlOGQ1NzU4OGQ1NTRkYThhYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a8eeceb commit d9407b8

4 files changed

Lines changed: 90 additions & 1 deletion

File tree

google-cloud-secure_source_manager-v1/lib/google/cloud/secure_source_manager/v1/secure_source_manager/paths.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,25 @@ def hook_path project:, location:, repository:, hook:
106106
"projects/#{project}/locations/#{location}/repositories/#{repository}/hooks/#{hook}"
107107
end
108108

109+
##
110+
# Create a fully-qualified InspectTemplate resource string.
111+
#
112+
# The resource will be in the following format:
113+
#
114+
# `projects/{project}/locations/{location}/inspectTemplates/{inspect_template}`
115+
#
116+
# @param project [String]
117+
# @param location [String]
118+
# @param inspect_template [String]
119+
#
120+
# @return [::String]
121+
def inspect_template_path project:, location:, inspect_template:
122+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
123+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
124+
125+
"projects/#{project}/locations/#{location}/inspectTemplates/#{inspect_template}"
126+
end
127+
109128
##
110129
# Create a fully-qualified Instance resource string.
111130
#
@@ -249,6 +268,23 @@ def repository_path project:, location:, repository:
249268
"projects/#{project}/locations/#{location}/repositories/#{repository}"
250269
end
251270

271+
##
272+
# Create a fully-qualified ServiceAccount resource string.
273+
#
274+
# The resource will be in the following format:
275+
#
276+
# `projects/{project}/serviceAccounts/{service_account}`
277+
#
278+
# @param project [String]
279+
# @param service_account [String]
280+
#
281+
# @return [::String]
282+
def service_account_path project:, service_account:
283+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
284+
285+
"projects/#{project}/serviceAccounts/#{service_account}"
286+
end
287+
252288
##
253289
# Create a fully-qualified ServiceAttachment resource string.
254290
#

google-cloud-secure_source_manager-v1/lib/google/cloud/securesourcemanager/v1/secure_source_manager_pb.rb

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

google-cloud-secure_source_manager-v1/proto_docs/google/cloud/securesourcemanager/v1/secure_source_manager.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ module StateNote
235235
# @!attribute [rw] initial_config
236236
# @return [::Google::Cloud::SecureSourceManager::V1::Repository::InitialConfig]
237237
# Input only. Initial configurations for the repository.
238+
# @!attribute [rw] service_account
239+
# @return [::String]
240+
# Optional. Repository level service account (BYOSA).
241+
# @!attribute [rw] scan_config
242+
# @return [::Google::Cloud::SecureSourceManager::V1::Repository::ScanConfig]
243+
# Optional. Provides configuration for scanning.
238244
class Repository
239245
include ::Google::Protobuf::MessageExts
240246
extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -396,6 +402,27 @@ class InitialConfig
396402
include ::Google::Protobuf::MessageExts
397403
extend ::Google::Protobuf::MessageExts::ClassMethods
398404
end
405+
406+
# Configuration for scanning.
407+
# @!attribute [rw] secret_scan_config
408+
# @return [::Google::Cloud::SecureSourceManager::V1::Repository::ScanConfig::SecretScanConfig]
409+
# Optional. Configuration for secret scanning.
410+
class ScanConfig
411+
include ::Google::Protobuf::MessageExts
412+
extend ::Google::Protobuf::MessageExts::ClassMethods
413+
414+
# Configuration for secret scanning.
415+
# @!attribute [rw] enabled
416+
# @return [::Boolean]
417+
# Optional. Enables secret scanning for the repository.
418+
# @!attribute [rw] inspect_template
419+
# @return [::String]
420+
# Optional. The DLP inspect template to use for secret scanning.
421+
class SecretScanConfig
422+
include ::Google::Protobuf::MessageExts
423+
extend ::Google::Protobuf::MessageExts::ClassMethods
424+
end
425+
end
399426
end
400427

401428
# Metadata of a Secure Source Manager Hook.

google-cloud-secure_source_manager-v1/test/google/cloud/secure_source_manager/v1/secure_source_manager_paths_test.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ def test_hook_path
8989
end
9090
end
9191

92+
def test_inspect_template_path
93+
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
94+
::Gapic::ServiceStub.stub :new, DummyStub.new do
95+
client = ::Google::Cloud::SecureSourceManager::V1::SecureSourceManager::Client.new do |config|
96+
config.credentials = grpc_channel
97+
end
98+
99+
path = client.inspect_template_path project: "value0", location: "value1", inspect_template: "value2"
100+
assert_equal "projects/value0/locations/value1/inspectTemplates/value2", path
101+
end
102+
end
103+
92104
def test_instance_path
93105
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
94106
::Gapic::ServiceStub.stub :new, DummyStub.new do
@@ -173,6 +185,18 @@ def test_repository_path
173185
end
174186
end
175187

188+
def test_service_account_path
189+
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
190+
::Gapic::ServiceStub.stub :new, DummyStub.new do
191+
client = ::Google::Cloud::SecureSourceManager::V1::SecureSourceManager::Client.new do |config|
192+
config.credentials = grpc_channel
193+
end
194+
195+
path = client.service_account_path project: "value0", service_account: "value1"
196+
assert_equal "projects/value0/serviceAccounts/value1", path
197+
end
198+
end
199+
176200
def test_service_attachment_path
177201
grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
178202
::Gapic::ServiceStub.stub :new, DummyStub.new do

0 commit comments

Comments
 (0)