@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:41.504Z") @Stability(value=Stable) public class ServerlessCluster extends Resource implements IServerlessCluster
Example:
// Build a data source for AppSync to access the database.
GraphqlApi api;
// Create username and password secret for DB Cluster
DatabaseSecret secret = DatabaseSecret.Builder.create(this, "AuroraSecret")
.username("clusteradmin")
.build();
// The VPC to place the cluster in
Vpc vpc = new Vpc(this, "AuroraVpc");
// Create the serverless cluster, provide all values needed to customise the database.
ServerlessCluster cluster = ServerlessCluster.Builder.create(this, "AuroraCluster")
.engine(DatabaseClusterEngine.AURORA_MYSQL)
.vpc(vpc)
.credentials(Map.of("username", "clusteradmin"))
.clusterIdentifier("db-endpoint-test")
.defaultDatabaseName("demos")
.build();
RdsDataSource rdsDS = api.addRdsDataSource("rds", cluster, secret, "demos");
// Set up a resolver for an RDS query.
rdsDS.createResolver(BaseResolverProps.builder()
.typeName("Query")
.fieldName("getDemosRds")
.requestMappingTemplate(MappingTemplate.fromString("\n {\n \"version\": \"2018-05-29\",\n \"statements\": [\n \"SELECT * FROM demos\"\n ]\n }\n "))
.responseMappingTemplate(MappingTemplate.fromString("\n $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])\n "))
.build());
// Set up a resolver for an RDS mutation.
rdsDS.createResolver(BaseResolverProps.builder()
.typeName("Mutation")
.fieldName("addDemoRds")
.requestMappingTemplate(MappingTemplate.fromString("\n {\n \"version\": \"2018-05-29\",\n \"statements\": [\n \"INSERT INTO demos VALUES (:id, :version)\",\n \"SELECT * WHERE id = :id\"\n ],\n \"variableMap\": {\n \":id\": $util.toJson($util.autoId()),\n \":version\": $util.toJson($ctx.args.version)\n }\n }\n "))
.responseMappingTemplate(MappingTemplate.fromString("\n $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])\n "))
.build());
| Modifier and Type | Class and Description |
|---|---|
static class |
ServerlessCluster.Builder
A fluent builder for
ServerlessCluster. |
software.amazon.jsii.JsiiObject.InitializationModeIServerlessCluster.Jsii$Default, IServerlessCluster.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
ServerlessCluster(software.constructs.Construct scope,
String id,
ServerlessClusterProps props) |
protected |
ServerlessCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ServerlessCluster(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
SecretRotation |
addRotationMultiUser(String id,
RotationMultiUserOptions options)
Adds the multi user rotation to this cluster.
|
SecretRotation |
addRotationSingleUser()
Adds the single user rotation of the master password to this cluster.
|
SecretRotation |
addRotationSingleUser(RotationSingleUserOptions options)
Adds the single user rotation of the master password to this cluster.
|
SecretAttachmentTargetProps |
asSecretAttachmentTarget()
Renders the secret attachment target specifications.
|
static IServerlessCluster |
fromServerlessClusterAttributes(software.constructs.Construct scope,
String id,
ServerlessClusterAttributes attrs)
Import an existing DatabaseCluster from properties.
|
String |
getClusterArn()
The ARN of the cluster.
|
Endpoint |
getClusterEndpoint()
The endpoint to use for read/write operations.
|
String |
getClusterIdentifier()
Identifier of the cluster.
|
Endpoint |
getClusterReadEndpoint()
The endpoint to use for read/write operations.
|
Connections |
getConnections()
Access to the network connections.
|
protected Boolean |
getEnableDataApi() |
protected CfnDBClusterProps |
getNewCfnProps() |
ISecret |
getSecret()
The secret attached to this cluster.
|
protected List<ISecurityGroup> |
getSecurityGroups() |
Grant |
grantDataApiAccess(IGrantable grantee)
Grant the given identity to access to the Data API, including read access to the secret attached to the cluster if present.
|
protected void |
setEnableDataApi(Boolean value) |
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected ServerlessCluster(software.amazon.jsii.JsiiObjectRef objRef)
protected ServerlessCluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public ServerlessCluster(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
ServerlessClusterProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IServerlessCluster fromServerlessClusterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServerlessClusterAttributes attrs)
scope - This parameter is required.id - This parameter is required.attrs - This parameter is required.@Stability(value=Stable) @NotNull public SecretRotation addRotationMultiUser(@NotNull String id, @NotNull RotationMultiUserOptions options)
id - This parameter is required.options - This parameter is required.@Stability(value=Stable) @NotNull public SecretRotation addRotationSingleUser(@Nullable RotationSingleUserOptions options)
options - @Stability(value=Stable) @NotNull public SecretRotation addRotationSingleUser()
@Stability(value=Stable) @NotNull public SecretAttachmentTargetProps asSecretAttachmentTarget()
asSecretAttachmentTarget in interface ISecretAttachmentTarget@Stability(value=Stable) @NotNull public Grant grantDataApiAccess(@NotNull IGrantable grantee)
grantDataApiAccess in interface IServerlessClustergrantee - The principal to grant access to. This parameter is required.@Stability(value=Stable) @NotNull public String getClusterArn()
getClusterArn in interface IServerlessCluster@Stability(value=Stable) @NotNull public Endpoint getClusterEndpoint()
getClusterEndpoint in interface IServerlessCluster@Stability(value=Stable) @NotNull public String getClusterIdentifier()
getClusterIdentifier in interface IServerlessCluster@Stability(value=Stable) @NotNull public Endpoint getClusterReadEndpoint()
getClusterReadEndpoint in interface IServerlessCluster@Stability(value=Stable) @NotNull public Connections getConnections()
getConnections in interface IConnectable@Stability(value=Stable) @NotNull protected CfnDBClusterProps getNewCfnProps()
@Stability(value=Stable) @NotNull protected List<ISecurityGroup> getSecurityGroups()
@Stability(value=Stable) @Nullable public ISecret getSecret()
@Stability(value=Stable) @Nullable protected Boolean getEnableDataApi()
@Stability(value=Stable)
protected void setEnableDataApi(@Nullable
Boolean value)
Copyright © 2022. All rights reserved.