View a markdown version of this page

PutFunction - AWS Elemental MediaTailor

PutFunction

Creates or updates a function. A function defines reusable logic that MediaTailor executes at lifecycle hooks during ad insertion. For more information about functions, see Working with functions in the MediaTailor User Guide.

Request Syntax

PUT /function/FunctionId HTTP/1.1 Content-type: application/json { "CustomOutputConfiguration": { "Output": { "string" : "string" }, "Runtime": "string" }, "Description": "string", "FunctionType": "string", "HttpRequestConfiguration": { "Body": "string", "Headers": { "string" : "string" }, "MethodType": "string", "Output": { "string" : "string" }, "RequestTimeoutMilliseconds": number, "Runtime": "string", "Url": "string" }, "SequentialExecutorConfiguration": { "FunctionList": [ { "FunctionId": "string", "RunCondition": "string" } ], "Output": { "string" : "string" }, "Runtime": "string", "TimeoutMilliseconds": number }, "tags": { "string" : "string" } }

URI Request Parameters

The request uses the following URI parameters.

FunctionId

The identifier of the function. The identifier must be unique within your account.

Required: Yes

Request Body

The request accepts the following data in JSON format.

CustomOutputConfiguration

The configuration for a CUSTOM_OUTPUT function. Specifies the runtime and output expressions. Required when FunctionType is CUSTOM_OUTPUT.

Type: CustomOutputConfiguration object

Required: No

Description

A description of the function.

Type: String

Required: No

FunctionType

The type of the function. The function type determines what the function can do at runtime. Valid values: CUSTOM_OUTPUT evaluates expressions and produces output bindings with no external calls. HTTP_REQUEST makes an HTTP call to an external service and evaluates output expressions that can reference the response. SEQUENTIAL_EXECUTOR runs a sequence of child functions in order, passing data between steps through temporary data. For more information, see Function types and composition in the MediaTailor User Guide.

Type: String

Valid Values: HTTP_REQUEST | CUSTOM_OUTPUT | SEQUENTIAL_EXECUTOR

Required: Yes

HttpRequestConfiguration

The configuration for an HTTP_REQUEST function. Specifies the HTTP method, URL, headers, body, timeout, and output expressions. Required when FunctionType is HTTP_REQUEST.

Type: HttpRequestConfiguration object

Required: No

SequentialExecutorConfiguration

The configuration for a SEQUENTIAL_EXECUTOR function. Specifies the ordered list of child functions to execute, an optional output block, and a timeout. Required when FunctionType is SEQUENTIAL_EXECUTOR.

Type: SequentialExecutorConfiguration object

Required: No

tags

The tags to assign to the function. Tags are key-value pairs that you can associate with Amazon resources to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor Resources.

Type: String to string map

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "Arn": "string", "CustomOutputConfiguration": { "Output": { "string" : "string" }, "Runtime": "string" }, "Description": "string", "FunctionId": "string", "FunctionType": "string", "HttpRequestConfiguration": { "Body": "string", "Headers": { "string" : "string" }, "MethodType": "string", "Output": { "string" : "string" }, "RequestTimeoutMilliseconds": number, "Runtime": "string", "Url": "string" }, "SequentialExecutorConfiguration": { "FunctionList": [ { "FunctionId": "string", "RunCondition": "string" } ], "Output": { "string" : "string" }, "Runtime": "string", "TimeoutMilliseconds": number }, "tags": { "string" : "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Arn

The Amazon Resource Name (ARN) of the function.

Type: String

CustomOutputConfiguration

The configuration for a CUSTOM_OUTPUT function.

Type: CustomOutputConfiguration object

Description

A description of the function.

Type: String

FunctionId

The identifier of the function.

Type: String

FunctionType

The type of the function.

Type: String

Valid Values: HTTP_REQUEST | CUSTOM_OUTPUT | SEQUENTIAL_EXECUTOR

HttpRequestConfiguration

The configuration for an HTTP_REQUEST function.

Type: HttpRequestConfiguration object

SequentialExecutorConfiguration

The configuration for a SEQUENTIAL_EXECUTOR function.

Type: SequentialExecutorConfiguration object

tags

The tags assigned to the function. Tags are key-value pairs that you can associate with Amazon resources to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor Resources.

Type: String to string map

Errors

For information about the errors that are common to all actions, see Common Error Types.

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: