All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cloudshiftdev.awscdk.services.lambda.CfnLayerVersionPermission.kt Maven / Gradle / Ivy

There is a newer version: 0.10.0
Show newest version
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")

package io.cloudshiftdev.awscdk.services.lambda

import io.cloudshiftdev.awscdk.CfnResource
import io.cloudshiftdev.awscdk.IInspectable
import io.cloudshiftdev.awscdk.TreeInspector
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import kotlin.String
import kotlin.Unit
import io.cloudshiftdev.constructs.Construct as CloudshiftdevConstructsConstruct
import software.constructs.Construct as SoftwareConstructsConstruct

/**
 * The `AWS::Lambda::LayerVersionPermission` resource adds permissions to the resource-based policy
 * of a version of an [Lambda
 * layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) . Use this action to
 * grant layer usage permission to other accounts. You can grant permission to a single account, all
 * AWS accounts, or all accounts in an organization.
 *
 *
 * Since the release of the
 * [UpdateReplacePolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html)
 * both `UpdateReplacePolicy` and `DeletionPolicy` are required to protect your
 * Resources/LayerPermissions from deletion.
 *
 *
 * Example:
 *
 * ```
 * // The code below shows an example of how to instantiate this type.
 * // The values are placeholders you should change.
 * import io.cloudshiftdev.awscdk.services.lambda.*;
 * CfnLayerVersionPermission cfnLayerVersionPermission =
 * CfnLayerVersionPermission.Builder.create(this, "MyCfnLayerVersionPermission")
 * .action("action")
 * .layerVersionArn("layerVersionArn")
 * .principal("principal")
 * // the properties below are optional
 * .organizationId("organizationId")
 * .build();
 * ```
 *
 * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html)
 */
