├── test
├── fixtures
│ └── cookbooks
│ │ ├── node_dump
│ │ ├── metadata.rb
│ │ └── recipes
│ │ │ └── default.rb
│ │ ├── test_get
│ │ ├── metadata.rb
│ │ └── recipes
│ │ │ ├── profile.rb
│ │ │ └── default.rb
│ │ └── test_virtualenv
│ │ ├── metadata.rb
│ │ └── recipes
│ │ └── default.rb
├── shared
│ └── spec_helper.rb
└── integration
│ ├── test_virtualenv
│ └── serverspec
│ │ └── test_virtualenv_spec.rb
│ ├── default
│ └── serverspec
│ │ └── default_spec.rb
│ ├── profile_test_get
│ └── serverspec
│ │ └── test_get_spec.rb
│ └── test_get
│ └── serverspec
│ └── test_get_spec.rb
├── NOTICE
├── .gitignore
├── .kitchen.docker.yml
├── Gemfile
├── Berksfile
├── .rubocop.yml
├── CHANGELOG.md
├── metadata.rb
├── spec
└── unit
│ ├── spec_helper.rb
│ └── recipes
│ ├── _linux_spec.rb
│ ├── default_spec.rb
│ └── _windows_spec.rb
├── libraries
└── matchers.rb
├── Rakefile
├── recipes
├── default.rb
├── _linux.rb
└── _windows.rb
├── .kitchen.ec2.yml
├── attributes
└── default.rb
├── chefignore
├── .kitchen.yml
├── resources
└── s3_file.rb
├── providers
└── s3_file.rb
├── README.md
└── LICENSE
/test/fixtures/cookbooks/node_dump/metadata.rb:
--------------------------------------------------------------------------------
1 | name 'node_dump'
2 |
--------------------------------------------------------------------------------
/test/fixtures/cookbooks/test_get/metadata.rb:
--------------------------------------------------------------------------------
1 | name 'test_get'
2 | depends 'awscli'
3 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | aws-cli Cookbook
2 | Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 |
--------------------------------------------------------------------------------
/test/fixtures/cookbooks/test_virtualenv/metadata.rb:
--------------------------------------------------------------------------------
1 | name 'test_virtualenv'
2 | depends 'python'
3 | depends 'awscli'
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *#
3 | .#*
4 | \#*#
5 | .*.sw[a-z]
6 | *.un~
7 | pkg/
8 |
9 | # Berkshelf
10 | .vagrant
11 | /cookbooks
12 | Berksfile.lock
13 |
14 | # Bundler
15 | Gemfile.lock
16 | bin/*
17 | .bundle/*
18 |
19 | .kitchen/
20 | .kitchen.local.yml
21 |
--------------------------------------------------------------------------------
/.kitchen.docker.yml:
--------------------------------------------------------------------------------
1 | ---
2 | driver:
3 | name: docker
4 |
5 | platforms:
6 | - name: ubuntu-14.04
7 | run_list:
8 | - recipe[apt]
9 | - name: centos-6.4
10 | driver_config:
11 | image: centos
12 | platform: rhel
13 | run_list:
14 | - recipe[yum]
15 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | gem 'berkshelf'
4 | gem 'emeril'
5 |
6 | group :style do
7 | gem 'rubocop'
8 | gem 'foodcritic'
9 | end
10 |
11 | group :test do
12 | gem 'test-kitchen'
13 | gem 'kitchen-vagrant'
14 | gem 'chefspec'
15 | end
16 |
17 | group :aws do
18 | gem 'kitchen-ec2'
19 | end
20 |
--------------------------------------------------------------------------------
/Berksfile:
--------------------------------------------------------------------------------
1 | source "https://supermarket.chef.io"
2 |
3 | metadata
4 |
5 | group :integration do
6 | cookbook "apt"
7 | cookbook 'node_dump', path: 'test/fixtures/cookbooks/node_dump'
8 | cookbook 'test_get', path: 'test/fixtures/cookbooks/test_get'
9 | cookbook 'test_virtualenv', path: 'test/fixtures/cookbooks/test_virtualenv'
10 | end
11 |
--------------------------------------------------------------------------------
/.rubocop.yml:
--------------------------------------------------------------------------------
1 | AllCops:
2 | Exclude:
3 | - vendor/**/*
4 | - tmp/**/*
5 | - cookbooks/**/*
6 | - bin/**/*
7 |
8 | AlignParameters:
9 | Enabled: false
10 | Encoding:
11 | Enabled: false
12 | HashSyntax:
13 | Enabled: false
14 | LineLength:
15 | Enabled: false
16 | StringLiterals:
17 | Enabled: false
18 | NumericLiterals:
19 | MinDigits: 12
20 | MethodLength:
21 | Max: 30
22 | Metrics/AbcSize:
23 | Max: 32
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.1.1 2015-05-26
2 |
3 | * Updated metadata.rb to show proper source and issues link on supermarket ([@nickryand][])
4 |
5 | ## 1.1.0 2015-05-26
6 |
7 | * Added owner, group, and mode parameters to the s3_file resource ([@nickryand][])
8 |
9 | ## 1.0.1 2015-01-10
10 |
11 | * Updated Berksfile to point to https://supermarket.chef.io ([@nickryand][])
12 |
13 | ## 1.0.0 2015-01-06
14 |
15 | Initial Release ([@nickryand][])
16 |
17 | [@nickryand]: https://github.com/nickryand
18 |
--------------------------------------------------------------------------------
/metadata.rb:
--------------------------------------------------------------------------------
1 | name 'awscli'
2 | maintainer 'Nick Downs'
3 | maintainer_email 'ndowns@amazon.com'
4 | license 'Apache 2.0'
5 | description 'Defines a number of LWRP wrapper commands around the awscli command line script'
6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7 | version '1.1.1'
8 | source_url 'https://github.com/awslabs/awscli-cookbook' if respond_to?(:source_url)
9 | issues_url 'https://github.com/awslabs/awscli-cookbook/issues' if respond_to?(:issues_url)
10 |
11 | supports 'ubuntu'
12 | supports 'centos'
13 |
14 | depends 'python', '~> 1.4'
15 |
--------------------------------------------------------------------------------
/spec/unit/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require 'chefspec'
15 | require 'chefspec/berkshelf'
16 | # require 'chefspec/cacher'
17 |
--------------------------------------------------------------------------------
/test/shared/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require 'serverspec'
15 |
16 | set :backend, :exec
17 | set :path, '/usr/local/bin:/sbin:/usr/local/sbin:$PATH'
18 |
--------------------------------------------------------------------------------
/libraries/matchers.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | if defined?(ChefSpec)
15 | def get_awscli_s3_file(path)
16 | ChefSpec::Matchers::ResourceMatcher.new(:awscli_s3_file, :get, path)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 | require 'bundler/setup'
4 | require 'emeril/rake'
5 |
6 | namespace :style do
7 | require 'rubocop/rake_task'
8 | desc 'Run rubocop for Ruby style checks'
9 | RuboCop::RakeTask.new(:ruby)
10 |
11 | require 'foodcritic'
12 | desc 'Run foodcritic for Chef style checks'
13 | FoodCritic::Rake::LintTask.new(:chef) do |t|
14 | t.options = { :fail_tags => ['correctness'] }
15 | end
16 | end
17 |
18 | desc 'Run all style checks'
19 | task style: ['style:chef', 'style:ruby']
20 |
21 | require 'rspec/core/rake_task'
22 | desc 'Run ChefSpec unit tests'
23 | RSpec::Core::RakeTask.new(:unit) do |t|
24 | t.rspec_opts = "--color --format progress"
25 | end
26 |
27 | namespace :travis do
28 | desc "run on Travis"
29 | task ci: ['unit']
30 | end
31 |
--------------------------------------------------------------------------------
/recipes/default.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Cookbook Name:: awscli
3 | # Recipe:: default
4 | #
5 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 | #
7 | # Licensed under the Apache License, Version 2.0 (the "License"). You
8 | # may not use this file except in compliance with the License. A copy of
9 | # the License is located at
10 | #
11 | # http://aws.amazon.com/apache2.0/
12 | #
13 | # or in the "license" file accompanying this file. This file is
14 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
15 | # ANY KIND, either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the License.
17 | #
18 | case node['platform_family']
19 | when 'windows'
20 | include_recipe 'awscli::_windows'
21 | else
22 | include_recipe 'awscli::_linux'
23 | end
24 |
--------------------------------------------------------------------------------
/test/integration/test_virtualenv/serverspec/test_virtualenv_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../../../kitchen/data/spec_helper'
15 |
16 | describe file('/tmp/testenv/bin/aws') do
17 | it { should be_file }
18 | it { should be_executable }
19 | end
20 |
--------------------------------------------------------------------------------
/recipes/_linux.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Cookbook Name:: awscli
3 | # Recipe:: _linux
4 | #
5 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 | #
7 | # Licensed under the Apache License, Version 2.0 (the "License"). You
8 | # may not use this file except in compliance with the License. A copy of
9 | # the License is located at
10 | #
11 | # http://aws.amazon.com/apache2.0/
12 | #
13 | # or in the "license" file accompanying this file. This file is
14 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
15 | # ANY KIND, either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the License.
17 | #
18 | include_recipe 'python::pip'
19 |
20 | python_pip 'awscli' do
21 | virtualenv node['awscli']['virtualenv'] if node['awscli']['virtualenv']
22 | action :install
23 | end
24 |
--------------------------------------------------------------------------------
/.kitchen.ec2.yml:
--------------------------------------------------------------------------------
1 | ---
2 | driver:
3 | name: ec2
4 | aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
5 | iam_profile_name: <%= ENV['AWS_IAM_PROFILE'] %>
6 | region: <%= ENV['AWS_REGION'] || 'us-east-1' %>
7 | availability_zone: <%= ENV['AWS_AVAILABILITY_ZONE'] || 'us-east-1b' %>
8 | instance_type: <%= ENV['AWS_FLAVOR_ID'] || 'm3.medium' %>
9 |
10 | transport:
11 | ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
12 | connection_timeout: 10
13 | connection_retries: 5
14 |
15 | provisioner:
16 | name: chef_zero
17 | require_chef_omnibus: latest
18 |
19 | platforms:
20 | - name: ubuntu-14.04-ec2
21 | driver:
22 | image_id: <%= ENV['AWS_UBUNTU_1404_AMI'] %>
23 | transport:
24 | username: ubuntu
25 | - name: amzn-linux-2014.09
26 | driver:
27 | image_id: <%= ENV['AWS_AMAZON_201409_AMI'] %>
28 | transport:
29 | username: ec2-user
30 |
--------------------------------------------------------------------------------
/test/integration/default/serverspec/default_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../../../kitchen/data/spec_helper'
15 |
16 | describe command('pip --version') do
17 | its(:exit_status) { should eq 0 }
18 | end
19 |
20 | describe command('aws --version') do
21 | its(:exit_status) { should eq 0 }
22 | end
23 |
--------------------------------------------------------------------------------
/test/fixtures/cookbooks/test_virtualenv/recipes/default.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | include_recipe 'python::virtualenv'
15 |
16 | python_virtualenv '/tmp/testenv' do
17 | owner 'root'
18 | group 'root'
19 | action :create
20 | end
21 |
22 | node.set['awscli']['virtualenv'] = '/tmp/testenv'
23 |
24 | include_recipe 'awscli::default'
25 |
--------------------------------------------------------------------------------
/recipes/_windows.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Cookbook Name:: awscli
3 | # Recipe:: _windows
4 | #
5 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 | #
7 | # Licensed under the Apache License, Version 2.0 (the "License"). You
8 | # may not use this file except in compliance with the License. A copy of
9 | # the License is located at
10 | #
11 | # http://aws.amazon.com/apache2.0/
12 | #
13 | # or in the "license" file accompanying this file. This file is
14 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
15 | # ANY KIND, either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the License.
17 | #
18 | remote_file "#{Chef::Config[:file_cache_path]}/awscli.msi" do
19 | source node['awscli']['windows_url']
20 | end
21 |
22 | windows_package 'aws_cli_installation' do
23 | source "#{Chef::Config[:file_cache_path]}/awscli.msi"
24 | action :install
25 | end
26 |
--------------------------------------------------------------------------------
/test/fixtures/cookbooks/test_get/recipes/profile.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | include_recipe 'awscli::default'
15 |
16 | # Awscli should pull credentials from the metadata profile if no creds
17 | # are set.
18 | awscli_s3_file "/tmp/testfile" do
19 | bucket node['test_get']['bucket']
20 | key node['test_get']['key']
21 | checksum node['test_get']['checksum']
22 | end
23 |
--------------------------------------------------------------------------------
/test/integration/profile_test_get/serverspec/test_get_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../../../kitchen/data/spec_helper'
15 | require 'json'
16 |
17 | node = ::JSON.parse(File.read('/tmp/serverspec/node.json'))
18 |
19 | describe file('/tmp/testfile') do
20 | it { should be_file }
21 | its(:sha256sum) { should eq node['test_get']['checksum'] }
22 | end
23 |
--------------------------------------------------------------------------------
/attributes/default.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Cookbook Name:: awscli
3 | # Attributes:: default
4 | #
5 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 | #
7 | # Licensed under the Apache License, Version 2.0 (the "License"). You
8 | # may not use this file except in compliance with the License. A copy of
9 | # the License is located at
10 | #
11 | # http://aws.amazon.com/apache2.0/
12 | #
13 | # or in the "license" file accompanying this file. This file is
14 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
15 | # ANY KIND, either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the License.
17 | #
18 | default['awscli']['virtualenv'] = nil
19 | default['awscli']['windows_url'] = 'https://s3.amazonaws.com/aws-cli/AWSCLI64.msi'
20 | default['awscli']['binary'] = case node['platform_family']
21 | when 'windows'
22 | '"C:\Program Files\Amazon\AWSCLI\aws"'
23 | else
24 | 'aws'
25 | end
26 |
--------------------------------------------------------------------------------
/spec/unit/recipes/_linux_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../spec_helper'
15 |
16 | describe 'awscli::_linux' do
17 | cached(:chef_run) do
18 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node|
19 | node.set['awscli']['virtualenv'] = '/opt/fake/pip'
20 | end.converge(described_recipe)
21 | end
22 |
23 | it 'includes the python::pip recipe' do
24 | expect(chef_run).to include_recipe('python::pip')
25 | end
26 |
27 | it 'installs awscli via pip' do
28 | expect(chef_run).to install_python_pip('awscli')
29 | .with_virtualenv('/opt/fake/pip')
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/test/fixtures/cookbooks/node_dump/recipes/default.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | directory '/tmp/serverspec' do
15 | recursive true
16 | end
17 |
18 | file '/tmp/serverspec/node.json' do
19 | owner "root"
20 | mode "0400"
21 | end
22 |
23 | ruby_block "dump_node_attributes" do
24 | block do
25 | require 'json'
26 |
27 | attrs = Hash.new
28 |
29 | attrs.merge!(node.default_attrs) unless node.default_attrs.empty?
30 | attrs.merge!(node.normal_attrs) unless node.normal_attrs.empty?
31 | attrs.merge!(node.override_attrs) unless node.override_attrs.empty?
32 |
33 | attrs['run_list'] = node.run_list.expand(node.chef_environment).recipes
34 |
35 | File.open('/tmp/serverspec/node.json', 'w') { |file| file.write(JSON.pretty_generate(attrs)) }
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/chefignore:
--------------------------------------------------------------------------------
1 | # Put files/directories that should be ignored in this file when uploading
2 | # or sharing to the community site.
3 | # Lines that start with '# ' are comments.
4 |
5 | # OS generated files #
6 | ######################
7 | .DS_Store
8 | Icon?
9 | nohup.out
10 | ehthumbs.db
11 | Thumbs.db
12 |
13 | # SASS #
14 | ########
15 | .sass-cache
16 |
17 | # EDITORS #
18 | ###########
19 | \#*
20 | .#*
21 | *~
22 | *.sw[a-z]
23 | *.bak
24 | REVISION
25 | TAGS*
26 | tmtags
27 | *_flymake.*
28 | *_flymake
29 | *.tmproj
30 | .project
31 | .settings
32 | mkmf.log
33 |
34 | ## COMPILED ##
35 | ##############
36 | a.out
37 | *.o
38 | *.pyc
39 | *.so
40 | *.com
41 | *.class
42 | *.dll
43 | *.exe
44 | */rdoc/
45 |
46 | # Testing #
47 | ###########
48 | .watchr
49 | .rspec
50 | spec/*
51 | spec/fixtures/*
52 | test/*
53 | features/*
54 | Guardfile
55 | Procfile
56 |
57 | # SCM #
58 | #######
59 | .git
60 | */.git
61 | .gitignore
62 | .gitmodules
63 | .gitconfig
64 | .gitattributes
65 | .svn
66 | */.bzr/*
67 | */.hg/*
68 | */.svn/*
69 |
70 | # Berkshelf #
71 | #############
72 | cookbooks/*
73 | tmp
74 |
75 | # Cookbooks #
76 | #############
77 | CONTRIBUTING
78 | CHANGELOG*
79 |
80 | # Strainer #
81 | ############
82 | Colanderfile
83 | Strainerfile
84 | .colander
85 | .strainer
86 |
87 | # Vagrant #
88 | ###########
89 | .vagrant
90 | Vagrantfile
91 |
92 | # Travis #
93 | ##########
94 | .travis.yml
95 |
--------------------------------------------------------------------------------
/.kitchen.yml:
--------------------------------------------------------------------------------
1 | ---
2 | driver:
3 | name: vagrant
4 |
5 | provisioner:
6 | name: chef_zero
7 | data_path: test/shared
8 |
9 | platforms:
10 | - name: ubuntu-14.04
11 | - name: ubuntu-12.04
12 | - name: centos-6.5
13 | - name: centos-6.4
14 |
15 | suites:
16 | - name: default
17 | run_list:
18 | - recipe[awscli::default]
19 | attributes:
20 | - name: test_get
21 | run_list:
22 | - recipe[test_get::default]
23 | - recipe[node_dump::default]
24 | attributes:
25 | test_get:
26 | aws_access_key_id: <%= ENV['TEST_AWS_ACCESS_KEY_ID'] %>
27 | aws_secret_access_key: <%= ENV['TEST_AWS_SECRET_ACCESS_KEY'] %>
28 | region: <%= ENV['TEST_AWS_REGION'] || 'us-east-1' %>
29 | bucket: <%= ENV['TEST_BUCKET'] %>
30 | key: <%= ENV['TEST_KEY'] %>
31 | checksum: <%= ENV['TEST_CHECKSUM'] %>
32 | - name: test_virtualenv
33 | run_list:
34 | - recipe[test_virtualenv::default]
35 |
36 | # For EC2 instances with a valid instance profile only
37 | - name: profile_test_get
38 | run_list:
39 | - recipe[test_get::profile]
40 | - recipe[node_dump::default]
41 | attributes:
42 | test_get:
43 | bucket: <%= ENV['TEST_BUCKET'] %>
44 | key: <%= ENV['TEST_KEY'] %>
45 | checksum: <%= ENV['TEST_CHECKSUM'] %>
46 | excludes: ["ubuntu-14.04", "ubuntu-12.04", "centos-6.4", "centos-6.5"]
--------------------------------------------------------------------------------
/spec/unit/recipes/default_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../spec_helper'
15 |
16 | describe 'awscli::default' do
17 | # Run only on Windows
18 | if ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw32|windows/
19 | context 'windows' do
20 | let(:chef_run) do
21 | ChefSpec::SoloRunner.new(platform: 'windows', version: '2012').converge(described_recipe)
22 | end
23 |
24 | it 'includes the windows recipe' do
25 | expect(chef_run).to include_recipe('awscli::_windows')
26 | end
27 | end
28 | end
29 |
30 | context 'linux' do
31 | let(:chef_run) do
32 | ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04').converge(described_recipe)
33 | end
34 |
35 | it 'includes the linux recipe' do
36 | expect(chef_run).to include_recipe('awscli::_linux')
37 | end
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/resources/s3_file.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Cookbook Name:: awscli
3 | # Resources:: s3_file
4 | #
5 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 | #
7 | # Licensed under the Apache License, Version 2.0 (the "License"). You
8 | # may not use this file except in compliance with the License. A copy of
9 | # the License is located at
10 | #
11 | # http://aws.amazon.com/apache2.0/
12 | #
13 | # or in the "license" file accompanying this file. This file is
14 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
15 | # ANY KIND, either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the License.
17 | #
18 |
19 | actions :get
20 | default_action :get
21 |
22 | attribute :bucket, :kind_of => String
23 | attribute :path, :kind_of => String, :name_attribute => true
24 | attribute :key, :kind_of => String
25 | attribute :aws_access_key_id, :kind_of => [String, NilClass], :default => nil
26 | attribute :aws_secret_access_key, :kind_of => [String, NilClass], :default => nil
27 | attribute :checksum, :kind_of => [String, NilClass], :default => nil
28 | attribute :region, :kind_of => String, :default => 'us-east-1'
29 | attribute :timeout, :kind_of => Integer, :default => 900
30 | attribute :owner, :kind_of => String, :default => 'root'
31 | attribute :group, :kind_of => String, :default => 'root'
32 | attribute :mode, :kind_of => [String, Integer, NilClass], :default => nil
33 |
--------------------------------------------------------------------------------
/spec/unit/recipes/_windows_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../spec_helper'
15 |
16 | # Run only on Windows
17 | if ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw32|windows/
18 | describe 'awscli::_windows' do
19 | cached(:chef_run) do
20 | ChefSpec::ServerRunner.new(platform: 'windows', version: '2012') do |node|
21 | node.set['awscli']['windows_url'] = 'http://s3.amazonaws.com/fake/download/awscli.exe'
22 | end.converge(described_recipe)
23 | end
24 |
25 | it 'includes the windows cookbook recipe' do
26 | expect(chef_run).to include_recipe('windows')
27 | end
28 |
29 | it 'installs awscli directly from a download link' do
30 | expect(chef_run).to install_windows_package('AWS Command Line Interface')
31 | .with_source('http://s3.amazonaws.com/fake/download/awscli.exe')
32 | end
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/test/integration/test_get/serverspec/test_get_spec.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | require_relative '../../../kitchen/data/spec_helper'
15 | require 'json'
16 |
17 | node = ::JSON.parse(File.read('/tmp/serverspec/node.json'))
18 |
19 | describe file('/tmp/testfile') do
20 | it { should be_file }
21 | it { should be_mode 755 }
22 | it { should be_owned_by 'testuser' }
23 | it { should be_grouped_into 'testgroup' }
24 | its(:sha256sum) { should eq node['test_get']['checksum'] }
25 | end
26 |
27 | describe file('/tmp/testfile2') do
28 | it { should be_file }
29 | it { should be_mode 1511 }
30 | it { should be_owned_by 'root' }
31 | it { should be_grouped_into 'root' }
32 | its(:sha256sum) { should eq node['test_get']['checksum'] }
33 | end
34 |
35 | describe file('/tmp/testfile3') do
36 | it { should be_file }
37 | it { should be_mode 644 }
38 | it { should be_owned_by 'root' }
39 | it { should be_grouped_into 'root' }
40 | its(:sha256sum) { should eq node['test_get']['checksum'] }
41 | end
42 |
--------------------------------------------------------------------------------
/test/fixtures/cookbooks/test_get/recipes/default.rb:
--------------------------------------------------------------------------------
1 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License"). You
4 | # may not use this file except in compliance with the License. A copy of
5 | # the License is located at
6 | #
7 | # http://aws.amazon.com/apache2.0/
8 | #
9 | # or in the "license" file accompanying this file. This file is
10 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 | # ANY KIND, either express or implied. See the License for the specific
12 | # language governing permissions and limitations under the License.
13 | #
14 | include_recipe 'awscli::default'
15 |
16 | user 'testuser' do
17 | comment 'Test kitchen user'
18 | system true
19 | action :create
20 | end
21 |
22 | group 'testgroup' do
23 | append true
24 | members 'testuser'
25 | action :create
26 | end
27 |
28 | # Specifying all download options
29 | awscli_s3_file "/tmp/testfile" do
30 | owner 'testuser'
31 | group 'testgroup'
32 | mode '0755'
33 | bucket node['test_get']['bucket']
34 | key node['test_get']['key']
35 | checksum node['test_get']['checksum']
36 | aws_access_key_id node['test_get']['aws_access_key_id']
37 | aws_secret_access_key node['test_get']['aws_secret_access_key']
38 | region node['test_get']['region']
39 | end
40 |
41 | # Test differing mode
42 | awscli_s3_file "/tmp/testfile2" do
43 | mode '1511'
44 | bucket node['test_get']['bucket']
45 | key node['test_get']['key']
46 | aws_access_key_id node['test_get']['aws_access_key_id']
47 | aws_secret_access_key node['test_get']['aws_secret_access_key']
48 | end
49 |
50 | # Default download options
51 | awscli_s3_file "/tmp/testfile3" do
52 | bucket node['test_get']['bucket']
53 | key node['test_get']['key']
54 | aws_access_key_id node['test_get']['aws_access_key_id']
55 | aws_secret_access_key node['test_get']['aws_secret_access_key']
56 | end
57 |
--------------------------------------------------------------------------------
/providers/s3_file.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Cookbook Name:: awscli
3 | # provider:: s3_file
4 | #
5 | # Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6 | #
7 | # Licensed under the Apache License, Version 2.0 (the "License"). You
8 | # may not use this file except in compliance with the License. A copy of
9 | # the License is located at
10 | #
11 | # http://aws.amazon.com/apache2.0/
12 | #
13 | # or in the "license" file accompanying this file. This file is
14 | # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
15 | # ANY KIND, either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the License.
17 | #
18 | require 'chef/mixin/shell_out'
19 | require 'chef/scan_access_control'
20 |
21 | include Chef::Mixin::ShellOut
22 | include Chef::Mixin::EnforceOwnershipAndPermissions
23 |
24 | use_inline_resources if defined?(use_inline_resources)
25 |
26 | def whyrun_supported?
27 | true
28 | end
29 |
30 | def load_current_resource
31 | @current_resource = Chef::Resource::AwscliS3File.new(new_resource.name)
32 | @current_resource.bucket(new_resource.bucket)
33 | @current_resource.key(new_resource.key)
34 | @current_resource.path(new_resource.path)
35 | @current_resource.region(new_resource.region)
36 | @current_resource.checksum(nil)
37 |
38 | if ::File.exist?(new_resource.path)
39 | @current_resource.checksum(Chef::Digester.checksum_for_file(new_resource.path))
40 | end
41 |
42 | # Approach using a similar method to the built-in file resource.
43 | # https://github.com/chef/chef/blob/master/lib/chef/provider/file.rb
44 | unless Chef::Platform.windows?
45 | acl_scanner = ScanAccessControl.new(@new_resource, @current_resource)
46 | acl_scanner.set_all!
47 | end
48 |
49 | @current_resource
50 | end
51 |
52 | action :get do
53 | # We do not want to download the file if we are able to validate the local file if it exists.
54 | if new_resource.checksum.nil? || new_resource.checksum != current_resource.checksum
55 | event = "download s3://#{new_resource.bucket}/#{new_resource.key} and store it at #{new_resource.path}"
56 | converge_by(event) do
57 | Chef::Log.info(event)
58 | new_resource.updated_by_last_action(true) if s3_get
59 | end
60 | end
61 | end
62 |
63 | def s3_get
64 | cmd = node['awscli']['binary'].dup
65 | cmd << ' s3 cp '
66 | cmd << "s3://#{new_resource.bucket}/#{new_resource.key} "
67 | cmd << new_resource.path
68 | s3_cmd(cmd)
69 |
70 | return unless access_controls.requires_changes?
71 | converge_by(access_controls.describe_changes) do
72 | access_controls.set_all
73 | end
74 | end
75 |
76 | def s3_cmd(command)
77 | # Setup Environment for aws cli to run in.
78 | environment = {}
79 | environment['AWS_DEFAULT_REGION'] = new_resource.region
80 | environment['AWS_ACCESS_KEY_ID'] = new_resource.aws_access_key_id unless new_resource.aws_access_key_id.nil?
81 | environment['AWS_SECRET_ACCESS_KEY'] = new_resource.aws_secret_access_key unless new_resource.aws_secret_access_key.nil?
82 |
83 | # Shell out options
84 | options = { :timeout => new_resource.timeout, :environment => environment }
85 | shell_out!(command, options)
86 | end
87 |
88 | # Borrowing from the file resource in core chef
89 | def manage_symlink_access?
90 | false
91 | end
92 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | *** DEPRECATED ***
3 | ==================
4 |
5 | This repository is deprecated in favour of the https://github.com/cmlicata/cloudcli-cookbook fork.
6 |
7 | ---
8 |
9 | awscli Cookbook
10 | =============
11 | Installs the AWS Command Line Interface tools and provides a set of LWRPs for use within chef cookbooks.
12 |
13 | Benefits
14 | --------
15 | The benefits of using the awscli are as follows:
16 | * awscli is maintained by Amazon and is updated as new APIs and Services are released
17 | * support for IAM profiles works out of the box
18 | * automatically take advantage of features like multi-threaded _download_ that are built into the CLI tools
19 | * no native compilation of dependencies is necessary
20 |
21 | Requirements
22 | ------------
23 |
24 | * Chef 11.6 or higher
25 |
26 | Supported Platforms
27 | -------------------
28 | * Ubuntu 12.04, 14.04
29 | * CentOS 6.4, 6.5
30 | * Amazon 2014.03
31 |
32 | Attributes
33 | ----------
34 | All attributes are located under `node['awscli']`
35 |
36 |
37 | | Attribute |
38 | Description |
39 | Example |
40 | Default |
41 |
42 |
43 | | version |
44 | The version of awscli to install |
45 | 1.4.0 |
46 | 1.4.4 |
47 |
48 |
49 | | virtualenv |
50 | Python virtualenv you would like to install awscli into |
51 | /home/ubuntu/my_ve |
52 | nil |
53 |
54 |
55 |
56 | Recipes
57 | -------
58 |
59 | ### default
60 | Installs the awscli tools.
61 |
62 | Resources/Providers
63 | -------------------
64 |
65 | ### awscli_s3_file
66 | #### Actions
67 |
68 |
69 | | Action |
70 | Description |
71 |
72 |
73 | | :get |
74 | Download a file from an s3 bucket |
75 |
76 |
77 |
78 | #### Attribute Parameters
79 |
80 |
81 | | Parameter |
82 | Description |
83 | Default |
84 |
85 |
86 | | aws_access_key_id |
87 | AWS API Access Key ID |
88 | nil |
89 |
90 |
91 | | aws_secret_access_key |
92 | AWS API Secret Access Key |
93 | nil |
94 |
95 |
96 | | path |
97 | Location to store downloaded file |
98 | name attribute |
99 |
100 |
101 | | bucket |
102 | S3 bucket name |
103 | |
104 |
105 |
106 | | key |
107 | S3 Key name to download |
108 | |
109 |
110 |
111 | | checksum |
112 | Sha256 checksum to validate download |
113 | nil |
114 |
115 |
116 | | region |
117 | AWS endpoint region |
118 | us-east-1 |
119 |
120 |
121 | | timeout |
122 | Number of seconds to wait for download to complete |
123 | 900 |
124 |
125 |
126 | | owner |
127 | The owner of the downloaded file |
128 | root |
129 |
130 |
131 | | group |
132 | The group name the file should be grouped into |
133 | root |
134 |
135 |
136 | | mode |
137 | The mode to set on the file. Setting to nil, leaves this to the operating system defaults |
138 | nil |
139 |
140 |
141 |
142 | #### Usage Examples
143 | ```ruby
144 | # Provide all credential information to download file and store it to /tmp/testfile
145 | awscli_s3_file '/tmp/testfile' do
146 | aws_access_key_id 'YOUR_ACCESS_KEY_ID'
147 | aws_secret_access_key 'YOUR_SECRET_ACCESS_KEY'
148 | region 'us-west-2'
149 | bucket 'my-test-bucket'
150 | key 'my_large_file.gz'
151 | checksum '37f9405a23d1e53082dbe9ea0ef19ec8791c778a6ecd0b02a6c1af2cf9bd4847'
152 | timeout 1200
153 | owner 'testuser'
154 | group 'testgroup'
155 | mode '0644'
156 | end
157 | ```
158 |
159 | ```ruby
160 | # Do not pass any credentials to provider because our instance is on EC2 and uses an IAM Profile
161 | awscli_s3_file '/tmp/testfile' do
162 | bucket 'my-test-bucket'
163 | key 'my_large_file.gz'
164 | end
165 | ```
166 |
167 | Testing
168 | -------
169 | In order to run the integration tests for this cookbook, you must have a valid AWS account and go through a few setup steps.
170 | __*Please note, you may incur AWS fees when executing the kitchen integration tests.*__
171 |
172 | ### Local Configuration
173 | The testing suites are setup to use environment variables to pass in end user specific information.
174 |
175 | #### Variables used by .kitchen.yml
176 | These variables are used to setup the `test_get` and `profile_test_get` (kitchen-ec2 only) suites. Kitchen will setup proper
177 | node attributes based on these variables. See the .kitchen.yml file for information on which variables are set.
178 |
179 | ```bash
180 | export TEST_AWS_ACCESS_KEY_ID=
181 | export TEST_AWS_SECRET_ACCESS_KEY=
182 | export TEST_AWS_REGION=
183 | export TEST_BUCKET=
184 | export TEST_KEY=
185 | export TEST_CHECKSUM=
186 | ```
187 |
188 | #### Variables used by .kitchen.cloud.yml
189 | The .kitchen.cloud.yml file is used to test within EC2. In order to use it, you must configure proper AWS security credentials
190 | as well as a few other settings. Take a look at .kitchen.cloud.yml to see which specific kitchen-ec2 variables are set from
191 | these environment variables.
192 |
193 | ```bash
194 | export AWS_ACCESS_KEY_ID=
195 | export AWS_SECRET_ACCESS_KEY=
196 | export AWS_KEYPAIR_NAME=
197 | export AWS_REGION=
198 | export AWS_AVAILABILITY_ZONE=
199 | export EC2_SSH_KEY_PATH=
200 | export AWS_EC2_AMI=
201 | export AWS_IAM_PROFILE=
202 | ```
203 |
204 | ### AWS Configuration
205 |
206 | #### test_get suite dependencies
207 | The following items need to be setup properly in order to use the `test_get` suite.
208 |
209 | * AWS S3 Bucket containing a test file
210 | * AWS IAM Account with at least GetObject access to the bucket setup in the previous step
211 | * AWS IAM Account API keys for the account setup in the previous step
212 |
213 | #### profile_test_get suite dependencies
214 | The following items need to be setup properly in order to use the `profile_test_get` suite.
215 |
216 | * AWS S3 Bucket containing a test file
217 | * AWS IAM Role/Profile with at least GetObject access to the bucket setup in the previous step
218 | * AWS IAM Account API Keys for an account with enough access to run an EC2 instance
219 |
220 | ### Executing the integration tests
221 | The `test_get` suite will download the file by
222 | providing the credentials configured via the environment. Those files
223 | will then be verified against the checksum you set via
224 | `TEST_CHECKSUM`. If the checksum does not match the downloaded file,
225 | the tests will fail.
226 |
227 | __Note: kitchen-ec2 profile support is waiting for a release. If you would like to test with
228 | IAM profiles, you will need to build the kitchen-ec2 gem from source.__
229 |
230 | The `profile_test_get` suite is only available when using the
231 | kitchen-ec2 driver. The .kitchen.cloud.yml file is configured to use
232 | the kitchen-ec2 driver. To enable this file, set the
233 | `KITCHEN_LOCAL_YAML` environment variable to the path for the
234 | .kitchen.cloud.yml file.
235 |
236 | * IAM Role Documentation: http://docs.aws.amazon.com/IAM/latest/UserGuide/role-usecase-ec2app.html
237 | * kitchen-ec2 plugin repository: https://github.com/test-kitchen/kitchen-ec2
238 |
239 | Contributing
240 | ------------
241 |
242 | 1. Fork the repository on Github:
243 | 2. Clone the repository locally:
244 |
245 | $ git clone http://github.com/awslabs/awscli-cookbook
246 |
247 | 3. Create a named feature branch:
248 |
249 | $ cd awscli-cookbook
250 | $ git checkout -b [new feature branch]
251 |
252 | 4. Add your change(s)
253 | 5. Write tests for your change(s):
254 |
255 | Please add tests for your changes. This helps prevent regressions in the future.
256 |
257 | 6. Install the gem dependencies:
258 |
259 | bundle install
260 |
261 | 7. Run the integration and spec tests to ensure they all pass:
262 |
263 | bundle exec rake integration
264 |
265 | 8. Run the style tests to ensure they all pass:
266 |
267 | bundle exec rake style
268 |
269 | 9. Update the README.md with new information if applicable.
270 | 10. Commit and push your changes up to your feature branch
271 | 11. Submit a Pull Request
272 |
273 | License and Authors
274 | -------------------
275 | - Author:: Nick Downs ()
276 |
277 | ```
278 | Copyright 2014 Amazon Web Services
279 |
280 | Licensed under the Apache License, Version 2.0 (the "License");
281 | you may not use this file except in compliance with the License.
282 | You may obtain a copy of the License at
283 |
284 | http://www.apache.org/licenses/LICENSE-2.0
285 |
286 | Unless required by applicable law or agreed to in writing, software
287 | distributed under the License is distributed on an "AS IS" BASIS,
288 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289 | See the License for the specific language governing permissions and
290 | limitations under the License.
291 | ```
292 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------