Class: AWSCDK::Events::CfnRuleProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Events::CfnRuleProps
- Defined in:
- events/cfn_rule_props.rb
Overview
Properties for defining a CfnRule.
Instance Attribute Summary collapse
-
#description ⇒ String?
readonly
The description of the rule.
-
#event_bus_name ⇒ String, ...
readonly
The name or ARN of the event bus associated with the rule.
-
#event_pattern ⇒ Object?
readonly
The event pattern of the rule.
-
#name ⇒ String?
readonly
The name of the rule.
-
#role_arn ⇒ String, ...
readonly
The Amazon Resource Name (ARN) of the role that is used for target invocation.
-
#schedule_expression ⇒ String?
readonly
The scheduling expression.
-
#state ⇒ String?
readonly
The state of the rule.
-
#tags ⇒ Array<AWSCDK::CfnTag>?
readonly
Any tags assigned to the event rule.
-
#targets ⇒ AWSCDK::IResolvable, ...
readonly
Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(description: nil, event_bus_name: nil, event_pattern: nil, name: nil, role_arn: nil, schedule_expression: nil, state: nil, tags: nil, targets: nil) ⇒ CfnRuleProps
constructor
A new instance of CfnRuleProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(description: nil, event_bus_name: nil, event_pattern: nil, name: nil, role_arn: nil, schedule_expression: nil, state: nil, tags: nil, targets: nil) ⇒ CfnRuleProps
Returns a new instance of CfnRuleProps.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'events/cfn_rule_props.rb', line 18 def initialize(description: nil, event_bus_name: nil, event_pattern: nil, name: nil, role_arn: nil, schedule_expression: nil, state: nil, tags: nil, targets: nil) @description = description Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil? @event_bus_name = event_bus_name Jsii::Type.check_type(@event_bus_name, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19ldmVudHMuSUV2ZW50QnVzUmVmIn1dfX0=")), "eventBusName") unless @event_bus_name.nil? @event_pattern = event_pattern Jsii::Type.check_type(@event_pattern, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "eventPattern") unless @event_pattern.nil? @name = name Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil? @role_arn = role_arn Jsii::Type.check_type(@role_arn, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifV19fQ==")), "roleArn") unless @role_arn.nil? @schedule_expression = schedule_expression Jsii::Type.check_type(@schedule_expression, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "scheduleExpression") unless @schedule_expression.nil? @state = state Jsii::Type.check_type(@state, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "state") unless @state.nil? @tags = .is_a?(Array) ? .map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil? @targets = targets Jsii::Type.check_type(@targets, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLkNmblJ1bGUuVGFyZ2V0UHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "targets") unless @targets.nil? end |
Instance Attribute Details
#description ⇒ String? (readonly)
The description of the rule.
43 44 45 |
# File 'events/cfn_rule_props.rb', line 43 def description @description end |
#event_bus_name ⇒ String, ... (readonly)
The name or ARN of the event bus associated with the rule.
If you omit this, the default event bus is used.
50 51 52 |
# File 'events/cfn_rule_props.rb', line 50 def event_bus_name @event_bus_name end |
#event_pattern ⇒ Object? (readonly)
The event pattern of the rule.
For more information, see Events and Event Patterns in the Amazon EventBridge User Guide .
57 58 59 |
# File 'events/cfn_rule_props.rb', line 57 def event_pattern @event_pattern end |
#name ⇒ String? (readonly)
The name of the rule.
62 63 64 |
# File 'events/cfn_rule_props.rb', line 62 def name @name end |
#role_arn ⇒ String, ... (readonly)
The Amazon Resource Name (ARN) of the role that is used for target invocation.
If you're setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a RoleArn with proper permissions in the Target structure, instead of here in this parameter.
69 70 71 |
# File 'events/cfn_rule_props.rb', line 69 def role_arn @role_arn end |
#schedule_expression ⇒ String? (readonly)
The scheduling expression.
For example, "cron(0 20 * * ? *)", "rate(5 minutes)". For more information, see Creating an Amazon EventBridge rule that runs on a schedule .
76 77 78 |
# File 'events/cfn_rule_props.rb', line 76 def schedule_expression @schedule_expression end |
#state ⇒ String? (readonly)
The state of the rule.
Valid values include:
DISABLED: The rule is disabled. EventBridge does not match any events against the rule.ENABLED: The rule is enabled. EventBridge matches events against the rule, except for AWS management events delivered through CloudTrail.ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS: The rule is enabled for all events, including AWS management events delivered through CloudTrail.
Management events provide visibility into management operations that are performed on resources in your AWS account. These are also known as control plane operations. For more information, see Logging management events in the CloudTrail User Guide , and Filtering management events from AWS services in the Amazon EventBridge User Guide .
This value is only valid for rules on the default event bus or custom event buses . It does not apply to partner event buses .
91 92 93 |
# File 'events/cfn_rule_props.rb', line 91 def state @state end |
#tags ⇒ Array<AWSCDK::CfnTag>? (readonly)
Any tags assigned to the event rule.
96 97 98 |
# File 'events/cfn_rule_props.rb', line 96 def @tags end |
#targets ⇒ AWSCDK::IResolvable, ... (readonly)
Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
Targets are the resources that are invoked when a rule is triggered.
The maximum number of entries per request is 10.
Each rule can have up to five (5) targets associated with it at one time.
For a list of services you can configure as targets for events, see EventBridge targets in the Amazon EventBridge User Guide .
Creating rules with built-in targets is supported only in the AWS Management Console . The built-in targets are:
Amazon EBS CreateSnapshot API callAmazon EC2 RebootInstances API callAmazon EC2 StopInstances API callAmazon EC2 TerminateInstances API call
For some target types, PutTargets 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 KinesisParameters argument. To invoke a command on multiple EC2 instances with one rule, you can use the RunCommandParameters field.
To be able to make API calls against the resources that you own, Amazon EventBridge needs the appropriate permissions:
- For AWS Lambda and Amazon SNS resources, EventBridge relies on resource-based policies.
- For EC2 instances, Kinesis Data Streams, AWS Step Functions state machines and API Gateway APIs, EventBridge relies on IAM roles that you specify in the
RoleARNargument inPutTargets.
For more information, see Authentication and Access Control in the Amazon EventBridge User Guide .
If another AWS account is in the same region and has granted you permission (using PutPermission ), 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 Arn value when you run PutTargets . 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 Amazon EventBridge Pricing .
Input,InputPath, andInputTransformerare not available withPutTargetif the target is an event bus of a different AWS account.
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 RoleArn with proper permissions in the Target structure. For more information, see Sending and Receiving Events Between AWS Accounts in the Amazon EventBridge User Guide .
If you have an IAM role on a cross-account event bus target, a
PutTargetscall without a role on the same target (sameIdandArn) will not remove the role.
For more information about enabling cross-account events, see PutPermission .
Input , InputPath , and InputTransformer are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:
- 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).
- If Input is specified in the form of valid JSON, then the matched event is overridden with this constant.
- If InputPath is specified in the form of JSONPath (for example,
$.detail), 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). - If InputTransformer 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.
When you specify InputPath or InputTransformer , you must use JSON dot notation, not bracket notation.
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.
This action can partially fail if too many requests are made at the same time. If that happens, FailedEntryCount is non-zero in the response and each entry in FailedEntries provides the ID of the failed target and the error code.
148 149 150 |
# File 'events/cfn_rule_props.rb', line 148 def targets @targets end |
Class Method Details
.jsii_properties ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'events/cfn_rule_props.rb', line 150 def self.jsii_properties { :description => "description", :event_bus_name => "eventBusName", :event_pattern => "eventPattern", :name => "name", :role_arn => "roleArn", :schedule_expression => "scheduleExpression", :state => "state", :tags => "tags", :targets => "targets", } end |
Instance Method Details
#to_jsii ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'events/cfn_rule_props.rb', line 164 def to_jsii result = {} result.merge!({ "description" => @description, "eventBusName" => @event_bus_name, "eventPattern" => @event_pattern, "name" => @name, "roleArn" => @role_arn, "scheduleExpression" => @schedule_expression, "state" => @state, "tags" => @tags, "targets" => @targets, }) result.compact end |