Skip to content
v2.277.0

Experimental

@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ComponentAction Enum ​

The action for a step within the component document.

Example ​

ts

const component = new imagebuilder.Component(this, 'JsonComponent', {
  platform: imagebuilder.Platform.LINUX,
  data: imagebuilder.ComponentData.fromJsonObject({
    schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
    phases: [
      {
        name: imagebuilder.ComponentPhaseName.BUILD,
        steps: [
          {
            name: 'configure-app',
            action: imagebuilder.ComponentAction.CREATE_FILE,
            inputs: {
              path: '/etc/myapp/config.json',
              content: '{"env": "production"}'
            }
          }
        ]
      }
    ]
  })
});
python
component = imagebuilder.Component(self, "JsonComponent",
    platform=imagebuilder.Platform.LINUX,
    data=imagebuilder.ComponentData.from_json_object({
        "schema_version": imagebuilder.ComponentSchemaVersion.V1_0,
        "phases": [{
            "name": imagebuilder.ComponentPhaseName.BUILD,
            "steps": [{
                "name": "configure-app",
                "action": imagebuilder.ComponentAction.CREATE_FILE,
                "inputs": {
                    "path": "/etc/myapp/config.json",
                    "content": "{\"env\": \"production\"}"
                }
            }
            ]
        }
        ]
    })
)
java
Component component = Component.Builder.create(this, "JsonComponent")
        .platform(Platform.LINUX)
        .data(ComponentData.fromJsonObject(Map.of(
                "schemaVersion", ComponentSchemaVersion.V1_0,
                "phases", List.of(Map.of(
                        "name", ComponentPhaseName.BUILD,
                        "steps", List.of(Map.of(
                                "name", "configure-app",
                                "action", ComponentAction.CREATE_FILE,
                                "inputs", Map.of(
                                        "path", "/etc/myapp/config.json",
                                        "content", "{\"env\": \"production\"}"))))))))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var component = new Component(this, "JsonComponent", new ComponentProps {
    Platform = Platform.LINUX,
    Data = ComponentData.FromJsonObject(new Dictionary<string, object> {
        { "schemaVersion", ComponentSchemaVersion.V1_0 },
        { "phases", new [] { new Dictionary<string, object> {
            { "name", ComponentPhaseName.BUILD },
            { "steps", new [] { new Struct {
                Name = "configure-app",
                Action = ComponentAction.CREATE_FILE,
                Inputs = new Struct {
                    Path = "/etc/myapp/config.json",
                    Content = "{\"env\": \"production\"}"
                }
            } } }
        } } }
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
component := imagebuilder.NewComponent(this, jsii.String("JsonComponent"), &ComponentProps{
	Platform: imagebuilder.Platform_LINUX,
	Data: imagebuilder.ComponentData_FromJsonObject(map[string]interface{}{
		"schemaVersion": imagebuilder.ComponentSchemaVersion_V1_0,
		"phases": []interface{}{
			map[string]interface{}{
				"name": imagebuilder.ComponentPhaseName_BUILD,
				"steps": []map[string]interface{}{
					map[string]interface{}{
						"name": jsii.String("configure-app"),
						"action": imagebuilder.ComponentAction_CREATE_FILE,
						"inputs": map[string]*string{
							"path": jsii.String("/etc/myapp/config.json"),
							"content": jsii.String("{\"env\": \"production\"}"),
						},
					},
				},
			},
		},
	}),
})

Members ​

MemberDescription
APPEND_FILEThe AppendFile action adds the provided content to the pre-existing content of a file.
ASSERTThe Assert action performs value with comparison/logic operators, and succeeds/fails the step based on the outcome of the assertion.
COPY_FILEThe CopyFile action copies files from a source file to a destination.
COPY_FOLDERThe CopyFolder action copies folders from a source to a destination.
CREATE_FILEThe CreateFile action creates a file in the provided location.
CREATE_FOLDERThe CreateFolder action creates a folder in the provided location.
CREATE_SYMLINKThe CreateSymlink action creates symbolic links from a given path to a target.
DELETE_FILEThe DeleteFile action deletes file(s) in the provided location.
DELETE_FOLDERThe DeleteFolder action deletes folders in the provided location.
EXECUTE_BASHThe ExecuteBash action runs bash scripts with inline bash commands.
EXECUTE_BINARYThe ExecuteBinary action runs a provided binary executable.
EXECUTE_DOCUMENTThe ExecuteDocument action allows running other component documents from within a given component.
EXECUTE_POWERSHELLThe ExecutePowershell action runs PowerShell scripts with inline PowerShell commands.
INSTALL_MSIThe InstallMSI action runs a Windows application with the provided MSI file.
LIST_FILESThe ListFiles action lists files in the provided folder.
MOVE_FILEThe MoveFile action moves files from a source to a destination.
MOVE_FOLDERThe MoveFolder action moves folders from a source to a destination.
READ_FILEThe ReadFile action reads the content of a text file.
REBOOTThe Reboot action reboots the instance.
SET_FILE_ENCODINGThe SetFileEncoding action modifies the encoding property of an existing file.
SET_FILE_OWNERThe SetFileOwner action modifies the owner and group ownership properties of an existing file.
SET_FOLDER_OWNERThe SetFolderOwner action recursively modifies the owner and group ownership properties of an existing folder.
SET_FILE_PERMISSIONSThe SetFilePermissions action modifies the permission of an existing file.
SET_FOLDER_PERMISSIONSThe SetFolderPermissions action recursively modifies the permissions of an existing folder and all of its subfiles and subfolders.
SET_REGISTRYThe SetRegistry action sets the value for the specified Windows registry key.
S3_DOWNLOADThe S3Download action downloads an Amazon S3 object/folder to a local destination.
S3_UPLOADThe S3Upload action uploads a file or folder to an Amazon S3 location.
UNINSTALL_MSIThe UninstallMSI action removes a Windows application using an MSI file.
UPDATE_OSThe UpdateOS action installs OS updates.
WEB_DOWNLOADThe WebDownload action downloads files from a URL to a local destination.

Referenced by ​