Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
List EventBridge rule names for a target using an Amazon SDK
The following code example shows how to list Amazon EventBridge rule names for a target.
- .NET
-
- Amazon SDK for .NET
-
List all of the rule names using the target.
/// <summary>
/// List names of all rules matching a target.
/// </summary>
/// <param name="targetArn">The ARN of the target.</param>
/// <returns>The list of rule names.</returns>
public async Task<List<string>> ListAllRuleNamesByTarget(string targetArn)
{
var results = new List<string>();
var request = new ListRuleNamesByTargetRequest()
{
TargetArn = targetArn
};
ListRuleNamesByTargetResponse response;
do
{
response = await _amazonEventBridge.ListRuleNamesByTargetAsync(request);
results.AddRange(response.RuleNames);
request.NextToken = response.NextToken;
} while (response.NextToken is not null);
return results;
}
For a complete list of Amazon SDK developer guides and code examples, see
Using EventBridge with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.