public SendCommandResult sendCommand()

in TerraformCustomResourceHandler/src/main/java/com/amazon/servicecatalog/terraform/customresource/facades/SsmFacade.java [47:75]


    public SendCommandResult sendCommand(List<String> commands,
            String instanceId,
            String outputS3Bucket,
            String outputS3KeyPrefix) {
        Map<String, List<String>> parameters = ImmutableMap.of(
                COMMAND_PARAMETER_NAME, commands,
                WORKING_DIRECTORY_PARAMETER_NAME, Collections.singletonList(DEFAULT_HOME_DIRECTORY)
        );

        SendCommandRequest commandRequest = new SendCommandRequest()
                .withInstanceIds(instanceId)
                .withParameters(parameters)
                .withOutputS3BucketName(outputS3Bucket)
                .withOutputS3KeyPrefix(outputS3KeyPrefix)
                .withDocumentName(RUN_SCRIPT_SSM_DOCUMENT);

        try {
            return ssm.sendCommand(commandRequest);
        } catch (InvalidInstanceIdException e) {
            String message = String.format("Received InvalidInstanceId Error from AWS Systems Manager when sending " +
                    "a command to the FulfillmentServer, %s. Verify that the instance is configured correctly.",
                    instanceId);
            throw new RuntimeException(message);
        } catch (UnsupportedPlatformTypeException e) {
            String message = String.format("ServiceCatalog does not support the platform type of the " +
                    "FulfillmentServer, %s.", instanceId);
            throw new RuntimeException(message);
        }
    }