-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Migrate database to v2 #71
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
Open
mandryllo
wants to merge
16
commits into
master
Choose a base branch
from
feat/db-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,749
−186
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e68f718
Create db v2 component
mandryllo e768f7b
Rename old component
mandryllo e35d75b
Make autoMinorVersionUpgrade configurable
mandryllo 02aa9f5
Support blue green deoloyments
mandryllo d12e7ed
Update vpc configuration
mandryllo f615a9f
Make simple database builder
mandryllo 974a125
Export db builder
mandryllo 2aca530
Add db type tests
mandryllo 570ff03
Add integration tests
mandryllo dda467d
Update database builder
mandryllo d043740
Refactor builder
mandryllo 004c29f
Merge branch 'master' into feat/db-v2
mandryllo a737feb
Use new vpc component
mandryllo c8701a4
Add test for monitoring
mandryllo c412da9
Enable creation of custom parameter group
mandryllo 0af86e6
Cleanup
mandryllo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?