App Engine Admin V1 API - Class Google::Cloud::AppEngine::V1::Services::Client (v0.5.0)

Reference documentation and code samples for the App Engine Admin V1 API class Google::Cloud::AppEngine::V1::Services::Client.

Client for the Services service.

Manages services of an application.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Services Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Services clients
::Google::Cloud::AppEngine::V1::Services::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Services Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#delete_service

def delete_service(request, options = nil) -> ::Gapic::Operation
def delete_service(name: nil) -> ::Gapic::Operation

Deletes the specified service and all enclosed versions.

Overloads
def delete_service(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_service via a request object, either of type DeleteServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::DeleteServiceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_service(name: nil) -> ::Gapic::Operation
Pass arguments to delete_service 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).
Parameter
  • name (::String) — Name of the resource requested. Example: apps/myapp/services/default.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/app_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AppEngine::V1::Services::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AppEngine::V1::DeleteServiceRequest.new

# Call the delete_service method.
result = client.delete_service request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#get_service

def get_service(request, options = nil) -> ::Google::Cloud::AppEngine::V1::Service
def get_service(name: nil) -> ::Google::Cloud::AppEngine::V1::Service

Gets the current configuration of the specified service.

Overloads
def get_service(request, options = nil) -> ::Google::Cloud::AppEngine::V1::Service
Pass arguments to get_service via a request object, either of type GetServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::GetServiceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_service(name: nil) -> ::Google::Cloud::AppEngine::V1::Service
Pass arguments to get_service 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).
Parameter
  • name (::String) — Name of the resource requested. Example: apps/myapp/services/default.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/app_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AppEngine::V1::Services::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AppEngine::V1::GetServiceRequest.new

# Call the get_service method.
result = client.get_service request

# The returned object is of type Google::Cloud::AppEngine::V1::Service.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new Services client object.

Yields
  • (config) — Configure the Services client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::AppEngine::V1::Services::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::AppEngine::V1::Services::Client.new do |config|
  config.timeout = 10.0
end

#list_services

def list_services(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AppEngine::V1::Service>
def list_services(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AppEngine::V1::Service>

Lists all the services in the application.

Overloads
def list_services(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AppEngine::V1::Service>
Pass arguments to list_services via a request object, either of type ListServicesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::ListServicesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_services(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AppEngine::V1::Service>
Pass arguments to list_services 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).
Parameters
  • parent (::String) — Name of the parent Application resource. Example: apps/myapp.
  • page_size (::Integer) — Maximum results to return per page.
  • page_token (::String) — Continuation token for fetching the next page of results.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/app_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AppEngine::V1::Services::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AppEngine::V1::ListServicesRequest.new

# Call the list_services method.
result = client.list_services request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::AppEngine::V1::Service.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::AppEngine::V1::Services::Operations

Get the associated client for long-running operations.

#update_service

def update_service(request, options = nil) -> ::Gapic::Operation
def update_service(name: nil, service: nil, update_mask: nil, migrate_traffic: nil) -> ::Gapic::Operation

Updates the configuration of the specified service.

Overloads
def update_service(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_service via a request object, either of type UpdateServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::UpdateServiceRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_service(name: nil, service: nil, update_mask: nil, migrate_traffic: nil) -> ::Gapic::Operation
Pass arguments to update_service 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).
Parameters
  • name (::String) — Name of the resource to update. Example: apps/myapp/services/default.
  • service (::Google::Cloud::AppEngine::V1::Service, ::Hash) — A Service resource containing the updated service. Only fields set in the field mask will be updated.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. Standard field mask for the set of fields to be updated.
  • migrate_traffic (::Boolean) — Set to true to gradually shift traffic to one or more versions that you specify. By default, traffic is shifted immediately. For gradual traffic migration, the target versions must be located within instances that are configured for both warmup requests and automatic scaling. You must specify the shardBy field in the Service resource. Gradual traffic migration is not supported in the App Engine flexible environment. For examples, see Migrating and Splitting Traffic.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/app_engine/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AppEngine::V1::Services::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AppEngine::V1::UpdateServiceRequest.new

# Call the update_service method.
result = client.update_service request

# The returned object is of type Gapic::Operation. You can use this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end