Skip to content

Commit d7d6077

Browse files
author
awstools
committed
feat(client-global-accelerator): Global Accelerator now supports AddEndpoints and RemoveEndpoints operations for standard endpoint groups.
1 parent 81b5510 commit d7d6077

File tree

61 files changed

+2562
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2562
-474
lines changed

clients/client-global-accelerator/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@aws-sdk/hash-node": "*",
2727
"@aws-sdk/invalid-dependency": "*",
2828
"@aws-sdk/middleware-content-length": "*",
29+
"@aws-sdk/middleware-endpoint": "*",
2930
"@aws-sdk/middleware-host-header": "*",
3031
"@aws-sdk/middleware-logger": "*",
3132
"@aws-sdk/middleware-recursion-detection": "*",
@@ -46,6 +47,7 @@
4647
"@aws-sdk/util-body-length-node": "*",
4748
"@aws-sdk/util-defaults-mode-browser": "*",
4849
"@aws-sdk/util-defaults-mode-node": "*",
50+
"@aws-sdk/util-endpoints": "*",
4951
"@aws-sdk/util-user-agent-browser": "*",
5052
"@aws-sdk/util-user-agent-node": "*",
5153
"@aws-sdk/util-utf8-browser": "*",

clients/client-global-accelerator/src/GlobalAccelerator.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import {
66
AddCustomRoutingEndpointsCommandInput,
77
AddCustomRoutingEndpointsCommandOutput,
88
} from "./commands/AddCustomRoutingEndpointsCommand";
9+
import {
10+
AddEndpointsCommand,
11+
AddEndpointsCommandInput,
12+
AddEndpointsCommandOutput,
13+
} from "./commands/AddEndpointsCommand";
914
import {
1015
AdvertiseByoipCidrCommand,
1116
AdvertiseByoipCidrCommandInput,
@@ -186,6 +191,11 @@ import {
186191
RemoveCustomRoutingEndpointsCommandInput,
187192
RemoveCustomRoutingEndpointsCommandOutput,
188193
} from "./commands/RemoveCustomRoutingEndpointsCommand";
194+
import {
195+
RemoveEndpointsCommand,
196+
RemoveEndpointsCommandInput,
197+
RemoveEndpointsCommandOutput,
198+
} from "./commands/RemoveEndpointsCommand";
189199
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
190200
import {
191201
UntagResourceCommand,
@@ -332,6 +342,50 @@ export class GlobalAccelerator extends GlobalAcceleratorClient {
332342
}
333343
}
334344

345+
/**
346+
* <p>Add endpoints to an endpoint group. The <code>AddEndpoints</code> API operation is the recommended option for adding endpoints. The
347+
* alternative options are to add endpoints when you create an endpoint group (with the
348+
* <a href="https://docs.aws.amazon.com/global-accelerator/latest/api/API_CreateEndpointGroup.html">CreateEndpointGroup</a> API)
349+
* or when you update an endpoint group (with the
350+
* <a href="https://docs.aws.amazon.com/global-accelerator/latest/api/API_UpdateEndpointGroup.html">UpdateEndpointGroup</a> API). </p>
351+
* <p>There are two advantages to using <code>AddEndpoints</code> to add endpoints:</p>
352+
* <ul>
353+
* <li>
354+
* <p>It's faster, because Global Accelerator only has to resolve the new endpoints that
355+
* you're adding.</p>
356+
* </li>
357+
* <li>
358+
* <p>It's more convenient, because you don't need to specify all of the current
359+
* endpoints that are already in the endpoint group in addition to the new endpoints that you want to add.</p>
360+
* </li>
361+
* </ul>
362+
*/
363+
public addEndpoints(
364+
args: AddEndpointsCommandInput,
365+
options?: __HttpHandlerOptions
366+
): Promise<AddEndpointsCommandOutput>;
367+
public addEndpoints(args: AddEndpointsCommandInput, cb: (err: any, data?: AddEndpointsCommandOutput) => void): void;
368+
public addEndpoints(
369+
args: AddEndpointsCommandInput,
370+
options: __HttpHandlerOptions,
371+
cb: (err: any, data?: AddEndpointsCommandOutput) => void
372+
): void;
373+
public addEndpoints(
374+
args: AddEndpointsCommandInput,
375+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AddEndpointsCommandOutput) => void),
376+
cb?: (err: any, data?: AddEndpointsCommandOutput) => void
377+
): Promise<AddEndpointsCommandOutput> | void {
378+
const command = new AddEndpointsCommand(args);
379+
if (typeof optionsOrCb === "function") {
380+
this.send(command, optionsOrCb);
381+
} else if (typeof cb === "function") {
382+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
383+
this.send(command, optionsOrCb || {}, cb);
384+
} else {
385+
return this.send(command, optionsOrCb);
386+
}
387+
}
388+
335389
/**
336390
* <p>Advertises an IPv4 address range that is provisioned for use with your Amazon Web Services resources
337391
* through bring your own IP addresses (BYOIP). It can take a few minutes before traffic to
@@ -1577,6 +1631,54 @@ export class GlobalAccelerator extends GlobalAcceleratorClient {
15771631
}
15781632
}
15791633

1634+
/**
1635+
* <p>Remove endpoints from an endpoint group. </p>
1636+
* <p>The <code>RemoveEndpoints</code> API operation is the recommended option for removing endpoints. The alternative is to remove
1637+
* endpoints by updating an endpoint group by using the
1638+
* <a href="https://docs.aws.amazon.com/global-accelerator/latest/api/API_UpdateEndpointGroup.html">UpdateEndpointGroup</a>
1639+
* API operation. There are two advantages to using <code>AddEndpoints</code> to remove endpoints instead:</p>
1640+
* <ul>
1641+
* <li>
1642+
* <p>It's more convenient, because you only need to specify the endpoints that you want to remove. With the
1643+
* <code>UpdateEndpointGroup</code> API operation, you must specify all of the endpoints in the
1644+
* endpoint group except the ones that you want to remove from the group.</p>
1645+
* </li>
1646+
* <li>
1647+
* <p>It's faster, because Global Accelerator doesn't need to resolve any endpoints. With the
1648+
* <code>UpdateEndpointGroup</code> API operation, Global Accelerator must resolve all of the endpoints that
1649+
* remain in the group.</p>
1650+
* </li>
1651+
* </ul>
1652+
*/
1653+
public removeEndpoints(
1654+
args: RemoveEndpointsCommandInput,
1655+
options?: __HttpHandlerOptions
1656+
): Promise<RemoveEndpointsCommandOutput>;
1657+
public removeEndpoints(
1658+
args: RemoveEndpointsCommandInput,
1659+
cb: (err: any, data?: RemoveEndpointsCommandOutput) => void
1660+
): void;
1661+
public removeEndpoints(
1662+
args: RemoveEndpointsCommandInput,
1663+
options: __HttpHandlerOptions,
1664+
cb: (err: any, data?: RemoveEndpointsCommandOutput) => void
1665+
): void;
1666+
public removeEndpoints(
1667+
args: RemoveEndpointsCommandInput,
1668+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RemoveEndpointsCommandOutput) => void),
1669+
cb?: (err: any, data?: RemoveEndpointsCommandOutput) => void
1670+
): Promise<RemoveEndpointsCommandOutput> | void {
1671+
const command = new RemoveEndpointsCommand(args);
1672+
if (typeof optionsOrCb === "function") {
1673+
this.send(command, optionsOrCb);
1674+
} else if (typeof cb === "function") {
1675+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
1676+
this.send(command, optionsOrCb || {}, cb);
1677+
} else {
1678+
return this.send(command, optionsOrCb);
1679+
}
1680+
}
1681+
15801682
/**
15811683
* <p>Add tags to an accelerator resource. </p>
15821684
* <p>For more information, see <a href="https://docs.aws.amazon.com/global-accelerator/latest/dg/tagging-in-global-accelerator.html">Tagging

clients/client-global-accelerator/src/GlobalAcceleratorClient.ts

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
// smithy-typescript generated code
2-
import {
3-
EndpointsInputConfig,
4-
EndpointsResolvedConfig,
5-
RegionInputConfig,
6-
RegionResolvedConfig,
7-
resolveEndpointsConfig,
8-
resolveRegionConfig,
9-
} from "@aws-sdk/config-resolver";
2+
import { RegionInputConfig, RegionResolvedConfig, resolveRegionConfig } from "@aws-sdk/config-resolver";
103
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
4+
import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@aws-sdk/middleware-endpoint";
115
import {
126
getHostHeaderPlugin,
137
HostHeaderInputConfig,
@@ -41,13 +35,13 @@ import {
4135
Credentials as __Credentials,
4236
Decoder as __Decoder,
4337
Encoder as __Encoder,
38+
EndpointV2 as __EndpointV2,
4439
Hash as __Hash,
4540
HashConstructor as __HashConstructor,
4641
HttpHandlerOptions as __HttpHandlerOptions,
4742
Logger as __Logger,
4843
Provider as __Provider,
4944
Provider,
50-
RegionInfoProvider,
5145
StreamCollector as __StreamCollector,
5246
UrlParser as __UrlParser,
5347
UserAgent as __UserAgent,
@@ -57,6 +51,7 @@ import {
5751
AddCustomRoutingEndpointsCommandInput,
5852
AddCustomRoutingEndpointsCommandOutput,
5953
} from "./commands/AddCustomRoutingEndpointsCommand";
54+
import { AddEndpointsCommandInput, AddEndpointsCommandOutput } from "./commands/AddEndpointsCommand";
6055
import { AdvertiseByoipCidrCommandInput, AdvertiseByoipCidrCommandOutput } from "./commands/AdvertiseByoipCidrCommand";
6156
import {
6257
AllowCustomRoutingTrafficCommandInput,
@@ -168,6 +163,7 @@ import {
168163
RemoveCustomRoutingEndpointsCommandInput,
169164
RemoveCustomRoutingEndpointsCommandOutput,
170165
} from "./commands/RemoveCustomRoutingEndpointsCommand";
166+
import { RemoveEndpointsCommandInput, RemoveEndpointsCommandOutput } from "./commands/RemoveEndpointsCommand";
171167
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
172168
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
173169
import {
@@ -193,10 +189,17 @@ import {
193189
} from "./commands/UpdateEndpointGroupCommand";
194190
import { UpdateListenerCommandInput, UpdateListenerCommandOutput } from "./commands/UpdateListenerCommand";
195191
import { WithdrawByoipCidrCommandInput, WithdrawByoipCidrCommandOutput } from "./commands/WithdrawByoipCidrCommand";
192+
import {
193+
ClientInputEndpointParameters,
194+
ClientResolvedEndpointParameters,
195+
EndpointParameters,
196+
resolveClientEndpointParameters,
197+
} from "./endpoint/EndpointParameters";
196198
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
197199

198200
export type ServiceInputTypes =
199201
| AddCustomRoutingEndpointsCommandInput
202+
| AddEndpointsCommandInput
200203
| AdvertiseByoipCidrCommandInput
201204
| AllowCustomRoutingTrafficCommandInput
202205
| CreateAcceleratorCommandInput
@@ -233,6 +236,7 @@ export type ServiceInputTypes =
233236
| ListTagsForResourceCommandInput
234237
| ProvisionByoipCidrCommandInput
235238
| RemoveCustomRoutingEndpointsCommandInput
239+
| RemoveEndpointsCommandInput
236240
| TagResourceCommandInput
237241
| UntagResourceCommandInput
238242
| UpdateAcceleratorAttributesCommandInput
@@ -246,6 +250,7 @@ export type ServiceInputTypes =
246250

247251
export type ServiceOutputTypes =
248252
| AddCustomRoutingEndpointsCommandOutput
253+
| AddEndpointsCommandOutput
249254
| AdvertiseByoipCidrCommandOutput
250255
| AllowCustomRoutingTrafficCommandOutput
251256
| CreateAcceleratorCommandOutput
@@ -282,6 +287,7 @@ export type ServiceOutputTypes =
282287
| ListTagsForResourceCommandOutput
283288
| ProvisionByoipCidrCommandOutput
284289
| RemoveCustomRoutingEndpointsCommandOutput
290+
| RemoveEndpointsCommandOutput
285291
| TagResourceCommandOutput
286292
| UntagResourceCommandOutput
287293
| UpdateAcceleratorAttributesCommandOutput
@@ -402,12 +408,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
402408
*/
403409
credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;
404410

