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

Update aws-ts-serverless-datawarehouse to BucketV2 #1698

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions aws-ts-serverless-datawarehouse/datawarehouse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as aws from "@pulumi/aws";
import { ARN } from "@pulumi/aws";
import { EventRuleEvent } from "@pulumi/aws/cloudwatch";
import { BucketArgs } from "@pulumi/aws/s3";
import { BucketV2Args } from "@pulumi/aws/s3";
import { input } from "@pulumi/aws/types";
import * as pulumi from "@pulumi/pulumi";
import { getS3Location } from "../utils";
Expand All @@ -13,19 +13,19 @@ import { HourlyPartitionRegistrar, PartitionRegistrarArgs } from "./partitionReg

export class ServerlessDataWarehouse extends pulumi.ComponentResource {

public dataWarehouseBucket: aws.s3.Bucket;
public queryResultsBucket: aws.s3.Bucket;
public dataWarehouseBucket: aws.s3.BucketV2;
public queryResultsBucket: aws.s3.BucketV2;
public database: aws.glue.CatalogDatabase;
private tables: { [key: string]: aws.glue.CatalogTable } = {};
private inputStreams: { [key: string]: aws.kinesis.Stream } = {};

constructor(name: string, args: DataWarehouseArgs = {}, opts: pulumi.ComponentResourceOptions = {}) {
super("serverless:data_warehouse", name, opts);

const bucketArgs: BucketArgs | undefined = args.isDev ? { forceDestroy: true } : undefined;
const bucketArgs: BucketV2Args | undefined = args.isDev ? { forceDestroy: true } : undefined;

const dataWarehouseBucket = new aws.s3.Bucket("datawarehouse-bucket", bucketArgs, { parent: this });
const queryResultsBucket = new aws.s3.Bucket("query-results-bucket", bucketArgs, { parent: this });
const dataWarehouseBucket = new aws.s3.BucketV2("datawarehouse-bucket", bucketArgs, { parent: this });
const queryResultsBucket = new aws.s3.BucketV2("query-results-bucket", bucketArgs, { parent: this });

const database = args.database || new aws.glue.CatalogDatabase(name, {
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export class InputStream extends pulumi.ComponentResource {
},
bucketArn: args.destinationBucket.arn,
prefix: args.tableName + "/",
bufferInterval,
bufferSize: 64,
bufferingInterval: bufferInterval,
bufferingSize: 64,
roleArn: role.arn,
dataFormatConversionConfiguration: {
inputFormatConfiguration: {
Expand Down Expand Up @@ -129,7 +129,7 @@ export class InputStream extends pulumi.ComponentResource {
export interface InputStreamArgs {
databaseName: pulumi.Input<string>;
tableName: pulumi.Input<string>;
destinationBucket: aws.s3.Bucket;
destinationBucket: aws.s3.BucketV2;
shardCount: number;
fileFlushIntervalSeconds?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class HourlyPartitionRegistrar extends pulumi.ComponentResource {
export interface PartitionRegistrarArgs {
table: string;
partitionKey: string;
dataWarehouseBucket: aws.s3.Bucket;
athenaResultsBucket: aws.s3.Bucket;
dataWarehouseBucket: aws.s3.BucketV2;
athenaResultsBucket: aws.s3.BucketV2;
database: aws.glue.CatalogDatabase;
region: string;
scheduleExpression?: string;
Expand Down
2 changes: 1 addition & 1 deletion aws-ts-serverless-datawarehouse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ dataWarehouse.withTable("facts", factTableArgs);
const data = `{"thing": "sky", "color": "blue"}\n{ "thing": "seattle sky", "color": "grey"}\n{ "thing": "oranges", "color": "orange"}`;

const factJSON = new aws.s3.BucketObject("factsFile", {
bucket: dataWarehouse.dataWarehouseBucket,
bucket: dataWarehouse.dataWarehouseBucket.bucket,
content: data,
key: `${factTableName}/facts.json`,
});
Expand Down
2 changes: 1 addition & 1 deletion aws-ts-serverless-datawarehouse/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";

export const getS3Location = (bucket: aws.s3.Bucket, tableName: string): pulumi.Output<string> => {
export const getS3Location = (bucket: aws.s3.BucketV2, tableName: string): pulumi.Output<string> => {
return bucket.arn.apply(a => `s3://${a.split(":::")[1]}/${tableName}`);
};
Loading