Example usage for com.amazonaws.services.cloudwatchevents.model PutRuleResult getRuleArn

List of usage examples for com.amazonaws.services.cloudwatchevents.model PutRuleResult getRuleArn

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatchevents.model PutRuleResult getRuleArn.

Prototype


public String getRuleArn() 

Source Link

Document

The Amazon Resource Name (ARN) of the rule.

Usage

From source file:aws.example.cloudwatch.PutRule.java

License:Open Source License

public static void main(String[] args) {

    final String USAGE = "To run this example, supply a rule name and role arn\n"
            + "Ex: PutRule <rule-name> <role-arn>\n";

    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);//from w  w  w  .  jav  a  2s .co m
    }

    String rule_name = args[0];
    String role_arn = args[1];

    final AmazonCloudWatchEvents cwe = AmazonCloudWatchEventsClientBuilder.defaultClient();

    PutRuleRequest request = new PutRuleRequest().withName(rule_name).withRoleArn(role_arn)
            .withScheduleExpression("rate(5 minutes)").withState(RuleState.ENABLED);

    PutRuleResult response = cwe.putRule(request);

    System.out.printf("Successfully created CloudWatch events rule %s with arn %s", rule_name,
            response.getRuleArn());
}

From source file:cloudwatch.src.main.java.aws.example.cloudwatch.PutRule.java

License:Open Source License

public static void main(String[] args) {

    final String USAGE = "To run this example, supply a rule name and role arn\n"
            + "Ex: PutRule <rule-name> <role-arn>\n";

    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);//www  .j ava2 s . com
    }

    String ruleName = args[0];
    String roleArn = args[1];

    final AmazonCloudWatchEvents cloudWatchEvents = AmazonCloudWatchEventsClientBuilder.defaultClient();

    PutRuleRequest request = new PutRuleRequest().withName(ruleName).withRoleArn(roleArn)
            .withScheduleExpression("rate(5 minutes)").withState(RuleState.ENABLED);

    PutRuleResult response = cloudWatchEvents.putRule(request);

    System.out.printf("Successfully created CloudWatch events rule %s with arn %s", ruleName,
            response.getRuleArn());
}