import { Construct, IConstruct } from "./construct-compat"; import { RosResource } from "./ros-resource"; import { RemovalPolicy } from "./ros-removal-policy"; import { RosCondition } from "./ros-condition"; import { Stack } from "./stack"; import { IResolvable } from "./resolvable"; export interface IResourceEnvironment { /** * The Alibaba Cloud account ID that this resource belongs to. * Since this can be a Token * (for example, when the account is ROS's ALIYUN::AccountId intrinsic), * make sure to use Token.compareStrings() * instead of just comparing the values for equality. */ readonly account: string; /** * The Alibaba Cloud region that this resource belongs to. * Since this can be a Token * (for example, when the region is ROS's ALIYUN::Region intrinsic), * make sure to use Token.compareStrings() * instead of just comparing the values for equality. */ readonly region: string; } /** * Interface for the Resource construct. */ export interface IResource extends IConstruct { /** * The stack in which this resource is defined. */ readonly stack: Stack; /** * The environment this resource belongs to. * For resources that are created and managed by the CDK * (generally, those created by creating new class instances like Role, Bucket, etc.), * this is always the same as the environment of the stack they belong to; * however, for imported resources * (those obtained from static methods like fromRoleArn, fromBucketName, etc.), * that might be different than the stack they were imported into. */ readonly env: IResourceEnvironment; } /** * Construction properties for {@link Resource}. */ export interface ResourceProps { /** * The value passed in by users to the physical name prop of the resource. * * - `undefined` implies that a physical name will be allocated during deployment. * - a concrete value implies a specific physical name * - `PhysicalName.GENERATE_IF_NEEDED` is a marker that indicates that a physical will only be generated * by the CDK if it is needed for cross-environment references. Otherwise, it will be allocated. * * @default - The physical name will be allocated at deployment time */ readonly physicalName?: string; /** * The Alibaba Cloud account ID this resource belongs to. * * @default - the resource is in the same account as the stack it belongs to */ readonly account?: string; /** * The Alibaba Cloud region this resource belongs to. * * @default - the resource is in the same region as the stack it belongs to */ readonly region?: string; /** * ARN to deduce region and account from * * The ARN is parsed and the account and region are taken from the ARN. * This should be used for imported resources. * * Cannot be supplied together with either `account` or `region`. * * @default - take environment from `account`, `region` parameters, or use Stack environment. */ readonly environmentFromArn?: string | IResolvable; } /** * A construct which represents a resource. */ export declare abstract class Resource extends Construct implements IResource { readonly stack: Stack; readonly env: IResourceEnvironment; resource: RosResource | undefined; /** * Returns a string-encoded token that resolves to the physical name that * should be passed to the ROS resource. * * This value will resolve to one of the following: * - a concrete value (e.g. `"my-awesome-bucket"`) * - `undefined`, when a name should be generated by ROS * - a concrete name generated automatically during synthesis, in * cross-environment scenarios. * * @experimental */ protected readonly physicalName: string; private _physicalName; private readonly _allowCrossEnvironment; constructor(scope: Construct, id: string, props?: ResourceProps); addDependency(resource: Resource): void; fetchDependency(): string[] | undefined; applyRemovalPolicy(policy: RemovalPolicy): void; addCondition(condition: RosCondition): void; fetchCondition(): RosCondition | undefined; addResourceDesc(desc: string): void; fetchResourceDesc(): string | undefined; setMetadata(key: string, value: any): void; addCount(count: number | IResolvable): void; getAtt(name: string): IResolvable; get ref(): string; /** * Called when this resource is referenced across environments * (account/region) to order to request that a physical name will be generated * for this resource during synthesis, so the resource can be referenced * through it's absolute name/arn. * * @internal */ _enableCrossEnvironment(): void; protected generatePhysicalName(): string; }