Source
Specifies bucket deployment source.
Usage:
Source.bucket(bucketName, objectKey)
Source.asset('/local/path/to/directory')
Source.asset('/local/path/to/a/file.zip')
Source.data('hello/world/file.txt', 'Hello, world!')
Source.jsonData('config.json', { key: value })
Initializers
import ros_cdk_ossdeployment
ros_cdk_ossdeployment.Source()
Name | Type | Description |
---|---|---|
Static Functions
Name | Description |
---|---|
asset |
Uses a local file path as the source of the target bucket contents. |
bucket |
Uses a file stored in an OSS bucket as the source for the destination bucket contents. |
data |
Deploys an object with the specified string contents into the bucket. |
json_data |
Deploys an object with the specified JSON object into the bucket. |
asset
import ros_cdk_ossdeployment
ros_cdk_ossdeployment.Source.asset(
path: str,
exclude: typing.List[str] = None,
follow_symlinks: SymlinkFollowMode = None,
ignore_mode: IgnoreMode = None,
asset_hash: str = None,
asset_hash_type: AssetHashType = None,
bundling: BundlingOptions = None,
deploy_time: bool = None,
object_prefix: str = None
)
Uses a local file path as the source of the target bucket contents.
ROS CDK will create a temporary bucket and upload the files you want to upload to it. Make sure that the region id you specify in synth and deploy is the same region id as the destination upload bucket.
If the local asset is a .zip archive, make sure you trust the producer of the archive.
- Type: str
The path to a local file or a directory.
- Type: typing.List[str]
- Default: nothing is excluded
File paths matching the patterns will be excluded.
See ignoreMode
to set the matching behavior.
Has no effect on Assets bundled using the bundling
property.
- Type: ros_cdk_core.SymlinkFollowMode
- Default: SymlinkFollowMode.NEVER
A strategy for how to handle symlinks.
- Type: ros_cdk_core.IgnoreMode
- Default: IgnoreMode.GLOB
The ignore behavior to use for exclude
patterns.
- Type: str
- Default: based on
assetHashType
Specify a custom hash for this asset.
If assetHashType
is set it must
be set to AssetHashType.CUSTOM
. For consistency, this custom hash will
be SHA256 hashed and encoded as hex. The resulting hash will be the asset
hash.
NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to OSS bucket, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated.
- Type: ros_cdk_core.AssetHashType
- Default: the default is
AssetHashType.SOURCE
, but ifassetHash
is explicitly specified this value defaults toAssetHashType.CUSTOM
.
Specifies the type of hash to calculate for this asset.
If assetHash
is configured, this option must be undefined
or
AssetHashType.CUSTOM
.
- Type: ros_cdk_core.BundlingOptions
- Default: uploaded as-is to OSS bucket if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to OSS bucket otherwise.
Bundle the asset by executing a command in a Docker container or a custom bundling provider.
The asset path will be mounted at /asset-input
. The Docker
container is responsible for putting content at /asset-output
.
The content at /asset-output
will be zipped and used as the
final asset.
- Type: bool
- Default: false
Whether or not the asset needs to exist beyond deployment time;
i.e. are copied over to a different location and not needed afterwards. Setting this property to true has an impact on the lifecycle of the asset, because we will assume that it is safe to delete after the ROS deployment succeeds.
For example, FC Function assets are copied over to Function during deployment. Therefore, it is not necessary to store the asset in OSS bucket, so we consider those deployTime assets.
- Type: str
The prefix of object key.
You can use it to specify the location of the object in the target bucket.
bucket
import ros_cdk_ossdeployment
ros_cdk_ossdeployment.Source.bucket(
bucket: typing.Union[str, IResolvable, Bucket],
object_key: typing.Union[str, IResolvable]
)
Uses a file stored in an OSS bucket as the source for the destination bucket contents.
Make sure you trust the producer of the archive. The source bucket and the destination bucket must be in the same region.
- Type: typing.Union[str, ros_cdk_core.IResolvable, ros_cdk_oss.Bucket]
The OSS Bucket.
- Type: typing.Union[str, ros_cdk_core.IResolvable]
The path of.
data
import ros_cdk_ossdeployment
ros_cdk_ossdeployment.Source.data(
object_key: str,
data: str
)
Deploys an object with the specified string contents into the bucket.
To store a JSON object use Source.jsonData()
.
- Type: str
The destination OSS object key (relative to the root of the OSS deployment).
- Type: str
The data to be stored in the object.
json_data
import ros_cdk_ossdeployment
ros_cdk_ossdeployment.Source.json_data(
object_key: str,
obj: typing.Any
)
Deploys an object with the specified JSON object into the bucket.
- Type: str
The destination OSS object key (relative to the root of the OSS deployment).
- Type: typing.Any
A JSON object.