Component

class aws_cdk.aws_imagebuilder_alpha.Component(scope, id, *, data, platform, change_description=None, component_name=None, component_version=None, description=None, kms_key=None, supported_os_versions=None, tags=None)

Bases: Resource

(experimental) Represents an EC2 Image Builder Component.

See:

https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-components.html

Stability:

experimental

ExampleMetadata:

infused

Example:

component = imagebuilder.Component(self, "MyComponent",
    platform=imagebuilder.Platform.LINUX,
    data=imagebuilder.ComponentData.from_json_object({
        "schema_version": imagebuilder.ComponentSchemaVersion.V1_0,
        "phases": [{
            "name": imagebuilder.ComponentPhaseName.BUILD,
            "steps": [{
                "name": "install-app",
                "action": imagebuilder.ComponentAction.EXECUTE_BASH,
                "inputs": {
                    "commands": ["echo "Installing my application..."", "yum update -y"]
                }
            }
            ]
        }
        ]
    })
)
Parameters:
  • scope (Construct)

  • id (str)

  • data (ComponentData) – (experimental) The component document content that defines the build, validation, or test steps to be executed during the image building process.

  • platform (Platform) – (experimental) The operating system platform of the component.

  • change_description (Optional[str]) – (experimental) The change description of the component. Describes what change has been made in this version of the component, or what makes this version different from other versions. Default: None

  • component_name (Optional[str]) – (experimental) The name of the component. Default: - a name is generated

  • component_version (Optional[str]) – (experimental) The version of the component. Default: 1.0.0

  • description (Optional[str]) – (experimental) The description of the component. Default: None

  • kms_key (Optional[IKey]) – (experimental) The KMS key used to encrypt this component. Default: - an Image Builder owned key will be used to encrypt the component.

  • supported_os_versions (Optional[Sequence[OSVersion]]) – (experimental) The operating system versions supported by the component. Default: None

  • tags (Optional[Mapping[str, str]]) – (experimental) The tags to apply to the component. Default: None

Stability:

experimental

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy)

Return type:

None

grant(grantee, *actions)

(experimental) Grant custom actions to the given grantee for the component.

Parameters:
  • grantee (IGrantable) – The principal.

  • actions (str) – The list of actions.

Stability:

experimental

Return type:

Grant

grant_read(grantee)

(experimental) Grant read permissions to the given grantee for the component.

Parameters:

grantee (IGrantable) – The principal.

Stability:

experimental

Return type:

Grant

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

PROPERTY_INJECTION_ID = '@aws-cdk.aws-imagebuilder-alpha.Component'
component_arn

(experimental) The ARN of the component.

Stability:

experimental

component_name

(experimental) The name of the component.

Stability:

experimental

component_type

(experimental) The type of the component.

Stability:

experimental

Attribute:

true

component_version

(experimental) The version of the component.

Stability:

experimental

encrypted

(experimental) Whether the component is encrypted.

Stability:

experimental

env

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

node

The tree node.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_component_arn(scope, id, component_arn)

(experimental) Import an existing component given its ARN.

Parameters:
  • scope (Construct)

  • id (str)

  • component_arn (str)

Stability:

experimental

Return type:

IComponent

classmethod from_component_attributes(scope, id, *, component_arn=None, component_name=None, component_version=None)

(experimental) Import an existing component by providing its attributes.

If the component name is provided as an attribute, it must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.

Parameters:
  • scope (Construct)

  • id (str)

  • component_arn (Optional[str]) – (experimental) The ARN of the component. Default: - the ARN is automatically constructed if a componentName is provided, otherwise a componentArn is required

  • component_name (Optional[str]) – (experimental) The name of the component. Default: - the name is automatically constructed if a componentArn is provided, otherwise a componentName is required

  • component_version (Optional[str]) – (experimental) The version of the component. Default: - the latest version of the component, x.x.x

Stability:

experimental

Return type:

IComponent

classmethod from_component_name(scope, id, component_name)

(experimental) Import an existing component given its name.

The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.

Parameters:
  • scope (Construct)

  • id (str)

  • component_name (str)

Stability:

experimental

Return type:

IComponent

classmethod is_component(x)

(experimental) Return whether the given object is a Component.

Parameters:

x (Any)

Stability:

experimental

Return type:

bool

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct)

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct)

Return type:

bool