- AWS Code Sample demonstrates how to get the migration status of an application.

/** * Copyright, Inc. or its affiliates. All Rights Reserved. * * This file is licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. A copy of * the License is located at * * * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package com.example.migrationhub; import; import; import; import; import; public class DescribeAppState { public static void main(String[] args) { final String USAGE = "\n" + "To run this example, supply the application ID value\n" + "\n" + "Ex: DescribeAppState appId\n"; if (args.length < 1) { System.out.println(USAGE); System.exit(1); } String appId = args[0]; Region region = Region.US_WEST_2; MigrationHubClient migrationClient = MigrationHubClient.builder() .region(region) .build(); describeApplicationState(migrationClient, appId); } public static void describeApplicationState (MigrationHubClient migrationClient, String appId) { try { DescribeApplicationStateRequest applicationStateRequest = DescribeApplicationStateRequest.builder() .applicationId(appId) .build(); DescribeApplicationStateResponse applicationStateResponse = migrationClient.describeApplicationState(applicationStateRequest); // Display the results System.out.println("The application status is " +applicationStateResponse.applicationStatusAsString() ); } catch(MigrationHubException e) { System.out.println(e.getMessage()); System.exit(1); } } }

Sample Details

Service: Amazon Migration Hub

Last tested: 6-23-2020

Author: scmacdon - AWS

Type: full-example