com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentials Maven / Gradle / Ivy
Show all versions of cdk-ses-smtp-credentials Show documentation
package com.pepperize.cdk.ses_smtp_credentials;
/**
* This construct creates an access key for the given user and stores the generated SMTP credentials inside a secret.
*
* Attaches an inline policy to the user allowing to send emails
*
*
* const user = User.fromUserName("ses-user-example");
* const credentials = new SesSmtpCredentials(this, 'SmtpCredentials', {
* user: user,
* });
* // smtpCredentials.secret contains json value {username: "<the generated access key id>", password: "<the calculated ses smtp password>"}
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.98.0 (build 00b106d)", date = "2024-05-13T22:36:21.470Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = com.pepperize.cdk.ses_smtp_credentials.$Module.class, fqn = "@pepperize/cdk-ses-smtp-credentials.SesSmtpCredentials")
public class SesSmtpCredentials extends software.constructs.Construct {
protected SesSmtpCredentials(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected SesSmtpCredentials(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public SesSmtpCredentials(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentialsProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* The secret that contains the calculated AWS SES Smtp Credentials.
*
*
* import { aws_ecs } from "aws-cdk-lib";
* const containerDefinitionOptions: aws_ecs.ContainerDefinitionOptions = {
* // ...
* secrets: {
* MAIL_USERNAME: aws_ecs.Secret.fromSecretsManager(smtpCredentials.secret, "username"),
* MAIL_PASSWORD: aws_ecs.Secret.fromSecretsManager(smtpCredentials.secret, "password"),
* }
* }
*
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.secretsmanager.ISecret getSecret() {
return software.amazon.jsii.Kernel.get(this, "secret", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.secretsmanager.ISecret.class));
}
/**
* A fluent builder for {@link com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentials}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentialsProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentialsProps.Builder();
}
/**
* Optional, an SecretsManager secret to write the AWS SES Smtp credentials to.
*
* @return {@code this}
* @param secret Optional, an SecretsManager secret to write the AWS SES Smtp credentials to. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder secret(final software.amazon.awscdk.services.secretsmanager.ISecret secret) {
this.props.secret(secret);
return this;
}
/**
* The user for which to create an AWS Access Key and to generate the smtp password.
*
* If omitted a user will be created.
*
* @return {@code this}
* @param user The user for which to create an AWS Access Key and to generate the smtp password. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder user(final software.amazon.awscdk.services.iam.IUser user) {
this.props.user(user);
return this;
}
/**
* Optional, a username to create a new user if no existing user is given.
*
* @return {@code this}
* @param userName Optional, a username to create a new user if no existing user is given. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder userName(final java.lang.String userName) {
this.props.userName(userName);
return this;
}
/**
* @return a newly built instance of {@link com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentials}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentials build() {
return new com.pepperize.cdk.ses_smtp_credentials.SesSmtpCredentials(
this.scope,
this.id,
this.props.build()
);
}
}
}