Back to Aws Sdk Js V3

@aws-sdk/client-api-gateway

clients/client-api-gateway/README.md

3.1043.063.7 KB
Original Source
<!-- generated file, do not edit directly -->

@aws-sdk/client-api-gateway

Description

AWS SDK for JavaScript APIGateway Client for Node.js, Browser and React Native.

<fullname>Amazon API Gateway</fullname>

<p>Amazon API Gateway helps developers deliver robust, secure, and scalable mobile and web application back ends. API Gateway allows developers to securely connect mobile and web applications to APIs that run on Lambda, Amazon EC2, or other publicly addressable web services that are hosted outside of AWS.</p>

Installing

To install this package, use the CLI of your favorite package manager:

  • npm install @aws-sdk/client-api-gateway
  • yarn add @aws-sdk/client-api-gateway
  • pnpm add @aws-sdk/client-api-gateway

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the APIGatewayClient and the commands you need, for example GetAccountCommand:

js
// ES5 example
const { APIGatewayClient, GetAccountCommand } = require("@aws-sdk/client-api-gateway");
ts
// ES6+ example
import { APIGatewayClient, GetAccountCommand } from "@aws-sdk/client-api-gateway";

Usage

To send a request:

  • Instantiate a client with configuration (e.g. credentials, region).
  • Instantiate a command with input parameters.
  • Call the send operation on the client, providing the command object as input.
js
const client = new APIGatewayClient({ region: "REGION" });

const params = { /** input parameters */ };
const command = new GetAccountCommand(params);

Async/await

We recommend using the await operator to wait for the promise returned by send operation as follows:

js
// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Promises

You can also use Promise chaining.

js
client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Aggregated client

The aggregated client class is exported from the same package, but without the "Client" suffix.

APIGateway extends APIGatewayClient and additionally supports all operations, waiters, and paginators as methods. This style may be familiar to you from the AWS SDK for JavaScript v2.

If you are bundling the AWS SDK, we recommend using only the bare-bones client (APIGatewayClient). More details are in the blog post on modular packages in AWS SDK for JavaScript.

ts
import { APIGateway } from "@aws-sdk/client-api-gateway";

const client = new APIGateway({ region: "REGION" });

// async/await.
try {
  const data = await client.getAccount(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .getAccount(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks (not recommended).
client.getAccount(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

js
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

See also docs/ERROR_HANDLING.

Getting Help

Please use these community resources for getting help. We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-api-gateway package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

<details> <summary> CreateApiKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateAuthorizer </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateBasePathMapping </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDeployment </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDocumentationPart </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDocumentationVersion </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDomainName </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateDomainNameAccessAssociation </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateModel </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateRequestValidator </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateRestApi </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateStage </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateUsagePlan </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateUsagePlanKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateVpcLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteApiKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteAuthorizer </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteBasePathMapping </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteClientCertificate </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDeployment </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDocumentationPart </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDocumentationVersion </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDomainName </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteDomainNameAccessAssociation </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteGatewayResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteIntegration </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteIntegrationResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteMethod </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteMethodResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteModel </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteRequestValidator </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteRestApi </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteStage </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteUsagePlan </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteUsagePlanKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteVpcLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> FlushStageAuthorizersCache </summary>

Command API Reference / Input / Output

</details> <details> <summary> FlushStageCache </summary>

Command API Reference / Input / Output

</details> <details> <summary> GenerateClientCertificate </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetAccount </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetApiKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetApiKeys </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetAuthorizer </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetAuthorizers </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetBasePathMapping </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetBasePathMappings </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetClientCertificate </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetClientCertificates </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDeployment </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDeployments </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDocumentationPart </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDocumentationParts </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDocumentationVersion </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDocumentationVersions </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDomainName </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDomainNameAccessAssociations </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetDomainNames </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetExport </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetGatewayResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetGatewayResponses </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetIntegration </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetIntegrationResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetMethod </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetMethodResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetModel </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetModels </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetModelTemplate </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetRequestValidator </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetRequestValidators </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetResources </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetRestApi </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetRestApis </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetSdk </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetSdkType </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetSdkTypes </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetStage </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetStages </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetTags </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetUsage </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetUsagePlan </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetUsagePlanKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetUsagePlanKeys </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetUsagePlans </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetVpcLink </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetVpcLinks </summary>

Command API Reference / Input / Output

</details> <details> <summary> ImportApiKeys </summary>

Command API Reference / Input / Output

</details> <details> <summary> ImportDocumentationParts </summary>

Command API Reference / Input / Output

</details> <details> <summary> ImportRestApi </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutGatewayResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutIntegration </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutIntegrationResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutMethod </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutMethodResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutRestApi </summary>

Command API Reference / Input / Output

</details> <details> <summary> RejectDomainNameAccessAssociation </summary>

Command API Reference / Input / Output

</details> <details> <summary> TagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> TestInvokeAuthorizer </summary>

Command API Reference / Input / Output

</details> <details> <summary> TestInvokeMethod </summary>

Command API Reference / Input / Output

</details> <details> <summary> UntagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateAccount </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateApiKey </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateAuthorizer </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateBasePathMapping </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateClientCertificate </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateDeployment </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateDocumentationPart </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateDocumentationVersion </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateDomainName </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateGatewayResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateIntegration </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateIntegrationResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateMethod </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateMethodResponse </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateModel </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateRequestValidator </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateRestApi </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateStage </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateUsage </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateUsagePlan </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateVpcLink </summary>

Command API Reference / Input / Output

</details>