-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 6741-cloudtrail-prefix-correct-bucket-policy
- Loading branch information
Showing
80 changed files
with
3,224 additions
and
171 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
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
62 changes: 62 additions & 0 deletions
62
packages/@aws-cdk/aws-amplify/lib/source-code-providers.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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as codecommit from '@aws-cdk/aws-codecommit'; | ||
import { SecretValue } from '@aws-cdk/core'; | ||
import { App, ISourceCodeProvider, SourceCodeProviderConfig } from './app'; | ||
|
||
/** | ||
* Properties for a GitHub source code provider | ||
*/ | ||
export interface GitHubSourceCodeProviderProps { | ||
/** | ||
* The user or organization owning the repository | ||
*/ | ||
readonly owner: string; | ||
|
||
/** | ||
* The name of the repository | ||
*/ | ||
readonly repository: string; | ||
|
||
/** | ||
* A personal access token with the `repo` scope | ||
*/ | ||
readonly oauthToken: SecretValue; | ||
} | ||
|
||
/** | ||
* GitHub source code provider | ||
*/ | ||
export class GitHubSourceCodeProvider implements ISourceCodeProvider { | ||
constructor(private readonly props: GitHubSourceCodeProviderProps) {} | ||
|
||
public bind(_app: App): SourceCodeProviderConfig { | ||
return { | ||
repository: `https://github.com/${this.props.owner}/${this.props.repository}`, | ||
oauthToken: this.props.oauthToken | ||
}; | ||
} | ||
} | ||
|
||
/** | ||
* Properties for a CodeCommit source code provider | ||
*/ | ||
export interface CodeCommitSourceCodeProviderProps { | ||
/** | ||
* The CodeCommit repository | ||
*/ | ||
readonly repository: codecommit.IRepository; | ||
} | ||
|
||
/** | ||
* CodeCommit source code provider | ||
*/ | ||
export class CodeCommitSourceCodeProvider implements ISourceCodeProvider { | ||
constructor(private readonly props: CodeCommitSourceCodeProviderProps) {} | ||
|
||
public bind(app: App): SourceCodeProviderConfig { | ||
this.props.repository.grantPull(app); | ||
|
||
return { | ||
repository: this.props.repository.repositoryCloneUrlHttp | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.