import { Command as $Command } from "@smithy/smithy-client"; import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { CloudFrontClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudFrontClient"; import { UpdateFunctionRequest, UpdateFunctionResult } from "../models/models_2"; /** * @public */ export type { __MetadataBearer }; export { $Command }; /** * @public * * The input for {@link UpdateFunctionCommand}. */ export interface UpdateFunctionCommandInput extends UpdateFunctionRequest { } /** * @public * * The output of {@link UpdateFunctionCommand}. */ export interface UpdateFunctionCommandOutput extends UpdateFunctionResult, __MetadataBearer { } declare const UpdateFunctionCommand_base: { new (input: UpdateFunctionCommandInput): import("@smithy/smithy-client").CommandImpl; new (input: UpdateFunctionCommandInput): import("@smithy/smithy-client").CommandImpl; getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions; }; /** *

Updates a CloudFront function.

You can update a function's code or the comment that describes the function. You cannot update a function's name.

To update a function, you provide the function's name and version (ETag value) along with the updated function code. To get the name and version, you can use ListFunctions and DescribeFunction.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript * import { CloudFrontClient, UpdateFunctionCommand } from "@aws-sdk/client-cloudfront"; // ES Modules import * // const { CloudFrontClient, UpdateFunctionCommand } = require("@aws-sdk/client-cloudfront"); // CommonJS import * const client = new CloudFrontClient(config); * const input = { // UpdateFunctionRequest * Name: "STRING_VALUE", // required * IfMatch: "STRING_VALUE", // required * FunctionConfig: { // FunctionConfig * Comment: "STRING_VALUE", // required * Runtime: "cloudfront-js-1.0" || "cloudfront-js-2.0", // required * KeyValueStoreAssociations: { // KeyValueStoreAssociations * Quantity: Number("int"), // required * Items: [ // KeyValueStoreAssociationList * { // KeyValueStoreAssociation * KeyValueStoreARN: "STRING_VALUE", // required * }, * ], * }, * }, * FunctionCode: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") // required * }; * const command = new UpdateFunctionCommand(input); * const response = await client.send(command); * // { // UpdateFunctionResult * // FunctionSummary: { // FunctionSummary * // Name: "STRING_VALUE", // required * // Status: "STRING_VALUE", * // FunctionConfig: { // FunctionConfig * // Comment: "STRING_VALUE", // required * // Runtime: "cloudfront-js-1.0" || "cloudfront-js-2.0", // required * // KeyValueStoreAssociations: { // KeyValueStoreAssociations * // Quantity: Number("int"), // required * // Items: [ // KeyValueStoreAssociationList * // { // KeyValueStoreAssociation * // KeyValueStoreARN: "STRING_VALUE", // required * // }, * // ], * // }, * // }, * // FunctionMetadata: { // FunctionMetadata * // FunctionARN: "STRING_VALUE", // required * // Stage: "DEVELOPMENT" || "LIVE", * // CreatedTime: new Date("TIMESTAMP"), * // LastModifiedTime: new Date("TIMESTAMP"), // required * // }, * // }, * // ETag: "STRING_VALUE", * // }; * * ``` * * @param UpdateFunctionCommandInput - {@link UpdateFunctionCommandInput} * @returns {@link UpdateFunctionCommandOutput} * @see {@link UpdateFunctionCommandInput} for command's `input` shape. * @see {@link UpdateFunctionCommandOutput} for command's `response` shape. * @see {@link CloudFrontClientResolvedConfig | config} for CloudFrontClient's `config` shape. * * @throws {@link FunctionSizeLimitExceeded} (client fault) *

The function is too large. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

* * @throws {@link InvalidArgument} (client fault) *

An argument is invalid.

* * @throws {@link InvalidIfMatchVersion} (client fault) *

The If-Match version is missing or not valid.

* * @throws {@link NoSuchFunctionExists} (client fault) *

The function does not exist.

* * @throws {@link PreconditionFailed} (client fault) *

The precondition in one or more of the request fields evaluated to false.

* * @throws {@link UnsupportedOperation} (client fault) *

This operation is not supported in this Amazon Web Services Region.

* * @throws {@link CloudFrontServiceException} *

Base exception class for all service exceptions from CloudFront service.

* * * @example To update a function * ```javascript * // Use the following command to update a function. * const input = { * FunctionCode: "function-code-changed.js", * FunctionConfig: { * Comment: "my-changed-comment", * KeyValueStoreAssociations: { * Items: [ * { * KeyValueStoreARN: "arn:aws:cloudfront::123456789012:key-value-store/54947df8-0e9e-4471-a2f9-9af509fb5889" * } * ], * Quantity: 1 * }, * Runtime: "cloudfront-js-2.0" * }, * IfMatch: "ETVPDKIKX0DER", * Name: "my-function-name" * }; * const command = new UpdateFunctionCommand(input); * const response = await client.send(command); * /* response is * { * ETag: "E3UN6WX5RRO2AG", * FunctionSummary: { * FunctionConfig: { * Comment: "my-changed-comment", * KeyValueStoreAssociations: { * Items: [ * { * KeyValueStoreARN: "arn:aws:cloudfront::123456789012:key-value-store/54947df8-0e9e-4471-a2f9-9af509fb5889" * } * ], * Quantity: 1 * }, * Runtime: "cloudfront-js-2.0" * }, * FunctionMetadata: { * CreatedTime: "2023-11-07T19:53:50.334Z", * FunctionARN: "arn:aws:cloudfront::123456789012:function/my-function-name", * LastModifiedTime: "2023-11-07T20:01:37.174Z", * Stage: "DEVELOPMENT" * }, * Name: "my-function-name", * Status: "UNPUBLISHED" * } * } * *\/ * ``` * * @public */ export declare class UpdateFunctionCommand extends UpdateFunctionCommand_base { /** @internal type navigation helper, not in runtime. */ protected static __types: { api: { input: UpdateFunctionRequest; output: UpdateFunctionResult; }; sdk: { input: UpdateFunctionCommandInput; output: UpdateFunctionCommandOutput; }; }; }