class AccessPoint (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.S3ObjectLambda.Alpha.AccessPoint |
Go | github.com/aws/aws-cdk-go/awscdks3objectlambdaalpha/v2#AccessPoint |
Java | software.amazon.awscdk.services.s3objectlambda.alpha.AccessPoint |
Python | aws_cdk.aws_s3objectlambda_alpha.AccessPoint |
TypeScript (source) | @aws-cdk/aws-s3objectlambda-alpha ยป AccessPoint |
Implements
IConstruct
, IDependable
, IResource
, IAccess
An S3 object lambda access point for intercepting and transforming GetObject
requests.
Example
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha';
import * as cdk from 'aws-cdk-lib';
const stack = new cdk.Stack();
const bucket = new s3.Bucket(stack, 'MyBucket');
const handler = new lambda.Function(stack, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
code: lambda.Code.fromAsset('lambda.zip'),
});
new s3objectlambda.AccessPoint(stack, 'MyObjectLambda', {
bucket,
handler,
accessPointName: 'my-access-point',
payload: {
prop: "value",
},
});
Initializer
new AccessPoint(scope: Construct, id: string, props: AccessPointProps)
Parameters
- scope
Construct
- id
string
- props
Access
Point Props
Construct Props
Name | Type | Description |
---|---|---|
bucket | IBucket | The bucket to which this access point belongs. |
handler | IFunction | The Lambda function used to transform objects. |
access | string | The name of the S3 object lambda access point. |
cloud | boolean | Whether CloudWatch metrics are enabled for the access point. |
payload? | { [string]: any } | Additional JSON that provides supplemental data passed to the Lambda function on every request. |
supports | boolean | Whether the Lambda function can process GetObject-PartNumber requests. |
supports | boolean | Whether the Lambda function can process GetObject-Range requests. |
bucket
Type:
IBucket
The bucket to which this access point belongs.
handler
Type:
IFunction
The Lambda function used to transform objects.
accessPointName?
Type:
string
(optional, default: a unique name will be generated)
The name of the S3 object lambda access point.
cloudWatchMetricsEnabled?
Type:
boolean
(optional, default: false)
Whether CloudWatch metrics are enabled for the access point.
payload?
Type:
{ [string]: any }
(optional, default: No data.)
Additional JSON that provides supplemental data passed to the Lambda function on every request.
supportsGetObjectPartNumber?
Type:
boolean
(optional, default: false)
Whether the Lambda function can process GetObject-PartNumber
requests.
supportsGetObjectRange?
Type:
boolean
(optional, default: false)
Whether the Lambda function can process GetObject-Range
requests.
Properties
Name | Type | Description |
---|---|---|
access | string | The ARN of the access point. |
access | string | The creation data of the access point. |
access | string | The ARN of the access point. |
domain | string | Implement the IAccessPoint.domainName field. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
regional | string | Implement the IAccessPoint.regionalDomainName field. |
stack | Stack | The stack in which this resource is defined. |
accessPointArn
Type:
string
The ARN of the access point.
accessPointCreationDate
Type:
string
The creation data of the access point.
accessPointName
Type:
string
The ARN of the access point.
domainName
Type:
string
Implement the IAccessPoint.domainName
field.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
regionalDomainName
Type:
string
Implement the IAccessPoint.regionalDomainName
field.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
virtual | Implement the IAccessPoint.virtualHostedUrlForObject method. |
static from | Reference an existing AccessPoint defined outside of the CDK code. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
HostedUrlForObject(key?, options?)
virtualpublic virtualHostedUrlForObject(key?: string, options?: VirtualHostedStyleUrlOptions): string
Parameters
- key
string
- options
Virtual
Hosted Style Url Options
Returns
string
Implement the IAccessPoint.virtualHostedUrlForObject
method.
AccessPointAttributes(scope, id, attrs)
static frompublic static fromAccessPointAttributes(scope: Construct, id: string, attrs: AccessPointAttributes): IAccessPoint
Parameters
- scope
Construct
- id
string
- attrs
Access
Point Attributes
Returns
Reference an existing AccessPoint defined outside of the CDK code.