From 088c466a2486517da22c933b46843b3e2f2d9fbe Mon Sep 17 00:00:00 2001 From: Dan Sun Date: Fri, 14 Jul 2023 16:45:58 -0700 Subject: [PATCH] [Maestro-14785] Fix DeploymentTarget - AccountURL in resource handler and documentation --- .../aws-cloudformation-stackset.json | 7 +++++++ .../docs/deploymenttargets.md | 16 ++++++++++++++++ .../stackset/translator/PropertyTranslator.java | 1 + .../translator/PropertyTranslatorTest.java | 3 +++ .../stackset/util/AltTestUtils.java | 1 + 5 files changed, 28 insertions(+) diff --git a/aws-cloudformation-stackset/aws-cloudformation-stackset.json b/aws-cloudformation-stackset/aws-cloudformation-stackset.json index c33ba0e..99e2f99 100644 --- a/aws-cloudformation-stackset/aws-cloudformation-stackset.json +++ b/aws-cloudformation-stackset/aws-cloudformation-stackset.json @@ -146,6 +146,13 @@ "$ref": "#/definitions/Account" } }, + "AccountsUrl": { + "description": "Returns the value of the AccountsUrl property.", + "type": "string", + "minLength": 1, + "maxLength": 5120, + "pattern": "(s3://|http(s?)://).+" + }, "OrganizationalUnitIds": { "description": "The organization root ID or organizational unit (OU) IDs to which StackSets deploys.", "type": "array", diff --git a/aws-cloudformation-stackset/docs/deploymenttargets.md b/aws-cloudformation-stackset/docs/deploymenttargets.md index ebd1530..56ee0bd 100644 --- a/aws-cloudformation-stackset/docs/deploymenttargets.md +++ b/aws-cloudformation-stackset/docs/deploymenttargets.md @@ -11,6 +11,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
 {
     "Accounts" : [ String, ... ],
+    "AccountsUrl" : String,
     "OrganizationalUnitIds" : [ String, ... ],
     "AccountFilterType" : String
 }
@@ -21,6 +22,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
 
 Accounts: 
       - String
+AccountsUrl: String
 OrganizationalUnitIds: 
       - String
 AccountFilterType: String
@@ -38,6 +40,20 @@ _Type_: List of String
 
 _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
 
+#### AccountsUrl
+
+Returns the value of the AccountsUrl property.
+
+_Required_: No
+
+_Type_: String
+
+_Length Constraints_: Minimum length of 1. Maximum length of 5120.
+
+_Pattern_: `(s3://|http(s?)://).+`
+
+_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
+
 #### OrganizationalUnitIds
 
 The organization root ID or organizational unit (OU) IDs to which StackSets deploys.
diff --git a/aws-cloudformation-stackset/src/main/java/software/amazon/cloudformation/stackset/translator/PropertyTranslator.java b/aws-cloudformation-stackset/src/main/java/software/amazon/cloudformation/stackset/translator/PropertyTranslator.java
index 2cf8579..ec969ff 100644
--- a/aws-cloudformation-stackset/src/main/java/software/amazon/cloudformation/stackset/translator/PropertyTranslator.java
+++ b/aws-cloudformation-stackset/src/main/java/software/amazon/cloudformation/stackset/translator/PropertyTranslator.java
@@ -61,6 +61,7 @@ static DeploymentTargets translateToSdkDeploymentTargets(
             final software.amazon.cloudformation.stackset.DeploymentTargets deploymentTargets) {
         return DeploymentTargets.builder()
                 .accounts(deploymentTargets.getAccounts())
+                .accountsUrl(deploymentTargets.getAccountsUrl())
                 .organizationalUnitIds(deploymentTargets.getOrganizationalUnitIds())
                 .accountFilterType(deploymentTargets.getAccountFilterType())
                 .build();
diff --git a/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/translator/PropertyTranslatorTest.java b/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/translator/PropertyTranslatorTest.java
index c12a9e8..9341765 100644
--- a/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/translator/PropertyTranslatorTest.java
+++ b/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/translator/PropertyTranslatorTest.java
@@ -21,6 +21,7 @@
 import static software.amazon.cloudformation.stackset.translator.PropertyTranslator.translateToSdkOperationPreferences;
 import static software.amazon.cloudformation.stackset.translator.PropertyTranslator.translateToSdkTags;
 import static software.amazon.cloudformation.stackset.translator.PropertyTranslator.translateToStackInstance;
+import static software.amazon.cloudformation.stackset.util.AltTestUtils.ACCOUNTS_URL;
 import static software.amazon.cloudformation.stackset.util.AltTestUtils.INTER;
 import static software.amazon.cloudformation.stackset.util.AltTestUtils.OU_1;
 import static software.amazon.cloudformation.stackset.util.AltTestUtils.account_1;
@@ -90,6 +91,7 @@ public void test_translateToSdkDeploymentTargets() {
                 software.amazon.cloudformation.stackset.DeploymentTargets.builder()
                         .organizationalUnitIds(new HashSet<>(Arrays.asList(OU_1)))
                         .accounts(new HashSet<>(Arrays.asList(account_1)))
+                        .accountsUrl(ACCOUNTS_URL)
                         .accountFilterType(INTER)
                         .build();
 
@@ -99,6 +101,7 @@ public void test_translateToSdkDeploymentTargets() {
                 .isEqualTo(new HashSet<>(Arrays.asList(OU_1)));
         assertThat(new HashSet<>(sdkDeploymentTargets.accounts()))
                 .isEqualTo(new HashSet<>(Arrays.asList(account_1)));
+        assertThat(sdkDeploymentTargets.accountsUrl()).isEqualTo(ACCOUNTS_URL);
         assertThat(sdkDeploymentTargets.accountFilterTypeAsString()).isEqualTo(INTER);
 
     }
diff --git a/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/util/AltTestUtils.java b/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/util/AltTestUtils.java
index 6ac439b..6085148 100644
--- a/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/util/AltTestUtils.java
+++ b/aws-cloudformation-stackset/src/test/java/software/amazon/cloudformation/stackset/util/AltTestUtils.java
@@ -31,6 +31,7 @@ public class AltTestUtils {
     public final static String region_2 = "us-west-1";
     public final static String region_3 = "us-east-2";
     public final static String region_4 = "us-east-1";
+    public final static String ACCOUNTS_URL = "http://test";
 
     public final static Set singleton_region_set = new HashSet<>(Collections.singletonList(region_1));