Skip to content

Commit 24e18ac

Browse files
author
awstools
committed
feat(client-lightsail): Amazon Lightsail now lets you serve website content from a private Lightsail bucket through a Lightsail distribution. This release adds enablePrivateOriginAccess to the CreateDistribution and UpdateDistribution actions, plus new defaultRootObject and customErrorResponses options.
1 parent 996d664 commit 24e18ac

10 files changed

Lines changed: 301 additions & 21 deletions

File tree

‎clients/client-lightsail/src/commands/CreateDistributionCommand.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ export interface CreateDistributionCommandOutput extends CreateDistributionResul
8888
* ],
8989
* certificateName: "STRING_VALUE",
9090
* viewerMinimumTlsProtocolVersion: "TLSv1.1_2016" || "TLSv1.2_2018" || "TLSv1.2_2019" || "TLSv1.2_2021",
91+
* enablePrivateOriginAccess: true || false,
92+
* defaultRootObject: "STRING_VALUE",
93+
* customErrorResponses: [ // DistributionCustomErrorResponseList
94+
* { // DistributionCustomErrorResponse
95+
* errorCode: Number("int"),
96+
* responseCode: "STRING_VALUE",
97+
* responsePagePath: "STRING_VALUE",
98+
* errorCachingMinTTL: Number("long"),
99+
* },
100+
* ],
91101
* };
92102
* const command = new CreateDistributionCommand(input);
93103
* const response = await client.send(command);
@@ -117,6 +127,7 @@ export interface CreateDistributionCommandOutput extends CreateDistributionResul
117127
* // protocolPolicy: "http-only" || "https-only",
118128
* // responseTimeout: Number("int"),
119129
* // ipAddressType: "ipv4" || "ipv6" || "dualstack",
130+
* // isPrivateOriginAccessEnabled: true || false,
120131
* // },
121132
* // originPublicDNS: "STRING_VALUE",
122133
* // defaultCacheBehavior: { // CacheBehavior
@@ -162,6 +173,15 @@ export interface CreateDistributionCommandOutput extends CreateDistributionResul
162173
* // },
163174
* // ],
164175
* // viewerMinimumTlsProtocolVersion: "STRING_VALUE",
176+
* // defaultRootObject: "STRING_VALUE",
177+
* // customErrorResponses: [ // DistributionCustomErrorResponseList
178+
* // { // DistributionCustomErrorResponse
179+
* // errorCode: Number("int"),
180+
* // responseCode: "STRING_VALUE",
181+
* // responsePagePath: "STRING_VALUE",
182+
* // errorCachingMinTTL: Number("long"),
183+
* // },
184+
* // ],
165185
* // },
166186
* // operation: { // Operation
167187
* // id: "STRING_VALUE",

‎clients/client-lightsail/src/commands/GetDistributionsCommand.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export interface GetDistributionsCommandOutput extends GetDistributionsResult, _
6666
* // protocolPolicy: "http-only" || "https-only",
6767
* // responseTimeout: Number("int"),
6868
* // ipAddressType: "ipv4" || "ipv6" || "dualstack",
69+
* // isPrivateOriginAccessEnabled: true || false,
6970
* // },
7071
* // originPublicDNS: "STRING_VALUE",
7172
* // defaultCacheBehavior: { // CacheBehavior
@@ -111,6 +112,15 @@ export interface GetDistributionsCommandOutput extends GetDistributionsResult, _
111112
* // },
112113
* // ],
113114
* // viewerMinimumTlsProtocolVersion: "STRING_VALUE",
115+
* // defaultRootObject: "STRING_VALUE",
116+
* // customErrorResponses: [ // DistributionCustomErrorResponseList
117+
* // { // DistributionCustomErrorResponse
118+
* // errorCode: Number("int"),
119+
* // responseCode: "STRING_VALUE",
120+
* // responsePagePath: "STRING_VALUE",
121+
* // errorCachingMinTTL: Number("long"),
122+
* // },
123+
* // ],
114124
* // },
115125
* // ],
116126
* // nextPageToken: "STRING_VALUE",

‎clients/client-lightsail/src/commands/GetLoadBalancerCommand.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
33

44
import { _ep0, _mw0, command } from "../commandBuilder";
5-
import type { GetLoadBalancerRequest } from "../models/models_0";
6-
import type { GetLoadBalancerResult } from "../models/models_1";
5+
import type { GetLoadBalancerRequest, GetLoadBalancerResult } from "../models/models_1";
76
import { GetLoadBalancer$ } from "../schemas/schemas_0";
87

