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

S3 export/import description is off #652

Closed
Doug-AWS opened this issue Aug 31, 2018 · 5 comments
Closed

S3 export/import description is off #652

Doug-AWS opened this issue Aug 31, 2018 · 5 comments
Assignees
Labels
docs/guide Related to the developer guide effort/small Small work item – less than a day of effort

Comments

@Doug-AWS
Copy link
Contributor

Doug-AWS commented Aug 31, 2018

As far as I can tell, S3 bucket.export returns a BucketRefProps object, not BucketRef. This works for me:

import cdk = require("@aws-cdk/cdk");
import s3 = require("@aws-cdk/aws-s3");

class HelloCdkStack extends cdk.Stack {
    public readonly myBucketRef: s3.BucketRefProps;

    constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
        super(parent, name, props);

        const mybucket = new s3.Bucket(this, "MyFirstBucket");

        this.myBucketRef = mybucket.export();
    }
}

interface ConsumerProps {
    userBucketRef: s3.BucketRefProps;
}

class MyCdkStack extends cdk.Stack {
    constructor(parent: cdk.App, name: string, props: ConsumerProps) {
        super(parent, name);

        s3.Bucket.import(this, "MyOtherBucket", props.userBucketRef);
    }
}

const app = new cdk.App(process.argv);

const myStack = new HelloCdkStack(app, "HelloCdkStack");
new MyCdkStack(app, "MyCdkStack", {
    userBucketRef: myStack.myBucketRef
});

process.stdout.write(app.run());
@Doug-AWS
Copy link
Contributor Author

This is part of the general conversation about the change to the export/import model. See #1525

@Doug-AWS Doug-AWS added the docs/guide Related to the developer guide label Jan 23, 2019
@Doug-AWS
Copy link
Contributor Author

Is this code correct? I will not add this info to the guide until a CDK dev endorses it.

@Doug-AWS Doug-AWS added p1 effort/small Small work item – less than a day of effort pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Jan 29, 2019
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 26, 2019

This is not the recommended way of sharing buckets anymore.

@Doug-AWS Doug-AWS self-assigned this Feb 26, 2019
@Doug-AWS
Copy link
Contributor Author

Okay, I'll wait on #1546

@Doug-AWS Doug-AWS added parked and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. parked labels Feb 26, 2019
@Doug-AWS Doug-AWS added post-GA and removed p1 labels Apr 16, 2019
@Doug-AWS
Copy link
Contributor Author

Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs/guide Related to the developer guide effort/small Small work item – less than a day of effort
Projects
None yet
Development

No branches or pull requests

2 participants