ListRuleNamesByTargetCommand

Lists the rules for the specified target. You can see which of the rules in Amazon EventBridge can invoke a specific target in your account.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CloudWatchEventsClient, ListRuleNamesByTargetCommand } from "@aws-sdk/client-cloudwatch-events"; // ES Modules import
// const { CloudWatchEventsClient, ListRuleNamesByTargetCommand } = require("@aws-sdk/client-cloudwatch-events"); // CommonJS import
const client = new CloudWatchEventsClient(config);
const input = { // ListRuleNamesByTargetRequest
  TargetArn: "STRING_VALUE", // required
  EventBusName: "STRING_VALUE",
  NextToken: "STRING_VALUE",
  Limit: Number("int"),
};
const command = new ListRuleNamesByTargetCommand(input);
const response = await client.send(command);
// { // ListRuleNamesByTargetResponse
//   RuleNames: [ // RuleNameList
//     "STRING_VALUE",
//   ],
//   NextToken: "STRING_VALUE",
// };

ListRuleNamesByTargetCommand Input

Parameter
Type
Description
TargetArn
Required
string | undefined

The Amazon Resource Name (ARN) of the target resource.

EventBusName
string | undefined

The name or ARN of the event bus to list rules for. If you omit this, the default event bus is used.

Limit
number | undefined

The maximum number of results to return.

NextToken
string | undefined

The token returned by a previous call to retrieve the next set of results.

ListRuleNamesByTargetCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
NextToken
string | undefined

Indicates whether there are additional results to retrieve. If there are no more results, the value is null.

RuleNames
string[] | undefined

The names of the rules that can invoke the given target.

Throws

Name
Fault
Details
InternalException
server

This exception occurs due to unexpected causes.

ResourceNotFoundException
client

An entity that you specified does not exist.

CloudWatchEventsServiceException
Base exception class for all service exceptions from CloudWatchEvents service.