Skip to content

Commit 719ff90

Browse files
author
awstools
committed
feat(client-lightsail): Add support for manage Lightsail Bucket CORS configuration
1 parent 4d78ec9 commit 719ff90

File tree

10 files changed

+469
-124
lines changed

10 files changed

+469
-124
lines changed

clients/client-lightsail/src/commands/CreateBucketCommand.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ export interface CreateBucketCommandOutput extends CreateBucketResult, __Metadat
9797
* // destination: "STRING_VALUE",
9898
* // prefix: "STRING_VALUE",
9999
* // },
100+
* // cors: { // BucketCorsConfig
101+
* // rules: [ // BucketCorsRules
102+
* // { // BucketCorsRule
103+
* // id: "STRING_VALUE",
104+
* // allowedMethods: [ // BucketCorsAllowedMethods // required
105+
* // "STRING_VALUE",
106+
* // ],
107+
* // allowedOrigins: [ // BucketCorsAllowedOrigins // required
108+
* // "STRING_VALUE",
109+
* // ],
110+
* // allowedHeaders: [ // BucketCorsAllowedHeaders
111+
* // "STRING_VALUE",
112+
* // ],
113+
* // exposeHeaders: [ // BucketCorsExposeHeaders
114+
* // "STRING_VALUE",
115+
* // ],
116+
* // maxAgeSeconds: Number("int"),
117+
* // },
118+
* // ],
119+
* // },
100120
* // },
101121
* // operations: [ // OperationList
102122
* // { // Operation

clients/client-lightsail/src/commands/CreateLoadBalancerCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface CreateLoadBalancerCommandOutput extends CreateLoadBalancerResul
2929

