Serverless VPC Access V1 API - Class Google::Cloud::VpcAccess::V1::VpcAccessService::Client (v0.2.0)

Reference documentation and code samples for the Serverless VPC Access V1 API class Google::Cloud::VpcAccess::V1::VpcAccessService::Client.

Client for the VpcAccessService service.

Serverless VPC Access API allows users to create and manage connectors for App Engine, Cloud Functions and Cloud Run to have internal connections to Virtual Private Cloud networks.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

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

#create_connector

def create_connector(request, options = nil) -> ::Gapic::Operation
def create_connector(parent: nil, connector_id: nil, connector: nil) -> ::Gapic::Operation

Creates a Serverless VPC Access connector, returns an operation.

Overloads
def create_connector(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_connector via a request object, either of type CreateConnectorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::VpcAccess::V1::CreateConnectorRequest, ::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 create_connector(parent: nil, connector_id: nil, connector: nil) -> ::Gapic::Operation
Pass arguments to create_connector 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) — Required. The project and location in which the configuration should be created, specified in the format projects/*/locations/*.
  • connector_id (::String) — Required. The ID to use for this connector.
  • connector (::Google::Cloud::VpcAccess::V1::Connector, ::Hash) — Required. Resource to create.
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/vpc_access/v1"

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

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

# Call the create_connector method.
result = client.create_connector 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

#delete_connector

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

Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

Overloads
def delete_connector(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_connector via a request object, either of type DeleteConnectorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::VpcAccess::V1::DeleteConnectorRequest, ::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_connector(name: nil) -> ::Gapic::Operation
Pass arguments to delete_connector 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) — Required. Name of a Serverless VPC Access connector to delete.
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/vpc_access/v1"

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

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

# Call the delete_connector method.
result = client.delete_connector 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_connector

def get_connector(request, options = nil) -> ::Google::Cloud::VpcAccess::V1::Connector
def get_connector(name: nil) -> ::Google::Cloud::VpcAccess::V1::Connector

Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource does not exist.

Overloads
def get_connector(request, options = nil) -> ::Google::Cloud::VpcAccess::V1::Connector
Pass arguments to get_connector via a request object, either of type GetConnectorRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::VpcAccess::V1::GetConnectorRequest, ::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_connector(name: nil) -> ::Google::Cloud::VpcAccess::V1::Connector
Pass arguments to get_connector 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) — Required. Name of a Serverless VPC Access connector to get.
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/vpc_access/v1"

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

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

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

# The returned object is of type Google::Cloud::VpcAccess::V1::Connector.
p result

#initialize

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

Create a new VpcAccessService client object.

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

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

#list_connectors

def list_connectors(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::VpcAccess::V1::Connector>
def list_connectors(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::VpcAccess::V1::Connector>

Lists Serverless VPC Access connectors.

Overloads
def list_connectors(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::VpcAccess::V1::Connector>
Pass arguments to list_connectors via a request object, either of type ListConnectorsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::VpcAccess::V1::ListConnectorsRequest, ::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_connectors(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::VpcAccess::V1::Connector>
Pass arguments to list_connectors 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) — Required. The project and location from which the routes should be listed.
  • page_size (::Integer) — Maximum number of functions to return per call.
  • page_token (::String) — Continuation token.
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/vpc_access/v1"

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

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

# Call the list_connectors method.
result = client.list_connectors 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::VpcAccess::V1::Connector.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::VpcAccess::V1::VpcAccessService::Operations

Get the associated client for long-running operations.