# FileAsset

A file asset.

- Source: [`lib/assets/file-asset.ts`](https://github.com/aws/aws-cdk-cli/blob/HEAD/packages/@aws-cdk/cloud-assembly-schema/lib/assets/file-asset.ts)
- Type last changed: v2.187.0 · 31 Mar 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';

declare const assumeRoleAdditionalOptions: any;
const fileAsset: cloud_assembly_schema.FileAsset = {
  destinations: {
    destinationsKey: {
      bucketName: 'bucketName',
      objectKey: 'objectKey',

      // the properties below are optional
      assumeRoleAdditionalOptions: {
        assumeRoleAdditionalOptionsKey: assumeRoleAdditionalOptions,
      },
      assumeRoleArn: 'assumeRoleArn',
      assumeRoleExternalId: 'assumeRoleExternalId',
      region: 'region',
    },
  },
  source: {
    executable: ['executable'],
    packaging: cloud_assembly_schema.FileAssetPackaging.FILE,
    path: 'path',
  },

  // the properties below are optional
  displayName: 'displayName',
};
```

Python:

```python
from aws_cdk.cloud_assembly_schema import FileAsset, FileDestination, FileSource
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cloud_assembly_schema

# assume_role_additional_options: Any

file_asset = FileAsset(
    destinations={
        "destinations_key": FileDestination(
            bucket_name="bucketName",
            object_key="objectKey",

            # the properties below are optional
            assume_role_additional_options={
                "assume_role_additional_options_key": assume_role_additional_options
            },
            assume_role_arn="assumeRoleArn",
            assume_role_external_id="assumeRoleExternalId",
            region="region"
        )
    },
    source=FileSource(
        executable=["executable"],
        packaging=cloud_assembly_schema.FileAssetPackaging.FILE,
        path="path"
    ),

    # the properties below are optional
    display_name="displayName"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cloud_assembly_schema.*;

Object assumeRoleAdditionalOptions;

FileAsset fileAsset = FileAsset.builder()
        .destinations(Map.of(
                "destinationsKey", FileDestination.builder()
                        .bucketName("bucketName")
                        .objectKey("objectKey")

                        // the properties below are optional
                        .assumeRoleAdditionalOptions(Map.of(
                                "assumeRoleAdditionalOptionsKey", assumeRoleAdditionalOptions))
                        .assumeRoleArn("assumeRoleArn")
                        .assumeRoleExternalId("assumeRoleExternalId")
                        .region("region")
                        .build()))
        .source(FileSource.builder()
                .executable(List.of("executable"))
                .packaging(FileAssetPackaging.FILE)
                .path("path")
                .build())

        // the properties below are optional
        .displayName("displayName")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.Cloud_assembly_schema;

var assumeRoleAdditionalOptions;

var fileAsset = new FileAsset {
    Destinations = new Dictionary<string, FileDestination> {
        { "destinationsKey", new FileDestination {
            BucketName = "bucketName",
            ObjectKey = "objectKey",

            // the properties below are optional
            AssumeRoleAdditionalOptions = new Dictionary<string, object> {
                { "assumeRoleAdditionalOptionsKey", assumeRoleAdditionalOptions }
            },
            AssumeRoleArn = "assumeRoleArn",
            AssumeRoleExternalId = "assumeRoleExternalId",
            Region = "region"
        } }
    },
    Source = new FileSource {
        Executable = new [] { "executable" },
        Packaging = FileAssetPackaging.FILE,
        Path = "path"
    },

    // the properties below are optional
    DisplayName = "displayName"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var assumeRoleAdditionalOptions interface{}

fileAsset := &FileAsset{
	Destinations: map[string]FileDestination{
		"destinationsKey": &FileDestination{
			"bucketName": jsii.String("bucketName"),
			"objectKey": jsii.String("objectKey"),

			// the properties below are optional
			"assumeRoleAdditionalOptions": map[string]interface{}{
				"assumeRoleAdditionalOptionsKey": assumeRoleAdditionalOptions,
			},
			"assumeRoleArn": jsii.String("assumeRoleArn"),
			"assumeRoleExternalId": jsii.String("assumeRoleExternalId"),
			"region": jsii.String("region"),
		},
	},
	Source: &FileSource{
		Executable: []*string{
			jsii.String("executable"),
		},
		Packaging: awscdk.Cloud_assembly_schema.FileAssetPackaging_FILE,
		Path: jsii.String("path"),
	},

	// the properties below are optional
	DisplayName: jsii.String("displayName"),
}
```

## Properties

- `destinations`: { [key: string]: [FileDestination](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.FileDestination.html) } (required) — Destinations for this file asset.

- `displayName`: string — A display name for this asset.

  **Default:** The identifier will be used as the display name

- `source`: [FileSource](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.FileSource.html) (required) — Source description for file assets.
