Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cloudfront): remove the originId property from OriginBase #9380

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions packages/@aws-cdk/aws-cloudfront/lib/origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ export abstract class OriginBase implements IOrigin {
private readonly connectionAttempts?: number;
private readonly customHeaders?: Record<string, string>;

private originId?: string;

protected constructor(domainName: string, props: OriginProps = {}) {
validateIntInRangeOrUndefined('connectionTimeout', 1, 10, props.connectionTimeout?.toSeconds());
validateIntInRangeOrUndefined('connectionAttempts', 1, 3, props.connectionAttempts, false);
Expand All @@ -99,22 +97,10 @@ export abstract class OriginBase implements IOrigin {
this.customHeaders = props.customHeaders;
}

/**
* The unique id for this origin.
*
* Cannot be accesed until bind() is called.
*/
public get id(): string {
if (!this.originId) { throw new Error('Cannot access originId until `bind` is called.'); }
return this.originId;
}

/**
* Binds the origin to the associated Distribution. Can be used to grant permissions, create dependent resources, etc.
*/
public bind(_scope: Construct, options: OriginBindOptions): OriginBindConfig {
this.originId = options.originId;

const s3OriginConfig = this.renderS3OriginConfig();
const customOriginConfig = this.renderCustomOriginConfig();

Expand All @@ -124,7 +110,7 @@ export abstract class OriginBase implements IOrigin {

return { originProperty: {
domainName: this.domainName,
id: this.id,
id: options.originId,
originPath: this.originPath,
connectionAttempts: this.connectionAttempts,
connectionTimeout: this.connectionTimeout?.toSeconds(),
Expand Down