Example usage for com.amazonaws.services.simplesystemsmanagement AWSSimpleSystemsManagementClient putParameter

List of usage examples for com.amazonaws.services.simplesystemsmanagement AWSSimpleSystemsManagementClient putParameter

Introduction

In this page you can find the example usage for com.amazonaws.services.simplesystemsmanagement AWSSimpleSystemsManagementClient putParameter.

Prototype

@Override
public PutParameterResult putParameter(PutParameterRequest request) 

Source Link

Document

Add a parameter to the system.

Usage

From source file:jp.classmethod.aws.gradle.ssm.AmazonSSMPutParameterTask.java

License:Apache License

@TaskAction
public void putParameter() {
    // to enable conventionMappings feature
    List<Parameter> parameters = getParameters();

    if (parameters.isEmpty()) {
        return;/*from w w  w  .ja v a 2 s .co  m*/
    }

    if (getPrefix() == null) {
        setPrefix("");
    }

    AmazonSSMPluginExtention ext = getProject().getExtensions().getByType(AmazonSSMPluginExtention.class);
    AWSSimpleSystemsManagementClient ssm = ext.getClient();

    parameters.stream()
            .map(param -> new PutParameterRequest().withName(getPrefix() + param.getName())
                    .withType(param.getType()).withValue(param.getValue()).withOverwrite(isOverwrite()))
            .forEach(request -> {
                try {
                    ssm.putParameter(request);
                } catch (ParameterAlreadyExistsException e) {
                    getLogger().warn("parameter {} already exists", request.getName());
                }
            });

    getLogger().info("Successfully Put SSM Parameters.");
}