// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_targets::_put_targets_input::PutTargetsInputBuilder;
pub use crate::operation::put_targets::_put_targets_output::PutTargetsOutputBuilder;
impl crate::operation::put_targets::builders::PutTargetsInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::put_targets::PutTargetsOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_targets::PutTargetsError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.put_targets();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `PutTargets`.
///
/// <p>Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.</p>
/// <p>Targets are the resources that are invoked when a rule is triggered.</p>
/// <p>The maximum number of entries per request is 10.</p><note>
/// <p>Each rule can have up to five (5) targets associated with it at one time.</p>
/// </note>
/// <p>For a list of services you can configure as targets for events, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-targets.html">EventBridge targets</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
/// <p>Creating rules with built-in targets is supported only in the Amazon Web Services Management Console. The built-in targets are:</p>
/// <ul>
/// <li>
/// <p><code>Amazon EBS CreateSnapshot API call</code></p></li>
/// <li>
/// <p><code>Amazon EC2 RebootInstances API call</code></p></li>
/// <li>
/// <p><code>Amazon EC2 StopInstances API call</code></p></li>
/// <li>
/// <p><code>Amazon EC2 TerminateInstances API call</code></p></li>
/// </ul>
/// <p>For some target types, <code>PutTargets</code> provides target-specific parameters. If the target is a Kinesis data stream, you can optionally specify which shard the event goes to by using the <code>KinesisParameters</code> argument. To invoke a command on multiple EC2 instances with one rule, you can use the <code>RunCommandParameters</code> field.</p>
/// <p>To be able to make API calls against the resources that you own, Amazon EventBridge needs the appropriate permissions:</p>
/// <ul>
/// <li>
/// <p>For Lambda and Amazon SNS resources, EventBridge relies on resource-based policies.</p></li>
/// <li>
/// <p>For EC2 instances, Kinesis Data Streams, Step Functions state machines and API Gateway APIs, EventBridge relies on IAM roles that you specify in the <code>RoleARN</code> argument in <code>PutTargets</code>.</p></li>
/// </ul>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/auth-and-access-control-eventbridge.html">Authentication and Access Control</a> in the <i> <i>Amazon EventBridge User Guide</i> </i>.</p>
/// <p>If another Amazon Web Services account is in the same region and has granted you permission (using <code>PutPermission</code>), you can send events to that account. Set that account's event bus as a target of the rules in your account. To send the matched events to the other account, specify that account's event bus as the <code>Arn</code> value when you run <code>PutTargets</code>. If your account sends events to another account, your account is charged for each sent event. Each event sent to another account is charged as a custom event. The account receiving the event is not charged. For more information, see <a href="http://aws.amazon.com/eventbridge/pricing/">Amazon EventBridge Pricing</a>.</p><note>
/// <p><code>Input</code>, <code>InputPath</code>, and <code>InputTransformer</code> are not available with <code>PutTarget</code> if the target is an event bus of a different Amazon Web Services account.</p>
/// </note>
/// <p>If you are setting the event bus of another account as the target, and that account granted permission to your account through an organization instead of directly by the account ID, then you must specify a <code>RoleArn</code> with proper permissions in the <code>Target</code> structure. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html">Sending and Receiving Events Between Amazon Web Services Accounts</a> in the <i>Amazon EventBridge User Guide</i>.</p><note>
/// <p>If you have an IAM role on a cross-account event bus target, a <code>PutTargets</code> call without a role on the same target (same <code>Id</code> and <code>Arn</code>) will not remove the role.</p>
/// </note>
/// <p>For more information about enabling cross-account events, see <a href="https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutPermission.html">PutPermission</a>.</p>
/// <p><b>Input</b>, <b>InputPath</b>, and <b>InputTransformer</b> are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:</p>
/// <ul>
/// <li>
/// <p>If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON format (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target).</p></li>
/// <li>
/// <p>If <b>Input</b> is specified in the form of valid JSON, then the matched event is overridden with this constant.</p></li>
/// <li>
/// <p>If <b>InputPath</b> is specified in the form of JSONPath (for example, <code>$.detail</code>), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed).</p></li>
/// <li>
/// <p>If <b>InputTransformer</b> is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target.</p></li>
/// </ul>
/// <p>When you specify <code>InputPath</code> or <code>InputTransformer</code>, you must use JSON dot notation, not bracket notation.</p>
/// <p>When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Allow a short period of time for changes to take effect.</p>
/// <p>This action can partially fail if too many requests are made at the same time. If that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry in <code>FailedEntries</code> provides the ID of the failed target and the error code.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct PutTargetsFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::put_targets::builders::PutTargetsInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::put_targets::PutTargetsOutput,
crate::operation::put_targets::PutTargetsError,
> for PutTargetsFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::put_targets::PutTargetsOutput,
crate::operation::put_targets::PutTargetsError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl PutTargetsFluentBuilder {
/// Creates a new `PutTargetsFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the PutTargets as a reference.
pub fn as_input(&self) -> &crate::operation::put_targets::builders::PutTargetsInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::put_targets::PutTargetsOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_targets::PutTargetsError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::put_targets::PutTargets::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::put_targets::PutTargets::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::put_targets::PutTargetsOutput,
crate::operation::put_targets::PutTargetsError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>The name of the rule.</p>
pub fn rule(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.rule(input.into());
self
}
/// <p>The name of the rule.</p>
pub fn set_rule(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_rule(input);
self
}
/// <p>The name of the rule.</p>
pub fn get_rule(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_rule()
}
/// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
pub fn event_bus_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.event_bus_name(input.into());
self
}
/// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
pub fn set_event_bus_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_event_bus_name(input);
self
}
/// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
pub fn get_event_bus_name(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_event_bus_name()
}
///
/// Appends an item to `Targets`.
///
/// To override the contents of this collection use [`set_targets`](Self::set_targets).
///
/// <p>The targets to update or add to the rule.</p>
pub fn targets(mut self, input: crate::types::Target) -> Self {
self.inner = self.inner.targets(input);
self
}
/// <p>The targets to update or add to the rule.</p>
pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Target>>) -> Self {
self.inner = self.inner.set_targets(input);
self
}
/// <p>The targets to update or add to the rule.</p>
pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Target>> {
self.inner.get_targets()
}
}