How to use the @aws-cdk/cx-api.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT function in @aws-cdk/cx-api

To help you get started, we’ve selected a few @aws-cdk/cx-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / aws-cdk / lib / api / cxapp / exec.ts View on Github external
let pathMetadata: boolean = config.settings.get(['pathMetadata']);
  if (pathMetadata === undefined) {
      pathMetadata = true; // defaults to true
  }

  if (pathMetadata) {
    context[cxapi.PATH_METADATA_ENABLE_CONTEXT] = true;
  }

  let assetMetadata: boolean = config.settings.get(['assetMetadata']);
  if (assetMetadata === undefined) {
    assetMetadata = true; // defaults to true
  }

  if (assetMetadata) {
    context[cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT] = true;
  }

  let versionReporting: boolean = config.settings.get(['versionReporting']);
  if (versionReporting === undefined) {
    versionReporting = true; // defaults to true
  }

  if (!versionReporting) {
    context[cxapi.DISABLE_VERSION_REPORTING] = true;
  }

  let stagingEnabled = config.settings.get(['staging']);
  if (stagingEnabled === undefined) {
    stagingEnabled = true;
  }
  if (!stagingEnabled) {
github aws / aws-cdk / packages / @aws-cdk / aws-s3-assets / lib / asset.ts View on Github external
public addResourceMetadata(resource: cdk.CfnResource, resourceProperty: string) {
    if (!this.node.tryGetContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)) {
      return; // not enabled
    }

    // tell tools such as SAM CLI that the "Code" property of this resource
    // points to a local path in order to enable local invocation of this function.
    resource.cfnOptions.metadata = resource.cfnOptions.metadata || { };
    resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PATH_KEY] = this.assetPath;
    resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PROPERTY_KEY] = resourceProperty;
  }