use of software.amazon.awssdk.services.ssm.model.SsmException in project aws-doc-sdk-examples by awsdocs.
the class GetParameter method getParaValue.
// snippet-start:[ssm.Java2.get_para_value.main]
public static void getParaValue(SsmClient ssmClient, String paraName) {
try {
GetParameterRequest parameterRequest = GetParameterRequest.builder().name(paraName).build();
GetParameterResponse parameterResponse = ssmClient.getParameter(parameterRequest);
System.out.println("The parameter value is " + parameterResponse.parameter().value());
} catch (SsmException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.ssm.model.SsmException in project aws-doc-sdk-examples by awsdocs.
the class CreateOpsItem method createNewOpsItem.
// snippet-start:[ssm.java2.create_ops.main]
public static String createNewOpsItem(SsmClient ssmClient, String title, String source, String category, String severity) {
try {
CreateOpsItemRequest opsItemRequest = CreateOpsItemRequest.builder().description("Created by the SSM Java API").title(title).source(source).category(category).severity(severity).build();
CreateOpsItemResponse itemResponse = ssmClient.createOpsItem(opsItemRequest);
return itemResponse.opsItemId();
} catch (SsmException e) {
System.err.println(e.getMessage());
System.exit(1);
}
return "";
}
use of software.amazon.awssdk.services.ssm.model.SsmException in project aws-doc-sdk-examples by awsdocs.
the class DescribeOpsItems method describeItems.
// snippet-start:[ssm.java2.describe_ops.main]
public static void describeItems(SsmClient ssmClient) {
try {
DescribeOpsItemsRequest itemsRequest = DescribeOpsItemsRequest.builder().maxResults(10).build();
DescribeOpsItemsResponse itemsResponse = ssmClient.describeOpsItems(itemsRequest);
List<OpsItemSummary> items = itemsResponse.opsItemSummaries();
for (OpsItemSummary item : items) {
System.out.println("The item title is " + item.title());
}
} catch (SsmException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.ssm.model.SsmException in project aws-doc-sdk-examples by awsdocs.
the class GetOpsItem method getOpsItem.
// snippet-start:[ssm.Java2.get_ops.main]
public static void getOpsItem(SsmClient ssmClient, String opsID) {
try {
GetOpsItemRequest opsRequest = GetOpsItemRequest.builder().opsItemId(opsID).build();
// Get SSM Parameters (you can define them in the AWS Management Console)
GetOpsItemResponse opsItem = ssmClient.getOpsItem(opsRequest);
OpsItem item = opsItem.opsItem();
System.out.println(item.title());
System.out.println(item.description());
System.out.println(item.source());
} catch (SsmException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
use of software.amazon.awssdk.services.ssm.model.SsmException in project aws-doc-sdk-examples by awsdocs.
the class ResolveOpsItem method setOpsItemStatus.
// snippet-start:[ssm.Java2.resolve_ops.main]
public static void setOpsItemStatus(SsmClient ssmClient, String opsID) {
try {
UpdateOpsItemRequest opsItemRequest = UpdateOpsItemRequest.builder().opsItemId(opsID).status(OpsItemStatus.RESOLVED).build();
ssmClient.updateOpsItem(opsItemRequest);
} catch (SsmException e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
Aggregations