serverkit-aws 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/lib/serverkit/aws/version.rb +5 -0
- data/lib/serverkit/aws.rb +2 -0
- data/lib/serverkit/resources/s3_bucket.rb +42 -0
- data/serverkit-aws.gemspec +21 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a57e09c031fe6375425d75add1e4a91ebcc47bb3
|
4
|
+
data.tar.gz: 362b1425fbadec3124b9db2e2768e621fedf9a20
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e13f5c6b752db825331d46ca0fd3e4a1ecd66e05e5dda558fe31dbdb8c8c14a157d56ddf12a92d7eb5b0bfd592389b3559e75fe4da633ae6c0abeb8821cac62
|
7
|
+
data.tar.gz: bfe51e47fbd04a82e30ffe625904189deb47734040d535e27fbb1e606d5e1f07635cbdcb90beafa64f1157cd70801245a414191d23cb1686fbe48deb935dd80d
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Ryo Nakamura
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# serverkit-aws
|
2
|
+
[Serverkit](https://github.com/serverkit/serverkit) plug-in for Amazon Web Services (AWS).
|
3
|
+
|
4
|
+
## Install
|
5
|
+
```rb
|
6
|
+
# Gemfile
|
7
|
+
gem "serverkit-aws"
|
8
|
+
```
|
9
|
+
|
10
|
+
## Resource
|
11
|
+
### s3_bucket
|
12
|
+
Create a S3 bucket.
|
13
|
+
|
14
|
+
#### Attributes
|
15
|
+
- name - S3 bucket name (required) (e.g. `"my-bucket"`)
|
16
|
+
- aws_access_key_id - AWS access key ID
|
17
|
+
- aws_region - AWS region
|
18
|
+
- aws_secret_access_key - AWS secret access key
|
19
|
+
|
20
|
+
Note: serverkit-s3 searches the following locations for credentials and a region:
|
21
|
+
|
22
|
+
- `ENV["AWS_ACCESS_KEY_ID"]`
|
23
|
+
- `ENV["AWS_REGION"]`
|
24
|
+
- `ENV["AWS_SECRET_ACCESS_KEY"]`
|
25
|
+
- The shared credentials ini file at `~/.aws/credentials`
|
26
|
+
- From an instance profile when running on EC2
|
27
|
+
|
28
|
+
#### Example
|
29
|
+
```yml
|
30
|
+
resources:
|
31
|
+
- type: s3_bucket
|
32
|
+
name: my-bucket
|
33
|
+
aws_region: ap-northeast-1
|
34
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "aws-sdk"
|
2
|
+
require "serverkit/resources/base"
|
3
|
+
|
4
|
+
module Serverkit
|
5
|
+
module Resources
|
6
|
+
class S3Bucket < Base
|
7
|
+
attribute :aws_access_key_id, type: String
|
8
|
+
attribute :aws_region, type: String
|
9
|
+
attribute :aws_secret_access_key, type: String
|
10
|
+
attribute :name, required: true, type: String
|
11
|
+
|
12
|
+
# @note Override
|
13
|
+
def apply
|
14
|
+
client.create_bucket(bucket: name)
|
15
|
+
end
|
16
|
+
|
17
|
+
# @note Override
|
18
|
+
def check
|
19
|
+
client.head_bucket(bucket: name)
|
20
|
+
true
|
21
|
+
rescue ::Aws::S3::Errors::NotFound
|
22
|
+
false
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# @return [Aws::S3::Client]
|
28
|
+
def client
|
29
|
+
@client ||= ::Aws::S3::Client.new(client_options)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Hash]
|
33
|
+
def client_options
|
34
|
+
options = { region: aws_region }
|
35
|
+
if aws_access_key_id || aws_secret_access_key
|
36
|
+
options[:credentials] = ::Aws::Credentials.new(aws_access_key_id, aws_secret_access_key)
|
37
|
+
end
|
38
|
+
options
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "serverkit/aws/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "serverkit-aws"
|
7
|
+
spec.version = Serverkit::Aws::VERSION
|
8
|
+
spec.authors = ["Ryo Nakamura"]
|
9
|
+
spec.email = ["r7kamura@gmail.com"]
|
10
|
+
spec.summary = "Serverkit plug-in for Amazon Web Services (AWS)."
|
11
|
+
spec.homepage = "https://github.com/serverkit/serverkit-s3"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "aws-sdk", "~> 2"
|
18
|
+
spec.add_runtime_dependency "serverkit", ">= 0.6.7"
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: serverkit-aws
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryo Nakamura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: serverkit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.6.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- r7kamura@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- CHANGELOG.md
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/serverkit/aws.rb
|
83
|
+
- lib/serverkit/aws/version.rb
|
84
|
+
- lib/serverkit/resources/s3_bucket.rb
|
85
|
+
- serverkit-aws.gemspec
|
86
|
+
homepage: https://github.com/serverkit/serverkit-s3
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.5
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Serverkit plug-in for Amazon Web Services (AWS).
|
110
|
+
test_files: []
|
111
|
+
has_rdoc:
|