Search in sources :

Example 1 with SsmClient

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

the class CreateOpsItem method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <title> <source> <category> <severity>\n\n" + "Where:\n" + "    title - the OpsItem title.\n" + "    source - the origin of the OpsItem, such as Amazon EC2 or AWS Systems Manager.\n" + "    category - a category to assign to an OpsItem.\n" + "    severity - a severity to assign to an OpsItem.\n";
    if (args.length != 4) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String title = args[0];
    String source = args[1];
    String category = args[2];
    String severity = args[3];
    Region region = Region.US_EAST_1;
    SsmClient ssmClient = SsmClient.builder().region(region).build();
    System.out.println("The Id of the OpsItem is " + createNewOpsItem(ssmClient, title, source, category, severity));
    ssmClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) SsmClient(software.amazon.awssdk.services.ssm.SsmClient)

Example 2 with SsmClient

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

the class DescribeParameters method main.

public static void main(String[] args) {
    Region region = Region.US_EAST_1;
    SsmClient ssmClient = SsmClient.builder().region(region).build();
    describeParams(ssmClient);
    ssmClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) SsmClient(software.amazon.awssdk.services.ssm.SsmClient)

Example 3 with SsmClient

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

the class GetOpsItem method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <opsID>\n\n" + "Where:\n" + "    opsID - the Ops item ID value.\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String opsID = args[0];
    Region region = Region.US_EAST_1;
    SsmClient ssmClient = SsmClient.builder().region(region).build();
    getOpsItem(ssmClient, opsID);
    ssmClient.close();
}
Also used : Region(software.amazon.awssdk.regions.Region) SsmClient(software.amazon.awssdk.services.ssm.SsmClient)

Example 4 with SsmClient

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

the class ResolveOpsItem method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "    <opsID>\n\n" + "Where:\n" + "    opsID - the Ops item ID value.\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    /* Read the name from command args */
    String opsID = args[0];
    Region region = Region.US_EAST_1;
    SsmClient ssmClient = SsmClient.builder().region(region).build();
    setOpsItemStatus(ssmClient, opsID);
}
Also used : Region(software.amazon.awssdk.regions.Region) SsmClient(software.amazon.awssdk.services.ssm.SsmClient)

Example 5 with SsmClient

use of software.amazon.awssdk.services.ssm.SsmClient in project athenz by yahoo.

the class MockAWSParameterStoreSyncer method initClient.

@Override
SsmClient initClient() {
    Date now = new Date();
    SsmClient mock = mock(SsmClient.class);
    when(mock.describeParameters(any(DescribeParametersRequest.class))).thenReturn(DescribeParametersResponse.builder().parameters(ParameterMetadata.builder().name("param1").lastModifiedDate(now.toInstant()).build(), ParameterMetadata.builder().name("param2").lastModifiedDate(now.toInstant()).build(), ParameterMetadata.builder().name("param4").lastModifiedDate(now.toInstant()).build()).build());
    when(mock.getParameter(parameterRequest("param1"))).thenReturn(GetParameterResponse.builder().parameter(Parameter.builder().name("param1").value("param1-val").lastModifiedDate(now.toInstant()).build()).build());
    when(mock.getParameter(parameterRequest("param2"))).thenReturn(GetParameterResponse.builder().parameter(Parameter.builder().name("param2").value("param2-val").lastModifiedDate(now.toInstant()).build()).build());
    when(mock.getParameter(parameterRequest("param4"))).thenThrow(new ResourceException(INTERNAL_SERVER_ERROR));
    return mock;
}
Also used : ResourceException(com.yahoo.athenz.common.server.rest.ResourceException) Date(java.util.Date) SsmClient(software.amazon.awssdk.services.ssm.SsmClient)

Aggregations

SsmClient (software.amazon.awssdk.services.ssm.SsmClient)9 Region (software.amazon.awssdk.regions.Region)6 ResourceException (com.yahoo.athenz.common.server.rest.ResourceException)1 Utils (com.yahoo.athenz.common.server.util.Utils)1 Arrays (java.util.Arrays)1 Date (java.util.Date)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Collectors (java.util.stream.Collectors)1 Mockito (org.mockito.Mockito)1 Assert (org.testng.Assert)1 Test (org.testng.annotations.Test)1 GetParameterRequest (software.amazon.awssdk.services.ssm.model.GetParameterRequest)1 GetParameterResponse (software.amazon.awssdk.services.ssm.model.GetParameterResponse)1 GetParametersByPathRequest (software.amazon.awssdk.services.ssm.model.GetParametersByPathRequest)1 GetParametersByPathResponse (software.amazon.awssdk.services.ssm.model.GetParametersByPathResponse)1 Parameter (software.amazon.awssdk.services.ssm.model.Parameter)1 ParameterNotFoundException (software.amazon.awssdk.services.ssm.model.ParameterNotFoundException)1