3030
/**
3131
* <p>Creates a Lightsail load balancer. To learn more about deciding whether to load balance
32-
* your application, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-lightsail-instances-for-load-balancing">Configure your Lightsail instances for load balancing</a>. You can create up to 5
32+
* your application, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-lightsail-instances-for-load-balancing">Configure your Lightsail instances for load balancing</a>. You can create up to 10
3333
* load balancers per AWS Region in your account.</p>
3434
* <p>When you create a load balancer, you can specify a unique name and port settings. To
3535
* change additional load balancer settings, use the <code>UpdateLoadBalancerAttribute</code>

clients/client-lightsail/src/commands/GetBucketsCommand.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export interface GetBucketsCommandOutput extends GetBucketsResult, __MetadataBea
4545
* bucketName: "STRING_VALUE",
4646
* pageToken: "STRING_VALUE",
4747
* includeConnectedResources: true || false,
48+
* includeCors: true || false,
4849
* };
4950
* const command = new GetBucketsCommand(input);
5051
* const response = await client.send(command);
@@ -92,6 +93,26 @@ export interface GetBucketsCommandOutput extends GetBucketsResult, __MetadataBea
9293
* // destination: "STRING_VALUE",
9394
* // prefix: "STRING_VALUE",
9495
* // },
96+
* // cors: { // BucketCorsConfig
97+
* // rules: [ // BucketCorsRules
98+
* // { // BucketCorsRule
99+
* // id: "STRING_VALUE",
100+
* // allowedMethods: [ // BucketCorsAllowedMethods // required
101+
* // "STRING_VALUE",
102+
* // ],
103+
* // allowedOrigins: [ // BucketCorsAllowedOrigins // required
104+
* // "STRING_VALUE",
105+
* // ],
106+
* // allowedHeaders: [ // BucketCorsAllowedHeaders
107+
* // "STRING_VALUE",
108+
* // ],
109+
* // exposeHeaders: [ // BucketCorsExposeHeaders
110+
* // "STRING_VALUE",
111+
* // ],
112+
* // maxAgeSeconds: Number("int"),
113+
* // },
114+
* // ],
115+
* // },
95116
* // },
96117
* // ],
97118
* // nextPageToken: "STRING_VALUE",

clients/client-lightsail/src/commands/GetContainerServiceMetricDataCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";
66

77
import { commonParams } from "../endpoint/EndpointParameters";
88
import { LightsailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LightsailClient";
9-
import { GetContainerServiceMetricDataRequest, GetContainerServiceMetricDataResult } from "../models/models_0";
9+
import { GetContainerServiceMetricDataRequest, GetContainerServiceMetricDataResult } from "../models/models_1";
1010
import {
1111
de_GetContainerServiceMetricDataCommand,
1212
se_GetContainerServiceMetricDataCommand,

clients/client-lightsail/src/commands/UpdateBucketCommand.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,26 @@ export interface UpdateBucketCommandOutput extends UpdateBucketResult, __Metadat
5454
* destination: "STRING_VALUE",
5555
* prefix: "STRING_VALUE",
5656
* },
57+
* cors: { // BucketCorsConfig
58+
* rules: [ // BucketCorsRules
59+
* { // BucketCorsRule
60+
* id: "STRING_VALUE",
61+
* allowedMethods: [ // BucketCorsAllowedMethods // required
62+
* "STRING_VALUE",
63+
* ],
64+
* allowedOrigins: [ // BucketCorsAllowedOrigins // required
65+
* "STRING_VALUE",
66+
* ],
67+
* allowedHeaders: [ // BucketCorsAllowedHeaders
68+
* "STRING_VALUE",
69+
* ],
70+
* exposeHeaders: [ // BucketCorsExposeHeaders
71+
* "STRING_VALUE",
72+
* ],
73+
* maxAgeSeconds: Number("int"),
74+
* },
75+
* ],
76+
* },
5777
* };
5878
* const command = new UpdateBucketCommand(input);
5979
* const response = await client.send(command);
@@ -100,6 +120,26 @@ export interface UpdateBucketCommandOutput extends UpdateBucketResult, __Metadat
100120
* // destination: "STRING_VALUE",
101121
* // prefix: "STRING_VALUE",
102122
* // },
123+
* // cors: { // BucketCorsConfig
124+
* // rules: [ // BucketCorsRules
125+
* // { // BucketCorsRule
126+
* // id: "STRING_VALUE",
127+
* // allowedMethods: [ // BucketCorsAllowedMethods // required
128+
* // "STRING_VALUE",
129+
* // ],
130+
* // allowedOrigins: [ // BucketCorsAllowedOrigins // required
131+
* // "STRING_VALUE",
132+
* // ],
133+
* // allowedHeaders: [ // BucketCorsAllowedHeaders
134+
* // "STRING_VALUE",
135+
* // ],
136+
* // exposeHeaders: [ // BucketCorsExposeHeaders
137+
* // "STRING_VALUE",
138+
* // ],
139+
* // maxAgeSeconds: Number("int"),
140+
* // },
141+
* // ],
142+
* // },
103143
* // },
104144
* // operations: [ // OperationList
105145
* // { // Operation

clients/client-lightsail/src/endpoint/ruleset.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ d="error",
1717
e="endpoint",
1818
f="tree",
1919
g="PartitionResult",
20-
h={[s]:false,"type":"String"},
21-
i={[s]:true,"default":false,"type":"Boolean"},
20+
h={[s]:false,"type":"string"},
21+
i={[s]:true,"default":false,"type":"boolean"},
2222
j={[v]:"Endpoint"},
2323
k={[t]:c,[u]:[{[v]:"UseFIPS"},true]},
2424
l={[t]:c,[u]:[{[v]:"UseDualStack"},true]},

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

Lines changed: 93 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,84 @@ export interface BucketAccessLogConfig {
19241924
prefix?: string | undefined;
19251925
}
19261926

1927+
/**
1928+
* <p>Describes a cross-origin resource sharing (CORS) rule for a Lightsail bucket. CORS rules specify which origins are allowed to access the bucket, which HTTP methods are allowed, and other access control information. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p>
1929+
* @public
1930+
*/
1931+
export interface BucketCorsRule {
1932+
/**
1933+
* <p>A unique identifier for the CORS rule. The ID value can be up to 255 characters long. The IDs help you find a rule in the configuration.</p>
1934+
* @public
1935+
*/
1936+
id?: string | undefined;
1937+
1938+
/**
1939+
* <p>The HTTP methods that are allowed when accessing the bucket from the specified origin. Each CORS rule must identify at least one origin and one method.</p>
1940+
* <p>You can use the following HTTP methods:</p>
1941+
* <ul>
1942+
* <li>
1943+
* <p>
1944+
* <code>GET</code> - Retrieves data from the server, such as downloading files or viewing content.</p>
1945+
* </li>
1946+
* <li>
1947+
* <p>
1948+
* <code>PUT</code> - Uploads or replaces data on the server, such as uploading new files.</p>
1949+
* </li>
1950+
* <li>
1951+
* <p>
1952+
* <code>POST</code> - Sends data to the server for processing, such as submitting forms or creating new resources.</p>
1953+
* </li>
1954+
* <li>
1955+
* <p>
1956+
* <code>DELETE</code> - Removes data from the server, such as deleting files or resources.</p>
1957+
* </li>
1958+
* <li>
1959+
* <p>
1960+
* <code>HEAD</code> - Retrieves only the headers from the server without the actual content, useful for checking if a resource exists.</p>
1961+
* </li>
1962+
* </ul>
1963+
* @public
1964+
*/
1965+
allowedMethods: string[] | undefined;
1966+
1967+
/**
1968+
* <p>One or more origins you want customers to be able to access the bucket from. Each CORS rule must identify at least one origin and one method.</p>
1969+
* @public
1970+
*/
1971+
allowedOrigins: string[] | undefined;
1972+
1973+
/**
1974+
* <p>Headers that are specified in the <code>Access-Control-Request-Headers</code> header. These headers are allowed in a preflight <code>OPTIONS</code> request. In response to any preflight <code>OPTIONS</code> request, Amazon S3 returns any requested headers that are allowed.</p>
1975+
* @public
1976+
*/
1977+
allowedHeaders?: string[] | undefined;
1978+
1979+
/**
1980+
* <p>One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript <code>XMLHttpRequest</code> object).</p>
1981+
* @public
1982+
*/
1983+
exposeHeaders?: string[] | undefined;
1984+
1985+
/**
1986+
* <p>The time in seconds that your browser is to cache the preflight response for the specified resource. A CORS rule can have only one <code>maxAgeSeconds</code> element.</p>
1987+
* @public
1988+
*/
1989+
maxAgeSeconds?: number | undefined;
1990+
}
1991+
1992+
/**
1993+
* <p>Describes the cross-origin resource sharing (CORS) configuration for a Lightsail bucket. CORS defines a way for client web applications that are loaded in one domain to interact with resources in a different domain.
1994+
* For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p>
1995+
* @public
1996+
*/
1997+
export interface BucketCorsConfig {
1998+
/**
1999+
* <p>A set of origins and methods (cross-origin access that you want to allow). You can add up to 20 rules to the configuration. The total size is limited to 64 KB.</p>
2000+
* @public
2001+
*/
2002+
rules?: BucketCorsRule[] | undefined;
2003+
}
2004+
19272005
/**
19282006
* <p>Describes the state of an Amazon Lightsail bucket.</p>
19292007
* @public
@@ -2110,6 +2188,12 @@ export interface Bucket {
21102188
* @public
21112189
*/
21122190
accessLogConfig?: BucketAccessLogConfig | undefined;
2191+
2192+
/**
2193+
* <p>An array of cross-origin resource sharing (CORS) rules that identify origins and the HTTP methods that can be executed on your bucket. This field is only included in the response when CORS configuration is requested or when updating CORS configuration. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p>
2194+
* @public
2195+
*/
2196+
cors?: BucketCorsConfig | undefined;
21132197
}
21142198

