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

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

Client for the Instances service.

Manages instances of a version.

Inherits

  • Object

Methods

.configure

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

Configure the Instances 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 Instances clients
::Google::Cloud::AppEngine::V1::Instances::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the Instances 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

#debug_instance

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

Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.

Only applicable for instances in App Engine flexible environment.

Overloads
def debug_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to debug_instance via a request object, either of type DebugInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::DebugInstanceRequest, ::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 debug_instance(name: nil, ssh_key: nil) -> ::Gapic::Operation
Pass arguments to debug_instance 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 requested. Example: apps/myapp/services/default/versions/v1/instances/instance-1.
  • ssh_key (::String) — Public SSH key to add to the instance. Examples:

    • [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME]
    • [USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}

    For more information, see Adding and Removing SSH Keys.

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::Instances::Client.new

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

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

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

#delete_instance

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

Stops a running instance.

The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" (standard environment | flexible environment).

To ensure that instances are not re-created and avoid getting billed, you can stop all instances within the target version by changing the serving status of the version to STOPPED with the apps.services.versions.patch method.

Overloads
def delete_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_instance via a request object, either of type DeleteInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::DeleteInstanceRequest, ::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_instance(name: nil) -> ::Gapic::Operation
Pass arguments to delete_instance 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/versions/v1/instances/instance-1.
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::Instances::Client.new

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

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

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

#get_instance

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

Gets instance information.

Overloads
def get_instance(request, options = nil) -> ::Google::Cloud::AppEngine::V1::Instance
Pass arguments to get_instance via a request object, either of type GetInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::GetInstanceRequest, ::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_instance(name: nil) -> ::Google::Cloud::AppEngine::V1::Instance
Pass arguments to get_instance 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/versions/v1/instances/instance-1.
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::Instances::Client.new

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

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

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

#initialize

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

Create a new Instances client object.

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

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

#list_instances

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

Lists the instances of a version.

Tip: To aggregate details about instances over time, see the Stackdriver Monitoring API.

Overloads
def list_instances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AppEngine::V1::Instance>
Pass arguments to list_instances via a request object, either of type ListInstancesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::AppEngine::V1::ListInstancesRequest, ::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_instances(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AppEngine::V1::Instance>
Pass arguments to list_instances 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 Version resource. Example: apps/myapp/services/default/versions/v1.
  • 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::Instances::Client.new

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

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::AppEngine::V1::Instance.
  p item
end

#operations_client

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

Get the associated client for long-running operations.