class AssetCode
| Language | Type name | 
|---|---|
|  .NET | Amazon.CDK.AWS.Synthetics.AssetCode | 
|  Java | software.amazon.awscdk.services.synthetics.AssetCode | 
|  Python | aws_cdk.aws_synthetics.AssetCode | 
|  TypeScript (source) | @aws-cdk/aws-synthetics»AssetCode | 
Extends
Code
Canary code from an Asset.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as assets from '@aws-cdk/assets';
import * as iam from '@aws-cdk/aws-iam';
import * as synthetics from '@aws-cdk/aws-synthetics';
import * as cdk from '@aws-cdk/core';
declare const dockerImage: cdk.DockerImage;
declare const grantable: iam.IGrantable;
declare const localBundling: cdk.ILocalBundling;
const assetCode = new synthetics.AssetCode('assetPath', /* all optional props */ {
  assetHash: 'assetHash',
  assetHashType: cdk.AssetHashType.SOURCE,
  bundling: {
    image: dockerImage,
    // the properties below are optional
    command: ['command'],
    entrypoint: ['entrypoint'],
    environment: {
      environmentKey: 'environment',
    },
    local: localBundling,
    outputType: cdk.BundlingOutput.ARCHIVED,
    securityOpt: 'securityOpt',
    user: 'user',
    volumes: [{
      containerPath: 'containerPath',
      hostPath: 'hostPath',
      // the properties below are optional
      consistency: cdk.DockerVolumeConsistency.CONSISTENT,
    }],
    workingDirectory: 'workingDirectory',
  },
  exclude: ['exclude'],
  follow: assets.FollowMode.NEVER,
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
  readers: [grantable],
  sourceHash: 'sourceHash',
});
Initializer
new AssetCode(assetPath: string, options?: AssetOptions)
Parameters
- assetPath string— The path to the asset file or directory.
- options AssetOptions 
Methods
| Name | Description | 
|---|---|
| bind(scope, handler, family) | Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun. | 
bind(scope, handler, family)
public bind(scope: Construct, handler: string, family: RuntimeFamily): CodeConfig
Parameters
- scope Construct
- handler string
- family RuntimeFamily 
Returns
Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
