Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved access to env variables to more general AWS_ACCESS_KEY class.

  • Loading branch information...
commit 784dedc2a0fe3c4d92a88e66fe155119f47e810a 1 parent 92b4141
@berenddeboer authored
View
2  README.md
@@ -8,4 +8,4 @@ But contributions and cleanup are greatly appreciated.
Requirements
============
-Gobo and eposix.
+Gobo and eposix. Might also need Gobo dxml.
View
51 library/base/aws_access_key.e
@@ -0,0 +1,51 @@
+note
+
+ description:
+
+ "Default AWS access keys"
+
+ library: "Eiffel AWS library"
+ author: "Berend de Boer <berend@pobox.com>"
+ copyright: "Copyright (c) 2008-2012, Berend de Boer"
+ license: "MIT License (see LICENSE)"
+
+
+class
+
+ AWS_ACCESS_KEY
+
+
+feature -- Access
+
+ access_key_id: STRING
+ -- AWS access key from environment variable, if available;
+ -- Empty string otherwise.
+ local
+ env: EPX_ENV_VAR
+ once
+ create env.make (once "AWS_ACCESS_KEY_ID")
+ if not env.is_set then
+ create env.make (once "S3_ACCESS_KEY_ID")
+ end
+ Result := env.value
+ ensure
+ not_void: Result /= Void
+ end
+
+ secret_access_key: STRING
+ -- AWS secret access key from environment variable, if available;
+ -- Empty string otherwise.
+ local
+ env: STDC_ENV_VAR
+ once
+ create env.make (once "AWS_SECRET_ACCESS_KEY")
+ if not env.is_set then
+ create env.make (once "S3_SECRET_ACCESS_KEY")
+ end
+ Result := env.value
+ ensure
+ not_void: Result /= Void
+ end
+
+
+end
View
5 library/cloudwatch/aws_cloudwatch.e
@@ -17,10 +17,7 @@ class
inherit
- EPX_HTTP_11_CLIENT
- rename
- make as make_http_11_client
- end
+ AWS_BASE
UT_URL_ENCODING
export
View
1  library/library.xace
@@ -11,6 +11,7 @@
</description>
<cluster name="aws" location="${AWS_EIFFEL}/library">
+ <cluster name="base"/>
<cluster name="cloudwatch"/>
<cluster name="documents"/>
<cluster name="s3"/>
View
39 library/s3/s3_access_key.e
@@ -1,39 +0,0 @@
-indexing
-
- description:
-
- "Default access keys"
-
- library: "s3 library"
- author: "Berend de Boer <berend@pobox.com>"
- copyright: "Copyright (c) 2008, Berend de Boer"
- license: "MIT License (see LICENSE)"
- date: "$Date$"
- revision: "$Revision$"
-
-
-class
-
- S3_ACCESS_KEY
-
-
-feature -- Access
-
- access_key_id: STRING is
- local
- env: STDC_ENV_VAR
- once
- create env.make (once "S3_ACCESS_KEY_ID")
- Result := env.value
- end
-
- secret_access_key: STRING is
- local
- env: STDC_ENV_VAR
- once
- create env.make (once "S3_SECRET_ACCESS_KEY")
- Result := env.value
- end
-
-
-end
View
14 test/cloudwatch/test_cloudwatch.e
@@ -19,20 +19,18 @@ inherit
TS_TEST_CASE
+ AWS_ACCESS_KEY
+
feature -- Tests
test_put_metric_data
local
- key: EPX_ENV_VAR
- secret: EPX_ENV_VAR
cloudwatch: AWS_CLOUDWATCH
data_points: DS_LINKED_LIST [AWS_METRIC_DATUM]
data_point: AWS_METRIC_DATUM
do
- create key.make (once "S3_ACCESS_KEY_ID")
- create secret.make (once "S3_SECRET_ACCESS_KEY")
- create cloudwatch.make (key.value, secret.value)
+ create cloudwatch.make (access_key_id, secret_access_key)
create data_point.make ("test-data-point", 1, "Count", Void)
create data_points.make
data_points.put_last (data_point)
@@ -46,13 +44,9 @@ feature -- Tests
test_list_metrics
local
- key: EPX_ENV_VAR
- secret: EPX_ENV_VAR
cloudwatch: AWS_CLOUDWATCH
do
- create key.make (once "S3_ACCESS_KEY_ID")
- create secret.make (once "S3_SECRET_ACCESS_KEY")
- create cloudwatch.make (key.value, secret.value)
+ create cloudwatch.make (access_key_id, secret_access_key)
cloudwatch.list_metrics ("aws-eiffel-test", "test-data-point")
debug ("test")
print (cloudwatch.response_code.out + " " + cloudwatch.response_phrase + "%N")
Please sign in to comment.
Something went wrong with that request. Please try again.