Class Google::Cloud::Eventarc::V1::Eventarc::Client (v0.1.4)

Client for the Eventarc service.

Eventarc allows users to subscribe to various events that are provided by Google Cloud services and forward them to supported destinations.

Inherits

  • Object

Methods

.configure

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

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

#configure

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

Configure the Eventarc 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_trigger

def create_trigger(request, options = nil) -> ::Gapic::Operation
def create_trigger(parent: nil, trigger: nil, trigger_id: nil, validate_only: nil) -> ::Gapic::Operation

Create a new trigger in a particular project and location.

Overloads
def create_trigger(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_trigger via a request object, either of type CreateTriggerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::V1::CreateTriggerRequest, ::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_trigger(parent: nil, trigger: nil, trigger_id: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to create_trigger 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 parent collection in which to add this trigger.
  • trigger (::Google::Cloud::Eventarc::V1::Trigger, ::Hash) — Required. The trigger to create.
  • trigger_id (::String) — Required. The user-provided ID to be assigned to the trigger.
  • validate_only (::Boolean) — Required. If set, validate the request and preview the review, but do not actually post it.
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/eventarc/v1"

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

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

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

def delete_trigger(request, options = nil) -> ::Gapic::Operation
def delete_trigger(name: nil, etag: nil, allow_missing: nil, validate_only: nil) -> ::Gapic::Operation

Delete a single trigger.

Overloads
def delete_trigger(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_trigger via a request object, either of type DeleteTriggerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::V1::DeleteTriggerRequest, ::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_trigger(name: nil, etag: nil, allow_missing: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to delete_trigger 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) — Required. The name of the trigger to be deleted.
  • etag (::String) — If provided, the trigger will only be deleted if the etag matches the current etag on the resource.
  • allow_missing (::Boolean) — If set to true, and the trigger is not found, the request will succeed but no action will be taken on the server.
  • validate_only (::Boolean) — Required. If set, validate the request and preview the review, but do not actually post it.
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/eventarc/v1"

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

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

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

def get_trigger(request, options = nil) -> ::Google::Cloud::Eventarc::V1::Trigger
def get_trigger(name: nil) -> ::Google::Cloud::Eventarc::V1::Trigger

Get a single trigger.

Overloads
def get_trigger(request, options = nil) -> ::Google::Cloud::Eventarc::V1::Trigger
Pass arguments to get_trigger via a request object, either of type GetTriggerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::V1::GetTriggerRequest, ::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_trigger(name: nil) -> ::Google::Cloud::Eventarc::V1::Trigger
Pass arguments to get_trigger 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. The name of the trigger 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/eventarc/v1"

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

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

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

# The returned object is of type Google::Cloud::Eventarc::V1::Trigger.
p result

#initialize

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

Create a new Eventarc client object.

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

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

#list_triggers

def list_triggers(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Eventarc::V1::Trigger>
def list_triggers(parent: nil, page_size: nil, page_token: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Eventarc::V1::Trigger>

List triggers.

Overloads
def list_triggers(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Eventarc::V1::Trigger>
Pass arguments to list_triggers via a request object, either of type ListTriggersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::V1::ListTriggersRequest, ::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_triggers(parent: nil, page_size: nil, page_token: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Eventarc::V1::Trigger>
Pass arguments to list_triggers 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 parent collection to list triggers on.
  • page_size (::Integer) — The maximum number of triggers to return on each page. Note: The service may send fewer.
  • page_token (::String) — The page token; provide the value from the next_page_token field in a previous ListTriggers call to retrieve the subsequent page.

    When paginating, all other parameters provided to ListTriggers must match the call that provided the page token.

  • order_by (::String) — The sorting order of the resources returned. Value should be a comma separated list of fields. The default sorting oder is ascending. To specify descending order for a field, append a desc suffix; for example: name desc, trigger_id.
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/eventarc/v1"

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

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

# Call the list_triggers method.
result = client.list_triggers 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::Eventarc::V1::Trigger.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::Eventarc::V1::Eventarc::Operations

Get the associated client for long-running operations.

#update_trigger

def update_trigger(request, options = nil) -> ::Gapic::Operation
def update_trigger(trigger: nil, update_mask: nil, allow_missing: nil, validate_only: nil) -> ::Gapic::Operation

Update a single trigger.

Overloads
def update_trigger(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_trigger via a request object, either of type UpdateTriggerRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Eventarc::V1::UpdateTriggerRequest, ::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_trigger(trigger: nil, update_mask: nil, allow_missing: nil, validate_only: nil) -> ::Gapic::Operation
Pass arguments to update_trigger 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
  • trigger (::Google::Cloud::Eventarc::V1::Trigger, ::Hash) — The trigger to be updated.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — The fields to be updated; only fields explicitly provided will be updated. If no field mask is provided, all provided fields in the request will be updated. To update all fields, provide a field mask of "*".
  • allow_missing (::Boolean) — If set to true, and the trigger is not found, a new trigger will be created. In this situation, update_mask is ignored.
  • validate_only (::Boolean) — Required. If set, validate the request and preview the review, but do not actually post it.
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/eventarc/v1"

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

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

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