Module: Google::Cloud::AppEngine

Defined in:
lib/google/cloud/app_engine.rb,
lib/google/cloud/app_engine/version.rb

Constant Summary collapse

VERSION =
"1.5.0"

Class Method Summary collapse

Class Method Details

.applications(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Applications.

By default, this returns an instance of Google::Cloud::AppEngine::V1::Applications::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 Applications 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Applications service. You can determine whether the method will succeed by calling applications_available?.

About Applications

Manages App Engine applications.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/google/cloud/app_engine.rb', line 75

def self.applications version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.applications_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the Applications service is supported by the current client. If true, you can retrieve a client object by calling applications. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Applications service, or if the versioned client gem needs an update to support the Applications service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/google/cloud/app_engine.rb', line 99

def self.applications_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :Applications
  service_module = service_module.const_get :Applications
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.authorized_certificates(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for AuthorizedCertificates.

By default, this returns an instance of Google::Cloud::AppEngine::V1::AuthorizedCertificates::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 AuthorizedCertificates 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the AuthorizedCertificates service. You can determine whether the method will succeed by calling authorized_certificates_available?.

About AuthorizedCertificates

Manages SSL certificates a user is authorized to administer. A user can administer any SSL certificates applicable to their authorized domains.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



507
508
509
510
511
512
513
514
515
516
517
# File 'lib/google/cloud/app_engine.rb', line 507

def self.authorized_certificates version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.authorized_certificates_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the AuthorizedCertificates service is supported by the current client. If true, you can retrieve a client object by calling authorized_certificates. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the AuthorizedCertificates service, or if the versioned client gem needs an update to support the AuthorizedCertificates service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/google/cloud/app_engine.rb', line 531

def self.authorized_certificates_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :AuthorizedCertificates
  service_module = service_module.const_get :AuthorizedCertificates
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.authorized_domains(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for AuthorizedDomains.

By default, this returns an instance of Google::Cloud::AppEngine::V1::AuthorizedDomains::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 AuthorizedDomains 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the AuthorizedDomains service. You can determine whether the method will succeed by calling authorized_domains_available?.

About AuthorizedDomains

Manages domains a user is authorized to administer. To authorize use of a domain, verify ownership via Webmaster Central.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



436
437
438
439
440
441
442
443
444
445
446
# File 'lib/google/cloud/app_engine.rb', line 436

def self.authorized_domains version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.authorized_domains_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the AuthorizedDomains service is supported by the current client. If true, you can retrieve a client object by calling authorized_domains. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the AuthorizedDomains service, or if the versioned client gem needs an update to support the AuthorizedDomains service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/google/cloud/app_engine.rb', line 460

def self.authorized_domains_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :AuthorizedDomains
  service_module = service_module.const_get :AuthorizedDomains
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.configure {|::Google::Cloud.configure.app_engine| ... } ⇒ ::Google::Cloud::Config

Configure the google-cloud-app_engine library.

The following configuration parameters are supported:

  • credentials (type: String, Hash, Google::Auth::Credentials) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.
  • lib_name (type: String) - 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}) - Additional headers to be sent with the call.
  • retry_policy (type: Hash) - The retry policy. The value is a hash with the following keys:
    • :initial_delay (type: Numeric) - The initial delay in seconds.
    • :max_delay (type: Numeric) - The max delay in seconds.
    • :multiplier (type: Numeric) - The incremental backoff multiplier.
    • :retry_codes (type: Array<String>) - The error codes that should trigger a retry.

Yields:

Returns:

  • (::Google::Cloud::Config)

    The default configuration used by this library



648
649
650
651
652
# File 'lib/google/cloud/app_engine.rb', line 648

def self.configure
  yield ::Google::Cloud.configure.app_engine if block_given?

  ::Google::Cloud.configure.app_engine
end

.domain_mappings(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for DomainMappings.

By default, this returns an instance of Google::Cloud::AppEngine::V1::DomainMappings::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 DomainMappings 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the DomainMappings service. You can determine whether the method will succeed by calling domain_mappings_available?.

About DomainMappings

Manages domains serving an application.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



577
578
579
580
581
582
583
584
585
586
587
# File 'lib/google/cloud/app_engine.rb', line 577

def self.domain_mappings version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.domain_mappings_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the DomainMappings service is supported by the current client. If true, you can retrieve a client object by calling domain_mappings. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the DomainMappings service, or if the versioned client gem needs an update to support the DomainMappings service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
# File 'lib/google/cloud/app_engine.rb', line 601

def self.domain_mappings_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :DomainMappings
  service_module = service_module.const_get :DomainMappings
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.firewall(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Firewall.

By default, this returns an instance of Google::Cloud::AppEngine::V1::Firewall::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 Firewall 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Firewall service. You can determine whether the method will succeed by calling firewall_available?.

About Firewall

Firewall resources are used to define a collection of access control rules for an Application. Each rule is defined with a position which specifies the rule's order in the sequence of rules, an IP range to be matched against requests, and an action to take upon matching requests.

Every request is evaluated against the Firewall rules in priority order. Processesing stops at the first rule which matches the request's IP address. A final rule always specifies an action that applies to all remaining IP addresses. The default final rule for a newly-created application will be set to "allow" if not otherwise specified by the user.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



364
365
366
367
368
369
370
371
372
373
374
# File 'lib/google/cloud/app_engine.rb', line 364

def self.firewall version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.firewall_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the Firewall service is supported by the current client. If true, you can retrieve a client object by calling firewall. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Firewall service, or if the versioned client gem needs an update to support the Firewall service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/google/cloud/app_engine.rb', line 388

def self.firewall_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :Firewall
  service_module = service_module.const_get :Firewall
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.instances(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Instances.

By default, this returns an instance of Google::Cloud::AppEngine::V1::Instances::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 Instances 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Instances service. You can determine whether the method will succeed by calling instances_available?.

About Instances

Manages instances of a version.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



285
286
287
288
289
290
291
292
293
294
295
# File 'lib/google/cloud/app_engine.rb', line 285

def self.instances version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.instances_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the Instances service is supported by the current client. If true, you can retrieve a client object by calling instances. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Instances service, or if the versioned client gem needs an update to support the Instances service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/google/cloud/app_engine.rb', line 309

def self.instances_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :Instances
  service_module = service_module.const_get :Instances
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.services(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Services.

By default, this returns an instance of Google::Cloud::AppEngine::V1::Services::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 Services 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Services service. You can determine whether the method will succeed by calling services_available?.

About Services

Manages services of an application.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/google/cloud/app_engine.rb', line 145

def self.services version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.services_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the Services service is supported by the current client. If true, you can retrieve a client object by calling services. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Services service, or if the versioned client gem needs an update to support the Services service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/google/cloud/app_engine.rb', line 169

def self.services_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :Services
  service_module = service_module.const_get :Services
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.versions(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Versions.

By default, this returns an instance of Google::Cloud::AppEngine::V1::Versions::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 Versions 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.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the Versions service. You can determine whether the method will succeed by calling versions_available?.

About Versions

Manages versions of a service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



215
216
217
218
219
220
221
222
223
224
225
# File 'lib/google/cloud/app_engine.rb', line 215

def self.versions version: :v1, transport: :grpc, &block
  require "google/cloud/app_engine/#{version.to_s.downcase}"

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

.versions_available?(version: :v1, transport: :grpc) ⇒ boolean

Determines whether the Versions service is supported by the current client. If true, you can retrieve a client object by calling versions. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the Versions service, or if the versioned client gem needs an update to support the Versions service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/google/cloud/app_engine.rb', line 239

def self.versions_available? version: :v1, transport: :grpc
  require "google/cloud/app_engine/#{version.to_s.downcase}"
  package_name = Google::Cloud::AppEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::AppEngine.const_get package_name
  return false unless service_module.const_defined? :Versions
  service_module = service_module.const_get :Versions
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end