98
/**

‎clients/client-lightsail/src/commands/UpdateDistributionCommand.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ export interface UpdateDistributionCommandOutput extends UpdateDistributionResul
8080
* viewerMinimumTlsProtocolVersion: "TLSv1.1_2016" || "TLSv1.2_2018" || "TLSv1.2_2019" || "TLSv1.2_2021",
8181
* certificateName: "STRING_VALUE",
8282
* useDefaultCertificate: true || false,
83+
* enablePrivateOriginAccess: true || false,
84+
* defaultRootObject: "STRING_VALUE",
85+
* customErrorResponses: [ // DistributionCustomErrorResponseList
86+
* { // DistributionCustomErrorResponse
87+
* errorCode: Number("int"),
88+
* responseCode: "STRING_VALUE",
89+
* responsePagePath: "STRING_VALUE",
90+
* errorCachingMinTTL: Number("long"),
91+
* },
92+
* ],
8393
* };
8494
* const command = new UpdateDistributionCommand(input);
8595
* const response = await client.send(command);

‎clients/client-lightsail/src/models/models_0.ts‎

Lines changed: 95 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,6 +4405,44 @@ export interface CreateDiskSnapshotResult {
44054405
operations?: Operation[] | undefined;
44064406
}
44074407

4408+
/**
4409+
* <p>Describes a custom error response for a Lightsail distribution. A custom error response
4410+
* specifies the page that the distribution returns to the viewer. It also specifies the HTTP
4411+
* status code that the distribution sends when the origin responds with a given HTTP error code.</p>
4412+
* @public
4413+
*/
4414+
export interface DistributionCustomErrorResponse {
4415+
/**
4416+
* <p>The HTTP error code from the origin that triggers the custom error response (for example,
4417+
* <code>403</code> or <code>404</code>).</p>
4418+
* @public
4419+
*/
4420+
errorCode?: number | undefined;
4421+
4422+
/**
4423+
* <p>The HTTP status code that the distribution returns to the viewer for the custom error
4424+
* response.</p>
4425+
* @public
4426+
*/
4427+
responseCode?: string | undefined;
4428+
4429+
/**
4430+
* <p>The path to the custom error page that the distribution returns to the viewer (for
4431+
* example, <code>/404.html</code>). The path must begin with a forward slash (<code>/</code>)
4432+
* and reference an object that is available from the origin.</p>
4433+
* @public
4434+
*/
4435+
responsePagePath?: string | undefined;
4436+
4437+
/**
4438+
* <p>The minimum time, in seconds, that the distribution caches the custom error response
4439+
* before requesting the object again from the origin. If you don't specify a value, the default
4440+
* is <code>10</code> seconds.</p>
4441+
* @public
4442+
*/
4443+
errorCachingMinTTL?: number | undefined;
4444+
}
4445+
44084446
/**
44094447
* <p>Describes the origin resource of an Amazon Lightsail content delivery network (CDN)
44104448
* distribution.</p>
@@ -4525,6 +4563,37 @@ export interface CreateDistributionRequest {
45254563
* @public
45264564
*/
45274565
viewerMinimumTlsProtocolVersion?: ViewerMinimumTlsProtocolVersionEnum | undefined;
4566+
4567+
/**
4568+
* <p>Specifies whether to enable private origin access for the distribution. With private
4569+
* origin access, the distribution can serve objects that aren't publicly accessible from a
4570+
* Lightsail bucket.</p>
4571+
* <p>Lightsail grants the distribution permission to read the bucket's objects. Enabling
4572+
* private origin access doesn't change the bucket's access settings, and you can still
4573+
* retrieve publicly accessible objects directly from the bucket's endpoint.</p>
4574+
* <note>
4575+
* <p>You can enable private origin access only when the distribution's origin is a
4576+
* Lightsail bucket. If the origin is another resource type, the request fails.</p>
4577+
* </note>
4578+
* @public
4579+
*/
4580+
enablePrivateOriginAccess?: boolean | undefined;
4581+
4582+
/**
4583+
* <p>The object (for example, <code>index.html</code>) that the distribution returns when a
4584+
* viewer requests the root URL of the distribution (<code>/</code>) instead of a specific
4585+
* object. The object that you specify must be available from the origin.</p>
4586+
* @public
4587+
*/
4588+
defaultRootObject?: string | undefined;
4589+
4590+
/**
4591+
* <p>An array of objects that describe the custom error responses for the distribution. With a
4592+
* custom error response, you can specify the page to return when the origin responds with a
4593+
* given HTTP error code. You can also specify the HTTP status code to send to the viewer.</p>
4594+
* @public
4595+
*/
4596+
customErrorResponses?: DistributionCustomErrorResponse[] | undefined;
45284597
}
45294598

