@aws-sdk/client-lambda
Version:
AWS SDK for JavaScript Lambda Client for Node.js, Browser and React Native
140 lines (139 loc) • 5.66 kB
TypeScript
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
import { LambdaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LambdaClient";
import { AliasConfiguration, UpdateAliasRequest } from "../models/models_0";
/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link UpdateAliasCommand}.
*/
export interface UpdateAliasCommandInput extends UpdateAliasRequest {
}
/**
* @public
*
* The output of {@link UpdateAliasCommand}.
*/
export interface UpdateAliasCommandOutput extends AliasConfiguration, __MetadataBearer {
}
declare const UpdateAliasCommand_base: {
new (input: UpdateAliasCommandInput): import("@smithy/smithy-client").CommandImpl<UpdateAliasCommandInput, UpdateAliasCommandOutput, LambdaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
new (input: UpdateAliasCommandInput): import("@smithy/smithy-client").CommandImpl<UpdateAliasCommandInput, UpdateAliasCommandOutput, LambdaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
};
/**
* <p>Updates the configuration of a Lambda function <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html">alias</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { LambdaClient, UpdateAliasCommand } from "@aws-sdk/client-lambda"; // ES Modules import
* // const { LambdaClient, UpdateAliasCommand } = require("@aws-sdk/client-lambda"); // CommonJS import
* const client = new LambdaClient(config);
* const input = { // UpdateAliasRequest
* FunctionName: "STRING_VALUE", // required
* Name: "STRING_VALUE", // required
* FunctionVersion: "STRING_VALUE",
* Description: "STRING_VALUE",
* RoutingConfig: { // AliasRoutingConfiguration
* AdditionalVersionWeights: { // AdditionalVersionWeights
* "<keys>": Number("double"),
* },
* },
* RevisionId: "STRING_VALUE",
* };
* const command = new UpdateAliasCommand(input);
* const response = await client.send(command);
* // { // AliasConfiguration
* // AliasArn: "STRING_VALUE",
* // Name: "STRING_VALUE",
* // FunctionVersion: "STRING_VALUE",
* // Description: "STRING_VALUE",
* // RoutingConfig: { // AliasRoutingConfiguration
* // AdditionalVersionWeights: { // AdditionalVersionWeights
* // "<keys>": Number("double"),
* // },
* // },
* // RevisionId: "STRING_VALUE",
* // };
*
* ```
*
* @param UpdateAliasCommandInput - {@link UpdateAliasCommandInput}
* @returns {@link UpdateAliasCommandOutput}
* @see {@link UpdateAliasCommandInput} for command's `input` shape.
* @see {@link UpdateAliasCommandOutput} for command's `response` shape.
* @see {@link LambdaClientResolvedConfig | config} for LambdaClient's `config` shape.
*
* @throws {@link InvalidParameterValueException} (client fault)
* <p>One of the parameters in the request is not valid.</p>
*
* @throws {@link PreconditionFailedException} (client fault)
* <p>The RevisionId provided does not match the latest RevisionId for the Lambda function or alias.</p> <ul> <li> <p> <b>For AddPermission and RemovePermission API operations:</b> Call <code>GetPolicy</code> to retrieve the latest RevisionId for your resource.</p> </li> <li> <p> <b>For all other API operations:</b> Call <code>GetFunction</code> or <code>GetAlias</code> to retrieve the latest RevisionId for your resource.</p> </li> </ul>
*
* @throws {@link ResourceConflictException} (client fault)
* <p>The resource already exists, or another operation is in progress.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The resource specified in the request does not exist.</p>
*
* @throws {@link ServiceException} (server fault)
* <p>The Lambda service encountered an internal error.</p>
*
* @throws {@link TooManyRequestsException} (client fault)
* <p>The request throughput limit was exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests">Lambda quotas</a>.</p>
*
* @throws {@link LambdaServiceException}
* <p>Base exception class for all service exceptions from Lambda service.</p>
*
*
* @example To update a function alias
* ```javascript
* // The following example updates the alias named BLUE to send 30% of traffic to version 2 and 70% to version 1.
* const input = {
* FunctionName: "my-function",
* FunctionVersion: "2",
* Name: "BLUE",
* RoutingConfig: {
* AdditionalVersionWeights: {
* 1: 0.7
* }
* }
* };
* const command = new UpdateAliasCommand(input);
* const response = await client.send(command);
* /* response is
* {
* AliasArn: "arn:aws:lambda:us-west-2:123456789012:function:my-function:BLUE",
* Description: "Production environment BLUE.",
* FunctionVersion: "2",
* Name: "BLUE",
* RevisionId: "594f41fb-xmpl-4c20-95c7-6ca5f2a92c93",
* RoutingConfig: {
* AdditionalVersionWeights: {
* 1: 0.7
* }
* }
* }
* *\/
* ```
*
* @public
*/
export declare class UpdateAliasCommand extends UpdateAliasCommand_base {
/** @internal type navigation helper, not in runtime. */
protected static __types: {
api: {
input: UpdateAliasRequest;
output: AliasConfiguration;
};
sdk: {
input: UpdateAliasCommandInput;
output: UpdateAliasCommandOutput;
};
};
}