Skip to content

Commit

Permalink
Merge branch 'master' into feature/enable-control-plane-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomourar authored Jun 11, 2020
2 parents e38402e + fdd1e8f commit 71f59a1
Show file tree
Hide file tree
Showing 35 changed files with 986 additions and 257 deletions.
17 changes: 2 additions & 15 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pull_request_rules:
label:
add: [ contribution/core ]
conditions:
- author~=^(eladb|RomainMuller|garnaat|nija-at|shivlaks|skinny85|rix0rrr|NGL321|Jerry-AWS|SomayaB|MrArnoldPalmer|NetaNir|iliapolo)$
- author~=^(eladb|RomainMuller|garnaat|nija-at|shivlaks|skinny85|rix0rrr|NGL321|Jerry-AWS|SomayaB|MrArnoldPalmer|NetaNir|iliapolo|njlynch)$
- -label~="contribution/core"
- name: automatic merge
actions:
Expand Down Expand Up @@ -66,20 +66,7 @@ pull_request_rules:
conditions:
- author!=dependabot[bot]
- author!=dependabot-preview[bot]
# List out all the people whose work is okay to provisionally approve
- author!=eladb
- author!=RomainMuller
- author!=garnaat
- author!=nija-at
- author!=shivlaks
- author!=skinny85
- author!=rix0rrr
- author!=NGL321
- author!=Jerry-AWS
- author!=SomayaB
- author!=MrArnoldPalmer
- author!=NetaNir
- author!=iliapolo
- label!=contribution/core
- base=master
- -merged
- -closed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"jsii-diff": "^1.6.0",
"jsii-pacmak": "^1.6.0",
"jsii-rosetta": "^1.6.0",
"lerna": "^3.22.0",
"lerna": "^3.22.1",
"standard-version": "^8.0.0",
"graceful-fs": "^4.2.4",
"typescript": "~3.8.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assert/lib/assertions/have-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function arrayWith(...elements: any[]): PropertyMatcher {

const ret = (value: any, inspection: InspectionFailure): boolean => {
if (!Array.isArray(value)) {
return failMatcher(inspection, `Expect an object but got '${typeof value}'`);
return failMatcher(inspection, `Expect an array but got '${typeof value}'`);
}

for (const element of elements) {
Expand Down Expand Up @@ -412,4 +412,4 @@ function isCallable(x: any): x is ((...args: any[]) => any) {
function isObject(x: any): x is object {
// Because `typeof null === 'object'`.
return x && typeof x === 'object';
}
}
11 changes: 11 additions & 0 deletions packages/@aws-cdk/aws-amplify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ const amplifyApp = new amplify.App(this, 'MyApp', {
});
```

To connect your `App` to GitLab, use the `GitLabSourceCodeProvider`:
```ts
const amplifyApp = new amplify.App(this, 'MyApp', {
sourceCodeProvider: new amplify.GitLabSourceCodeProvider({
owner: '<user>',
repository: '<repo>',
oauthToken: cdk.SecretValue.secretsManager('my-gitlab-token')
})
});
```

To connect your `App` to CodeCommit, use the `CodeCommitSourceCodeProvider`:
```ts
const repository = new codecommit.Repository(this, 'Repo', {
Expand Down
34 changes: 34 additions & 0 deletions packages/@aws-cdk/aws-amplify/lib/source-code-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,40 @@ export class GitHubSourceCodeProvider implements ISourceCodeProvider {
}
}

/**
* Properties for a GitLab source code provider
*/
export interface GitLabSourceCodeProviderProps {
/**
* 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;
}

/**
* GitLab source code provider
*/
export class GitLabSourceCodeProvider implements ISourceCodeProvider {
constructor(private readonly props: GitLabSourceCodeProviderProps) { }

public bind(_app: App): SourceCodeProviderConfig {
return {
repository: `https://gitlab.com/${this.props.owner}/${this.props.repository}`,
oauthToken: this.props.oauthToken,
};
}
}

/**
* Properties for a CodeCommit source code provider
*/
Expand Down
52 changes: 52 additions & 0 deletions packages/@aws-cdk/aws-amplify/test/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,58 @@ test('create an app connected to a GitHub repository', () => {
});
});

test('create an app connected to a GitLab repository', () => {
// WHEN
new amplify.App(stack, 'App', {
sourceCodeProvider: new amplify.GitLabSourceCodeProvider({
owner: 'aws',
repository: 'aws-cdk',
oauthToken: SecretValue.plainText('secret'),
}),
buildSpec: codebuild.BuildSpec.fromObject({
version: '1.0',
frontend: {
phases: {
build: {
commands: [
'npm run build',
],
},
},
},
}),
});

// THEN
expect(stack).toHaveResource('AWS::Amplify::App', {
Name: 'App',
BuildSpec: '{\n \"version\": \"1.0\",\n \"frontend\": {\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm run build\"\n ]\n }\n }\n }\n}',
IAMServiceRole: {
'Fn::GetAtt': [
'AppRole1AF9B530',
'Arn',
],
},
OauthToken: 'secret',
Repository: 'https://gitlab.com/aws/aws-cdk',
});

expect(stack).toHaveResource('AWS::IAM::Role', {
AssumeRolePolicyDocument: {
Statement: [
{
Action: 'sts:AssumeRole',
Effect: 'Allow',
Principal: {
Service: 'amplify.amazonaws.com',
},
},
],
Version: '2012-10-17',
},
});
});

test('create an app connected to a CodeCommit repository', () => {
// WHEN
new amplify.App(stack, 'App', {
Expand Down
11 changes: 7 additions & 4 deletions packages/@aws-cdk/aws-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ export class ApiStack extends Stack {
},
authorizationConfig: {
defaultAuthorization: {
userPool,
defaultAction: UserPoolDefaultAction.ALLOW,
authorizationType: AuthorizationType.USER_POOL,
userPoolConfig: {
userPool,
defaultAction: UserPoolDefaultAction.ALLOW
},
},
additionalAuthorizationModes: [
{
apiKeyDesc: 'My API Key',
},
authorizationType: AuthorizationType.API_KEY,
}
],
},
schemaDefinitionFile: './schema.graphql',
Expand Down
Loading

0 comments on commit 71f59a1

Please sign in to comment.