Application Recovery Controller examples using SDK for Java 2.x - AWS SDK for Java

You can now use the Amazon S3 Transfer Manager (Developer Preview) in the AWS SDK for Java 2.x for accelerated file transfers. Give it a try and let us know what you think! By the way, the AWS SDK for Java team is hiring software development engineers!

Application Recovery Controller examples using SDK for Java 2.x

The following code examples show you how to perform actions and implement common scenarios by using the AWS SDK for Java 2.x with Application Recovery Controller.

Actions are code excerpts that show you how to call individual Application Recovery Controller functions.

Scenarios are code examples that show you how to accomplish a specific task by calling multiple Application Recovery Controller functions.

Each example includes a link to GitHub, where you can find instructions on how to set up and run the code in context.

Topics

Actions

The following code example shows how to get the state of an Application Recovery Controller routing control.

SDK for Java 2.x

public static GetRoutingControlStateResponse getRoutingControlState(List<ClusterEndpoint> clusterEndpoints, String routingControlArn) { for (ClusterEndpoint clusterEndpoint : clusterEndpoints) { try { System.out.println(clusterEndpoint); Route53RecoveryClusterClient client = Route53RecoveryClusterClient.builder() .endpointOverride(URI.create(clusterEndpoint.endpoint())) .region(Region.of(clusterEndpoint.region())).build(); return client.getRoutingControlState( GetRoutingControlStateRequest.builder() .routingControlArn(routingControlArn).build()); } catch (Exception exception) { System.out.println(exception); } } return null; }

The following code example shows how to update the state of an Application Recovery Controller routing control.

SDK for Java 2.x

public static UpdateRoutingControlStateResponse updateRoutingControlState(List<ClusterEndpoint> clusterEndpoints, String routingControlArn, String routingControlState) { for (ClusterEndpoint clusterEndpoint : clusterEndpoints) { try { System.out.println(clusterEndpoint); Route53RecoveryClusterClient client = Route53RecoveryClusterClient.builder() .endpointOverride(URI.create(clusterEndpoint.endpoint())) .region(Region.of(clusterEndpoint.region())) .build(); return client.updateRoutingControlState( UpdateRoutingControlStateRequest.builder() .routingControlArn(routingControlArn).routingControlState(routingControlState).build()); } catch (Exception exception) { System.out.println(exception); } } return null; }