405-
/**
406-
* Fetch related hostname, signing name or signing region with given region.
407-
* @internal
408-
*/
409-
regionInfoProvider?: RegionInfoProvider;
410-
411411
/**
412412
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
413413
* @internal
@@ -423,11 +423,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
423423
type GlobalAcceleratorClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
424424
ClientDefaults &
425425
RegionInputConfig &
426-
EndpointsInputConfig &
426+
EndpointInputConfig<EndpointParameters> &
427427
RetryInputConfig &
428428
HostHeaderInputConfig &
429429
AwsAuthInputConfig &
430-
UserAgentInputConfig;
430+
UserAgentInputConfig &
431+
ClientInputEndpointParameters;
431432
/**
432433
* The configuration interface of GlobalAcceleratorClient class constructor that set the region, credentials and other options.
433434
*/
@@ -436,11 +437,12 @@ export interface GlobalAcceleratorClientConfig extends GlobalAcceleratorClientCo
436437
type GlobalAcceleratorClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
437438
Required<ClientDefaults> &
438439
RegionResolvedConfig &
439-
EndpointsResolvedConfig &
440+
EndpointResolvedConfig<EndpointParameters> &
440441
RetryResolvedConfig &
441442
HostHeaderResolvedConfig &
442443
AwsAuthResolvedConfig &
443-
UserAgentResolvedConfig;
444+
UserAgentResolvedConfig &
445+
ClientResolvedEndpointParameters;
444446
/**
445447
* The resolved configuration interface of GlobalAcceleratorClient class. This is resolved and normalized from the {@link GlobalAcceleratorClientConfig | constructor configuration interface}.
446448
*/
@@ -514,14 +516,15 @@ export class GlobalAcceleratorClient extends __Client<
514516

