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 com.aliyun.ros.cdk.ossdeployment.Source;
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 com.aliyun.ros.cdk.ossdeployment.Source;
Source.asset(java.lang.String path),Source.asset(java.lang.String path, AssetOptions options),Source.asset(java.lang.String path, AssetOptions options, java.lang.String objectPrefix)

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: java.lang.String

The path to a local file or a directory.


optionsOptional

  • Type: com.aliyun.ros.cdk.ossassets.AssetOptions

Options for the Asset.


objectPrefixOptional

  • Type: java.lang.String

The prefix of object key.

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


bucket

import com.aliyun.ros.cdk.ossdeployment.Source;
Source.bucket(java.lang.String OR IResolvable OR Bucket bucket, java.lang.String OR IResolvable objectKey)

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: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable OR com.aliyun.ros.cdk.oss.Bucket

The OSS Bucket.


objectKeyRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

The path of.


data

import com.aliyun.ros.cdk.ossdeployment.Source;
Source.data(java.lang.String objectKey, java.lang.String data)

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

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

objectKeyRequired

  • Type: java.lang.String

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


dataRequired

  • Type: java.lang.String

The data to be stored in the object.


jsonData

import com.aliyun.ros.cdk.ossdeployment.Source;
Source.jsonData(java.lang.String objectKey, java.lang.Object obj)

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

objectKeyRequired

  • Type: java.lang.String

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


objRequired

  • Type: java.lang.Object

A JSON object.


Protocols