Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ def export_model request, options = nil
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil)
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil, custom_service_account: nil)
# Pass arguments to `copy_model` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
Expand Down Expand Up @@ -1458,6 +1458,17 @@ def export_model request, options = nil
# @param encryption_spec [::Google::Cloud::AIPlatform::V1::EncryptionSpec, ::Hash]
# Customer-managed encryption key options. If this is set,
# then the Model copy will be encrypted with the provided encryption key.
# @param custom_service_account [::String]
# Optional. The user-provided custom service account to use to do the copy
# model. If empty, [Vertex AI Service
# Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
# will be used to access resources needed to upload the model. This account
# must belong to the destination project where the model is copied to,
# i.e., the project specified in the `parent` field of this request and
# have the Vertex AI Service Agent role in the source project.
#
# Requires the user copying the Model to have the
# `iam.serviceAccounts.actAs` permission on this service account.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::Operation]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ def export_model request, options = nil
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil)
# @overload copy_model(model_id: nil, parent_model: nil, parent: nil, source_model: nil, encryption_spec: nil, custom_service_account: nil)
# Pass arguments to `copy_model` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
Expand Down Expand Up @@ -1376,6 +1376,17 @@ def export_model request, options = nil
# @param encryption_spec [::Google::Cloud::AIPlatform::V1::EncryptionSpec, ::Hash]
# Customer-managed encryption key options. If this is set,
# then the Model copy will be encrypted with the provided encryption key.
# @param custom_service_account [::String]
# Optional. The user-provided custom service account to use to do the copy
# model. If empty, [Vertex AI Service
# Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
# will be used to access resources needed to upload the model. This account
# must belong to the destination project where the model is copied to,
# i.e., the project specified in the `parent` field of this request and
# have the Vertex AI Service Agent role in the source project.
#
# Requires the user copying the Model to have the
# `iam.serviceAccounts.actAs` permission on this service account.
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Gapic::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,18 @@ class ExportModelResponse
# @return [::Google::Cloud::AIPlatform::V1::EncryptionSpec]
# Customer-managed encryption key options. If this is set,
# then the Model copy will be encrypted with the provided encryption key.
# @!attribute [rw] custom_service_account
# @return [::String]
# Optional. The user-provided custom service account to use to do the copy
# model. If empty, [Vertex AI Service
# Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
# will be used to access resources needed to upload the model. This account
# must belong to the destination project where the model is copied to,
# i.e., the project specified in the `parent` field of this request and
# have the Vertex AI Service Agent role in the source project.
#
# Requires the user copying the Model to have the
# `iam.serviceAccounts.actAs` permission on this service account.
class CopyModelRequest
include ::Google::Protobuf::MessageExts
extend ::Google::Protobuf::MessageExts::ClassMethods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ def test_copy_model
parent = "hello world"
source_model = "hello world"
encryption_spec = {}
custom_service_account = "hello world"

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

# Use hash object
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }) do |_result, response|
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|
assert_equal http_response, response.underlying_op
end

# Use named arguments
client.copy_model model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec do |_result, response|
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|
assert_equal http_response, response.underlying_op
end

# Use protobuf object
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|
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|
assert_equal http_response, response.underlying_op
end

# Use hash object with options
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }, call_options) do |_result, response|
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|
assert_equal http_response, response.underlying_op
end

# Use protobuf object with options
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|
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|
assert_equal http_response, response.underlying_op
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ def test_copy_model
parent = "hello world"
source_model = "hello world"
encryption_spec = {}
custom_service_account = "hello world"

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

Expand All @@ -812,35 +814,35 @@ def test_copy_model
end

# Use hash object
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }) do |response, operation|
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|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use named arguments
client.copy_model model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec do |response, operation|
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|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use protobuf object
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|
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|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use hash object with options
client.copy_model({ model_id: model_id, parent: parent, source_model: source_model, encryption_spec: encryption_spec }, grpc_options) do |response, operation|
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|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
end

# Use protobuf object with options
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|
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|
assert_kind_of Gapic::Operation, response
assert_equal grpc_response, response.grpc_op
assert_equal grpc_operation, operation
Expand Down
Loading