Skip to content

Commit 1bf8fbd

Browse files
feat: Model Registry CopyModel BYOSA (googleapis#33833)
* feat: Model Registry CopyModel BYOSA PiperOrigin-RevId: 899215526 Source-Link: googleapis/googleapis@62e4ecb Source-Link: https://github.com/googleapis/googleapis-gen/commit/1363385f47c4e0a3f54c1c93af3d09e8fa518d0a Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLWFpX3BsYXRmb3JtLXYxLy5Pd2xCb3QueWFtbCIsImgiOiIxMzYzMzg1ZjQ3YzRlMGEzZjU0YzFjOTNhZjNkMDllOGZhNTE4ZDBhIn0= * 🦉 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 2b3c335 commit 1bf8fbd

File tree

6 files changed

+50
-13
lines changed

6 files changed

+50
-13
lines changed

google-cloud-ai_platform-v1/lib/google/cloud/ai_platform/v1/model_service/client.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ def export_model request, options = nil
14291429
# @param options [::Gapic::CallOptions, ::Hash]
14301430
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
14311431
#
1432-
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil)
1432+
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil, custom_service_account: nil)
14331433
# Pass arguments to `copy_model` via keyword arguments. Note that at
14341434
# least one keyword argument is required. To specify no parameters, or to keep all
14351435
# the default parameter values, pass an empty Hash as a request object (see above).
@@ -1458,6 +1458,17 @@ def export_model request, options = nil
14581458
# @param encryption_spec [::Google::Cloud::AIPlatform::V1::EncryptionSpec, ::Hash]
14591459
# Customer-managed encryption key options. If this is set,
14601460
# then the Model copy will be encrypted with the provided encryption key.
1461+
# @param custom_service_account [::String]
1462+
# Optional. The user-provided custom service account to use to do the copy
1463+
# model. If empty, [Vertex AI Service
1464+
# Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
1465+
# will be used to access resources needed to upload the model. This account
1466+
# must belong to the destination project where the model is copied to,
1467+
# i.e., the project specified in the `parent` field of this request and
1468+
# have the Vertex AI Service Agent role in the source project.
1469+
#
1470+
# Requires the user copying the Model to have the
1471+
# `iam.serviceAccounts.actAs` permission on this service account.
14611472
#
14621473
# @yield [response, operation] Access the result along with the RPC operation
14631474
# @yieldparam response [::Gapic::Operation]

google-cloud-ai_platform-v1/lib/google/cloud/ai_platform/v1/model_service/rest/client.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ def export_model request, options = nil
13471347
# @param options [::Gapic::CallOptions, ::Hash]
13481348
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
13491349
#
1350-
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil)
1350+
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil, custom_service_account: nil)
13511351
# Pass arguments to `copy_model` via keyword arguments. Note that at
13521352
# least one keyword argument is required. To specify no parameters, or to keep all
13531353
# the default parameter values, pass an empty Hash as a request object (see above).
@@ -1376,6 +1376,17 @@ def export_model request, options = nil
13761376
# @param encryption_spec [::Google::Cloud::AIPlatform::V1::EncryptionSpec, ::Hash]
13771377
# Customer-managed encryption key options. If this is set,
13781378
# then the Model copy will be encrypted with the provided encryption key.
1379+
# @param custom_service_account [::String]
1380+
# Optional. The user-provided custom service account to use to do the copy
1381+
# model. If empty, [Vertex AI Service
1382+
# Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
1383+
# will be used to access resources needed to upload the model. This account
1384+
# must belong to the destination project where the model is copied to,
1385+
# i.e., the project specified in the `parent` field of this request and
1386+
# have the Vertex AI Service Agent role in the source project.
1387+
#
1388+
# Requires the user copying the Model to have the
1389+
# `iam.serviceAccounts.actAs` permission on this service account.
13791390
# @yield [result, operation] Access the result along with the TransportOperation object
13801391
# @yieldparam result [::Gapic::Operation]
13811392
# @yieldparam operation [::Gapic::Rest::TransportOperation]

google-cloud-ai_platform-v1/lib/google/cloud/aiplatform/v1/model_service_pb.rb

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

