Class: Aws::EventBridgeV2::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::EventBridgeV2::Client
- Includes:
- ClientStubs
- Defined in:
- gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb
Overview
An API client for EventBridgeV2. To construct a client, you need to configure a :region and :credentials.
client = Aws::EventBridgeV2::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the developer guide.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
API Operations collapse
-
#create_event_bus(params = {}) ⇒ Types::CreateEventBusResponse
Creates an event bus.
-
#create_event_source(params = {}) ⇒ Types::CreateEventSourceResponse
Creates an EventSource, which forwards events from an origin (an AWS service, a partner, or a third-party webhook provider) to an event bus.
-
#create_subscriber(params = {}) ⇒ Types::CreateSubscriberResponse
Creates a subscriber on an event bus, which delivers matching events to the configured target.
-
#delete_event_bus(params = {}) ⇒ Struct
Deletes an event bus.
-
#delete_event_source(params = {}) ⇒ Struct
Deletes an EventSource.
-
#delete_resource_policy(params = {}) ⇒ Types::DeleteResourcePolicyResponse
Deletes the named resource policy attached to an event bus.
-
#delete_subscriber(params = {}) ⇒ Struct
Deletes a subscriber.
-
#describe_event_bus(params = {}) ⇒ Types::DescribeEventBusResponse
Returns the full configuration and lifecycle state of an event bus.
-
#describe_event_source(params = {}) ⇒ Types::DescribeEventSourceResponse
Returns the full configuration and lifecycle state of an EventSource.
-
#describe_subscriber(params = {}) ⇒ Types::DescribeSubscriberResponse
Returns the full configuration and state of a subscriber.
-
#get_resource_policy(params = {}) ⇒ Types::GetResourcePolicyResponse
Returns the named resource policy attached to an event bus.
-
#list_event_buses(params = {}) ⇒ Types::ListEventBusesResponse
Lists the event buses visible to the caller: buses the account owns and buses shared with it through AWS RAM.
-
#list_event_sources(params = {}) ⇒ Types::ListEventSourcesResponse
Lists EventSources as summaries.
-
#list_resource_policies(params = {}) ⇒ Types::ListResourcePoliciesResponse
Lists the resource policies attached to an event bus as summaries (policy name and revision ID).
-
#list_subscribers(params = {}) ⇒ Types::ListSubscribersResponse
Lists subscribers as summaries.
-
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
Lists the tags on an event bus, subscriber, or event source.
-
#put_events(params = {}) ⇒ Types::PutEventsResponse
Publishes events to an event bus.
-
#put_raw_events(params = {}) ⇒ Types::PutRawEventsResponse
Publishes pre-shaped events to an event bus.
-
#put_resource_policy(params = {}) ⇒ Types::PutResourcePolicyResponse
Attaches a named resource policy to an event bus — the only resource type that supports policies; other resource ARNs are rejected.
-
#revoke_resource(params = {}) ⇒ Types::RevokeResourceResponse
Revokes a subscriber or an EventSource.
-
#rotate_webhook_credentials(params = {}) ⇒ Types::RotateWebhookCredentialsResponse
Sets a new credential on a webhook EventSource.
-
#tag_resource(params = {}) ⇒ Struct
Adds or replaces tags on an event bus, subscriber, or event source.
-
#untag_resource(params = {}) ⇒ Struct
Removes tags from an event bus, subscriber, or event source.
-
#update_event_bus(params = {}) ⇒ Types::UpdateEventBusResponse
Updates an event bus.
-
#update_event_source(params = {}) ⇒ Types::UpdateEventSourceResponse
Updates an EventSource.
-
#update_subscriber(params = {}) ⇒ Types::UpdateSubscriberResponse
Updates a subscriber.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
Methods included from ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
488 489 490 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 488 def initialize(*args) super end |
Instance Method Details
#create_event_bus(params = {}) ⇒ Types::CreateEventBusResponse
Creates an event bus. Provisioning is asynchronous: the bus is returned in the CREATING state and transitions to ACTIVE when ready (see the EventBusActive waiter). Retries carrying the same ClientToken are idempotent.
572 573 574 575 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 572 def create_event_bus(params = {}, = {}) req = build_request(:create_event_bus, params) req.send_request() end |
#create_event_source(params = {}) ⇒ Types::CreateEventSourceResponse
Creates an EventSource, which forwards events from an origin (an AWS service, a partner, or a third-party webhook provider) to an event bus. The event bus must be in the ACTIVE state. This operation is idempotent: retries that use the same ClientToken return the same result.
701 702 703 704 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 701 def create_event_source(params = {}, = {}) req = build_request(:create_event_source, params) req.send_request() end |
#create_subscriber(params = {}) ⇒ Types::CreateSubscriberResponse
Creates a subscriber on an event bus, which delivers matching events to the configured target. The bus must be ACTIVE. Retries carrying the same ClientToken are idempotent. A subscriber that targets an Amazon MSK cluster provisions its connectivity asynchronously after this call returns and begins delivering when its ConnectivityState reaches ACTIVE (see the MskSubscriberActive waiter).
959 960 961 962 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 959 def create_subscriber(params = {}, = {}) req = build_request(:create_subscriber, params) req.send_request() end |
#delete_event_bus(params = {}) ⇒ Struct
Deletes an event bus. Deletion is asynchronous: the bus moves to DELETING and disappears when complete (see the EventBusDeleted waiter). A bus with subscribers or event sources cannot be deleted.
983 984 985 986 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 983 def delete_event_bus(params = {}, = {}) req = build_request(:delete_event_bus, params) req.send_request() end |
#delete_event_source(params = {}) ⇒ Struct
Deletes an EventSource. Forwarding from its origin stops.
1009 1010 1011 1012 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1009 def delete_event_source(params = {}, = {}) req = build_request(:delete_event_source, params) req.send_request() end |
#delete_resource_policy(params = {}) ⇒ Types::DeleteResourcePolicyResponse
Deletes the named resource policy attached to an event bus.
1060 1061 1062 1063 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1060 def delete_resource_policy(params = {}, = {}) req = build_request(:delete_resource_policy, params) req.send_request() end |
#delete_subscriber(params = {}) ⇒ Struct
Deletes a subscriber. Events are no longer delivered to its target.
1082 1083 1084 1085 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1082 def delete_subscriber(params = {}, = {}) req = build_request(:delete_subscriber, params) req.send_request() end |
#describe_event_bus(params = {}) ⇒ Types::DescribeEventBusResponse
Returns the full configuration and lifecycle state of an event bus.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- event_bus_active
- event_bus_deleted
1133 1134 1135 1136 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1133 def describe_event_bus(params = {}, = {}) req = build_request(:describe_event_bus, params) req.send_request() end |
#describe_event_source(params = {}) ⇒ Types::DescribeEventSourceResponse
Returns the full configuration and lifecycle state of an EventSource.
1213 1214 1215 1216 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1213 def describe_event_source(params = {}, = {}) req = build_request(:describe_event_source, params) req.send_request() end |
#describe_subscriber(params = {}) ⇒ Types::DescribeSubscriberResponse
Returns the full configuration and state of a subscriber.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- msk_subscriber_active
1348 1349 1350 1351 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1348 def describe_subscriber(params = {}, = {}) req = build_request(:describe_subscriber, params) req.send_request() end |
#get_resource_policy(params = {}) ⇒ Types::GetResourcePolicyResponse
Returns the named resource policy attached to an event bus. Fails with ResourceNotFoundException when the event bus or the named policy does not exist.
1395 1396 1397 1398 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1395 def get_resource_policy(params = {}, = {}) req = build_request(:get_resource_policy, params) req.send_request() end |
#list_event_buses(params = {}) ⇒ Types::ListEventBusesResponse
Lists the event buses visible to the caller: buses the account owns and buses shared with it through AWS RAM. Shared entries carry identity fields only (Name, EventBusArn, EventBusAccountId); owned entries carry every summary field. Set EventBusAccountId to scope the list to one owner account.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1457 1458 1459 1460 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1457 def list_event_buses(params = {}, = {}) req = build_request(:list_event_buses, params) req.send_request() end |
#list_event_sources(params = {}) ⇒ Types::ListEventSourcesResponse
Lists EventSources as summaries. By default the list spans the EventSources the caller account owns; set EventBusArn to scope it to one bus. Use DescribeEventSource to retrieve full configuration.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1518 1519 1520 1521 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1518 def list_event_sources(params = {}, = {}) req = build_request(:list_event_sources, params) req.send_request() end |
#list_resource_policies(params = {}) ⇒ Types::ListResourcePoliciesResponse
Lists the resource policies attached to an event bus as summaries (policy name and revision ID). Use GetResourcePolicy to retrieve a policy document.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1563 1564 1565 1566 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1563 def list_resource_policies(params = {}, = {}) req = build_request(:list_resource_policies, params) req.send_request() end |
#list_subscribers(params = {}) ⇒ Types::ListSubscribersResponse
Lists subscribers as summaries. By default the list spans the subscribers the caller account owns across all buses; set EventBusArn to scope it to one bus. Use DescribeSubscriber to retrieve full configuration.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1622 1623 1624 1625 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1622 def list_subscribers(params = {}, = {}) req = build_request(:list_subscribers, params) req.send_request() end |
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
Lists the tags on an event bus, subscriber, or event source.
1652 1653 1654 1655 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1652 def (params = {}, = {}) req = build_request(:list_tags_for_resource, params) req.send_request() end |
#put_events(params = {}) ⇒ Types::PutEventsResponse
Publishes events to an event bus.
The total size of all event entries in a request must not exceed 1 MB
(1,048,576 bytes). The limit applies to the request as a whole, not to
individual entries. If you exceed the limit, the request fails with
InvalidInputException and the service publishes none of the entries
in the request.
1716 1717 1718 1719 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1716 def put_events(params = {}, = {}) req = build_request(:put_events, params) req.send_request() end |
#put_raw_events(params = {}) ⇒ Types::PutRawEventsResponse
Publishes pre-shaped events to an event bus.
The total size of all event entries in a request must not exceed 1 MB
(1,048,576 bytes), including the Data payload and the keys and
values of Metadata for each entry. The limit applies to the request
as a whole, not to individual entries.
If you exceed the limit, the request fails with
InvalidInputException, and the service doesn't publish any of the
entries in the request.
1795 1796 1797 1798 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1795 def put_raw_events(params = {}, = {}) req = build_request(:put_raw_events, params) req.send_request() end |
#put_resource_policy(params = {}) ⇒ Types::PutResourcePolicyResponse
Attaches a named resource policy to an event bus — the only resource type that supports policies; other resource ARNs are rejected. Each bus holds two named policies: "default" (customer-managed, full IAM policy language including Deny) and "AWS_RAM" (written exclusively by AWS Resource Access Manager to reflect resource shares). Both policies are evaluated on cross-account authorization; an explicit Deny in either overrides an Allow in the other. Operations that omit PolicyName target "default". A "default" policy that would grant public access is rejected with PublicPolicyException and is not attached; this check is always on and cannot be disabled.
1863 1864 1865 1866 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1863 def put_resource_policy(params = {}, = {}) req = build_request(:put_resource_policy, params) req.send_request() end |
#revoke_resource(params = {}) ⇒ Types::RevokeResourceResponse
Revokes a subscriber or an EventSource. The bus owner calls this to withdraw a misbehaving resource attached to their bus. Revocation is terminal: there is no operation that clears it. A revoked resource refuses mutating operations with InvalidStateException; delete stays available for cleanup.
1897 1898 1899 1900 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1897 def revoke_resource(params = {}, = {}) req = build_request(:revoke_resource, params) req.send_request() end |
#rotate_webhook_credentials(params = {}) ⇒ Types::RotateWebhookCredentialsResponse
Sets a new credential on a webhook EventSource. If you supply Credential, EventBridge uses that value. Otherwise, EventBridge generates one. For HTTP Basic authentication, only the password changes. The username does not change. EventBridge never returns the credential. To read a generated value, call secretsmanager:GetSecretValue on the secret that SecretArn identifies.
You can rotate the credential of an EventSource in the ACTIVE, UPDATING, or UPDATE_FAILED state. For a revoked EventSource or an EventSource in any other state, EventBridge returns InvalidStateException. EventBridge also returns InvalidStateException if the secret of the EventSource is scheduled for deletion or has been deleted.
If you rotate the credential of one EventSource too many times in 24 hours, EventBridge returns LimitExceededException. Retry later. The limit becomes available again automatically.
If AWS Secrets Manager throttles the call, EventBridge returns ThrottlingException. Retry later.
To use this operation, you must have the following permissions in your IAM policy:
secretsmanager:PutSecretValue on the secret of the EventSource
secretsmanager:GetSecretValue on the secret of the EventSource, for HTTP Basic authentication only
kms:GenerateDataKey and kms:Decrypt on the AWS KMS key that encrypts the secret
The resource policy of the secret must not deny the secretsmanager actions.
EventBridge accepts the new credential when this call returns. In rare cases, the new credential takes up to 2 minutes to reach every EventBridge endpoint.
EventBridge also accepts the previous credential for 15 minutes after the rotation. The window ends at the CreatedDate of the AWSCURRENT secret version plus 15 minutes. Only the credential that the most recent rotation replaced stays valid. If you rotate again within 15 minutes, the older credential stops working immediately.
A retry with the same ClientToken within 8 hours returns the same result and does not rotate again. A retry of a rotation that supplied a value can arrive after a later rotation completed. In that case, the retried value becomes the current credential, and the credential it replaces does not stay valid.
1994 1995 1996 1997 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 1994 def rotate_webhook_credentials(params = {}, = {}) req = build_request(:rotate_webhook_credentials, params) req.send_request() end |
#tag_resource(params = {}) ⇒ Struct
Adds or replaces tags on an event bus, subscriber, or event source.
2023 2024 2025 2026 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 2023 def tag_resource(params = {}, = {}) req = build_request(:tag_resource, params) req.send_request() end |
#untag_resource(params = {}) ⇒ Struct
Removes tags from an event bus, subscriber, or event source.
2050 2051 2052 2053 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 2050 def untag_resource(params = {}, = {}) req = build_request(:untag_resource, params) req.send_request() end |
#update_event_bus(params = {}) ⇒ Types::UpdateEventBusResponse
Updates an event bus. The update is asynchronous: the bus moves to UPDATING and returns to ACTIVE when the change is applied. Fields omitted from the request are left unchanged.
2112 2113 2114 2115 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 2112 def update_event_bus(params = {}, = {}) req = build_request(:update_event_bus, params) req.send_request() end |
#update_event_source(params = {}) ⇒ Types::UpdateEventSourceResponse
Updates an EventSource. Fields omitted from the request are left unchanged.
2215 2216 2217 2218 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 2215 def update_event_source(params = {}, = {}) req = build_request(:update_event_source, params) req.send_request() end |
#update_subscriber(params = {}) ⇒ Types::UpdateSubscriberResponse
Updates a subscriber. Fields omitted from the request are left unchanged. Changing an Amazon MSK subscriber's connectivity can re-provision it; when it does, the subscriber resumes delivering once its ConnectivityState returns to ACTIVE (see the MskSubscriberActive waiter).
2439 2440 2441 2442 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 2439 def update_subscriber(params = {}, = {}) req = build_request(:update_subscriber, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
Basic Usage
A waiter will call an API operation until:
- It is successful
- It enters a terminal state
- It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# polls in a loop, sleeping between attempts
client.wait_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
client.wait_until(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
Valid Waiters
The following table lists the valid waiter names, the operations they call,
and the default :delay and :max_attempts values.
| waiter_name | params | :delay | :max_attempts |
|---|---|---|---|
| event_bus_active | #describe_event_bus | 2 | 60 |
| event_bus_deleted | #describe_event_bus | 2 | 60 |
| msk_subscriber_active | #describe_subscriber | 2 | 150 |
2556 2557 2558 2559 2560 |
# File 'gems/aws-sdk-eventbridgev2/lib/aws-sdk-eventbridgev2/client.rb', line 2556 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |