Search in sources :

Example 1 with EcsClient

use of software.amazon.awssdk.services.ecs.EcsClient in project aws-doc-sdk-examples by awsdocs.

the class UpdateService method main.

public static void main(String[] args) {
    final String usage = "\n" + "Usage:\n" + "  UpdateService " + "   <clusterName> <serviceArn> \n\n" + "Where:\n" + "  clusterName - the cluster name.\n" + "  serviceArn - the service ARN value.\n";
    if (args.length != 2) {
        System.out.println(usage);
        System.exit(1);
    }
    String clusterName = args[0];
    String serviceArn = args[1];
    Region region = Region.US_EAST_1;
    EcsClient ecsClient = EcsClient.builder().region(region).build();
    updateSpecificService(ecsClient, clusterName, serviceArn);
    ecsClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) EcsClient(software.amazon.awssdk.services.ecs.EcsClient)

Example 2 with EcsClient

use of software.amazon.awssdk.services.ecs.EcsClient in project aws-doc-sdk-examples by awsdocs.

the class ListTaskDefinitions method main.

public static void main(String[] args) {
    final String usage = "\n" + "Usage:\n" + "  <clusterArn> <taskId> \n\n" + "Where:\n" + "  clusterArn - the ARN of an ECS cluster.\n" + "  taskId - the task Id value.\n";
    if (args.length != 2) {
        System.out.println(usage);
        System.exit(1);
    }
    String clusterArn = args[0];
    String taskId = args[1];
    Region region = Region.US_EAST_1;
    EcsClient ecsClient = EcsClient.builder().region(region).build();
    getAllTasks(ecsClient, clusterArn, taskId);
    ecsClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) EcsClient(software.amazon.awssdk.services.ecs.EcsClient)

Example 3 with EcsClient

use of software.amazon.awssdk.services.ecs.EcsClient in project aws-doc-sdk-examples by awsdocs.

the class CreateService method main.

public static void main(String[] args) {
    final String usage = "\n" + "Usage:\n" + "  <clusterName> <serviceName> <securityGroups> <subnets> <taskDefinition>\n\n" + "Where:\n" + "  clusterName - the name of the ECS cluster.\n" + "  serviceName - the name of the ECS service to create.\n" + "  securityGroups - the name of the security group.\n" + "  subnets - the name of the subnet.\n" + "  taskDefinition - the name of the task definition.\n";
    if (args.length != 5) {
        System.out.println(usage);
        System.exit(1);
    }
    String clusterName = args[0];
    String serviceName = args[1];
    String securityGroups = args[2];
    String subnets = args[3];
    String taskDefinition = args[4];
    Region region = Region.US_EAST_1;
    EcsClient ecsClient = EcsClient.builder().region(region).build();
    String serviceArn = CreateNewService(ecsClient, clusterName, serviceName, securityGroups, subnets, taskDefinition);
    System.out.println("The ARN of the service is " + serviceArn);
    ecsClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) EcsClient(software.amazon.awssdk.services.ecs.EcsClient)

Example 4 with EcsClient

use of software.amazon.awssdk.services.ecs.EcsClient in project aws-doc-sdk-examples by awsdocs.

the class CreateCluster method main.

public static void main(String[] args) {
    final String usage = "\n" + "Usage:\n" + "   <clusterName> \n\n" + "Where:\n" + "   clusterName - the name of the ECS cluster to create.\n";
    if (args.length != 1) {
        System.out.println(usage);
        System.exit(1);
    }
    String clusterName = args[0];
    Region region = Region.US_EAST_1;
    EcsClient ecsClient = EcsClient.builder().region(region).build();
    String clusterArn = createGivenCluster(ecsClient, clusterName);
    System.out.println("The cluster ARN is " + clusterArn);
    ecsClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) EcsClient(software.amazon.awssdk.services.ecs.EcsClient)

Example 5 with EcsClient

use of software.amazon.awssdk.services.ecs.EcsClient in project aws-doc-sdk-examples by awsdocs.

the class DeleteService method main.

public static void main(String[] args) {
    final String usage = "\n" + "Usage:\n" + "  <clusterName> <serviceArn> \n\n" + "Where:\n" + "  clusterName - the name of the ECS cluster.\n" + "  serviceArn - the ARN of the ECS service.\n";
    if (args.length != 2) {
        System.out.println(usage);
        System.exit(1);
    }
    String clusterName = args[0];
    String serviceArn = args[1];
    Region region = Region.US_EAST_1;
    EcsClient ecsClient = EcsClient.builder().region(region).build();
    deleteSpecificService(ecsClient, clusterName, serviceArn);
    ecsClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) EcsClient(software.amazon.awssdk.services.ecs.EcsClient)

Aggregations

Region (software.amazon.awssdk.regions.Region)7 EcsClient (software.amazon.awssdk.services.ecs.EcsClient)7