@maestro-js/aws-cdk-recipes 1.0.0-alpha.28 → 1.0.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +14 -0
- package/dist/index.js +28 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4846,7 +4846,21 @@ declare class Email extends Construct {
|
|
|
4846
4846
|
private _sender;
|
|
4847
4847
|
get sender(): string;
|
|
4848
4848
|
get configSetName(): string;
|
|
4849
|
+
/**
|
|
4850
|
+
* The ARN of the configuration set. `aws-cdk-lib`'s {@link ses.ConfigurationSet} exposes only
|
|
4851
|
+
* `configurationSetName`, so we build the ARN ourselves — consumers need it to grant access to
|
|
4852
|
+
* the config-set resource (see {@link grantSendEmail}).
|
|
4853
|
+
*/
|
|
4854
|
+
get configurationSetArn(): string;
|
|
4849
4855
|
constructor(scope: Construct, id: string, props: Email.Props);
|
|
4856
|
+
/**
|
|
4857
|
+
* Grant a principal permission to send email through this identity **and** its configuration set.
|
|
4858
|
+
*
|
|
4859
|
+
* The recipe wires the app to send through the configuration set it creates, so authorizing only
|
|
4860
|
+
* the identity ({@link ses.EmailIdentity.grantSendEmail}) is a silent under-grant: SES rejects the
|
|
4861
|
+
* send when the caller lacks access to the config-set resource. This grants both by construction.
|
|
4862
|
+
*/
|
|
4863
|
+
grantSendEmail(grantee: iam.IGrantable): iam.Grant;
|
|
4850
4864
|
}
|
|
4851
4865
|
/**
|
|
4852
4866
|
* Configuration types for {@link Email}.
|
package/dist/index.js
CHANGED
|
@@ -4186,8 +4186,10 @@ function resolveParameterGroupFamily(engine, version) {
|
|
|
4186
4186
|
}
|
|
4187
4187
|
|
|
4188
4188
|
// src/email.ts
|
|
4189
|
+
import { Stack as Stack7 } from "aws-cdk-lib";
|
|
4189
4190
|
import { Construct as Construct31 } from "constructs";
|
|
4190
4191
|
import * as ses from "aws-cdk-lib/aws-ses";
|
|
4192
|
+
import * as iam18 from "aws-cdk-lib/aws-iam";
|
|
4191
4193
|
import * as route532 from "aws-cdk-lib/aws-route53";
|
|
4192
4194
|
var Email = class extends Construct31 {
|
|
4193
4195
|
identity;
|
|
@@ -4200,6 +4202,18 @@ var Email = class extends Construct31 {
|
|
|
4200
4202
|
get configSetName() {
|
|
4201
4203
|
return this.configurationSet.configurationSetName;
|
|
4202
4204
|
}
|
|
4205
|
+
/**
|
|
4206
|
+
* The ARN of the configuration set. `aws-cdk-lib`'s {@link ses.ConfigurationSet} exposes only
|
|
4207
|
+
* `configurationSetName`, so we build the ARN ourselves — consumers need it to grant access to
|
|
4208
|
+
* the config-set resource (see {@link grantSendEmail}).
|
|
4209
|
+
*/
|
|
4210
|
+
get configurationSetArn() {
|
|
4211
|
+
return Stack7.of(this).formatArn({
|
|
4212
|
+
service: "ses",
|
|
4213
|
+
resource: "configuration-set",
|
|
4214
|
+
resourceName: this.configurationSet.configurationSetName
|
|
4215
|
+
});
|
|
4216
|
+
}
|
|
4203
4217
|
constructor(scope, id, props) {
|
|
4204
4218
|
super(scope, id);
|
|
4205
4219
|
this._sender = props.sender;
|
|
@@ -4244,6 +4258,20 @@ var Email = class extends Construct31 {
|
|
|
4244
4258
|
}
|
|
4245
4259
|
}
|
|
4246
4260
|
}
|
|
4261
|
+
/**
|
|
4262
|
+
* Grant a principal permission to send email through this identity **and** its configuration set.
|
|
4263
|
+
*
|
|
4264
|
+
* The recipe wires the app to send through the configuration set it creates, so authorizing only
|
|
4265
|
+
* the identity ({@link ses.EmailIdentity.grantSendEmail}) is a silent under-grant: SES rejects the
|
|
4266
|
+
* send when the caller lacks access to the config-set resource. This grants both by construction.
|
|
4267
|
+
*/
|
|
4268
|
+
grantSendEmail(grantee) {
|
|
4269
|
+
return iam18.Grant.addToPrincipal({
|
|
4270
|
+
grantee,
|
|
4271
|
+
actions: ["ses:SendEmail", "ses:SendRawEmail"],
|
|
4272
|
+
resourceArns: [this.identity.emailIdentityArn, this.configurationSetArn]
|
|
4273
|
+
});
|
|
4274
|
+
}
|
|
4247
4275
|
};
|
|
4248
4276
|
function resolveSenderType(sender) {
|
|
4249
4277
|
return sender.includes("@") ? "email" : "domain";
|