Code review comment for lp://staging/~benoit-canet/goamz/add-CONTRIBUTING

Revision history for this message
BenoƮt Canet (benoit-canet) wrote :

Reviewers: mp+218959_code.launchpad.net,

Message:
Please take a look.

Description:
Add the Outscale EC2 compatible cloud provider.

This commits define the EC2 endpoint used by Outscale in Outscale
specific regions.

Outscale only implement the EC2 API so other endpoint are left set to
"".

This commit takes care of making the code panic in various constructor
when a struct will use an undefined endpoint.

https://code.launchpad.net/~benoit-canet/goamz/add-CONTRIBUTING/+merge/218959

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/98130043/

Affected files (+61, -0 lines):
   A [revision details]
   M aws/aws.go
   M exp/sdb/sdb.go
   M exp/sns/sns.go
   M iam/iam.go
   M s3/s3.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision: <email address hidden>

Index: aws/aws.go
=== modified file 'aws/aws.go'
--- aws/aws.go 2014-02-12 13:42:33 +0000
+++ aws/aws.go 2014-05-09 10:30:42 +0000
@@ -133,6 +133,47 @@
   "https://iam.amazonaws.com",
  }

+// The following regions are for the Outscale SAS cloud provider.
+// Outscale SAS only implement EC2 so other values are set to "".
+var OscEuWest3 = Region{
+ "osc-eu-west-3",
+ "https://api-ppd.outscale.com",
+ "",
+ "",
+ false,
+ false,
+ "",
+ "",
+ "",
+ "",
+}
+
+var OscEuWest1 = Region{
+ "osc-eu-west-1",
+ "https://api.eu-west-1.outscale.com",
+ "",
+ "",
+ false,
+ false,
+ "",
+ "",
+ "",
+ "",
+}
+
+var OscUsEast1 = Region{
+ "osc-us-east-1",
+ "https://api.us-east-1.outscale.com",
+ "",
+ "",
+ false,
+ false,
+ "",
+ "",
+ "",
+ "",
+}
+
  var Regions = map[string]Region{
   APNortheast.Name: APNortheast,
   APSoutheast.Name: APSoutheast,
@@ -142,6 +183,9 @@
   USWest.Name: USWest,
   USWest2.Name: USWest2,
   SAEast.Name: SAEast,
+ OscEuWest3.Name: OscEuWest3,
+ OscEuWest1.Name: OscEuWest1,
+ OscUsEast1.Name: OscUsEast1,
  }

  type Auth struct {

Index: iam/iam.go
=== modified file 'iam/iam.go'
--- iam/iam.go 2013-03-02 02:11:38 +0000
+++ iam/iam.go 2014-05-09 10:30:42 +0000
@@ -20,6 +20,9 @@

  // New creates a new IAM instance.
  func New(auth aws.Auth, region aws.Region) *IAM {
+ if region.IAMEndpoint == "" {
+ panic("The provided region has no IAM endpoint")
+ }
   return &IAM{auth, region}
  }

Index: s3/s3.go
=== modified file 's3/s3.go'
--- s3/s3.go 2014-02-12 13:42:33 +0000
+++ s3/s3.go 2014-05-09 10:30:42 +0000
@@ -68,6 +68,12 @@

  // New creates a new S3.
  func New(auth aws.Auth, region aws.Region) *S3 {
+ if region.S3Endpoint == "" {
+ panic("The provided region has no S3 endpoint")
+ }
+ if region.S3BucketEndpoint == "" {
+ panic("The provided region has no S3 bucket endpoint")
+ }
   return &S3{auth, region, 0}
  }

Index: exp/sdb/sdb.go
=== modified file 'exp/sdb/sdb.go'
--- exp/sdb/sdb.go 2013-05-23 01:06:45 +0000
+++ exp/sdb/sdb.go 2014-05-09 10:30:42 +0000
@@ -42,6 +42,9 @@

  // New creates a new SDB.
  func New(auth aws.Auth, region aws.Region) *SDB {
+ if region.SDBEndpoint == "" {
+ panic("The provided region has not SDB endpoint")
+ }
   return &SDB{auth, region, 0}
  }

Index: exp/sns/sns.go
=== modified file 'exp/sns/sns.go'
--- exp/sns/sns.go 2012-03-09 15:34:56 +0000
+++ exp/sns/sns.go 2014-05-09 10:30:42 +0000
@@ -47,6 +47,9 @@
  }

  func New(auth aws.Auth, region aws.Region) *SNS {
+ if region.SNSEndpoint == "" {
+ panic("The provided region has no SNS endpoint")
+ }
   return &SNS{auth, region, 0}
  }

« Back to merge proposal