import * as cdk from 'aws-cdk-lib'; import { CfnDatabase, CfnTable } from 'aws-cdk-lib/aws-glue'; import * as iam from 'aws-cdk-lib/aws-iam'; import type { Construct } from 'constructs'; import { ColumnDefinition } from './schema'; /** * Column definition for a view. * * Sample: * ```ts * { * columnType: Schema.DOUBLE, * definition: 'price_per_unit * quantity' * } * ``` */ export interface ViewTableColumnDefinition extends ColumnDefinition { /** * If the column is a derived column, this is the SQL definition. * * As example for just renaming a column the definition would be `old_column_name` but also more complex SQL statements are possible. */ readonly definition?: string; } export interface ViewTableProps { /** * The view name. * * @defaultValue - generated by CDK */ readonly viewName?: string; /** * Description of the view. */ readonly description?: string; /** * SQL Query statement to query the source data which is actually the FROM statement. * @example `orders` */ readonly fromQuery: string; /** * Glue database where the view will be created. */ readonly database: string | cdk.IResolvable | CfnDatabase; /** * Columns of a view. * * Sample: * ```ts * { * total: { * columnType: Schema.DOUBLE, * definition: 'price_per_unit * quantity' * }, * } * ``` */ readonly columns: Record; } /** * A representation of a View in Athena, which is actually a Glue Table. * * Sample usage: * ```ts * new ViewTable(this, 'AwsAmortizedCostsView', { * database: database, * viewName: 'cur2_with_amortized_costs', * fromQuery: '"cid_data_export"."cur2"', * columns: { * ...cur2Schema.columns, * amortized_cost: { * columnType: Schema.DOUBLE, * definition: `CASE * WHEN (line_item_line_item_type = 'SavingsPlanCoveredUsage') THEN savings_plan_net_savings_plan_effective_cost * WHEN (line_item_line_item_type = 'SavingsPlanRecurringFee') THEN (savings_plan_total_commitment_to_date - savings_plan_used_commitment) * WHEN (line_item_line_item_type = 'SavingsPlanNegation') THEN 0 * WHEN (line_item_line_item_type = 'SavingsPlanUpfrontFee') THEN 0 * WHEN (line_item_line_item_type = 'EdpDiscount' AND line_item_product_code = 'ComputeSavingsPlans') THEN 0 * WHEN (line_item_line_item_type = 'EdpDiscount' AND line_item_product_code = 'AWSSupportEnterprise') THEN 0 * WHEN (line_item_line_item_type = 'DiscountedUsage') THEN reservation_effective_cost * WHEN (line_item_line_item_type = 'RIFee') THEN (reservation_unused_amortized_upfront_fee_for_billing_period + reservation_unused_recurring_fee) * WHEN ((line_item_line_item_type = 'Fee') AND (reservation_reservation_a_r_n <> '')) THEN 0 * ELSE line_item_unblended_cost END` * } * } *}); * ``` * * @see https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-glue-alpha */ export declare class ViewTable extends cdk.Resource { /** * @internal */ protected readonly _viewName: string; /** * @internal */ protected readonly _resource: CfnTable; /** * @internal */ protected readonly _databaseName: string; /** * @internal */ protected readonly _arn: string; /** * @internal */ protected readonly _databaseArn: string; /** * @internal */ protected readonly _catalogArn: string; constructor(scope: Construct, id: string, props: ViewTableProps); grant(grantee: iam.IGrantable, actions: string[]): cdk.aws_iam.Grant; grantToUnderlyingResources(grantee: iam.IGrantable, actions: string[]): cdk.aws_iam.Grant; grantRead(grantee: iam.IGrantable): cdk.aws_iam.Grant; grantWrite(grantee: iam.IGrantable): cdk.aws_iam.Grant; grantReadWrite(grantee: iam.IGrantable): cdk.aws_iam.Grant; }