Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._crossAccountSupport[resourceStack.account] = resourceStack;
return resourceStack;
}
}
if (!action.actionProperties.account) {
return undefined;
}
const targetAccount = action.actionProperties.account;
// check whether the account is a static string
if (Token.isUnresolved(targetAccount)) {
throw new Error(`The 'account' property must be a concrete value (action: '${action.actionProperties.actionName}')`);
}
// check whether the pipeline account is a static string
if (Token.isUnresolved(pipelineStack.account)) {
throw new Error("Pipeline stack which uses cross-environment actions must have an explicitly set account");
}
if (pipelineStack.account === targetAccount) {
return undefined;
}
let targetAccountStack: Stack | undefined = this._crossAccountSupport[targetAccount];
if (!targetAccountStack) {
const stackId = `cross-account-support-stack-${targetAccount}`;
const app = this.requireApp();
targetAccountStack = app.node.tryFindChild(stackId) as Stack;
if (!targetAccountStack) {
targetAccountStack = new Stack(app, stackId, {
stackName: `${pipelineStack.stackName}-support-${targetAccount}`,
env: {
constructor(scope: Construct, id: string, attrs: SubnetAttributes) {
super(scope, id);
if (!attrs.routeTableId) {
const ref = Token.isUnresolved(attrs.subnetId)
? `at '${scope.node.path}/${id}'`
: `'${attrs.subnetId}'`;
// tslint:disable-next-line: max-line-length
scope.node.addWarning(`No routeTableId was provided to the subnet ${ref}. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)`);
}
this.availabilityZone = attrs.availabilityZone;
this.subnetId = attrs.subnetId;
this.routeTable = {
// Forcing routeTableId to pretend non-null to maintain backwards-compatibility. See https://github.com/aws/aws-cdk/pull/3171
routeTableId: attrs.routeTableId!
};
}
constructor(private readonly url: string, private readonly props: UrlSubscriptionProps = {}) {
this.unresolvedUrl = Token.isUnresolved(url);
if (!this.unresolvedUrl && !url.startsWith('http://') && !url.startsWith('https://')) {
throw new Error('URL must start with either http:// or https://');
}
if (this.unresolvedUrl && props.protocol === undefined) {
throw new Error('Must provide protocol if url is unresolved');
}
if (this.unresolvedUrl) {
this.protocol = props.protocol!;
} else {
this.protocol = this.url.startsWith('https:') ? sns.SubscriptionProtocol.HTTPS : sns.SubscriptionProtocol.HTTP;
}
}
function renderPort(port: number) {
return Token.isUnresolved(port) ? `{IndirectPort}` : port.toString();
}
function stringifyNumber(x: number) {
if (Token.isUnresolved(x)) {
return Lazy.stringValue({ produce: context => `${context.resolve(x)}` });
} else {
return `${x}`;
}
}
private requireRegion(): string {
const region = Stack.of(this).region;
if (Token.isUnresolved(region)) {
throw new Error(`Pipeline stack which uses cross-environment actions must have an explicitly set region`);
}
return region;
}
function domainValidationOption(domainName: string): CfnCertificate.DomainValidationOptionProperty {
let validationDomain = props.validationDomains && props.validationDomains[domainName];
if (validationDomain === undefined) {
if (Token.isUnresolved(domainName)) {
throw new Error(`When using Tokens for domain names, 'validationDomains' needs to be supplied`);
}
validationDomain = apexDomain(domainName);
}
return { domainName, validationDomain };
}
}
: props.nameServers.map(ns => (Token.isUnresolved(ns) || ns.endsWith('.')) ? ns : `${ns}.`)
),
constructor(private readonly cidrIpv6: string) {
if (!Token.isUnresolved(cidrIpv6)) {
const cidrMatch = cidrIpv6.match(/^([\da-f]{0,4}:){2,7}([\da-f]{0,4})?(\/\d+)?$/);
if (!cidrMatch) {
throw new Error(`Invalid IPv6 CIDR: "${cidrIpv6}"`);
}
if (!cidrMatch[3]) {
throw new Error(`CIDR mask is missing in IPv6: "${cidrIpv6}". Did you mean "${cidrIpv6}/128"?`);
}
}
this.uniqueId = cidrIpv6;
}
function validateBuildArgs(buildArgs?: { [key: string]: string }) {
for (const [key, value] of Object.entries(buildArgs || {})) {
if (Token.isUnresolved(key) || Token.isUnresolved(value)) {
throw new Error(`Cannot use tokens in keys or values of "buildArgs" since they are needed before deployment`);
}
}
}