-
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 fix-docs-rds-admin-username
- Loading branch information
Showing
40 changed files
with
1,492 additions
and
210 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 |
---|---|---|
@@ -1,58 +1 @@ | ||
incompatible-argument:@aws-cdk/aws-ecs.Ec2TaskDefinition.<initializer> | ||
incompatible-argument:@aws-cdk/aws-ecs.Ec2TaskDefinition.addVolume | ||
incompatible-argument:@aws-cdk/aws-ecs.FargateTaskDefinition.<initializer> | ||
incompatible-argument:@aws-cdk/aws-ecs.FargateTaskDefinition.addVolume | ||
incompatible-argument:@aws-cdk/aws-ecs.TaskDefinition.<initializer> | ||
incompatible-argument:@aws-cdk/aws-ecs.TaskDefinition.addVolume | ||
change-return-type:@aws-cdk/core.Fn.getAtt | ||
new-argument:@aws-cdk/aws-iam.ManagedPolicy.<initializer> | ||
new-argument:@aws-cdk/aws-iam.ManagedPolicy.<initializer> | ||
removed:@aws-cdk/aws-apigateway.AwsIntegration.props | ||
removed:@aws-cdk/aws-apigateway.HttpIntegration.props | ||
removed:@aws-cdk/aws-apigateway.Integration.props | ||
removed:@aws-cdk/aws-apigateway.LambdaIntegration.props | ||
removed:@aws-cdk/aws-apigateway.MockIntegration.props | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledEc2TaskDefinitionOptions.schedule | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledEc2TaskDefinitionOptions.cluster | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledEc2TaskDefinitionOptions.desiredTaskCount | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledEc2TaskDefinitionOptions.vpc | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledFargateTaskDefinitionOptions.schedule | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledFargateTaskDefinitionOptions.cluster | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledFargateTaskDefinitionOptions.desiredTaskCount | ||
removed:@aws-cdk/aws-ecs-patterns.ScheduledFargateTaskDefinitionOptions.vpc | ||
incompatible-argument:@aws-cdk/aws-lambda.Function.<initializer> | ||
incompatible-argument:@aws-cdk/aws-lambda.SingletonFunction.<initializer> | ||
incompatible-argument:@aws-cdk/aws-lambda.Function.addEnvironment | ||
changed-type:@aws-cdk/aws-dynamodb.Table.tableStreamArn | ||
incompatible-argument:@aws-cdk/aws-apigateway.LambdaRestApi.addModel | ||
incompatible-argument:@aws-cdk/aws-apigateway.Model.<initializer> | ||
incompatible-argument:@aws-cdk/aws-apigateway.RestApi.addModel | ||
incompatible-argument:@aws-cdk/aws-apigateway.ProxyResource.addProxy | ||
incompatible-argument:@aws-cdk/aws-apigateway.Resource.addProxy | ||
incompatible-argument:@aws-cdk/aws-apigateway.ResourceBase.addProxy | ||
incompatible-argument:@aws-cdk/aws-apigateway.IResource.addProxy | ||
incompatible-argument:@aws-cdk/aws-apigateway.RequestAuthorizer.<initializer> | ||
incompatible-argument:@aws-cdk/aws-servicediscovery.Service.fromServiceAttributes | ||
removed:@aws-cdk/core.ConstructNode.addReference | ||
removed:@aws-cdk/core.ConstructNode.references | ||
removed:@aws-cdk/core.OutgoingReference | ||
change-return-type:@aws-cdk/aws-lambda-destinations.EventBridgeDestination.bind | ||
change-return-type:@aws-cdk/aws-lambda-destinations.LambdaDestination.bind | ||
change-return-type:@aws-cdk/aws-lambda-destinations.SnsDestination.bind | ||
change-return-type:@aws-cdk/aws-lambda-destinations.SqsDestination.bind | ||
removed:@aws-cdk/cdk-assets-schema.DockerImageDestination.imageUri | ||
incompatible-argument:@aws-cdk/aws-iam.FederatedPrincipal.<initializer> | ||
incompatible-argument:@aws-cdk/aws-iam.PolicyStatement.addCondition | ||
incompatible-argument:@aws-cdk/aws-iam.PolicyStatement.addConditions | ||
incompatible-argument:@aws-cdk/aws-iam.PolicyStatement.addFederatedPrincipal | ||
incompatible-argument:@aws-cdk/aws-iam.PrincipalPolicyFragment.<initializer> | ||
changed-type:@aws-cdk/aws-iam.FederatedPrincipal.conditions | ||
changed-type:@aws-cdk/aws-iam.PrincipalPolicyFragment.conditions | ||
changed-type:@aws-cdk/aws-iam.PrincipalWithConditions.conditions | ||
removed:@aws-cdk/cdk-assets-schema.Placeholders | ||
# Following two are because we're turning: properties: {string=>any} into a union of typed interfaces | ||
# Needs to be removed after next release. | ||
incompatible-argument:@aws-cdk/cloud-assembly-schema.Manifest.save | ||
change-return-type:@aws-cdk/cloud-assembly-schema.Manifest.load | ||
removed:@aws-cdk/core.DefaultStackSynthesizer.DEFAULT_DEPLOY_ACTION_ROLE_ARN | ||
removed:@aws-cdk/core.DefaultStackSynthesizerProps.deployActionRoleArn | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
// AWS::CodeGuruProfiler CloudFormation Resources: | ||
export * from './codeguruprofiler.generated'; | ||
export * from './profiling-group'; |
180 changes: 180 additions & 0 deletions
180
packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.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,180 @@ | ||
import { Grant, IGrantable } from '@aws-cdk/aws-iam'; | ||
import { Construct, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; | ||
import { CfnProfilingGroup } from './codeguruprofiler.generated'; | ||
|
||
/** | ||
* IResource represents a Profiling Group. | ||
*/ | ||
export interface IProfilingGroup extends IResource { | ||
|
||
/** | ||
* A name for the profiling group. | ||
* | ||
* @attribute | ||
*/ | ||
readonly profilingGroupName: string; | ||
|
||
/** | ||
* Grant access to publish profiling information to the Profiling Group to the given identity. | ||
* | ||
* This will grant the following permissions: | ||
* | ||
* - codeguru-profiler:ConfigureAgent | ||
* - codeguru-profiler:PostAgentProfile | ||
* | ||
* @param grantee Principal to grant publish rights to | ||
*/ | ||
grantPublish(grantee: IGrantable): Grant; | ||
|
||
/** | ||
* Grant access to read profiling information from the Profiling Group to the given identity. | ||
* | ||
* This will grant the following permissions: | ||
* | ||
* - codeguru-profiler:GetProfile | ||
* - codeguru-profiler:DescribeProfilingGroup | ||
* | ||
* @param grantee Principal to grant read rights to | ||
*/ | ||
grantRead(grantee: IGrantable): Grant; | ||
|
||
} | ||
|
||
abstract class ProfilingGroupBase extends Resource implements IProfilingGroup { | ||
|
||
public abstract readonly profilingGroupName: string; | ||
|
||
public abstract readonly profilingGroupArn: string; | ||
|
||
/** | ||
* Grant access to publish profiling information to the Profiling Group to the given identity. | ||
* | ||
* This will grant the following permissions: | ||
* | ||
* - codeguru-profiler:ConfigureAgent | ||
* - codeguru-profiler:PostAgentProfile | ||
* | ||
* @param grantee Principal to grant publish rights to | ||
*/ | ||
public grantPublish(grantee: IGrantable) { | ||
// https://docs.aws.amazon.com/codeguru/latest/profiler-ug/security-iam.html#security-iam-access-control | ||
return Grant.addToPrincipal({ | ||
grantee, | ||
actions: ['codeguru-profiler:ConfigureAgent', 'codeguru-profiler:PostAgentProfile'], | ||
resourceArns: [this.profilingGroupArn], | ||
}); | ||
} | ||
|
||
/** | ||
* Grant access to read profiling information from the Profiling Group to the given identity. | ||
* | ||
* This will grant the following permissions: | ||
* | ||
* - codeguru-profiler:GetProfile | ||
* - codeguru-profiler:DescribeProfilingGroup | ||
* | ||
* @param grantee Principal to grant read rights to | ||
*/ | ||
public grantRead(grantee: IGrantable) { | ||
// https://docs.aws.amazon.com/codeguru/latest/profiler-ug/security-iam.html#security-iam-access-control | ||
return Grant.addToPrincipal({ | ||
grantee, | ||
actions: ['codeguru-profiler:GetProfile', 'codeguru-profiler:DescribeProfilingGroup'], | ||
resourceArns: [this.profilingGroupArn], | ||
}); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Properties for creating a new Profiling Group. | ||
*/ | ||
export interface ProfilingGroupProps { | ||
|
||
/** | ||
* A name for the profiling group. | ||
* @default - automatically generated name. | ||
*/ | ||
readonly profilingGroupName?: string; | ||
|
||
} | ||
|
||
/** | ||
* A new Profiling Group. | ||
*/ | ||
export class ProfilingGroup extends ProfilingGroupBase { | ||
|
||
/** | ||
* Import an existing Profiling Group provided a Profiling Group Name. | ||
* | ||
* @param scope The parent creating construct | ||
* @param id The construct's name | ||
* @param profilingGroupName Profiling Group Name | ||
*/ | ||
public static fromProfilingGroupName(scope: Construct, id: string, profilingGroupName: string): IProfilingGroup { | ||
const stack = Stack.of(scope); | ||
|
||
return this.fromProfilingGroupArn(scope, id, stack.formatArn({ | ||
service: 'codeguru-profiler', | ||
resource: 'profilingGroup', | ||
resourceName: profilingGroupName, | ||
})); | ||
} | ||
|
||
/** | ||
* Import an existing Profiling Group provided an ARN. | ||
* | ||
* @param scope The parent creating construct | ||
* @param id The construct's name | ||
* @param profilingGroupArn Profiling Group ARN | ||
*/ | ||
public static fromProfilingGroupArn(scope: Construct, id: string, profilingGroupArn: string): IProfilingGroup { | ||
class Import extends ProfilingGroupBase { | ||
public readonly profilingGroupName = Stack.of(scope).parseArn(profilingGroupArn).resource; | ||
public readonly profilingGroupArn = profilingGroupArn; | ||
} | ||
|
||
return new Import(scope, id); | ||
} | ||
|
||
/** | ||
* The name of the Profiling Group. | ||
* | ||
* @attribute | ||
*/ | ||
public readonly profilingGroupName: string; | ||
|
||
/** | ||
* The ARN of the Profiling Group. | ||
* | ||
* @attribute | ||
*/ | ||
public readonly profilingGroupArn: string; | ||
|
||
constructor(scope: Construct, id: string, props: ProfilingGroupProps = {}) { | ||
super(scope, id, { | ||
physicalName: props.profilingGroupName ?? Lazy.stringValue({ produce: () => this.generateUniqueId() }), | ||
}); | ||
|
||
const profilingGroup = new CfnProfilingGroup(this, 'ProfilingGroup', { | ||
profilingGroupName: this.physicalName, | ||
}); | ||
|
||
this.profilingGroupName = this.getResourceNameAttribute(profilingGroup.ref); | ||
|
||
this.profilingGroupArn = this.getResourceArnAttribute(profilingGroup.attrArn, { | ||
service: 'codeguru-profiler', | ||
resource: 'profilingGroup', | ||
resourceName: this.physicalName, | ||
}); | ||
} | ||
|
||
private generateUniqueId(): string { | ||
const name = this.node.uniqueId; | ||
if (name.length > 240) { | ||
return name.substring(0, 120) + name.substring(name.length - 120); | ||
} | ||
return name; | ||
} | ||
|
||
} |
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.