515517
constructor(configuration: GlobalAcceleratorClientConfig) {
516518
const _config_0 = __getRuntimeConfig(configuration);
517-
const _config_1 = resolveRegionConfig(_config_0);
518-
const _config_2 = resolveEndpointsConfig(_config_1);
519-
const _config_3 = resolveRetryConfig(_config_2);
520-
const _config_4 = resolveHostHeaderConfig(_config_3);
521-
const _config_5 = resolveAwsAuthConfig(_config_4);
522-
const _config_6 = resolveUserAgentConfig(_config_5);
523-
super(_config_6);
524-
this.config = _config_6;
519+
const _config_1 = resolveClientEndpointParameters(_config_0);
520+
const _config_2 = resolveRegionConfig(_config_1);
521+
const _config_3 = resolveEndpointConfig(_config_2);
522+
const _config_4 = resolveRetryConfig(_config_3);
523+
const _config_5 = resolveHostHeaderConfig(_config_4);
524+
const _config_6 = resolveAwsAuthConfig(_config_5);
525+
const _config_7 = resolveUserAgentConfig(_config_6);
526+
super(_config_7);
527+
this.config = _config_7;
525528
this.middlewareStack.use(getRetryPlugin(this.config));
526529
this.middlewareStack.use(getContentLengthPlugin(this.config));
527530
this.middlewareStack.use(getHostHeaderPlugin(this.config));

clients/client-global-accelerator/src/commands/AddCustomRoutingEndpointsCommand.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
23
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
34
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
45
import { Command as $Command } from "@aws-sdk/smithy-client";
@@ -66,6 +67,15 @@ export class AddCustomRoutingEndpointsCommand extends $Command<
6667
// Start section: command_properties
6768
// End section: command_properties
6869

70+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
71+
return {
72+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
73+
Endpoint: { type: "builtInParams", name: "endpoint" },
74+
Region: { type: "builtInParams", name: "region" },
75+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
76+
};
77+
}
78+
6979
constructor(readonly input: AddCustomRoutingEndpointsCommandInput) {
7080
// Start section: command_constructor
7181
super();
@@ -81,6 +91,9 @@ export class AddCustomRoutingEndpointsCommand extends $Command<
8191
options?: __HttpHandlerOptions
8292
): Handler<AddCustomRoutingEndpointsCommandInput, AddCustomRoutingEndpointsCommandOutput> {
8393
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
94+
this.middlewareStack.use(
95+
getEndpointPlugin(configuration, AddCustomRoutingEndpointsCommand.getEndpointParameterInstructions())
96+
);
8497

8598
const stack = clientStack.concat(this.middlewareStack);
8699

0 commit comments

Comments
 (0)