import { Command as $Command } from "@smithy/smithy-client"; import type { MetadataBearer as __MetadataBearer } from "@smithy/types"; import type { EventBridgeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EventBridgeClient"; import type { PutRuleRequest, PutRuleResponse } from "../models/models_0"; /** * @public */ export type { __MetadataBearer }; export { $Command }; /** * @public * * The input for {@link PutRuleCommand}. */ export interface PutRuleCommandInput extends PutRuleRequest { } /** * @public * * The output of {@link PutRuleCommand}. */ export interface PutRuleCommandOutput extends PutRuleResponse, __MetadataBearer { } declare const PutRuleCommand_base: { new (input: PutRuleCommandInput): import("@smithy/smithy-client").CommandImpl; new (input: PutRuleCommandInput): import("@smithy/smithy-client").CommandImpl; getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions; }; /** *

Creates or updates the specified rule. Rules are enabled by default, or based on value of * the state. You can disable a rule using DisableRule.

*

A single rule watches for events from a single event bus. Events generated by Amazon Web Services services go to your account's default event bus. Events generated by SaaS partner * services or applications go to the matching partner event bus. If you have custom applications * or services, you can specify whether their events go to your default event bus or a custom * event bus that you have created. For more information, see CreateEventBus.

*

If you are updating an existing rule, the rule is replaced with what you specify in this * PutRule command. If you omit arguments in PutRule, the old values * for those arguments are not kept. Instead, they are replaced with null values.

*

When you create or update a rule, incoming events might not immediately start matching to * new or updated rules. Allow a short period of time for changes to take effect.

*

A rule must contain at least an EventPattern or ScheduleExpression. Rules with * EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions * self-trigger based on the given schedule. A rule can have both an EventPattern and a * ScheduleExpression, in which case the rule triggers on matching events as well as on a * schedule.

*

When you initially create a rule, you can optionally assign one or more tags to the rule. * Tags can help you organize and categorize your resources. You can also use them to scope user * permissions, by granting a user permission to access or change only rules with certain tag * values. To use the PutRule operation and assign tags, you must have both the * events:PutRule and events:TagResource permissions.

*

If you are updating an existing rule, any tags you specify in the PutRule * operation are ignored. To update the tags of an existing rule, use TagResource and UntagResource.

*

Most services in Amazon Web Services treat : or / as the same character in Amazon Resource * Names (ARNs). However, EventBridge uses an exact match in event patterns and rules. Be sure to * use the correct ARN characters when creating event patterns so that they match the ARN syntax * in the event you want to match.

*

In EventBridge, it is possible to create rules that lead to infinite loops, where a rule * is fired repeatedly. For example, a rule might detect that ACLs have changed on an S3 bucket, * and trigger software to change them to the desired state. If the rule is not written * carefully, the subsequent change to the ACLs fires the rule again, creating an infinite * loop.

*

To prevent this, write the rules so that the triggered actions do not re-fire the same * rule. For example, your rule could fire only if ACLs are found to be in a bad state, instead * of after any change.

*

An infinite loop can quickly cause higher than expected charges. We recommend that you use * budgeting, which alerts you when charges exceed your specified limit. For more information, * see Managing Your Costs with * Budgets.

*

To create a rule that filters for management events from Amazon Web Services services, see * Receiving read-only management events from Amazon Web Services services in the * EventBridge User Guide.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript * import { EventBridgeClient, PutRuleCommand } from "@aws-sdk/client-eventbridge"; // ES Modules import * // const { EventBridgeClient, PutRuleCommand } = require("@aws-sdk/client-eventbridge"); // CommonJS import * // import type { EventBridgeClientConfig } from "@aws-sdk/client-eventbridge"; * const config = {}; // type is EventBridgeClientConfig * const client = new EventBridgeClient(config); * const input = { // PutRuleRequest * Name: "STRING_VALUE", // required * ScheduleExpression: "STRING_VALUE", * EventPattern: "STRING_VALUE", * State: "ENABLED" || "DISABLED" || "ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS", * Description: "STRING_VALUE", * RoleArn: "STRING_VALUE", * Tags: [ // TagList * { // Tag * Key: "STRING_VALUE", // required * Value: "STRING_VALUE", // required * }, * ], * EventBusName: "STRING_VALUE", * }; * const command = new PutRuleCommand(input); * const response = await client.send(command); * // { // PutRuleResponse * // RuleArn: "STRING_VALUE", * // }; * * ``` * * @param PutRuleCommandInput - {@link PutRuleCommandInput} * @returns {@link PutRuleCommandOutput} * @see {@link PutRuleCommandInput} for command's `input` shape. * @see {@link PutRuleCommandOutput} for command's `response` shape. * @see {@link EventBridgeClientResolvedConfig | config} for EventBridgeClient's `config` shape. * * @throws {@link ConcurrentModificationException} (client fault) *

There is concurrent modification on a rule, target, archive, or replay.

* * @throws {@link InternalException} (server fault) *

This exception occurs due to unexpected causes.

* * @throws {@link InvalidEventPatternException} (client fault) *

The event pattern is not valid.

* * @throws {@link LimitExceededException} (client fault) *

The request failed because it attempted to create resource beyond the allowed service * quota.

* * @throws {@link ManagedRuleException} (client fault) *

This rule was created by an Amazon Web Services service on behalf of your account. It is * managed by that service. If you see this error in response to DeleteRule or * RemoveTargets, you can use the Force parameter in those calls to * delete the rule or remove targets from the rule. You cannot modify these managed rules by * using DisableRule, EnableRule, PutTargets, * PutRule, TagResource, or UntagResource.

* * @throws {@link ResourceNotFoundException} (client fault) *

An entity that you specified does not exist.

* * @throws {@link EventBridgeServiceException} *

Base exception class for all service exceptions from EventBridge service.

* * * @public */ export declare class PutRuleCommand extends PutRuleCommand_base { /** @internal type navigation helper, not in runtime. */ protected static __types: { api: { input: PutRuleRequest; output: PutRuleResponse; }; sdk: { input: PutRuleCommandInput; output: PutRuleCommandOutput; }; }; }