Skip to content
v2.277.0

InlineCode Class ​

Canary code from an inline string.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_synthetics as synthetics } from 'aws-cdk-lib';
const inlineCode = new synthetics.InlineCode('code');
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_synthetics as synthetics

inline_code = synthetics.InlineCode("code")
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.synthetics.*;

InlineCode inlineCode = new InlineCode("code");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Synthetics;

var inlineCode = new InlineCode("code");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

inlineCode := awscdk.Aws_synthetics.NewInlineCode(jsii.String("code"))

Initializer ​

ts
new InlineCode(code: string)
python
InlineCode(code: str)
java
new InlineCode(String code)
csharp
new InlineCode(string code)
go
NewInlineCode(Code *string)

Methods ​

bind(scope: Construct, handler: string, _family: RuntimeFamily, _runtimeName?: string): CodeConfigdef bind(self, scope: Construct, handler: str, _family: RuntimeFamily, _runtime_name: typing.Optional[str] = None) -> CodeConfigpublic CodeConfig bind(Construct scope, String handler, RuntimeFamily _family, String _runtimeName)public CodeConfig Bind(Construct scope, string handler, RuntimeFamily _family, string? _runtimeName = null)func Bind(Scope Construct, Handler *string, _family RuntimeFamily, _runtimeName *string) CodeConfig#
Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
fromAsset(assetPath: string, options?: AssetOptions): AssetCode@staticmethod def from_asset(asset_path: str, options: typing.Optional[AssetOptions] = None) -> AssetCodepublic static AssetCode fromAsset(String assetPath, AssetOptions options)public static AssetCode FromAsset(string assetPath, AssetOptions? options = null)func FromAsset(AssetPath *string, Options AssetOptions) AssetCodestatic#
Specify code from a local path.

Path must include the folder structure nodejs/node_modules/myCanaryFilename.js.

1 parameter · returns

Parameters

  • assetPathasset_pathassetPathassetPathAssetPath — Either a directory or a .zip file.

Returns: AssetCode associated with the specified path.

fromBucket(bucket: IBucketRef, key: string, objectVersion?: string): S3Code@staticmethod def from_bucket(bucket: IBucketRef, key: str, object_version: typing.Optional[str] = None) -> S3Codepublic static S3Code fromBucket(IBucketRef bucket, String key, String objectVersion)public static S3Code FromBucket(IBucketRef bucket, string key, string? objectVersion = null)func FromBucket(Bucket IBucketRef, Key *string, ObjectVersion *string) S3Codestatic#
Specify code from an s3 bucket.

The object in the s3 bucket must be a .zip file that contains the structure nodejs/node_modules/myCanaryFilename.js.

3 parameters · returns

Parameters

  • bucketbucketbucketbucketBucket — The S3 bucket.
  • keykeykeykeyKey — The object key.
  • objectVersionobject_versionobjectVersionobjectVersionObjectVersion — Optional S3 object version.

Returns: S3Code associated with the specified S3 object.

fromInline(code: string): InlineCode // chainable@staticmethod def from_inline(code: str) -> InlineCodepublic static InlineCode fromInline(String code)public static InlineCode FromInline(string code)func FromInline(Code *string) InlineCodestatic#
Specify code inline.
1 parameter · returns

Parameters

  • codecodecodecodeCode — The actual handler code (limited to 5MB).

Returns: InlineCode with inline code.