Skip to content

Commit

Permalink
fix(api_hub)!: Drop support for gRPC transport which is not yet suppo…
Browse files Browse the repository at this point in the history
…rted (#27324)
  • Loading branch information
gcf-owl-bot[bot] committed Sep 12, 2024
1 parent 6f6cb40 commit 26bee6d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 137 deletions.
87 changes: 28 additions & 59 deletions google-cloud-api_hub/lib/google/cloud/api_hub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
config.add_field! :scope, nil, match: [::Array, ::String]
config.add_field! :lib_name, nil, match: ::String
config.add_field! :lib_version, nil, match: ::String
config.add_field! :interceptors, nil, match: ::Array
config.add_field! :timeout, nil, match: ::Numeric
config.add_field! :metadata, nil, match: ::Hash
config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
Expand All @@ -49,48 +48,42 @@ module ApiHub
# Create a new client object for ApiHub.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::ApiHub::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-ApiHub-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::ApiHub::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-ApiHub-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the ApiHub service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About ApiHub
#
# This service provides all methods related to the API hub.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.api_hub version: :v1, transport: :grpc, &block
def self.api_hub version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:ApiHub)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
# Create a new client object for ApiHubDependencies.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::ApiHubDependencies::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-ApiHubDependencies-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::ApiHubDependencies::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-ApiHubDependencies-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the ApiHubDependencies service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About ApiHubDependencies
#
Expand All @@ -99,189 +92,167 @@ def self.api_hub version: :v1, transport: :grpc, &block
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.api_hub_dependencies version: :v1, transport: :grpc, &block
def self.api_hub_dependencies version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:ApiHubDependencies)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
# Create a new client object for HostProjectRegistrationService.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::HostProjectRegistrationService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-HostProjectRegistrationService-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::HostProjectRegistrationService::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-HostProjectRegistrationService-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the HostProjectRegistrationService service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About HostProjectRegistrationService
#
# This service is used for managing the host project registrations.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.host_project_registration_service version: :v1, transport: :grpc, &block
def self.host_project_registration_service version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:HostProjectRegistrationService)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
# Create a new client object for LintingService.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::LintingService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-LintingService-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::LintingService::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-LintingService-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the LintingService service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About LintingService
#
# This service provides all methods related to the 1p Linter.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.linting_service version: :v1, transport: :grpc, &block
def self.linting_service version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:LintingService)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
# Create a new client object for ApiHubPlugin.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::ApiHubPlugin::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-ApiHubPlugin-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::ApiHubPlugin::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-ApiHubPlugin-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the ApiHubPlugin service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About ApiHubPlugin
#
# This service is used for managing plugins inside the API Hub.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.api_hub_plugin version: :v1, transport: :grpc, &block
def self.api_hub_plugin version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:ApiHubPlugin)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
# Create a new client object for Provisioning.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::Provisioning::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-Provisioning-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::Provisioning::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-Provisioning-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the Provisioning service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About Provisioning
#
# This service is used for managing the data plane provisioning of the API hub.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.provisioning version: :v1, transport: :grpc, &block
def self.provisioning version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:Provisioning)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
# Create a new client object for RuntimeProjectAttachmentService.
#
# By default, this returns an instance of
# [Google::Cloud::ApiHub::V1::RuntimeProjectAttachmentService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-RuntimeProjectAttachmentService-Client)
# for a gRPC client for version V1 of the API.
# [Google::Cloud::ApiHub::V1::RuntimeProjectAttachmentService::Rest::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-api_hub-v1/latest/Google-Cloud-ApiHub-V1-RuntimeProjectAttachmentService-Rest-Client)
# for a REST client for version V1 of the API.
# However, you can specify a different API version by passing it in the
# `version` parameter. If the RuntimeProjectAttachmentService service is
# supported by that API version, and the corresponding gem is available, the
# appropriate versioned client will be returned.
# You can also specify a different transport by passing `:rest` or `:grpc` in
# the `transport` parameter.
#
# ## About RuntimeProjectAttachmentService
#
# This service is used for managing the runtime project attachments.
#
# @param version [::String, ::Symbol] The API version to connect to. Optional.
# Defaults to `:v1`.
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
# @return [::Object] A client object for the specified version.
#
def self.runtime_project_attachment_service version: :v1, transport: :grpc, &block
def self.runtime_project_attachment_service version: :v1, &block
require "google/cloud/api_hub/#{version.to_s.downcase}"

package_name = Google::Cloud::ApiHub
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::ApiHub.const_get(package_name).const_get(:RuntimeProjectAttachmentService)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
service_module.const_get(:Rest).const_get(:Client).new(&block)
end

##
Expand All @@ -296,8 +267,6 @@ def self.runtime_project_attachment_service version: :v1, transport: :grpc, &blo
# The library name as recorded in instrumentation and logging.
# * `lib_version` (*type:* `String`) -
# The library version as recorded in instrumentation and logging.
# * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
# An array of interceptors that are run before calls are executed.
# * `timeout` (*type:* `Numeric`) -
# Default timeout in seconds.
# * `metadata` (*type:* `Hash{Symbol=>String}`) -
Expand Down
Loading

0 comments on commit 26bee6d

Please sign in to comment.