Skip to content

Commit

Permalink
Polish some log wordings and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
xiwhuang committed May 29, 2020
1 parent aa976dc commit f134b12
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"typeName": "AWS::CloudFormation::StackSet",
"description": "Resource Type definition for AWS::CloudFormation::StackSet",
"description": "StackSet as a resource provides one-click experience for provisioning a StackSet and StackInstances",
"sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-cloudformation.git",
"resourceLink": {
"templateUri": "/cloudformation/home?region=${awsRegion}#/stacksets/${StackSetId}",
Expand Down
2 changes: 1 addition & 1 deletion aws-cloudformation-stackset/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AWS::CloudFormation::StackSet

Resource Type definition for AWS::CloudFormation::StackSet
StackSet as a resource provides one-click experience for provisioning a StackSet and StackInstances

## Syntax

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected static boolean isStackSetOperationDone(

switch (status) {
case SUCCEEDED:
logger.log(String.format("%s has been successfully stabilized.", operationId));
logger.log(String.format("StackSet Operation [%s] has been successfully stabilized.", operationId));
return true;
case RUNNING:
case QUEUED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected ProgressEvent<ResourceModel, CallbackContext> deleteStackSet(
.makeServiceCall((modelRequest, proxyInvocation) -> {
final DeleteStackSetResponse response = proxyInvocation.injectCredentialsAndInvokeV2(
deleteStackSetRequest(model.getStackSetId()), proxyInvocation.client()::deleteStackSet);
logger.log(String.format("%s successfully deleted.", ResourceModel.TYPE_NAME));
logger.log(String.format("%s [%s] has been deleted successfully.", ResourceModel.TYPE_NAME, model.getStackSetId()));
return response;
})
.success();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static DeploymentTargets translateToSdkDeploymentTargets(
}

/**
* Converts resource model Parameters to StackSet SDK Parameters
* Converts StackSet SDK Parameters to resource model Parameters
*
* @param parameters Parameters collection from resource model
* @return SDK Parameter list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public class RequestTranslator {

private static int LIST_MAX_ITEMS = 100;
private static final int LIST_MAX_ITEMS = 100;

public static CreateStackSetRequest createStackSetRequest(
final ResourceModel model, final String requestToken) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ private static void validateResource(final String type) {
switch (type) {
case "AWS::CloudFormation::Stack":
case "AWS::CloudFormation::StackSet":
throw new CfnInvalidRequestException(String.format("Nested %s is not allowed", type));
throw new CfnInvalidRequestException(
String.format("Nested %s is not supported in AWS::CloudFormation::StackSet", type));
}
}

Expand All @@ -33,7 +34,7 @@ private static void validateResource(final String type) {
* <li> Template contents must be valid
* </ul>
*
* @param proxyClient {@link ProxyClient < CloudFormationClient >}
* @param proxyClient {@link ProxyClient <CloudFormationClient>}
* @param templateBody {@link software.amazon.cloudformation.stackset.ResourceModel#getTemplateBody}
* @param templateLocation {@link software.amazon.cloudformation.stackset.ResourceModel#getTemplateURL}
* @throws CfnInvalidRequestException if template is not valid
Expand All @@ -46,6 +47,7 @@ public void validateTemplate(
final GetTemplateSummaryResponse response = proxyClient.injectCredentialsAndInvokeV2(
getTemplateSummaryRequest(templateBody, templateLocation),
proxyClient.client()::getTemplateSummary);

if (response.hasResourceTypes()) {
response.resourceTypes().forEach(Validator::validateResource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import static software.amazon.cloudformation.stackset.util.TestUtils.DESCRIBE_STACK_INSTANCE_RESPONSE_2;
import static software.amazon.cloudformation.stackset.util.TestUtils.DESCRIBE_STACK_INSTANCE_RESPONSE_3;
import static software.amazon.cloudformation.stackset.util.TestUtils.DESCRIBE_STACK_INSTANCE_RESPONSE_4;
import static software.amazon.cloudformation.stackset.util.TestUtils.INVALID_TEMPLATE_SUMMARY_RESPONSE;
import static software.amazon.cloudformation.stackset.util.TestUtils.LIST_SELF_MANAGED_STACK_SET_EMPTY_RESPONSE;
import static software.amazon.cloudformation.stackset.util.TestUtils.LIST_SELF_MANAGED_STACK_SET_ONE_INSTANCES_RESPONSE;
import static software.amazon.cloudformation.stackset.util.TestUtils.LIST_SELF_MANAGED_STACK_SET_RESPONSE;
Expand All @@ -57,6 +56,7 @@
import static software.amazon.cloudformation.stackset.util.TestUtils.SELF_MANAGED_ONE_INSTANCES_MODEL;
import static software.amazon.cloudformation.stackset.util.TestUtils.SERVICE_MANAGED_MODEL;
import static software.amazon.cloudformation.stackset.util.TestUtils.SERVICE_MANAGED_MODEL_FOR_READ;
import static software.amazon.cloudformation.stackset.util.TestUtils.TEMPLATE_SUMMARY_RESPONSE_WITH_NESTED_STACK;
import static software.amazon.cloudformation.stackset.util.TestUtils.VALID_TEMPLATE_SUMMARY_RESPONSE;

@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -294,7 +294,7 @@ public void handlerRequest_CfnInvalidRequestException_NestedStack() {
.build();

when(proxyClient.client().getTemplateSummary(any(GetTemplateSummaryRequest.class)))
.thenReturn(INVALID_TEMPLATE_SUMMARY_RESPONSE);
.thenReturn(TEMPLATE_SUMMARY_RESPONSE_WITH_NESTED_STACK);

assertThrows(CfnInvalidRequestException.class,
() -> handler.handleRequest(proxy, request, new CallbackContext(), proxyClient, logger));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ public class TestUtils {
.resourceTypes(Arrays.asList("AWS::CloudFormation::WaitCondition"))
.build();

public final static GetTemplateSummaryResponse INVALID_TEMPLATE_SUMMARY_RESPONSE = GetTemplateSummaryResponse.builder()
.resourceTypes(Arrays.asList("AWS::CloudFormation::Stack"))
.build();
public final static GetTemplateSummaryResponse TEMPLATE_SUMMARY_RESPONSE_WITH_NESTED_STACK =
GetTemplateSummaryResponse.builder()
.resourceTypes(Arrays.asList("AWS::CloudFormation::Stack"))
.build();

public final static StackInstanceSummary STACK_INSTANCE_SUMMARY_1 = StackInstanceSummary.builder()
.organizationalUnitId(ORGANIZATION_UNIT_ID_1)
Expand Down

0 comments on commit f134b12

Please sign in to comment.