21152199
/**
@@ -8906,6 +8990,15 @@ export interface GetBucketsRequest {
89068990
* @public
89078991
*/
89088992
includeConnectedResources?: boolean | undefined;
8993+
8994+
/**
8995+
* <p>A Boolean value that indicates whether to include Lightsail bucket CORS configuration in the response. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/configure-cors.html">Configuring cross-origin resource sharing (CORS)</a>.</p>
8996+
* <note>
8997+
* <p>This parameter is only supported when getting a single bucket with <code>bucketName</code> specified. The default value for this parameter is <code>False</code>.</p>
8998+
* </note>
8999+
* @public
9000+
*/
9001+
includeCors?: boolean | undefined;
89099002
}
89109003

89119004
/**
@@ -9281,119 +9374,6 @@ export interface GetContainerServiceDeploymentsResult {
92819374
deployments?: ContainerServiceDeployment[] | undefined;
92829375
}
92839376

9284-
/**
9285-
* @public
9286-
*/
9287-
export interface GetContainerServiceMetricDataRequest {
9288-
/**
9289-
* <p>The name of the container service for which to get metric data.</p>
9290-
* @public
9291-
*/
9292-
serviceName: string | undefined;
9293-
9294-
/**
9295-
* <p>The metric for which you want to return information.</p>
9296-
* <p>Valid container service metric names are listed below, along with the most useful
9297-
* statistics to include in your request, and the published unit value.</p>
9298-
* <ul>
9299-
* <li>
9300-
* <p>
9301-
* <code>CPUUtilization</code> - The average percentage of compute units that are
9302-
* currently in use across all nodes of the container service. This metric identifies the
9303-
* processing power required to run containers on each node of the container service.</p>
9304-
* <p>Statistics: The most useful statistics are <code>Maximum</code> and
9305-
* <code>Average</code>.</p>
9306-
* <p>Unit: The published unit is <code>Percent</code>.</p>
9307-
* </li>
9308-
* <li>
9309-
* <p>
9310-
* <code>MemoryUtilization</code> - The average percentage of available memory that is
9311-
* currently in use across all nodes of the container service. This metric identifies the
9312-
* memory required to run containers on each node of the container service.</p>
9313-
* <p>Statistics: The most useful statistics are <code>Maximum</code> and
9314-
* <code>Average</code>.</p>
9315-
* <p>Unit: The published unit is <code>Percent</code>.</p>
9316-
* </li>
9317-
* </ul>
9318-
* @public
9319-
*/
9320-
metricName: ContainerServiceMetricName | undefined;
9321-
9322-
/**
9323-
* <p>The start time of the time period.</p>
9324-
* @public
9325-
*/
9326-
startTime: Date | undefined;
9327-
9328-
/**
9329-
* <p>The end time of the time period.</p>
9330-
* @public
9331-
*/
9332-
endTime: Date | undefined;
9333-
9334-
/**
9335-
* <p>The granularity, in seconds, of the returned data points.</p>
9336-
* <p>All container service metric data is available in 5-minute (300 seconds)
9337-
* granularity.</p>
9338-
* @public
9339-
*/
9340-
period: number | undefined;
9341-
9342-
/**
9343-
* <p>The statistic for the metric.</p>
9344-
* <p>The following statistics are available:</p>
9345-
* <ul>
9346-
* <li>
9347-
* <p>
9348-
* <code>Minimum</code> - The lowest value observed during the specified period. Use this
9349-
* value to determine low volumes of activity for your application.</p>
9350-
* </li>
9351-
* <li>
9352-
* <p>
9353-
* <code>Maximum</code> - The highest value observed during the specified period. Use
9354-
* this value to determine high volumes of activity for your application.</p>
9355-
* </li>
9356-
* <li>
9357-
* <p>
9358-
* <code>Sum</code> - All values submitted for the matching metric added together. You
9359-
* can use this statistic to determine the total volume of a metric.</p>
9360-
* </li>
9361-
* <li>
9362-
* <p>
9363-
* <code>Average</code> - The value of <code>Sum</code> / <code>SampleCount</code> during
9364-
* the specified period. By comparing this statistic with the <code>Minimum</code> and
9365-
* <code>Maximum</code> values, you can determine the full scope of a metric and how close
9366-
* the average use is to the <code>Minimum</code> and <code>Maximum</code> values. This
9367-
* comparison helps you to know when to increase or decrease your resources.</p>
9368-
* </li>
9369-
* <li>
9370-
* <p>
9371-
* <code>SampleCount</code> - The count, or number, of data points used for the
9372-
* statistical calculation.</p>
9373-
* </li>
9374-
* </ul>
9375-
* @public
9376-
*/
9377-
statistics: MetricStatistic[] | undefined;
9378-
}
9379-
9380-
/**
9381-
* @public
9382-
*/
9383-
export interface GetContainerServiceMetricDataResult {
9384-
/**
9385-
* <p>The name of the metric returned. </p>
9386-
* @public
9387-
*/
9388-
metricName?: ContainerServiceMetricName | undefined;
9389-
9390-
/**
9391-
* <p>An array of objects that describe the metric data returned.</p>
9392-
* @public
9393-
*/
9394-
metricData?: MetricDatapoint[] | undefined;
9395-
}
9396-
93979377
/**
93989378
* @internal
93999379
*/

0 commit comments

Comments
 (0)