CfnFunctionDefinitionPropsMixin
- class aws_cdk.mixins_preview.aws_greengrass.mixins.CfnFunctionDefinitionPropsMixin(props, *, strategy=None)
Bases:
MixinThe
AWS::Greengrass::FunctionDefinitionresource represents a function definition for AWS IoT Greengrass .Function definitions are used to organize your function definition versions.
Function definitions can reference multiple function definition versions. All function definition versions must be associated with a function definition. Each function definition version can contain one or more functions. .. epigraph:
When you create a function definition, you can optionally include an initial function definition version. To associate a function definition version later, create an ```AWS::Greengrass::FunctionDefinitionVersion`` <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinitionversion.html>`_ resource and specify the ID of this function definition. After you create the function definition version that contains the functions you want to deploy, you must add it to your group version. For more information, see ```AWS::Greengrass::Group`` <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html>`_ .
- See:
- CloudformationResource:
AWS::Greengrass::FunctionDefinition
- Mixin:
true
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview import mixins from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins # tags: Any # variables: Any cfn_function_definition_props_mixin = greengrass_mixins.CfnFunctionDefinitionPropsMixin(greengrass_mixins.CfnFunctionDefinitionMixinProps( initial_version=greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionDefinitionVersionProperty( default_config=greengrass_mixins.CfnFunctionDefinitionPropsMixin.DefaultConfigProperty( execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ) ), functions=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionProperty( function_arn="functionArn", function_configuration=greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionConfigurationProperty( encoding_type="encodingType", environment=greengrass_mixins.CfnFunctionDefinitionPropsMixin.EnvironmentProperty( access_sysfs=False, execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ), resource_access_policies=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty( permission="permission", resource_id="resourceId" )], variables=variables ), exec_args="execArgs", executable="executable", memory_size=123, pinned=False, timeout=123 ), id="id" )] ), name="name", tags=tags ), strategy=mixins.PropertyMergeStrategy.OVERRIDE )
Create a mixin to apply properties to
AWS::Greengrass::FunctionDefinition.- Parameters:
props (
Union[CfnFunctionDefinitionMixinProps,Dict[str,Any]]) – L1 properties to apply.strategy (
Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE
Methods
- apply_to(construct)
Apply the mixin properties to the construct.
- Parameters:
construct (
IConstruct)- Return type:
- supports(construct)
Check if this mixin supports the given construct.
- Parameters:
construct (
IConstruct)- Return type:
bool
Attributes
- CFN_PROPERTY_KEYS = ['initialVersion', 'name', 'tags']
Static Methods
- classmethod is_mixin(x)
(experimental) Checks if
xis a Mixin.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsMixin.- Stability:
experimental
DefaultConfigProperty
- class CfnFunctionDefinitionPropsMixin.DefaultConfigProperty(*, execution=None)
Bases:
objectThe default configuration that applies to all Lambda functions in the function definition version.
Individual Lambda functions can override these settings.
In an CloudFormation template,
DefaultConfigis a property of the`FunctionDefinitionVersion<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functiondefinitionversion.html>`_ property type.- Parameters:
execution (
Union[IResolvable,ExecutionProperty,Dict[str,Any],None]) – Configuration settings for the Lambda execution environment on the AWS IoT Greengrass core.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins default_config_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.DefaultConfigProperty( execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ) )
Attributes
- execution
Configuration settings for the Lambda execution environment on the AWS IoT Greengrass core.
EnvironmentProperty
- class CfnFunctionDefinitionPropsMixin.EnvironmentProperty(*, access_sysfs=None, execution=None, resource_access_policies=None, variables=None)
Bases:
objectThe environment configuration for a Lambda function on the AWS IoT Greengrass core.
In an CloudFormation template,
Environmentis a property of the`FunctionConfiguration<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functionconfiguration.html>`_ property type.- Parameters:
access_sysfs (
Union[bool,IResolvable,None]) – Indicates whether the function is allowed to access the/sysdirectory on the core device, which allows the read device information from/sys. .. epigraph:: This property applies only to Lambda functions that run in a Greengrass container.execution (
Union[IResolvable,ExecutionProperty,Dict[str,Any],None]) – Settings for the Lambda execution environment in AWS IoT Greengrass .resource_access_policies (
Union[IResolvable,Sequence[Union[IResolvable,ResourceAccessPolicyProperty,Dict[str,Any]]],None]) – A list of the resources in the group that the function can access, with the corresponding read-only or read-write permissions. The maximum is 10 resources. .. epigraph:: This property applies only for Lambda functions that run in a Greengrass container.variables (
Any) – Environment variables for the Lambda function.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins # variables: Any environment_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.EnvironmentProperty( access_sysfs=False, execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ), resource_access_policies=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty( permission="permission", resource_id="resourceId" )], variables=variables )
Attributes
- access_sysfs
Indicates whether the function is allowed to access the
/sysdirectory on the core device, which allows the read device information from/sys.This property applies only to Lambda functions that run in a Greengrass container.
- execution
Settings for the Lambda execution environment in AWS IoT Greengrass .
- resource_access_policies
A list of the resources in the group that the function can access, with the corresponding read-only or read-write permissions. The maximum is 10 resources.
This property applies only for Lambda functions that run in a Greengrass container.
- variables
Environment variables for the Lambda function.
ExecutionProperty
- class CfnFunctionDefinitionPropsMixin.ExecutionProperty(*, isolation_mode=None, run_as=None)
Bases:
objectConfiguration settings for the Lambda execution environment on the AWS IoT Greengrass core.
In an CloudFormation template,
Executionis a property of the`DefaultConfig<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-defaultconfig.html>`_ property type for a function definition version and the`Environment<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-environment.html>`_ property type for a function.- Parameters:
isolation_mode (
Optional[str]) – The containerization that the Lambda function runs in. Valid values areGreengrassContainerorNoContainer. Typically, this isGreengrassContainer. For more information, see Containerization in the Developer Guide . - When set on the`DefaultConfig<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html>`_ property of a function definition version, this setting is used as the default containerization for all Lambda functions in the function definition version. - When set on the`Environment<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html>`_ property of a function, this setting applies to the individual function and overrides the default. Omit this value to run the function with the default containerization. .. epigraph:: We recommend that you run in a Greengrass container unless your business case requires that you run without containerization.run_as (
Union[IResolvable,RunAsProperty,Dict[str,Any],None]) – The user and group permissions used to run the Lambda function. Typically, this is the ggc_user and ggc_group. For more information, see Run as in the Developer Guide . - When set on the`DefaultConfig<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html>`_ property of a function definition version, this setting is used as the default access identity for all Lambda functions in the function definition version. - When set on the`Environment<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html>`_ property of a function, this setting applies to the individual function and overrides the default. You can override the user, group, or both. Omit this value to run the function with the default permissions. .. epigraph:: Running as the root user increases risks to your data and device. Do not run as root (UID/GID=0) unless your business case requires it. For more information and requirements, see Running a Lambda Function as Root .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins execution_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) )
Attributes
- isolation_mode
The containerization that the Lambda function runs in.
Valid values are
GreengrassContainerorNoContainer. Typically, this isGreengrassContainer. For more information, see Containerization in the Developer Guide .When set on the
`DefaultConfig<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html>`_ property of a function definition version, this setting is used as the default containerization for all Lambda functions in the function definition version.When set on the
`Environment<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html>`_ property of a function, this setting applies to the individual function and overrides the default. Omit this value to run the function with the default containerization.
We recommend that you run in a Greengrass container unless your business case requires that you run without containerization.
- run_as
The user and group permissions used to run the Lambda function.
Typically, this is the ggc_user and ggc_group. For more information, see Run as in the Developer Guide .
When set on the
`DefaultConfig<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html>`_ property of a function definition version, this setting is used as the default access identity for all Lambda functions in the function definition version.When set on the
`Environment<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html>`_ property of a function, this setting applies to the individual function and overrides the default. You can override the user, group, or both. Omit this value to run the function with the default permissions.
Running as the root user increases risks to your data and device. Do not run as root (UID/GID=0) unless your business case requires it. For more information and requirements, see Running a Lambda Function as Root .
FunctionConfigurationProperty
- class CfnFunctionDefinitionPropsMixin.FunctionConfigurationProperty(*, encoding_type=None, environment=None, exec_args=None, executable=None, memory_size=None, pinned=None, timeout=None)
Bases:
objectThe group-specific configuration settings for a Lambda function.
These settings configure the function’s behavior in the Greengrass group. For more information, see Controlling Execution of Greengrass Lambda Functions by Using Group-Specific Configuration in the Developer Guide .
In an CloudFormation template,
FunctionConfigurationis a property of the`Function<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-function.html>`_ property type.- Parameters:
encoding_type (
Optional[str]) – The expected encoding type of the input payload for the function. Valid values arejson(default) andbinary.environment (
Union[IResolvable,EnvironmentProperty,Dict[str,Any],None]) – The environment configuration of the function.exec_args (
Optional[str]) – The execution arguments.executable (
Optional[str]) – The name of the function executable.memory_size (
Union[int,float,None]) – The memory size (in KB) required by the function. .. epigraph:: This property applies only to Lambda functions that run in a Greengrass container.pinned (
Union[bool,IResolvable,None]) – Indicates whether the function is pinned (or long-lived ). Pinned functions start when the core starts and process all requests in the same container. The default value is false.timeout (
Union[int,float,None]) – The allowed execution time (in seconds) after which the function should terminate. For pinned functions, this timeout applies for each request.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins # variables: Any function_configuration_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionConfigurationProperty( encoding_type="encodingType", environment=greengrass_mixins.CfnFunctionDefinitionPropsMixin.EnvironmentProperty( access_sysfs=False, execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ), resource_access_policies=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty( permission="permission", resource_id="resourceId" )], variables=variables ), exec_args="execArgs", executable="executable", memory_size=123, pinned=False, timeout=123 )
Attributes
- encoding_type
The expected encoding type of the input payload for the function.
Valid values are
json(default) andbinary.
- environment
The environment configuration of the function.
- exec_args
The execution arguments.
- executable
The name of the function executable.
- memory_size
The memory size (in KB) required by the function.
This property applies only to Lambda functions that run in a Greengrass container.
- pinned
Indicates whether the function is pinned (or long-lived ).
Pinned functions start when the core starts and process all requests in the same container. The default value is false.
- timeout
The allowed execution time (in seconds) after which the function should terminate.
For pinned functions, this timeout applies for each request.
FunctionDefinitionVersionProperty
- class CfnFunctionDefinitionPropsMixin.FunctionDefinitionVersionProperty(*, default_config=None, functions=None)
Bases:
objectA function definition version contains a list of functions.
After you create a function definition version that contains the functions you want to deploy, you must add it to your group version. For more information, see
`AWS::Greengrass::Group<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html>`_ .In an CloudFormation template,
FunctionDefinitionVersionis the property type of theInitialVersionproperty in the`AWS::Greengrass::FunctionDefinition<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinition.html>`_ resource.- Parameters:
default_config (
Union[IResolvable,DefaultConfigProperty,Dict[str,Any],None]) – The default configuration that applies to all Lambda functions in the group. Individual Lambda functions can override these settings.functions (
Union[IResolvable,Sequence[Union[IResolvable,FunctionProperty,Dict[str,Any]]],None]) – The functions in this version.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins # variables: Any function_definition_version_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionDefinitionVersionProperty( default_config=greengrass_mixins.CfnFunctionDefinitionPropsMixin.DefaultConfigProperty( execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ) ), functions=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionProperty( function_arn="functionArn", function_configuration=greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionConfigurationProperty( encoding_type="encodingType", environment=greengrass_mixins.CfnFunctionDefinitionPropsMixin.EnvironmentProperty( access_sysfs=False, execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ), resource_access_policies=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty( permission="permission", resource_id="resourceId" )], variables=variables ), exec_args="execArgs", executable="executable", memory_size=123, pinned=False, timeout=123 ), id="id" )] )
Attributes
- default_config
The default configuration that applies to all Lambda functions in the group.
Individual Lambda functions can override these settings.
FunctionProperty
- class CfnFunctionDefinitionPropsMixin.FunctionProperty(*, function_arn=None, function_configuration=None, id=None)
Bases:
objectA function is a Lambda function that’s referenced from an AWS IoT Greengrass group.
The function is deployed to a Greengrass core where it runs locally. For more information, see Run Lambda Functions on the AWS IoT Greengrass Core in the Developer Guide .
In an CloudFormation template, the
Functionsproperty of the`FunctionDefinitionVersion<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functiondefinitionversion.html>`_ property type contains a list ofFunctionproperty types.- Parameters:
function_arn (
Optional[str]) – The Amazon Resource Name (ARN) of the alias (recommended) or version of the referenced Lambda function.function_configuration (
Union[IResolvable,FunctionConfigurationProperty,Dict[str,Any],None]) – The group-specific settings of the Lambda function. These settings configure the function’s behavior in the Greengrass group.id (
Optional[str]) – A descriptive or arbitrary ID for the function. This value must be unique within the function definition version. Maximum length is 128 characters with pattern[a-zA-Z0-9:_-]+.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins # variables: Any function_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionProperty( function_arn="functionArn", function_configuration=greengrass_mixins.CfnFunctionDefinitionPropsMixin.FunctionConfigurationProperty( encoding_type="encodingType", environment=greengrass_mixins.CfnFunctionDefinitionPropsMixin.EnvironmentProperty( access_sysfs=False, execution=greengrass_mixins.CfnFunctionDefinitionPropsMixin.ExecutionProperty( isolation_mode="isolationMode", run_as=greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 ) ), resource_access_policies=[greengrass_mixins.CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty( permission="permission", resource_id="resourceId" )], variables=variables ), exec_args="execArgs", executable="executable", memory_size=123, pinned=False, timeout=123 ), id="id" )
Attributes
- function_arn
The Amazon Resource Name (ARN) of the alias (recommended) or version of the referenced Lambda function.
- function_configuration
The group-specific settings of the Lambda function.
These settings configure the function’s behavior in the Greengrass group.
- id
A descriptive or arbitrary ID for the function.
This value must be unique within the function definition version. Maximum length is 128 characters with pattern
[a-zA-Z0-9:_-]+.
ResourceAccessPolicyProperty
- class CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty(*, permission=None, resource_id=None)
Bases:
objectA list of the resources in the group that the function can access, with the corresponding read-only or read-write permissions. The maximum is 10 resources.
This property applies only to Lambda functions that run in a Greengrass container.
In an CloudFormation template,
ResourceAccessPolicyis a property of the`Environment<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-environment.html>`_ property type.- Parameters:
permission (
Optional[str]) – The read-only or read-write access that the Lambda function has to the resource. Valid values areroorrw.resource_id (
Optional[str]) – The ID of the resource. This ID is assigned to the resource when you create the resource definition.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins resource_access_policy_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.ResourceAccessPolicyProperty( permission="permission", resource_id="resourceId" )
Attributes
- permission
The read-only or read-write access that the Lambda function has to the resource.
Valid values are
roorrw.
- resource_id
The ID of the resource.
This ID is assigned to the resource when you create the resource definition.
RunAsProperty
- class CfnFunctionDefinitionPropsMixin.RunAsProperty(*, gid=None, uid=None)
Bases:
objectThe access identity whose permissions are used to run the Lambda function.
This setting overrides the default access identity that’s specified for the group (by default, ggc_user and ggc_group). You can override the user, group, or both. For more information, see Run as in the Developer Guide . .. epigraph:
Running as the root user increases risks to your data and device. Do not run as root (UID/GID=0) unless your business case requires it. For more information and requirements, see `Running a Lambda Function as Root <https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-running-as-root>`_ .
In an CloudFormation template,
RunAsis a property of the`Execution<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-execution.html>`_ property type.- Parameters:
gid (
Union[int,float,None]) – The group ID whose permissions are used to run the Lambda function. You can use thegetent groupcommand on your core device to look up the group ID.uid (
Union[int,float,None]) – The user ID whose permissions are used to run the Lambda function. You can use thegetent passwdcommand on your core device to look up the user ID.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_greengrass import mixins as greengrass_mixins run_as_property = greengrass_mixins.CfnFunctionDefinitionPropsMixin.RunAsProperty( gid=123, uid=123 )
Attributes
- gid
The group ID whose permissions are used to run the Lambda function.
You can use the
getent groupcommand on your core device to look up the group ID.
- uid
The user ID whose permissions are used to run the Lambda function.
You can use the
getent passwdcommand on your core device to look up the user ID.