Skip to content

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 { Source } from '@alicloud/ros-cdk-ossdeployment'
new 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.
jsonData Deploys an object with the specified JSON object into the bucket.

asset

import { Source } from '@alicloud/ros-cdk-ossdeployment'
Source.asset(path: string, options?: AssetOptions, objectPrefix?: string)

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.

pathRequired

  • Type: string

The path to a local file or a directory.


optionsOptional

  • Type: @alicloud/ros-cdk-ossassets.AssetOptions

Options for the Asset.


objectPrefixOptional

  • Type: string

The prefix of object key.

You can use it to specify the location of the object in the target bucket.


bucket

import { Source } from '@alicloud/ros-cdk-ossdeployment'
Source.bucket(bucket: string | IResolvable | Bucket, objectKey: string | 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.

bucketRequired

  • Type: string | @alicloud/ros-cdk-core.IResolvable | @alicloud/ros-cdk-oss.Bucket

The OSS Bucket.


objectKeyRequired

  • Type: string | @alicloud/ros-cdk-core.IResolvable

The path of.


data

import { Source } from '@alicloud/ros-cdk-ossdeployment'
Source.data(objectKey: string, data: string)

Deploys an object with the specified string contents into the bucket.

To store a JSON object use Source.jsonData().

objectKeyRequired

  • Type: string

The destination OSS object key (relative to the root of the OSS deployment).


dataRequired

  • Type: string

The data to be stored in the object.


jsonData

import { Source } from '@alicloud/ros-cdk-ossdeployment'
Source.jsonData(objectKey: string, obj: any)

Deploys an object with the specified JSON object into the bucket.

objectKeyRequired

  • Type: string

The destination OSS object key (relative to the root of the OSS deployment).


objRequired

  • Type: any

A JSON object.


Protocols