Describe an EventBridge rule using an Amazon SDK - Amazon EventBridge
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).

Describe an EventBridge rule using an Amazon SDK

The following code example shows how to describe an Amazon EventBridge rule.

.NET
Amazon SDK for .NET
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

Get the state of a rule using the rule description.

/// <summary> /// Get the state for a rule by the rule name. /// </summary> /// <param name="ruleName">The name of the rule.</param> /// <param name="eventBusName">The optional name of the event bus. If empty, uses the default event bus.</param> /// <returns>The state of the rule.</returns> public async Task<RuleState> GetRuleStateByRuleName(string ruleName, string? eventBusName = null) { var ruleResponse = await _amazonEventBridge.DescribeRuleAsync( new DescribeRuleRequest() { Name = ruleName, EventBusName = eventBusName }); return ruleResponse.State; }
  • For API details, see DescribeRule in Amazon SDK for .NET API Reference.

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.