github.com/mweagle/Sparta@v1.15.0/s3site.go (about) 1 package sparta 2 3 import ( 4 "github.com/aws/aws-sdk-go/service/s3" 5 gocf "github.com/mweagle/go-cloudformation" 6 ) 7 8 func stableCloudformationResourceName(prefix string) string { 9 return CloudFormationResourceName(prefix, prefix) 10 } 11 12 // S3Site provisions a new, publicly available S3Bucket populated by the 13 // contents of the resources directory. 14 // http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-s3.html#scenario-s3-bucket-website-customdomain 15 type S3Site struct { 16 // Directory or filepath (uncompressed) of contents to use to initialize 17 // S3 bucket hosting site. 18 resources string 19 // If nil, defaults to ErrorDocument: error.html and IndexDocument: index.html 20 WebsiteConfiguration *s3.WebsiteConfiguration 21 // BucketName is the name of the bucket to create. Required 22 // to specify a CloudFront Distribution 23 BucketName *gocf.StringExpr 24 // UserManifestData is a map of optional data to include 25 // in the MANIFEST.json data at the site root. These optional 26 // values will be scoped to a `userdata` key in the MANIFEST.json 27 // object 28 UserManifestData map[string]interface{} 29 } 30 31 // CloudFormationS3ResourceName returns the stable CloudformationResource name that 32 // can be used by callers to get S3 resource outputs for API Gateway configuration 33 func (s3Site *S3Site) CloudFormationS3ResourceName() string { 34 return stableCloudformationResourceName("S3Site") 35 }