Creates a list of environmental variables in an API by its ID value.
When creating an environmental variable, it must follow the constraints below:
-
Both JavaScript and VTL templates support environmental variables.
-
Environmental variables are not evaluated before function invocation.
-
Environmental variables only support string values.
-
Any defined value in an environmental variable is considered a string literal and not expanded.
-
Variable evaluations should ideally be performed in the function code.
When creating an environmental variable key-value pair, it must follow the additional constraints below:
-
Keys must begin with a letter.
-
Keys must be at least two characters long.
-
Keys can only contain letters, numbers, and the underscore character (_).
-
Values can be up to 512 characters long.
-
You can configure up to 50 key-value pairs in a GraphQL API.
You can create a list of environmental variables by adding it to the environmentVariables payload as a list in the format {"key1":"value1","key2":"value2", …}. Note that each call of the PutGraphqlApiEnvironmentVariables action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.
Parameters:
-
api_id
(String)
–
The ID of the API to which the environmental variable list will be written.
-
environment_variables
(EnvironmentVariableMap)
–
The list of environmental variables to add to the API.
When creating an environmental variable key-value pair, it must follow the additional constraints below:
-
Keys must begin with a letter.
-
Keys must be at least two characters long.
-
Keys can only contain letters, numbers, and the underscore character (_).
-
Values can be up to 512 characters long.
-
You can configure up to 50 key-value pairs in a GraphQL API.
You can create a list of environmental variables by adding it to the environmentVariables payload as a list in the format {"key1":"value1","key2":"value2", …}. Note that each call of the PutGraphqlApiEnvironmentVariables action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.
Raises:
Source code in docs_src/capo_appsync/_services/async_app_sync.py
| async def put_graphql_api_environment_variables(
self,
api_id: "capo_appsync.types.string.String",
environment_variables: "capo_appsync.types.environment_variable_map.EnvironmentVariableMap",
*,
config_overrides: Optional[AsyncAppSyncClientConfig] = None,
) -> "capo_appsync.types.put_graphql_api_environment_variables_response.PutGraphqlApiEnvironmentVariablesResponse":
"""<p>Creates a list of environmental variables in an API by its ID value. </p> <p>When creating an environmental variable, it must follow the constraints below:</p> <ul> <li> <p>Both JavaScript and VTL templates support environmental variables.</p> </li> <li> <p>Environmental variables are not evaluated before function invocation.</p> </li> <li> <p>Environmental variables only support string values.</p> </li> <li> <p>Any defined value in an environmental variable is considered a string literal and not expanded.</p> </li> <li> <p>Variable evaluations should ideally be performed in the function code.</p> </li> </ul> <p>When creating an environmental variable key-value pair, it must follow the additional constraints below:</p> <ul> <li> <p>Keys must begin with a letter.</p> </li> <li> <p>Keys must be at least two characters long.</p> </li> <li> <p>Keys can only contain letters, numbers, and the underscore character (_).</p> </li> <li> <p>Values can be up to 512 characters long.</p> </li> <li> <p>You can configure up to 50 key-value pairs in a GraphQL API.</p> </li> </ul> <p>You can create a list of environmental variables by adding it to the <code>environmentVariables</code> payload as a list in the format <code>{"key1":"value1","key2":"value2", …}</code>. Note that each call of the <code>PutGraphqlApiEnvironmentVariables</code> action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.</p>
Args:
api_id: <p>The ID of the API to which the environmental variable list will be written.</p>
environment_variables: <p>The list of environmental variables to add to the API.</p> <p>When creating an environmental variable key-value pair, it must follow the additional constraints below:</p> <ul> <li> <p>Keys must begin with a letter.</p> </li> <li> <p>Keys must be at least two characters long.</p> </li> <li> <p>Keys can only contain letters, numbers, and the underscore character (_).</p> </li> <li> <p>Values can be up to 512 characters long.</p> </li> <li> <p>You can configure up to 50 key-value pairs in a GraphQL API.</p> </li> </ul> <p>You can create a list of environmental variables by adding it to the <code>environmentVariables</code> payload as a list in the format <code>{"key1":"value1","key2":"value2", …}</code>. Note that each call of the <code>PutGraphqlApiEnvironmentVariables</code> action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.</p>
Raises:
capo_appsync.errors.access_denied_exception.AccessDeniedException: <p>You don't have access to perform this operation on this resource.</p>
capo_appsync.errors.bad_request_exception.BadRequestException: <p>The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and then try again.</p>
capo_appsync.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another modification is in progress at this time and it must complete before you can make your change.</p>
capo_appsync.errors.internal_failure_exception.InternalFailureException: <p>An internal AppSync error occurred. Try your request again.</p>
capo_appsync.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. Check the resource, and then try again.</p>
capo_appsync.errors.unauthorized_exception.UnauthorizedException: <p>You aren't authorized to perform this operation.</p>
capo_appsync.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_appsync.types.put_graphql_api_environment_variables_request.PutGraphqlApiEnvironmentVariablesRequest]",
) -> AsyncOperationResponse[
"capo_appsync.types.put_graphql_api_environment_variables_response.PutGraphqlApiEnvironmentVariablesResponse"
]:
import capo_appsync._operations.aws_deepdish_control_plane_service.put_graphql_api_environment_variables
(
output,
http_response,
) = await capo_appsync._operations.aws_deepdish_control_plane_service.put_graphql_api_environment_variables.async_put_graphql_api_environment_variables(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutGraphqlApiEnvironmentVariables")
)
input_: capo_appsync.types.put_graphql_api_environment_variables_request.PutGraphqlApiEnvironmentVariablesRequest = {
"api_id": api_id,
"environment_variables": environment_variables,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|