Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2,075 changes: 1,890 additions & 185 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
"@aws-sdk/client-efs": "^3.758.0",
"@aws-sdk/client-elastic-load-balancing-v2": "^3.764.0",
"@aws-sdk/client-elasticache": "^3.901.0",
"@aws-sdk/client-iam": "^3.925.0",
"@aws-sdk/client-kms": "^3.922.0",
"@aws-sdk/client-rds": "^3.922.0",
"@aws-sdk/client-route-53": "^3.782.0",
"@aws-sdk/client-secrets-manager": "^3.906.0",
"@aws-sdk/client-servicediscovery": "^3.758.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class Database extends pulumi.ComponentResource {
args: DatabaseArgs,
opts: pulumi.ComponentResourceOptions = {},
) {
super('studion:Database', name, {}, opts);
super('studion:LegacyDatabase', name, {}, opts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?


this.name = name;

Expand Down
90 changes: 90 additions & 0 deletions src/v2/components/database/builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import * as pulumi from '@pulumi/pulumi';
import * as aws from '@pulumi/aws';
import * as awsx from '@pulumi/awsx';
import { Database } from '.';

export namespace DatabaseBuilder {
export type Config = Omit<
Database.Args,
'vpc' | 'enableMonitoring' | 'snapshotIdentifier'
>;
}

export class DatabaseBuilder {
private _name: string;
private _config?: DatabaseBuilder.Config;
private _vpc?: Database.Args['vpc'];
private _enableMonitoring?: Database.Args['enableMonitoring'];
private _snapshotIdentifier?: Database.Args['snapshotIdentifier'];
private _parameterGroupArgs?: Database.Args['parameterGroupArgs'];

constructor(name: string) {
this._name = name;
}

public configure(
dbName: DatabaseBuilder.Config['dbName'],
username: DatabaseBuilder.Config['username'],
config: Omit<DatabaseBuilder.Config, 'dbName' | 'username'> = {},
): this {
this._config = {
dbName,
username,
...config,
};

return this;
}

public withVpc(vpc: pulumi.Input<awsx.ec2.Vpc>): this {
this._vpc = pulumi.output(vpc);

return this;
}

public withMonitoring(): this {
this._enableMonitoring = true;

return this;
}

public withSnapshot(snapshotIdentifier: pulumi.Input<string>): this {
this._snapshotIdentifier = snapshotIdentifier;

return this;
}

public withParameterGroup(
parameterGroupArgs: pulumi.Input<aws.rds.ParameterGroupArgs>,
): this {
this._parameterGroupArgs = parameterGroupArgs;

return this;
}

public build(opts: pulumi.ComponentResourceOptions = {}): Database {
if (!this._config) {
throw new Error(
'Database is not configured. Make sure to call DatabaseBuilder.configure().',
);
}

if (!this._vpc) {
throw new Error(
'VPC not provided. Make sure to call DatabaseBuilder.withVpc().',
);
}

return new Database(
this._name,
{
...this._config,
vpc: this._vpc,
enableMonitoring: this._enableMonitoring,
snapshotIdentifier: this._snapshotIdentifier,
parameterGroupArgs: this._parameterGroupArgs,
},
opts,
);
}
}
Loading