-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ObservabilityConfiguration for AppRunner Service
- Loading branch information
Showing
15 changed files
with
866 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// AWS::AppRunner CloudFormation Resources: | ||
export * from './service'; | ||
export * from './vpc-connector'; | ||
export * from './observability-configuration'; |
135 changes: 135 additions & 0 deletions
135
packages/@aws-cdk/aws-apprunner-alpha/lib/observability-configuration.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,135 @@ | ||
import * as cdk from 'aws-cdk-lib/core'; | ||
import { Construct } from 'constructs'; | ||
import { CfnObservabilityConfiguration } from 'aws-cdk-lib/aws-apprunner'; | ||
|
||
/** | ||
* The implementation provider chosen for tracing App Runner services | ||
*/ | ||
export enum Vendor { | ||
/** | ||
* AWS X-RAY | ||
*/ | ||
AWSXRAY = 'AWSXRAY', | ||
} | ||
|
||
/** | ||
* Properties of the AppRunner Observability configuration | ||
*/ | ||
export interface ObservabilityConfigurationProps { | ||
/** | ||
* The name for the ObservabilityConfiguration. | ||
* | ||
* @default - a name generated by CloudFormation | ||
*/ | ||
readonly observabilityConfigurationName?: string; | ||
|
||
/** | ||
* The implementation provider chosen for tracing App Runner services. | ||
* | ||
* @default Vendor.AWSXRAY | ||
*/ | ||
readonly vendor?: Vendor; | ||
} | ||
|
||
/** | ||
* Attributes for the App Runner Observability configuration | ||
*/ | ||
export interface ObservabilityConfigurationAttributes { | ||
/** | ||
* The name of the Observability configuration. | ||
*/ | ||
readonly observabilityConfigurationName: string; | ||
|
||
/** | ||
* The ARN of the Observability configuration. | ||
*/ | ||
readonly observabilityConfigurationArn: string; | ||
|
||
/** | ||
* The revision of the Observability configuration. | ||
*/ | ||
readonly observabilityConfigurationRevision: number; | ||
} | ||
|
||
/** | ||
* Represents the App Runner Observability configuration. | ||
*/ | ||
export interface IObservabilityConfiguration extends cdk.IResource { | ||
/** | ||
* The Name of the Observability configuration. | ||
* @attribute | ||
*/ | ||
readonly observabilityConfigurationName: string; | ||
|
||
/** | ||
* The ARN of the Observability configuration. | ||
* @attribute | ||
*/ | ||
readonly observabilityConfigurationArn: string; | ||
|
||
/** | ||
* The revision of the Observability configuration. | ||
* @attribute | ||
*/ | ||
readonly observabilityConfigurationRevision: number; | ||
} | ||
|
||
/** | ||
* The App Runner Observability configuration | ||
* | ||
* @resource AWS::AppRunner::ObservabilityConfiguration | ||
*/ | ||
export class ObservabilityConfiguration extends cdk.Resource implements IObservabilityConfiguration { | ||
/** | ||
* Import from Observability configuration attributes. | ||
*/ | ||
public static fromObservabilityConfigurationAttributes(scope: Construct, id: string, | ||
attrs: ObservabilityConfigurationAttributes): IObservabilityConfiguration { | ||
const observabilityConfigurationArn = attrs.observabilityConfigurationArn; | ||
const observabilityConfigurationName = attrs.observabilityConfigurationName; | ||
const observabilityConfigurationRevision = attrs.observabilityConfigurationRevision; | ||
|
||
class Import extends cdk.Resource { | ||
public readonly observabilityConfigurationArn = observabilityConfigurationArn | ||
public readonly observabilityConfigurationName = observabilityConfigurationName | ||
public readonly observabilityConfigurationRevision = observabilityConfigurationRevision | ||
} | ||
|
||
return new Import(scope, id); | ||
} | ||
|
||
/** | ||
* The ARN of the Observability configuration. | ||
* @attribute | ||
*/ | ||
readonly observabilityConfigurationArn: string; | ||
|
||
/** | ||
* The revision of the Observability configuration. | ||
* @attribute | ||
*/ | ||
readonly observabilityConfigurationRevision: number; | ||
|
||
/** | ||
* The name of the Observability configuration. | ||
* @attribute | ||
*/ | ||
readonly observabilityConfigurationName: string; | ||
|
||
public constructor(scope: Construct, id: string, props: ObservabilityConfigurationProps = {}) { | ||
super(scope, id, { | ||
physicalName: props.observabilityConfigurationName, | ||
}); | ||
|
||
const resource = new CfnObservabilityConfiguration(this, 'Resource', { | ||
observabilityConfigurationName: props.observabilityConfigurationName, | ||
traceConfiguration: { | ||
vendor: props.vendor ?? Vendor.AWSXRAY, | ||
}, | ||
}); | ||
|
||
this.observabilityConfigurationArn = resource.attrObservabilityConfigurationArn; | ||
this.observabilityConfigurationRevision = resource.attrObservabilityConfigurationRevision; | ||
this.observabilityConfigurationName = resource.ref; | ||
} | ||
} |
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: 19 additions & 0 deletions
19
...s.snapshot/AppRunnerObservabilityConfigurationDefaultTestDeployAssertFEB7E279.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
...snapshot/AppRunnerObservabilityConfigurationDefaultTestDeployAssertFEB7E279.template.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...dk/aws-apprunner-alpha/test/integ.service-observability-configuration.js.snapshot/cdk.out
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...ability-configuration.js.snapshot/integ-apprunner-observability-configuration.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.