Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(efs): allow AccessPoint to set client token #31184

Merged
merged 5 commits into from
Oct 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add clientToken prop for AccessPoint
perrylson committed Aug 22, 2024
commit bdd4b635253379e8c8f165f9cadd13470437c220

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -458,6 +458,7 @@
"Value": "test-efs-integ/FileSystem/AccessPoint"
}
],
"ClientToken": "client-token",
"FileSystemId": {
"Ref": "FileSystem8A8E25C0"
},

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ fileSystem.addAccessPoint('AccessPoint', {
gid: '1000',
uid: '1000',
},
clientToken: 'client-token',
});

new integ.IntegTest(app, 'test-efs-integ-test', {
3 changes: 2 additions & 1 deletion packages/aws-cdk-lib/aws-efs/README.md
Original file line number Diff line number Diff line change
@@ -217,7 +217,8 @@ the access point can only access data in its own directory and below. To learn m
Use the `addAccessPoint` API to create an access point from a fileSystem.

```ts fixture=with-filesystem-instance
fileSystem.addAccessPoint('AccessPoint');
fileSystem.addAccessPoint('MyAccessPoint', {clientToken: 'client-token',
});
```

By default, when you create an access point, the root(`/`) directory is exposed to the client
10 changes: 10 additions & 0 deletions packages/aws-cdk-lib/aws-efs/lib/access-point.ts
Original file line number Diff line number Diff line change
@@ -102,6 +102,15 @@ export interface AccessPointOptions {
* @default - user identity not enforced
*/
readonly posixUser?: PosixUser;

/**
* The opaque string specified in the request to ensure idempotent creation.
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-accesspoint.html#cfn-efs-accesspoint-clienttoken
*
* @default - No client token.
*/
readonly clientToken?: string;
}

/**
@@ -216,6 +225,7 @@ export class AccessPoint extends AccessPointBase {
gid: props.posixUser.gid,
secondaryGids: props.posixUser.secondaryGids,
} : undefined,
clientToken: props.clientToken,
});

Tags.of(this).add('Name', this.node.path);
13 changes: 13 additions & 0 deletions packages/aws-cdk-lib/aws-efs/test/access-point.test.ts
Original file line number Diff line number Diff line change
@@ -50,6 +50,19 @@ test('support tags for AccessPoint', () => {
});
});

test('allow client token to be set for AccessPoint', () => {
// WHEN
new AccessPoint(stack, 'MyAccessPoint', {
fileSystem,
clientToken: 'client-token',
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::EFS::AccessPoint', {
ClientToken: 'client-token',
});
});

test('import an AccessPoint using fromAccessPointId', () => {
// WHEN
const ap = new AccessPoint(stack, 'MyAccessPoint', {
Loading