public open class CfnLayerVersionPermission(
  cdkObject: software.amazon.awscdk.services.lambda.CfnLayerVersionPermission,
) : CfnResource(cdkObject),
    IInspectable {
  public constructor(
    scope: CloudshiftdevConstructsConstruct,
    id: String,
    props: CfnLayerVersionPermissionProps,
  ) :
      this(software.amazon.awscdk.services.lambda.CfnLayerVersionPermission(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
      id, props.let(CfnLayerVersionPermissionProps.Companion::unwrap))
  )

  public constructor(
    scope: CloudshiftdevConstructsConstruct,
    id: String,
    props: CfnLayerVersionPermissionProps.Builder.() -> Unit,
  ) : this(scope, id, CfnLayerVersionPermissionProps(props)
  )

  /**
   * The API action that grants access to the layer.
   */
  public open fun action(): String = unwrap(this).getAction()

  /**
   * The API action that grants access to the layer.
   */
  public open fun action(`value`: String) {
    unwrap(this).setAction(`value`)
  }

  /**
   * ID generated by service.
   */
  public open fun attrId(): String = unwrap(this).getAttrId()

  /**
   * Examines the CloudFormation resource and discloses attributes.
   *
   * @param inspector tree inspector to collect and process attributes. 
   */
  public override fun inspect(inspector: TreeInspector) {
    unwrap(this).inspect(inspector.let(TreeInspector.Companion::unwrap))
  }

  /**
   * The name or Amazon Resource Name (ARN) of the layer.
   */
  public open fun layerVersionArn(): String = unwrap(this).getLayerVersionArn()

  /**
   * The name or Amazon Resource Name (ARN) of the layer.
   */
  public open fun layerVersionArn(`value`: String) {
    unwrap(this).setLayerVersionArn(`value`)
  }

  /**
   * With the principal set to `*` , grant permission to all accounts in the specified organization.
   */
  public open fun organizationId(): String? = unwrap(this).getOrganizationId()

  /**
   * With the principal set to `*` , grant permission to all accounts in the specified organization.
   */
  public open fun organizationId(`value`: String) {
    unwrap(this).setOrganizationId(`value`)
  }

  /**
   * An account ID, or `*` to grant layer usage permission to all accounts in an organization, or
   * all AWS accounts (if `organizationId` is not specified).
   */
  public open fun principal(): String = unwrap(this).getPrincipal()

  /**
   * An account ID, or `*` to grant layer usage permission to all accounts in an organization, or
   * all AWS accounts (if `organizationId` is not specified).
   */
  public open fun principal(`value`: String) {
    unwrap(this).setPrincipal(`value`)
  }

  /**
   * A fluent builder for [io.cloudshiftdev.awscdk.services.lambda.CfnLayerVersionPermission].
   */
  @CdkDslMarker
  public interface Builder {
    /**
     * The API action that grants access to the layer.
     *
     * For example, `lambda:GetLayerVersion` .
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-action)
     * @param action The API action that grants access to the layer. 
     */
    public fun action(action: String)

    /**
     * The name or Amazon Resource Name (ARN) of the layer.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-layerversionarn)
     * @param layerVersionArn The name or Amazon Resource Name (ARN) of the layer. 
     */
    public fun layerVersionArn(layerVersionArn: String)

    /**
     * With the principal set to `*` , grant permission to all accounts in the specified
     * organization.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-organizationid)
     * @param organizationId With the principal set to `*` , grant permission to all accounts in the
     * specified organization. 
     */
    public fun organizationId(organizationId: String)

    /**
     * An account ID, or `*` to grant layer usage permission to all accounts in an organization, or
     * all AWS accounts (if `organizationId` is not specified).
     *
     * For the last case, make sure that you really do want all AWS accounts to have usage
     * permission to this layer.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-principal)
     * @param principal An account ID, or `*` to grant layer usage permission to all accounts in an
     * organization, or all AWS accounts (if `organizationId` is not specified). 
     */
    public fun principal(principal: String)
  }

  private class BuilderImpl(
    scope: SoftwareConstructsConstruct,
    id: String,
  ) : Builder {
    private val cdkBuilder: software.amazon.awscdk.services.lambda.CfnLayerVersionPermission.Builder
        = software.amazon.awscdk.services.lambda.CfnLayerVersionPermission.Builder.create(scope, id)

    /**
     * The API action that grants access to the layer.
     *
     * For example, `lambda:GetLayerVersion` .
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-action)
     * @param action The API action that grants access to the layer. 
     */
    override fun action(action: String) {
      cdkBuilder.action(action)
    }

    /**
     * The name or Amazon Resource Name (ARN) of the layer.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-layerversionarn)
     * @param layerVersionArn The name or Amazon Resource Name (ARN) of the layer. 
     */
    override fun layerVersionArn(layerVersionArn: String) {
      cdkBuilder.layerVersionArn(layerVersionArn)
    }

    /**
     * With the principal set to `*` , grant permission to all accounts in the specified
     * organization.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-organizationid)
     * @param organizationId With the principal set to `*` , grant permission to all accounts in the
     * specified organization. 
     */
    override fun organizationId(organizationId: String) {
      cdkBuilder.organizationId(organizationId)
    }

    /**
     * An account ID, or `*` to grant layer usage permission to all accounts in an organization, or
     * all AWS accounts (if `organizationId` is not specified).
     *
     * For the last case, make sure that you really do want all AWS accounts to have usage
     * permission to this layer.
     *
     * [Documentation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversionpermission.html#cfn-lambda-layerversionpermission-principal)
     * @param principal An account ID, or `*` to grant layer usage permission to all accounts in an
     * organization, or all AWS accounts (if `organizationId` is not specified). 
     */
    override fun principal(principal: String) {
      cdkBuilder.principal(principal)
    }

    public fun build(): software.amazon.awscdk.services.lambda.CfnLayerVersionPermission =
        cdkBuilder.build()
  }

  public companion object {
    public val CFN_RESOURCE_TYPE_NAME: String =
        software.amazon.awscdk.services.lambda.CfnLayerVersionPermission.CFN_RESOURCE_TYPE_NAME

    public operator fun invoke(
      scope: CloudshiftdevConstructsConstruct,
      id: String,
      block: Builder.() -> Unit = {},
    ): CfnLayerVersionPermission {
      val builderImpl = BuilderImpl(CloudshiftdevConstructsConstruct.unwrap(scope), id)
      return CfnLayerVersionPermission(builderImpl.apply(block).build())
    }

    internal fun wrap(cdkObject: software.amazon.awscdk.services.lambda.CfnLayerVersionPermission):
        CfnLayerVersionPermission = CfnLayerVersionPermission(cdkObject)

    internal fun unwrap(wrapped: CfnLayerVersionPermission):
        software.amazon.awscdk.services.lambda.CfnLayerVersionPermission = wrapped.cdkObject as
        software.amazon.awscdk.services.lambda.CfnLayerVersionPermission
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy