How to get Schedule Expression from CloudWatch programmatically?

I'm needing to pull the Schedule Expression from a CloudWatch event in Java. I already know that I probably need to call 'listRules' on a 'ListRulesRequest'. I can find no online examples of how to do this, put I have found the opposite, which can add rules to the expression. However, whenever I run my method, it times out when I call 'listRules' on my AmazonCloudWatchEvents object. I'm thinking it is possible that I need to add credentials somewhere, but have no idea where or how.

Here is the code:

final AmazonCloudWatchEvents cwe =
	        AmazonCloudWatchEventsClientBuilder.standard()
		    .withRegion(Regions.US_EAST_1)
		    .build();
	    ListRulesRequest lrr = new ListRulesRequest();
	    ListRulesResult result = cwe.listRules(lrr); //Error happens here

Edit: I just looked and do have the proper credentials set up in Eclipse, so I don't believe it is that

Posted Aug 17, 2017, 7:57 PM UTC · edited

54
Loading comments…