Skip to content

Commit

Permalink
chore(cloudfront): remove the originId property from OriginBase (#9380)
Browse files Browse the repository at this point in the history
This property is no longer used, and OriginBase is a publicly available class of the module.

BREAKING CHANGE: the property OriginBase.originId has been removed

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
skinny85 committed Aug 3, 2020
1 parent 056bcaf commit 70b9f63
Showing 1 changed file with 1 addition and 15 deletions.
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

0 comments on commit 70b9f63

Please sign in to comment.