mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(cloudfront): preserve tenant parameter definitions (#9647)
CreateDistribution, GetDistribution and GetDistributionConfig dropped a distribution's TenantConfig.ParameterDefinitions. They are now parsed, stored and returned, with DefaultValue and Comment kept as sent and a numeric Required (1 or 0) read as an XML boolean. The TenantConfig subtree is read as a bounded stream: more than five definitions, CloudFront's quota for parameters per multi-tenant distribution, or nesting deeper than 32 levels is refused with InvalidArgument. Closes #9580
This commit is contained in:
1 parent
777c959de4
commit
28d6d2997f
5 files changed
+390
-6
No files matched your search
@@ -97,8 +97,10 @@ The service model does not spell every outcome out, so these are Floci's reading
|
||||
- `Parameters` and `Customizations` are validated for shape only (`Name` and `Value` are required,
|
||||
parameter name pattern and value length, `WebAcl.Action` is required with a `WebAcl` and
|
||||
`GeoRestrictions.RestrictionType` is held to its enumeration); each failure is `InvalidArgument`. A distribution's
|
||||
`TenantConfig.ParameterDefinitions` is not modeled, so the parameters are stored as given and not
|
||||
checked against the distribution. `ManagedCertificateRequest` is accepted and ignored.
|
||||
`TenantConfig.ParameterDefinitions` is limited to five entries, matching CloudFront's quota for
|
||||
parameters per multi-tenant distribution. Definitions are stored and returned, but tenant
|
||||
parameters are not checked against the distribution. `ManagedCertificateRequest` is accepted and
|
||||
ignored.
|
||||
- `AWS::CloudFront::DistributionTenant` updates are declarative: a template that drops
|
||||
`ConnectionGroupId` moves the tenant back to the account's default connection group, which is what
|
||||
a create without it picks.
|
||||
|
||||
@@ -42,6 +42,8 @@ public class CloudFrontController {
|
||||
private static final String RESTRICTIONS = "Restrictions";
|
||||
private static final String DEFAULT_GEO_RESTRICTION_TYPE = "none";
|
||||
private static final int EMPTY_QUANTITY = 0;
|
||||
private static final int MAX_TENANT_CONFIG_DEPTH = 32;
|
||||
private static final int MAX_TENANT_PARAMETER_DEFINITIONS = 5;
|
||||
|
||||
/**
|
||||
* Origin timeout constraints from the CloudFront {@code CustomOriginConfig} and
|
||||
@@ -2244,6 +2246,9 @@ public class CloudFrontController {
|
||||
xml.raw(xmlViewerCertificate(cfg.getViewerCertificate()));
|
||||
xml.raw(xmlRestrictions(cfg.getGeoRestriction()));
|
||||
xml.raw(xmlLogging(cfg.getLogging()));
|
||||
if (cfg.getTenantConfig() != null) {
|
||||
xml.raw(xmlTenantConfig(cfg.getTenantConfig()));
|
||||
}
|
||||
if (cfg.getConnectionMode() != null) {
|
||||
xml.elem("ConnectionMode", cfg.getConnectionMode());
|
||||
}
|
||||
@@ -2251,6 +2256,44 @@ public class CloudFrontController {
|
||||
return xml.build();
|
||||
}
|
||||
|
||||
private String xmlTenantConfig(DistributionConfig.TenantConfig tenantConfig) {
|
||||
XmlBuilder xml = new XmlBuilder().start("TenantConfig");
|
||||
List<DistributionConfig.ParameterDefinition> parameterDefinitions =
|
||||
tenantConfig.getParameterDefinitions();
|
||||
if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) {
|
||||
xml.start("ParameterDefinitions");
|
||||
for (DistributionConfig.ParameterDefinition parameterDefinition : parameterDefinitions) {
|
||||
xml.start("member");
|
||||
if (parameterDefinition.getName() != null) {
|
||||
xml.elem("Name", parameterDefinition.getName());
|
||||
}
|
||||
DistributionConfig.ParameterDefinitionDetails definition =
|
||||
parameterDefinition.getDefinition();
|
||||
if (definition != null) {
|
||||
xml.start("Definition");
|
||||
DistributionConfig.StringSchema stringSchema = definition.getStringSchema();
|
||||
if (stringSchema != null) {
|
||||
xml.start("StringSchema");
|
||||
if (stringSchema.getRequired() != null) {
|
||||
xml.elem("Required", stringSchema.getRequired());
|
||||
}
|
||||
if (stringSchema.getDefaultValue() != null) {
|
||||
xml.elem("DefaultValue", stringSchema.getDefaultValue());
|
||||
}
|
||||
if (stringSchema.getComment() != null) {
|
||||
xml.elem("Comment", stringSchema.getComment());
|
||||
}
|
||||
xml.end("StringSchema");
|
||||
}
|
||||
xml.end("Definition");
|
||||
}
|
||||
xml.end("member");
|
||||
}
|
||||
xml.end("ParameterDefinitions");
|
||||
}
|
||||
return xml.end("TenantConfig").build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging is always present on a real DistributionConfig response, disabled by
|
||||
* default. Callers read it unconditionally, so omitting it when the caller did not
|
||||
@@ -2969,10 +3012,147 @@ public class CloudFrontController {
|
||||
cfg.setCustomErrorResponses(parseCustomErrorResponses(body));
|
||||
cfg.setGeoRestriction(parseGeoRestriction(body));
|
||||
cfg.setLogging(parseLogging(body));
|
||||
cfg.setTenantConfig(parseTenantConfig(body));
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
||||
private DistributionConfig.TenantConfig parseTenantConfig(String body) {
|
||||
if (body == null || body.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
XMLStreamReader reader = null;
|
||||
try {
|
||||
reader = XmlParser.newStreamReader(body);
|
||||
DistributionConfig.TenantConfig tenantConfig = null;
|
||||
DistributionConfig.ParameterDefinition parameterDefinition = null;
|
||||
DistributionConfig.ParameterDefinitionDetails definition = null;
|
||||
DistributionConfig.StringSchema stringSchema = null;
|
||||
List<DistributionConfig.ParameterDefinition> parameterDefinitions = null;
|
||||
int tenantDepth = 0;
|
||||
int definitionsDepth = -1;
|
||||
int memberDepth = -1;
|
||||
int definitionDepth = -1;
|
||||
int stringSchemaDepth = -1;
|
||||
int captureDepth = -1;
|
||||
boolean definitionsSeen = false;
|
||||
String captureField = null;
|
||||
StringBuilder captureText = new StringBuilder();
|
||||
|
||||
while (reader.hasNext()) {
|
||||
int event = reader.next();
|
||||
if (event == XMLStreamConstants.START_ELEMENT) {
|
||||
String localName = reader.getLocalName();
|
||||
if (tenantDepth == 0) {
|
||||
if ("TenantConfig".equals(localName)) {
|
||||
tenantConfig = new DistributionConfig.TenantConfig();
|
||||
tenantDepth = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tenantDepth == MAX_TENANT_CONFIG_DEPTH) {
|
||||
throw invalidTenantConfig(
|
||||
"TenantConfig exceeds the maximum supported nesting depth.");
|
||||
}
|
||||
int parentDepth = tenantDepth;
|
||||
tenantDepth++;
|
||||
|
||||
if (parentDepth == 1 && "ParameterDefinitions".equals(localName)
|
||||
&& !definitionsSeen) {
|
||||
definitionsSeen = true;
|
||||
definitionsDepth = tenantDepth;
|
||||
parameterDefinitions = new ArrayList<>();
|
||||
tenantConfig.setParameterDefinitions(parameterDefinitions);
|
||||
} else if (parentDepth == definitionsDepth && "member".equals(localName)) {
|
||||
if (parameterDefinitions.size() == MAX_TENANT_PARAMETER_DEFINITIONS) {
|
||||
throw invalidTenantConfig(
|
||||
"TenantConfig supports at most "
|
||||
+ MAX_TENANT_PARAMETER_DEFINITIONS
|
||||
+ " parameter definitions.");
|
||||
}
|
||||
parameterDefinition = new DistributionConfig.ParameterDefinition();
|
||||
parameterDefinitions.add(parameterDefinition);
|
||||
memberDepth = tenantDepth;
|
||||
} else if (parentDepth == memberDepth && "Name".equals(localName)) {
|
||||
captureField = "Name";
|
||||
captureDepth = tenantDepth;
|
||||
captureText.setLength(0);
|
||||
} else if (parentDepth == memberDepth && "Definition".equals(localName)) {
|
||||
definition = new DistributionConfig.ParameterDefinitionDetails();
|
||||
parameterDefinition.setDefinition(definition);
|
||||
definitionDepth = tenantDepth;
|
||||
} else if (parentDepth == definitionDepth && "StringSchema".equals(localName)) {
|
||||
stringSchema = new DistributionConfig.StringSchema();
|
||||
definition.setStringSchema(stringSchema);
|
||||
stringSchemaDepth = tenantDepth;
|
||||
} else if (parentDepth == stringSchemaDepth
|
||||
&& ("Required".equals(localName)
|
||||
|| "DefaultValue".equals(localName)
|
||||
|| "Comment".equals(localName))) {
|
||||
captureField = localName;
|
||||
captureDepth = tenantDepth;
|
||||
captureText.setLength(0);
|
||||
}
|
||||
} else if (event == XMLStreamConstants.CHARACTERS
|
||||
|| event == XMLStreamConstants.CDATA) {
|
||||
if (captureDepth == tenantDepth) {
|
||||
captureText.append(reader.getText());
|
||||
}
|
||||
} else if (event == XMLStreamConstants.END_ELEMENT) {
|
||||
if (tenantDepth == 0) {
|
||||
continue;
|
||||
}
|
||||
if (captureDepth == tenantDepth) {
|
||||
String value = captureText.toString();
|
||||
switch (captureField) {
|
||||
case "Name" -> parameterDefinition.setName(value.trim());
|
||||
case "Required" -> stringSchema.setRequired(xmlBoolean(value.trim()));
|
||||
case "DefaultValue" -> stringSchema.setDefaultValue(value);
|
||||
case "Comment" -> stringSchema.setComment(value);
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
captureField = null;
|
||||
captureDepth = -1;
|
||||
}
|
||||
if (tenantDepth == stringSchemaDepth) {
|
||||
stringSchema = null;
|
||||
stringSchemaDepth = -1;
|
||||
} else if (tenantDepth == definitionDepth) {
|
||||
definition = null;
|
||||
definitionDepth = -1;
|
||||
} else if (tenantDepth == memberDepth) {
|
||||
parameterDefinition = null;
|
||||
memberDepth = -1;
|
||||
} else if (tenantDepth == definitionsDepth) {
|
||||
definitionsDepth = -1;
|
||||
} else if (tenantDepth == 1
|
||||
&& "TenantConfig".equals(reader.getLocalName())) {
|
||||
return tenantConfig;
|
||||
}
|
||||
tenantDepth--;
|
||||
}
|
||||
}
|
||||
} catch (XMLStreamException e) {
|
||||
LOG.debugv("Ignoring malformed TenantConfig during parse: {0}", e.getMessage());
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (XMLStreamException e) {
|
||||
LOG.debugv("Ignoring TenantConfig reader close failure: {0}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static AwsException invalidTenantConfig(String message) {
|
||||
return new AwsException("InvalidArgument", message, 400);
|
||||
}
|
||||
|
||||
private Map<String, String> parseDistributionConfigTopLevelValues(
|
||||
String body) {
|
||||
Map<String, String> values = new LinkedHashMap<>();
|
||||
|
||||
@@ -27,6 +27,7 @@ public class DistributionConfig {
|
||||
private String continuousDeploymentPolicyId;
|
||||
private boolean staging;
|
||||
private String connectionMode;
|
||||
private TenantConfig tenantConfig;
|
||||
|
||||
public DistributionConfig() {}
|
||||
|
||||
@@ -86,4 +87,61 @@ public class DistributionConfig {
|
||||
|
||||
public String getConnectionMode() { return connectionMode; }
|
||||
public void setConnectionMode(String connectionMode) { this.connectionMode = connectionMode; }
|
||||
|
||||
public TenantConfig getTenantConfig() { return tenantConfig; }
|
||||
public void setTenantConfig(TenantConfig tenantConfig) { this.tenantConfig = tenantConfig; }
|
||||
|
||||
@RegisterForReflection
|
||||
public static class TenantConfig {
|
||||
private List<ParameterDefinition> parameterDefinitions;
|
||||
|
||||
public TenantConfig() {}
|
||||
|
||||
public List<ParameterDefinition> getParameterDefinitions() { return parameterDefinitions; }
|
||||
public void setParameterDefinitions(List<ParameterDefinition> parameterDefinitions) {
|
||||
this.parameterDefinitions = parameterDefinitions;
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
public static class ParameterDefinition {
|
||||
private String name;
|
||||
private ParameterDefinitionDetails definition;
|
||||
|
||||
public ParameterDefinition() {}
|
||||
|
||||
public String getName() { return name; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public ParameterDefinitionDetails getDefinition() { return definition; }
|
||||
public void setDefinition(ParameterDefinitionDetails definition) { this.definition = definition; }
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
public static class ParameterDefinitionDetails {
|
||||
private StringSchema stringSchema;
|
||||
|
||||
public ParameterDefinitionDetails() {}
|
||||
|
||||
public StringSchema getStringSchema() { return stringSchema; }
|
||||
public void setStringSchema(StringSchema stringSchema) { this.stringSchema = stringSchema; }
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
public static class StringSchema {
|
||||
private Boolean required;
|
||||
private String defaultValue;
|
||||
private String comment;
|
||||
|
||||
public StringSchema() {}
|
||||
|
||||
public Boolean getRequired() { return required; }
|
||||
public void setRequired(Boolean required) { this.required = required; }
|
||||
|
||||
public String getDefaultValue() { return defaultValue; }
|
||||
public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; }
|
||||
|
||||
public String getComment() { return comment; }
|
||||
public void setComment(String comment) { this.comment = comment; }
|
||||
}
|
||||
}
|
||||
+77
@@ -18,6 +18,7 @@ import java.util.UUID;
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.xml.HasXPath.hasXPath;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* DistributionConfig members that a caller may omit on input but still expects to read
|
||||
@@ -258,6 +259,82 @@ class CloudFrontDistributionConfigMembersTest {
|
||||
.body(hasXPath(LOGGING_PREFIX, equalTo("update/")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void tenantParameterDefinitionAcceptsNumericXmlBoolean() {
|
||||
String originId = "origin-tenant-parameter-" + UUID.randomUUID();
|
||||
String id = postDistribution(distributionConfigBody(originId, """
|
||||
<ConnectionMode>tenant-only</ConnectionMode>
|
||||
<TenantConfig>
|
||||
<ParameterDefinitions><member>
|
||||
<Name>tenantDomain</Name>
|
||||
<Definition><StringSchema><Required>1</Required></StringSchema></Definition>
|
||||
</member></ParameterDefinitions>
|
||||
</TenantConfig>"""));
|
||||
|
||||
given()
|
||||
.when()
|
||||
.get(API + id + "/config")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(hasXPath(
|
||||
"//*[local-name()='TenantConfig']//*[local-name()='Required']",
|
||||
equalTo("true")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void tenantParameterDefinitionsEnforceTheCloudFrontQuota() {
|
||||
String members = "<member><Name>parameter</Name></member>".repeat(6);
|
||||
|
||||
given()
|
||||
.contentType(ContentType.XML)
|
||||
.body(distributionConfigBody("origin-tenant-parameter-limit-" + UUID.randomUUID(), """
|
||||
<TenantConfig><ParameterDefinitions>%s</ParameterDefinitions></TenantConfig>
|
||||
""".formatted(members)))
|
||||
.when()
|
||||
.post(DISTRIBUTIONS)
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(hasXPath("//*[local-name()='Code']", equalTo("InvalidArgument")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void tenantParameterDefinitionsAcceptTheCloudFrontQuotaOfFive() {
|
||||
StringBuilder members = new StringBuilder();
|
||||
for (int index = 1; index <= 5; index++) {
|
||||
members.append("<member><Name>parameter-").append(index)
|
||||
.append("</Name><Definition><StringSchema><Required>false</Required>")
|
||||
.append("</StringSchema></Definition></member>");
|
||||
}
|
||||
String originId = "origin-tenant-parameter-five-" + UUID.randomUUID();
|
||||
String id = postDistribution(distributionConfigBody(originId,
|
||||
"<ConnectionMode>tenant-only</ConnectionMode><TenantConfig><ParameterDefinitions>"
|
||||
+ members + "</ParameterDefinitions></TenantConfig>"));
|
||||
String response = given()
|
||||
.when()
|
||||
.get(API + id + "/config")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.extract().asString();
|
||||
|
||||
XmlParser.XmlElement definitions = XmlParser.extractElementTree(response, "ParameterDefinitions");
|
||||
assertEquals(5, definitions.children().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void tenantConfigRejectsExcessiveNesting() {
|
||||
String nested = "<unknown>".repeat(32) + "</unknown>".repeat(32);
|
||||
|
||||
given()
|
||||
.contentType(ContentType.XML)
|
||||
.body(distributionConfigBody("origin-tenant-config-depth-" + UUID.randomUUID(),
|
||||
"<TenantConfig><Unknown>" + nested + "</Unknown></TenantConfig>"))
|
||||
.when()
|
||||
.post(DISTRIBUTIONS)
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(hasXPath("//*[local-name()='Code']", equalTo("InvalidArgument")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void webAclIdRoundTripsThroughCreateUpdateAndDistributionReads() {
|
||||
String originId = "origin-web-acl-" + UUID.randomUUID();
|
||||
|
||||
+71
-4
@@ -9,6 +9,7 @@ import software.amazon.awssdk.services.cloudfront.CloudFrontClient;
|
||||
import software.amazon.awssdk.services.cloudfront.model.CannotDeleteEntityWhileInUseException;
|
||||
import software.amazon.awssdk.services.cloudfront.model.Certificate;
|
||||
import software.amazon.awssdk.services.cloudfront.model.CreateConnectionGroupResponse;
|
||||
import software.amazon.awssdk.services.cloudfront.model.CreateDistributionResponse;
|
||||
import software.amazon.awssdk.services.cloudfront.model.CreateDistributionTenantResponse;
|
||||
import software.amazon.awssdk.services.cloudfront.model.Customizations;
|
||||
import software.amazon.awssdk.services.cloudfront.model.DefaultCacheBehavior;
|
||||
@@ -27,11 +28,15 @@ import software.amazon.awssdk.services.cloudfront.model.NoSuchDistributionExcept
|
||||
import software.amazon.awssdk.services.cloudfront.model.Origin;
|
||||
import software.amazon.awssdk.services.cloudfront.model.Origins;
|
||||
import software.amazon.awssdk.services.cloudfront.model.Parameter;
|
||||
import software.amazon.awssdk.services.cloudfront.model.ParameterDefinition;
|
||||
import software.amazon.awssdk.services.cloudfront.model.ParameterDefinitionSchema;
|
||||
import software.amazon.awssdk.services.cloudfront.model.PreconditionFailedException;
|
||||
import software.amazon.awssdk.services.cloudfront.model.ResourceNotDisabledException;
|
||||
import software.amazon.awssdk.services.cloudfront.model.S3OriginConfig;
|
||||
import software.amazon.awssdk.services.cloudfront.model.StringSchemaConfig;
|
||||
import software.amazon.awssdk.services.cloudfront.model.Tag;
|
||||
import software.amazon.awssdk.services.cloudfront.model.Tags;
|
||||
import software.amazon.awssdk.services.cloudfront.model.TenantConfig;
|
||||
import software.amazon.awssdk.services.cloudfront.model.UpdateDistributionTenantResponse;
|
||||
import software.amazon.awssdk.services.cloudfront.model.ViewerCertificate;
|
||||
import software.amazon.awssdk.services.cloudfront.model.WebAclCustomization;
|
||||
@@ -341,6 +346,46 @@ class CloudFrontDistributionTenantSdkIntegrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDistributionPreservesTenantParameterDefinitionsOnCreateAndRead() {
|
||||
try (CloudFrontClient client = client()) {
|
||||
TenantConfig tenantConfig = TenantConfig.builder()
|
||||
.parameterDefinitions(
|
||||
ParameterDefinition.builder()
|
||||
.name("tenantDomain")
|
||||
.definition(ParameterDefinitionSchema.builder()
|
||||
.stringSchema(StringSchemaConfig.builder()
|
||||
.required(true)
|
||||
.build())
|
||||
.build())
|
||||
.build(),
|
||||
ParameterDefinition.builder()
|
||||
.name("tier")
|
||||
.definition(ParameterDefinitionSchema.builder()
|
||||
.stringSchema(StringSchemaConfig.builder()
|
||||
.required(false)
|
||||
.defaultValue(" standard ")
|
||||
.comment(" Tenant service tier ")
|
||||
.build())
|
||||
.build())
|
||||
.build())
|
||||
.build();
|
||||
CreateDistributionResponse created =
|
||||
createDistribution(client, "tenant-only", tenantConfig);
|
||||
String distributionId = created.distribution().id();
|
||||
try {
|
||||
assertTenantParameterDefinitions(
|
||||
created.distribution().distributionConfig().tenantConfig());
|
||||
assertTenantParameterDefinitions(client.getDistribution(
|
||||
request -> request.id(distributionId)).distribution().distributionConfig().tenantConfig());
|
||||
assertTenantParameterDefinitions(client.getDistributionConfig(
|
||||
request -> request.id(distributionId)).distributionConfig().tenantConfig());
|
||||
} finally {
|
||||
disableAndDeleteDistribution(client, distributionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void tenantTagsFollowTheCloudFrontTagApi() {
|
||||
try (CloudFrontClient client = client()) {
|
||||
@@ -370,7 +415,12 @@ class CloudFrontDistributionTenantSdkIntegrationTest {
|
||||
}
|
||||
|
||||
private String createDistribution(CloudFrontClient client, String connectionMode) {
|
||||
DistributionConfig config = DistributionConfig.builder()
|
||||
return createDistribution(client, connectionMode, null).distribution().id();
|
||||
}
|
||||
|
||||
private CreateDistributionResponse createDistribution(
|
||||
CloudFrontClient client, String connectionMode, TenantConfig tenantConfig) {
|
||||
DistributionConfig.Builder config = DistributionConfig.builder()
|
||||
.callerReference("tenant-config-" + stamp())
|
||||
.comment("multi-tenant")
|
||||
.enabled(true)
|
||||
@@ -384,9 +434,26 @@ class CloudFrontDistributionTenantSdkIntegrationTest {
|
||||
.viewerProtocolPolicy("redirect-to-https")
|
||||
.build())
|
||||
.viewerCertificate(ViewerCertificate.builder().cloudFrontDefaultCertificate(true).build())
|
||||
.connectionMode(connectionMode)
|
||||
.build();
|
||||
return client.createDistribution(request -> request.distributionConfig(config)).distribution().id();
|
||||
.connectionMode(connectionMode);
|
||||
if (tenantConfig != null) {
|
||||
config.tenantConfig(tenantConfig);
|
||||
}
|
||||
return client.createDistribution(request -> request.distributionConfig(config.build()));
|
||||
}
|
||||
|
||||
private void assertTenantParameterDefinitions(TenantConfig tenantConfig) {
|
||||
assertNotNull(tenantConfig);
|
||||
assertEquals(2, tenantConfig.parameterDefinitions().size());
|
||||
assertEquals("tenantDomain", tenantConfig.parameterDefinitions().get(0).name());
|
||||
assertTrue(tenantConfig.parameterDefinitions().get(0).definition()
|
||||
.stringSchema().required());
|
||||
assertEquals("tier", tenantConfig.parameterDefinitions().get(1).name());
|
||||
assertFalse(tenantConfig.parameterDefinitions().get(1).definition()
|
||||
.stringSchema().required());
|
||||
assertEquals(" standard ", tenantConfig.parameterDefinitions().get(1).definition()
|
||||
.stringSchema().defaultValue());
|
||||
assertEquals(" Tenant service tier ", tenantConfig.parameterDefinitions().get(1).definition()
|
||||
.stringSchema().comment());
|
||||
}
|
||||
|
||||
private void disableAndDeleteDistribution(CloudFrontClient client, String distributionId) {
|
||||
|
||||
Reference in new issue
Block a user