Skip to content

Commit

Permalink
feat(client-global-accelerator): Global Accelerator now supports AddE…
Browse files Browse the repository at this point in the history
…ndpoints and RemoveEndpoints operations for standard endpoint groups.
  • Loading branch information
awstools committed Oct 20, 2022
1 parent 81b5510 commit d7d6077
Show file tree
Hide file tree
Showing 61 changed files with 2,562 additions and 474 deletions.
2 changes: 2 additions & 0 deletions clients/client-global-accelerator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@aws-sdk/hash-node": "*",
"@aws-sdk/invalid-dependency": "*",
"@aws-sdk/middleware-content-length": "*",
"@aws-sdk/middleware-endpoint": "*",
"@aws-sdk/middleware-host-header": "*",
"@aws-sdk/middleware-logger": "*",
"@aws-sdk/middleware-recursion-detection": "*",
Expand All @@ -46,6 +47,7 @@
"@aws-sdk/util-body-length-node": "*",
"@aws-sdk/util-defaults-mode-browser": "*",
"@aws-sdk/util-defaults-mode-node": "*",
"@aws-sdk/util-endpoints": "*",
"@aws-sdk/util-user-agent-browser": "*",
"@aws-sdk/util-user-agent-node": "*",
"@aws-sdk/util-utf8-browser": "*",
Expand Down
102 changes: 102 additions & 0 deletions clients/client-global-accelerator/src/GlobalAccelerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import {
AddCustomRoutingEndpointsCommandInput,
AddCustomRoutingEndpointsCommandOutput,
} from "./commands/AddCustomRoutingEndpointsCommand";
import {
AddEndpointsCommand,
AddEndpointsCommandInput,
AddEndpointsCommandOutput,
} from "./commands/AddEndpointsCommand";
import {
AdvertiseByoipCidrCommand,
AdvertiseByoipCidrCommandInput,
Expand Down Expand Up @@ -186,6 +191,11 @@ import {
RemoveCustomRoutingEndpointsCommandInput,
RemoveCustomRoutingEndpointsCommandOutput,
} from "./commands/RemoveCustomRoutingEndpointsCommand";
import {
RemoveEndpointsCommand,
RemoveEndpointsCommandInput,
RemoveEndpointsCommandOutput,
} from "./commands/RemoveEndpointsCommand";
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import {
UntagResourceCommand,
Expand Down Expand Up @@ -332,6 +342,50 @@ export class GlobalAccelerator extends GlobalAcceleratorClient {
}
}

/**
* <p>Add endpoints to an endpoint group. The <code>AddEndpoints</code> API operation is the recommended option for adding endpoints. The
* alternative options are to add endpoints when you create an endpoint group (with the
* <a href="https://docs.aws.amazon.com/global-accelerator/latest/api/API_CreateEndpointGroup.html">CreateEndpointGroup</a> API)
* or when you update an endpoint group (with the
* <a href="https://docs.aws.amazon.com/global-accelerator/latest/api/API_UpdateEndpointGroup.html">UpdateEndpointGroup</a> API). </p>
* <p>There are two advantages to using <code>AddEndpoints</code> to add endpoints:</p>
* <ul>
* <li>
* <p>It's faster, because Global Accelerator only has to resolve the new endpoints that
* you're adding.</p>
* </li>
* <li>
* <p>It's more convenient, because you don't need to specify all of the current
* endpoints that are already in the endpoint group in addition to the new endpoints that you want to add.</p>
* </li>
* </ul>
*/
public addEndpoints(
args: AddEndpointsCommandInput,
options?: __HttpHandlerOptions
): Promise<AddEndpointsCommandOutput>;
public addEndpoints(args: AddEndpointsCommandInput, cb: (err: any, data?: AddEndpointsCommandOutput) => void): void;
public addEndpoints(
args: AddEndpointsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: AddEndpointsCommandOutput) => void
): void;
public addEndpoints(
args: AddEndpointsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: AddEndpointsCommandOutput) => void),
cb?: (err: any, data?: AddEndpointsCommandOutput) => void
): Promise<AddEndpointsCommandOutput> | void {
const command = new AddEndpointsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Advertises an IPv4 address range that is provisioned for use with your Amazon Web Services resources
* through bring your own IP addresses (BYOIP). It can take a few minutes before traffic to
Expand Down Expand Up @@ -1577,6 +1631,54 @@ export class GlobalAccelerator extends GlobalAcceleratorClient {
}
}

