Skip to content

AssetStaging

Stages a file or directory from a location on the file system into a staging directory.

This is controlled by the context key 'aliyun:ros:disable-asset-staging' and enabled by the CLI by default in order to ensure that when the CDK app exists, all assets are available for deployment. Otherwise, if an app references assets in temporary locations, those will not be available when it exists.

The stagedPath property is a stringified token that represents the location of the file or directory after staging. It will be resolved only during the "prepare" stage and may be either the original path or the staged path depending on the context setting.

The file/directory are staged based on their content hash (fingerprint). This means that only if content was changed, copy will happen.

Initializers

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.NewAssetStaging(scope Construct, id *string, props AssetStagingProps) AssetStaging
Name Type Description
scope Construct No description.
id *string No description.
props AssetStagingProps No description.

scopeRequired


idRequired

  • Type: *string

propsRequired


Methods

Name Description
ToString Returns a string representation of this construct.
Synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
RelativeStagedPath Return the path to the staged asset, relative to the Cloud Assembly (manifest) directory of the given stack.

ToString

func ToString() *string

Returns a string representation of this construct.

Synthesize

func Synthesize(session ISynthesisSession)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

The synthesis session.


RelativeStagedPath

func RelativeStagedPath(stack Stack) *string

Return the path to the staged asset, relative to the Cloud Assembly (manifest) directory of the given stack.

Only returns a relative path if the asset was staged, returns an absolute path if it was not staged.

A bundled asset might end up in the outDir and still not count as "staged"; if asset staging is disabled we're technically expected to reference source directories, but we don't have a source directory for the bundled outputs (as the bundle output is written to a temporary directory). Nevertheless, we will still return an absolute path.

A non-obvious directory layout may look like this:

   CLOUD ASSEMBLY ROOT
     +-- asset.12345abcdef/
     +-- assembly-Stage
           +-- MyStack.template.json
           +-- MyStack.assets.json <- will contain { "path": "../asset.12345abcdef" }

stackRequired


Static Functions

Name Description
IsConstruct Return whether the given object is a Construct.
ClearAssetHashCache Clears the asset hash cache.

IsConstruct

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.AssetStaging_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct.

xRequired

  • Type: interface{}

ClearAssetHashCache

import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.AssetStaging_ClearAssetHashCache()

Clears the asset hash cache.

Properties

Name Type Description
Node ConstructNode The construct tree node associated with this construct.
AbsoluteStagedPath *string Absolute path to the asset data.
AssetHash *string A cryptographic hash of the asset.
IsArchive *bool Whether this asset is an archive (zip or jar).
Packaging FileAssetPackaging How this asset should be packaged.
SourcePath *string The absolute path of the asset as it was referenced by the user.

NodeRequired

func Node() ConstructNode

The construct tree node associated with this construct.


AbsoluteStagedPathRequired

func AbsoluteStagedPath() *string
  • Type: *string

Absolute path to the asset data.

If asset staging is disabled, this will just be the source path or a temporary directory used for bundling.

If asset staging is enabled it will be the staged path.

IMPORTANT: If you are going to call addFileAsset(), use relativeStagedPath() instead.


AssetHashRequired

func AssetHash() *string
  • Type: *string

A cryptographic hash of the asset.


IsArchiveRequired

func IsArchive() *bool
  • Type: *bool

Whether this asset is an archive (zip or jar).


PackagingRequired

func Packaging() FileAssetPackaging

How this asset should be packaged.


SourcePathRequired

func SourcePath() *string
  • Type: *string

The absolute path of the asset as it was referenced by the user.


Constants

Name Type Description
BundlingInputDir *string The directory inside the bundling container into which the asset sources will be mounted.
BundlingOutputDir *string The directory inside the bundling container into which the bundled output should be written.

BundlingInputDirRequired

func BundlingInputDir() *string
  • Type: *string

The directory inside the bundling container into which the asset sources will be mounted.


BundlingOutputDirRequired

func BundlingOutputDir() *string
  • Type: *string

The directory inside the bundling container into which the bundled output should be written.