-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch(feat): octo-aws-cdk | ini based account module.
- Loading branch information
1 parent
84ea238
commit dcf0a04
Showing
8 changed files
with
97 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -60,6 +60,7 @@ iam | |
idx | ||
igw | ||
infima | ||
ini | ||
intra | ||
Ipv | ||
ispec | ||
|
This file contains 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 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 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
26 changes: 22 additions & 4 deletions
26
...cto-aws-cdk/src/modules/account/ini-based-aws-account/models/account/aws.account.model.ts
This file contains 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 |
---|---|---|
@@ -1,13 +1,31 @@ | ||
import { Account, Model } from '@quadnix/octo'; | ||
import { fromIni } from '@aws-sdk/credential-providers'; | ||
import { Account, AccountType, Model } from '@quadnix/octo'; | ||
import type { AwsCredentialIdentityProvider } from '@smithy/types'; | ||
import { AwsAccountSchema } from './aws.account.schema.js'; | ||
|
||
@Model<AwsAccount>('@octo', 'account', AwsAccountSchema) | ||
export class AwsAccount extends Account { | ||
constructor(accountId: string) { | ||
super(accountId); | ||
readonly iniProfile: string; | ||
|
||
constructor(accountId: string, iniProfile: string) { | ||
super(AccountType.AWS, accountId); | ||
|
||
this.iniProfile = iniProfile; | ||
} | ||
|
||
override getCredentials(): AwsCredentialIdentityProvider { | ||
return fromIni({ profile: this.iniProfile }); | ||
} | ||
|
||
override synth(): AwsAccountSchema { | ||
return { | ||
accountId: this.accountId, | ||
accountType: this.accountType, | ||
iniProfile: this.iniProfile, | ||
}; | ||
} | ||
|
||
static override async unSynth(account: AwsAccountSchema): Promise<AwsAccount> { | ||
return new AwsAccount(account.accountId); | ||
return new AwsAccount(account.accountId, account.iniProfile); | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
...to-aws-cdk/src/modules/account/ini-based-aws-account/models/account/aws.account.schema.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { AccountSchema } from '@quadnix/octo'; | ||
import { AccountSchema, Schema } from '@quadnix/octo'; | ||
|
||
export class AwsAccountSchema extends AccountSchema {} | ||
export class AwsAccountSchema extends AccountSchema { | ||
iniProfile = Schema<string>(); | ||
} |
This file contains 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
19 changes: 16 additions & 3 deletions
19
packages/octo-aws-cdk/src/modules/app/simple-app/models/app/actions/add-app.model.action.ts
This file contains 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