/**
* <p>Remove endpoints from an endpoint group. </p>
* <p>The <code>RemoveEndpoints</code> API operation is the recommended option for removing endpoints. The alternative is to remove
* endpoints by updating an endpoint group by using the
* <a href="https://docs.aws.amazon.com/global-accelerator/latest/api/API_UpdateEndpointGroup.html">UpdateEndpointGroup</a>
* API operation. There are two advantages to using <code>AddEndpoints</code> to remove endpoints instead:</p>
* <ul>
* <li>
* <p>It's more convenient, because you only need to specify the endpoints that you want to remove. With the
* <code>UpdateEndpointGroup</code> API operation, you must specify all of the endpoints in the
* endpoint group except the ones that you want to remove from the group.</p>
* </li>
* <li>
* <p>It's faster, because Global Accelerator doesn't need to resolve any endpoints. With the
* <code>UpdateEndpointGroup</code> API operation, Global Accelerator must resolve all of the endpoints that
* remain in the group.</p>
* </li>
* </ul>
*/
public removeEndpoints(
args: RemoveEndpointsCommandInput,
options?: __HttpHandlerOptions
): Promise<RemoveEndpointsCommandOutput>;
public removeEndpoints(
args: RemoveEndpointsCommandInput,
cb: (err: any, data?: RemoveEndpointsCommandOutput) => void
): void;
public removeEndpoints(
args: RemoveEndpointsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: RemoveEndpointsCommandOutput) => void
): void;
public removeEndpoints(
args: RemoveEndpointsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: RemoveEndpointsCommandOutput) => void),
cb?: (err: any, data?: RemoveEndpointsCommandOutput) => void
): Promise<RemoveEndpointsCommandOutput> | void {
const command = new RemoveEndpointsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Add tags to an accelerator resource. </p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/global-accelerator/latest/dg/tagging-in-global-accelerator.html">Tagging
Expand Down
57 changes: 30 additions & 27 deletions clients/client-global-accelerator/src/GlobalAcceleratorClient.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// smithy-typescript generated code
import {
EndpointsInputConfig,
EndpointsResolvedConfig,
RegionInputConfig,
RegionResolvedConfig,
resolveEndpointsConfig,
resolveRegionConfig,
} from "@aws-sdk/config-resolver";
import { RegionInputConfig, RegionResolvedConfig, resolveRegionConfig } from "@aws-sdk/config-resolver";
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@aws-sdk/middleware-endpoint";
import {
getHostHeaderPlugin,
HostHeaderInputConfig,
Expand Down Expand Up @@ -41,13 +35,13 @@ import {
Credentials as __Credentials,
Decoder as __Decoder,
Encoder as __Encoder,
EndpointV2 as __EndpointV2,
Hash as __Hash,
HashConstructor as __HashConstructor,
HttpHandlerOptions as __HttpHandlerOptions,
Logger as __Logger,
Provider as __Provider,
Provider,
RegionInfoProvider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
Expand All @@ -57,6 +51,7 @@ import {
AddCustomRoutingEndpointsCommandInput,
AddCustomRoutingEndpointsCommandOutput,
} from "./commands/AddCustomRoutingEndpointsCommand";
import { AddEndpointsCommandInput, AddEndpointsCommandOutput } from "./commands/AddEndpointsCommand";
import { AdvertiseByoipCidrCommandInput, AdvertiseByoipCidrCommandOutput } from "./commands/AdvertiseByoipCidrCommand";
import {
AllowCustomRoutingTrafficCommandInput,
Expand Down Expand Up @@ -168,6 +163,7 @@ import {
RemoveCustomRoutingEndpointsCommandInput,
RemoveCustomRoutingEndpointsCommandOutput,
} from "./commands/RemoveCustomRoutingEndpointsCommand";
import { RemoveEndpointsCommandInput, RemoveEndpointsCommandOutput } from "./commands/RemoveEndpointsCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import {
Expand All @@ -193,10 +189,17 @@ import {
} from "./commands/UpdateEndpointGroupCommand";
import { UpdateListenerCommandInput, UpdateListenerCommandOutput } from "./commands/UpdateListenerCommand";
import { WithdrawByoipCidrCommandInput, WithdrawByoipCidrCommandOutput } from "./commands/WithdrawByoipCidrCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
EndpointParameters,
resolveClientEndpointParameters,
} from "./endpoint/EndpointParameters";
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";

export type ServiceInputTypes =
| AddCustomRoutingEndpointsCommandInput
| AddEndpointsCommandInput
| AdvertiseByoipCidrCommandInput
| AllowCustomRoutingTrafficCommandInput
| CreateAcceleratorCommandInput
Expand Down Expand Up @@ -233,6 +236,7 @@ export type ServiceInputTypes =
| ListTagsForResourceCommandInput
| ProvisionByoipCidrCommandInput
| RemoveCustomRoutingEndpointsCommandInput
| RemoveEndpointsCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateAcceleratorAttributesCommandInput
Expand All @@ -246,6 +250,7 @@ export type ServiceInputTypes =

export type ServiceOutputTypes =
| AddCustomRoutingEndpointsCommandOutput
| AddEndpointsCommandOutput
| AdvertiseByoipCidrCommandOutput
| AllowCustomRoutingTrafficCommandOutput
| CreateAcceleratorCommandOutput
Expand Down Expand Up @@ -282,6 +287,7 @@ export type ServiceOutputTypes =
| ListTagsForResourceCommandOutput
| ProvisionByoipCidrCommandOutput
| RemoveCustomRoutingEndpointsCommandOutput
| RemoveEndpointsCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateAcceleratorAttributesCommandOutput
Expand Down Expand Up @@ -402,12 +408,6 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
*/
credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;

/**
* Fetch related hostname, signing name or signing region with given region.
* @internal
*/
regionInfoProvider?: RegionInfoProvider;

/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
Expand All @@ -423,11 +423,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
type GlobalAcceleratorClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
ClientDefaults &
RegionInputConfig &
EndpointsInputConfig &
EndpointInputConfig<EndpointParameters> &
RetryInputConfig &
HostHeaderInputConfig &
AwsAuthInputConfig &
UserAgentInputConfig;
UserAgentInputConfig &
ClientInputEndpointParameters;
/**
* The configuration interface of GlobalAcceleratorClient class constructor that set the region, credentials and other options.
*/
Expand All @@ -436,11 +437,12 @@ export interface GlobalAcceleratorClientConfig extends GlobalAcceleratorClientCo
type GlobalAcceleratorClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
EndpointResolvedConfig<EndpointParameters> &
RetryResolvedConfig &
HostHeaderResolvedConfig &
AwsAuthResolvedConfig &
UserAgentResolvedConfig;
UserAgentResolvedConfig &
ClientResolvedEndpointParameters;
/**
* The resolved configuration interface of GlobalAcceleratorClient class. This is resolved and normalized from the {@link GlobalAcceleratorClientConfig | constructor configuration interface}.
*/
Expand Down Expand Up @@ -514,14 +516,15 @@ export class GlobalAcceleratorClient extends __Client<

constructor(configuration: GlobalAcceleratorClientConfig) {
const _config_0 = __getRuntimeConfig(configuration);
const _config_1 = resolveRegionConfig(_config_0);
const _config_2 = resolveEndpointsConfig(_config_1);
const _config_3 = resolveRetryConfig(_config_2);
const _config_4 = resolveHostHeaderConfig(_config_3);
const _config_5 = resolveAwsAuthConfig(_config_4);
const _config_6 = resolveUserAgentConfig(_config_5);
super(_config_6);
this.config = _config_6;
const _config_1 = resolveClientEndpointParameters(_config_0);
const _config_2 = resolveRegionConfig(_config_1);
const _config_3 = resolveEndpointConfig(_config_2);
const _config_4 = resolveRetryConfig(_config_3);
const _config_5 = resolveHostHeaderConfig(_config_4);
const _config_6 = resolveAwsAuthConfig(_config_5);
const _config_7 = resolveUserAgentConfig(_config_6);
super(_config_7);
this.config = _config_7;
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
Expand Down Expand Up @@ -66,6 +67,15 @@ export class AddCustomRoutingEndpointsCommand extends $Command<
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

constructor(readonly input: AddCustomRoutingEndpointsCommandInput) {
// Start section: command_constructor
super();
Expand All @@ -81,6 +91,9 @@ export class AddCustomRoutingEndpointsCommand extends $Command<
options?: __HttpHandlerOptions
): Handler<AddCustomRoutingEndpointsCommandInput, AddCustomRoutingEndpointsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, AddCustomRoutingEndpointsCommand.getEndpointParameterInstructions())
);

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

Expand Down
Loading

0 comments on commit d7d6077

Please sign in to comment.