google-cloud-ai_platform-v1/proto_docs/google/cloud/aiplatform/v1/model_service.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,18 @@ class ExportModelResponse
528528
# @return [::Google::Cloud::AIPlatform::V1::EncryptionSpec]
529529
# Customer-managed encryption key options. If this is set,
530530
# then the Model copy will be encrypted with the provided encryption key.
531+
# @!attribute [rw] custom_service_account
532+
# @return [::String]
533+
# Optional. The user-provided custom service account to use to do the copy
534+
# model. If empty, [Vertex AI Service
535+
# Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
536+
# will be used to access resources needed to upload the model. This account
537+
# must belong to the destination project where the model is copied to,
538+
# i.e., the project specified in the `parent` field of this request and
539+
# have the Vertex AI Service Agent role in the source project.
540+
#
541+
# Requires the user copying the Model to have the
542+
# `iam.serviceAccounts.actAs` permission on this service account.
531543
class CopyModelRequest
532544
include ::Google::Protobuf::MessageExts
533545
extend ::Google::Protobuf::MessageExts::ClassMethods

google-cloud-ai_platform-v1/test/google/cloud/ai_platform/v1/model_service_rest_test.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ def test_copy_model
704704
parent = "hello world"
705705
source_model = "hello world"
706706
encryption_spec = {}
707+
custom_service_account = "hello world"
707708

708709
copy_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:|
709710
assert options.metadata.key? :"x-goog-api-client"
@@ -719,27 +720,27 @@ def test_copy_model
719720
end
720721

721722
# Use hash object
722-
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }) do |_result, response|
723+
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account }) do |_result, response|
723724
assert_equal http_response, response.underlying_op
724725
end
725726

726727
# Use named arguments
727-
client.copy_model model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec do |_result, response|
728+
client.copy_model model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account do |_result, response|
728729
assert_equal http_response, response.underlying_op
729730
end
730731

731732
# Use protobuf object
732-
client.copy_model ::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec) do |_result, response|
733+
client.copy_model ::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account) do |_result, response|
733734
assert_equal http_response, response.underlying_op
734735
end
735736

736737
# Use hash object with options
737-
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }, call_options) do |_result, response|
738+
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account }, call_options) do |_result, response|
738739
assert_equal http_response, response.underlying_op
739740
end
740741

741742
# Use protobuf object with options
742-
client.copy_model(::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec), call_options) do |_result, response|
743+
client.copy_model(::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account), call_options) do |_result, response|
743744
assert_equal http_response, response.underlying_op
744745
end
745746

google-cloud-ai_platform-v1/test/google/cloud/ai_platform/v1/model_service_test.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ def test_copy_model
793793
parent = "hello world"
794794
source_model = "hello world"
795795
encryption_spec = {}
796+
custom_service_account = "hello world"
796797

797798
copy_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:|
798799
assert_equal :copy_model, name
@@ -802,6 +803,7 @@ def test_copy_model
802803
assert_equal "hello world", request["parent"]
803804
assert_equal "hello world", request["source_model"]
804805
assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::AIPlatform::V1::EncryptionSpec), request["encryption_spec"]
806+
assert_equal "hello world", request["custom_service_account"]
805807
refute_nil options
806808
end
807809

@@ -812,35 +814,35 @@ def test_copy_model
812814
end
813815

814816
# Use hash object
815-
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }) do |response, operation|
817+
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account }) do |response, operation|
816818
assert_kind_of Gapic::Operation, response
817819
assert_equal grpc_response, response.grpc_op
818820
assert_equal grpc_operation, operation
819821
end
820822

821823
# Use named arguments
822-
client.copy_model model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec do |response, operation|
824+
client.copy_model model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account do |response, operation|
823825
assert_kind_of Gapic::Operation, response
824826
assert_equal grpc_response, response.grpc_op
825827
assert_equal grpc_operation, operation
826828
end
827829

828830
# Use protobuf object
829-
client.copy_model ::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec) do |response, operation|
831+
client.copy_model ::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account) do |response, operation|
830832
assert_kind_of Gapic::Operation, response
831833
assert_equal grpc_response, response.grpc_op
832834
assert_equal grpc_operation, operation
833835
end
834836

835837
# Use hash object with options
836-
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }, grpc_options) do |response, operation|
838+
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account }, grpc_options) do |response, operation|
837839
assert_kind_of Gapic::Operation, response
838840
assert_equal grpc_response, response.grpc_op
839841
assert_equal grpc_operation, operation
840842
end
841843

842844
# Use protobuf object with options
843-
client.copy_model(::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec), grpc_options) do |response, operation|
845+
client.copy_model(::Google::Cloud::AIPlatform::V1::CopyModelRequest.new(model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec, custom_service_account: custom_service_account), grpc_options) do |response, operation|
844846
assert_kind_of Gapic::Operation, response
845847
assert_equal grpc_response, response.grpc_op
846848
assert_equal grpc_operation, operation

0 commit comments

Comments
 (0)