45304599
/**
@@ -4576,6 +4645,17 @@ export interface Origin {
45764645
* @public
45774646
*/
45784647
ipAddressType?: OriginIpAddressTypeEnum | undefined;
4648+
4649+
/**
4650+
* <p>Specifies whether private origin access is enabled for the distribution's origin. With
4651+
* private origin access, the distribution can serve objects that aren't publicly accessible
4652+
* from a Lightsail bucket.</p>
4653+
* <p>This applies when you set the bucket's <code>getObject</code> access rule to
4654+
* <code>private</code>. It also applies when you set <code>getObject</code> to <code>public</code>
4655+
* but set individual objects to private.</p>
4656+
* @public
4657+
*/
4658+
isPrivateOriginAccessEnabled?: boolean | undefined;
45794659
}
45804660

45814661
/**
@@ -4725,6 +4805,21 @@ export interface LightsailDistribution {
47254805
* @public
47264806
*/
47274807
viewerMinimumTlsProtocolVersion?: string | undefined;
4808+
4809+
/**
4810+
* <p>The object (for example, <code>index.html</code>) that the distribution returns when a
4811+
* viewer requests the root URL of the distribution (<code>/</code>) instead of a specific
4812+
* object.</p>
4813+
* @public
4814+
*/
4815+
defaultRootObject?: string | undefined;
4816+
4817+
/**
4818+
* <p>An array of objects that describe the custom error responses configured for the
4819+
* distribution.</p>
4820+
* @public
4821+
*/
4822+
customErrorResponses?: DistributionCustomErrorResponse[] | undefined;
47284823
}
47294824

47304825
/**
@@ -10343,14 +10438,3 @@ export interface GetKeyPairsResult {
1034310438
*/
1034410439
nextPageToken?: string | undefined;
1034510440
}
10346-
10347-
/**
10348-
* @public
10349-
*/
10350-
export interface GetLoadBalancerRequest {
10351-
/**
10352-
* <p>The name of the load balancer.</p>
10353-
* @public
10354-
*/
10355-
loadBalancerName: string | undefined;
10356-
}

‎clients/client-lightsail/src/models/models_1.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import type {
4949
CacheSettings,
5050
ContainerImage,
5151
ContainerService,
52+
DistributionCustomErrorResponse,
5253
DomainEntry,
5354
InputOrigin,
5455
MetricDatapoint,
@@ -59,6 +60,17 @@ import type {
5960
Tag,
6061
} from "./models_0";
6162

63+
/**
64+
* @public
65+
*/
66+
export interface GetLoadBalancerRequest {
67+
/**
68+
* <p>The name of the load balancer.</p>
69+
* @public
70+
*/
71+
loadBalancerName: string | undefined;
72+
}
73+
6274
/**
6375
* <p>Describes information about the health of the instance.</p>
6476
* @public
@@ -4260,6 +4272,39 @@ export interface UpdateDistributionRequest {
42604272
* @public
42614273
*/
42624274
useDefaultCertificate?: boolean | undefined;
4275+
4276+
/**
4277+
* <p>Specifies whether to enable private origin access for the distribution. With private
4278+
* origin access, the distribution can serve objects that aren't publicly accessible from a
4279+
* Lightsail bucket.</p>
4280+
* <p>Lightsail grants the distribution permission to read the bucket's objects. Enabling
4281+
* private origin access doesn't change the bucket's access settings, and you can still
4282+
* retrieve publicly accessible objects directly from the bucket's endpoint.</p>
4283+
* <note>
4284+
* <p>When you include this parameter, you must also include the <code>origin</code> parameter
4285+
* with the resource name, even if the origin is not changing.</p>
4286+
* <p>You can enable private origin access only when the distribution's origin is a
4287+
* Lightsail bucket. If the origin is another resource type, the request fails.</p>
4288+
* </note>
4289+
* @public
4290+
*/
4291+
enablePrivateOriginAccess?: boolean | undefined;
4292+
4293+
/**
4294+
* <p>The object (for example, <code>index.html</code>) that the distribution returns when a
4295+
* viewer requests the root URL of the distribution (<code>/</code>) instead of a specific
4296+
* object. The object that you specify must be available from the origin.</p>
4297+
* @public
4298+
*/
4299+
defaultRootObject?: string | undefined;
4300+
4301+
/**
4302+
* <p>An array of objects that describe the custom error responses for the distribution. With a
4303+
* custom error response, you can specify the page to return when the origin responds with a
4304+
* given HTTP error code. You can also specify the HTTP status code to send to the viewer.</p>
4305+
* @public
4306+
*/
4307+
customErrorResponses?: DistributionCustomErrorResponse[] | undefined;
42634308
}
42644309

42654310
/**

0 commit comments

Comments
 (0)