Skip to content

Commit

Permalink
chore(ai_platform): Reordered ModelService and ModelGardenService
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed May 2, 2024
1 parent d5805c5 commit d871cfa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions google-cloud-ai_platform/lib/google/cloud/ai_platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -560,62 +560,62 @@ def self.migration_service version: :v1, &block
end

##
# Create a new client object for ModelService.
# Create a new client object for ModelGardenService.
#
# By default, this returns an instance of
# [Google::Cloud::AIPlatform::V1::ModelService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-ai_platform-v1/latest/Google-Cloud-AIPlatform-V1-ModelService-Client)
# [Google::Cloud::AIPlatform::V1::ModelGardenService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-ai_platform-v1/latest/Google-Cloud-AIPlatform-V1-ModelGardenService-Client)
# for a gRPC client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the ModelService service is
# `version` parameter. If the ModelGardenService service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
#
# ## About ModelService
# ## About ModelGardenService
#
# A service for managing Vertex AI's machine learning Models.
# The interface of Model Garden Service.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @return [::Object] A client object for the specified version.
#
def self.model_service version: :v1, &block
def self.model_garden_service version: :v1, &block
require "google/cloud/ai_platform/#{version.to_s.downcase}"

package_name = Google::Cloud::AIPlatform
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::AIPlatform.const_get(package_name).const_get(:ModelService)
service_module = Google::Cloud::AIPlatform.const_get(package_name).const_get(:ModelGardenService)
service_module.const_get(:Client).new(&block)
end

##
# Create a new client object for ModelGardenService.
# Create a new client object for ModelService.
#
# By default, this returns an instance of
# [Google::Cloud::AIPlatform::V1::ModelGardenService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-ai_platform-v1/latest/Google-Cloud-AIPlatform-V1-ModelGardenService-Client)
# [Google::Cloud::AIPlatform::V1::ModelService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-ai_platform-v1/latest/Google-Cloud-AIPlatform-V1-ModelService-Client)
# for a gRPC client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the ModelGardenService service is
# `version` parameter. If the ModelService service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
#
# ## About ModelGardenService
# ## About ModelService
#
# The interface of Model Garden Service.
# A service for managing Vertex AI's machine learning Models.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @return [::Object] A client object for the specified version.
#
def self.model_garden_service version: :v1, &block
def self.model_service version: :v1, &block
require "google/cloud/ai_platform/#{version.to_s.downcase}"

package_name = Google::Cloud::AIPlatform
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::AIPlatform.const_get(package_name).const_get(:ModelGardenService)
service_module = Google::Cloud::AIPlatform.const_get(package_name).const_get(:ModelService)
service_module.const_get(:Client).new(&block)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,23 @@ def test_migration_service_grpc
end
end

def test_model_service_grpc
def test_model_garden_service_grpc
Gapic::ServiceStub.stub :new, DummyStub.new do
grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
client = Google::Cloud::AIPlatform.model_service do |config|
client = Google::Cloud::AIPlatform.model_garden_service do |config|
config.credentials = grpc_channel
end
assert_kind_of Google::Cloud::AIPlatform::V1::ModelService::Client, client
assert_kind_of Google::Cloud::AIPlatform::V1::ModelGardenService::Client, client
end
end

def test_model_garden_service_grpc
def test_model_service_grpc
Gapic::ServiceStub.stub :new, DummyStub.new do
grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure
client = Google::Cloud::AIPlatform.model_garden_service do |config|
client = Google::Cloud::AIPlatform.model_service do |config|
config.credentials = grpc_channel
end
assert_kind_of Google::Cloud::AIPlatform::V1::ModelGardenService::Client, client
assert_kind_of Google::Cloud::AIPlatform::V1::ModelService::Client, client
end
end

Expand Down

0 comments on commit d871cfa

Please sign in to comment.