polytrix 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.groc.json +7 -0
- data/.rspec +11 -0
- data/.rspec_parallel +10 -0
- data/Gemfile +23 -0
- data/README.md +48 -0
- data/Rakefile +143 -0
- data/Vagrantfile +41 -0
- data/features/0_identity_spec.rb +40 -0
- data/features/1_cloud_files_spec.rb +48 -0
- data/features/2_servers_spec.rb +19 -0
- data/features/features_helper.rb +46 -0
- data/features/helpers/cloudfiles_helper.rb +31 -0
- data/features/helpers/pacto_helper.rb +33 -0
- data/features/helpers/teardown_helper.rb +49 -0
- data/features/pacto/extensions/loaders/api_blueprint_loader.rb +63 -0
- data/features/pacto/extensions/loaders/simple_loader.rb +55 -0
- data/features/pacto/extensions/loaders/yaml_or_json_loader.rb +17 -0
- data/features/pacto/extensions/matchers.rb +38 -0
- data/features/phase2/feature_coverage_report.rb +109 -0
- data/features/phase2/run_all_features.rb +14 -0
- data/features/static_site/fixtures/index.html +6 -0
- data/lib/polytrix/challenge.rb +27 -0
- data/lib/polytrix/challenge_builder.rb +16 -0
- data/lib/polytrix/challenge_runner.rb +87 -0
- data/lib/polytrix/configuration.rb +31 -0
- data/lib/polytrix/core/file_finder.rb +43 -0
- data/lib/polytrix/core/implementor.rb +17 -0
- data/lib/polytrix/core/result_tracker.rb +25 -0
- data/lib/polytrix/documentation_generator.rb +18 -0
- data/lib/polytrix/manifest.rb +46 -0
- data/lib/polytrix/result.rb +9 -0
- data/lib/polytrix/rspec/documentation_formatter.rb +41 -0
- data/lib/polytrix/rspec.rb +75 -0
- data/lib/polytrix/runners/linux_challenge_runner.rb +22 -0
- data/lib/polytrix/runners/middleware/change_directory.rb +20 -0
- data/lib/polytrix/runners/middleware/feature_executor.rb +23 -0
- data/lib/polytrix/runners/middleware/pacto.rb +59 -0
- data/lib/polytrix/runners/middleware/setup_env_vars.rb +38 -0
- data/lib/polytrix/runners/windows_challenge_runner.rb +25 -0
- data/lib/polytrix/version.rb +3 -0
- data/lib/polytrix.rb +56 -0
- data/packer/.gitignore +3 -0
- data/packer/Berksfile +15 -0
- data/packer/Gemfile +5 -0
- data/packer/Vagrantfile +128 -0
- data/packer/cookbooks/drg/metadata.rb +27 -0
- data/packer/cookbooks/drg/recipes/admins.rb +22 -0
- data/packer/cookbooks/drg/recipes/default.rb +9 -0
- data/packer/cookbooks/drg/recipes/dotnet.rb +4 -0
- data/packer/cookbooks/drg/recipes/golang.rb +4 -0
- data/packer/cookbooks/drg/recipes/java.rb +5 -0
- data/packer/cookbooks/drg/recipes/php.rb +10 -0
- data/packer/cookbooks/drg/recipes/ruby.rb +29 -0
- data/packer/cookbooks/drg/recipes/system.rb +13 -0
- data/packer/create_box.sh +10 -0
- data/packer/http/preseed.cfg +87 -0
- data/packer/packer.json +91 -0
- data/packer/scripts/root_setup.sh +37 -0
- data/packer/scripts/setup.sh +32 -0
- data/pacto/config/pacto_server.rb +40 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/extensions.json +64 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/flavors/id.json +100 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/images/id.json +176 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/servers/id.json +189 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/servers.json +63 -0
- data/pacto/contracts/dns.api.rackspacecloud.com/v1.0/_tenant_id/domains.json +62 -0
- data/pacto/contracts/identity.api.rackspacecloud.com/v2.0/tokens.json +192 -0
- data/pacto/contracts/monitoring.api.rackspacecloud.com/v1.0/_tenant_id/account.json +39 -0
- data/pacto/contracts/ord.autoscale.api.rackspacecloud.com/v1.0/_tenant_id/groups.json +38 -0
- data/pacto/contracts/ord.blockstorage.api.rackspacecloud.com/v1/_tenant_id/volumes.json +30 -0
- data/pacto/contracts/ord.databases.api.rackspacecloud.com/v1.0/_tenant_id/instances.json +30 -0
- data/pacto/contracts/ord.loadbalancers.api.rackspacecloud.com/v1.0/_tenant_id/loadbalancers.json +114 -0
- data/pacto/contracts/ord.queues.api.rackspacecloud.com/v1/_tenant_id/queues.json +13 -0
- data/pacto/contracts/ord.servers.api.rackspacecloud.com/v2/_tenant_id/os-networksv2.json +46 -0
- data/pacto/contracts/ord.servers.api.rackspacecloud.com/v2/_tenant_id/servers/detail.json +230 -0
- data/pacto/contracts/storage101.dfw1.clouddrive.com/v1/mosso_account/container/object.json +15 -0
- data/pacto/contracts/storage101.dfw1.clouddrive.com/v1/mosso_account.json +43 -0
- data/pacto/contracts/storage101.ord1.clouddrive.com/v1/_mosso_id.json +44 -0
- data/pacto/pacto_server.rb +100 -0
- data/pacto/rackspace_uri_map.yaml +229 -0
- data/polytrix.gemspec +27 -0
- data/scripts/bootstrap +10 -0
- data/scripts/cibuild +4 -0
- data/sdks/fog/.gitignore +1 -0
- data/sdks/fog/Gemfile +5 -0
- data/sdks/fog/challenges/all_connections.rb +45 -0
- data/sdks/fog/challenges/authenticate_token.rb +15 -0
- data/sdks/fog/challenges/cdn_enable_container.rb +20 -0
- data/sdks/fog/challenges/create_a_container.rb +17 -0
- data/sdks/fog/challenges/create_server.rb +36 -0
- data/sdks/fog/challenges/get_object_metadata.rb +13 -0
- data/sdks/fog/challenges/list_containers.rb +10 -0
- data/sdks/fog/challenges/provision_scalable_webapp.rb +30 -0
- data/sdks/fog/challenges/upload_folder.rb +25 -0
- data/sdks/fog/scripts/bootstrap +4 -0
- data/sdks/fog/scripts/bootstrap.ps1 +1 -0
- data/sdks/fog/scripts/wrapper +2 -0
- data/sdks/fog/scripts/wrapper.ps1 +1 -0
- data/sdks/gophercloud/.gitignore +2 -0
- data/sdks/gophercloud/challenges/authenticate_token.go +23 -0
- data/sdks/gophercloud/scripts/bootstrap +6 -0
- data/sdks/gophercloud/scripts/wrapper +10 -0
- data/sdks/jclouds/.gitignore +1 -0
- data/sdks/jclouds/challenges/AuthenticateToken.java +115 -0
- data/sdks/jclouds/pom.xml +34 -0
- data/sdks/jclouds/scripts/bootstrap +3 -0
- data/sdks/jclouds/scripts/wrapper +7 -0
- data/sdks/openstack.net/.gitignore +4 -0
- data/sdks/openstack.net/.nuget/Microsoft.Build.dll +0 -0
- data/sdks/openstack.net/.nuget/NuGet.Config +6 -0
- data/sdks/openstack.net/.nuget/NuGet.exe +0 -0
- data/sdks/openstack.net/.nuget/NuGet.targets +136 -0
- data/sdks/openstack.net/Challenge.cs +10 -0
- data/sdks/openstack.net/RunChallenge.cs +19 -0
- data/sdks/openstack.net/challenges/AuthenticateToken.cs +24 -0
- data/sdks/openstack.net/challenges/Weird.cs +133 -0
- data/sdks/openstack.net/openstack.net.csproj +58 -0
- data/sdks/openstack.net/openstack.net.sln +27 -0
- data/sdks/openstack.net/openstack.net.userprefs +8 -0
- data/sdks/openstack.net/packages.config +6 -0
- data/sdks/openstack.net/scripts/bootstrap +2 -0
- data/sdks/openstack.net/scripts/bootstrap.ps1 +2 -0
- data/sdks/openstack.net/scripts/wrapper +7 -0
- data/sdks/openstack.net/scripts/wrapper.ps1 +1 -0
- data/sdks/php-opencloud/.gitignore +4 -0
- data/sdks/php-opencloud/challenges/all_connections.php +64 -0
- data/sdks/php-opencloud/challenges/authenticate_token.php +14 -0
- data/sdks/php-opencloud/challenges/create_server.php +39 -0
- data/sdks/php-opencloud/challenges/get_object_metadata.php +19 -0
- data/sdks/php-opencloud/composer.json +5 -0
- data/sdks/php-opencloud/scripts/bootstrap +4 -0
- data/sdks/php-opencloud/scripts/bootstrap.ps1 +2 -0
- data/sdks/php-opencloud/scripts/wrapper +2 -0
- data/sdks/php-opencloud/scripts/wrapper.ps1 +1 -0
- data/sdks/pkgcloud/.gitignore +1 -0
- data/sdks/pkgcloud/challenges/authenticate_token.js +17 -0
- data/sdks/pkgcloud/challenges/get_object_metadata.js +18 -0
- data/sdks/pkgcloud/scripts/bootstrap +2 -0
- data/sdks/pkgcloud/scripts/bootstrap.ps1 +1 -0
- data/sdks/pkgcloud/scripts/wrapper +2 -0
- data/sdks/pkgcloud/scripts/wrapper.ps1 +1 -0
- data/sdks/pyrax/.gitignore +2 -0
- data/sdks/pyrax/challenges/all_connections.py +61 -0
- data/sdks/pyrax/challenges/authenticate_token.py +17 -0
- data/sdks/pyrax/challenges/cdn_enable_container.py +22 -0
- data/sdks/pyrax/challenges/create_a_container.py +21 -0
- data/sdks/pyrax/challenges/create_server.py +35 -0
- data/sdks/pyrax/challenges/get_object_metadata.py +17 -0
- data/sdks/pyrax/challenges/upload_folder.py +32 -0
- data/sdks/pyrax/requirements.txt +21 -0
- data/sdks/pyrax/scripts/bootstrap +9 -0
- data/sdks/pyrax/scripts/bootstrap.ps1 +7 -0
- data/sdks/pyrax/scripts/wrapper +3 -0
- data/sdks/pyrax/scripts/wrapper.ps1 +2 -0
- data/spec/fixtures/factorial.py +18 -0
- data/spec/fixtures/polytrix.yml +16 -0
- data/spec/fixtures/src-doc/quine.md.erb +20 -0
- data/spec/polytrix/challenge_builder_spec.rb +16 -0
- data/spec/polytrix/challenge_runner_spec.rb +14 -0
- data/spec/polytrix/challenge_spec.rb +20 -0
- data/spec/polytrix/configuration_spec.rb +10 -0
- data/spec/polytrix/documentation_generator_spec.rb +36 -0
- data/spec/polytrix/file_finder_spec.rb +24 -0
- data/spec/polytrix/manifest_spec.rb +26 -0
- data/spec/polytrix/middleware/feature_executor_spec.rb +48 -0
- data/spec/polytrix_spec.rb +13 -0
- data/spec/rspec_spec.rb +17 -0
- data/spec/spec_helper.rb +7 -0
- metadata +325 -0
@@ -0,0 +1,229 @@
|
|
1
|
+
---
|
2
|
+
# Provides a simple map of request patterns to service names,
|
3
|
+
# so Pacto can do basic validation that services are called
|
4
|
+
# and testing of services before a complete contract is available.
|
5
|
+
services:
|
6
|
+
Identity:
|
7
|
+
servers:
|
8
|
+
- identity.api.rackspacecloud.com
|
9
|
+
services:
|
10
|
+
# contract is available
|
11
|
+
Authenticate:
|
12
|
+
method: post
|
13
|
+
uriTemplate: /v2.0/tokens
|
14
|
+
requestSchema:
|
15
|
+
$schema: "http://json-schema.org/draft-03/schema#"
|
16
|
+
description: "Generated from pacto with shasum b5ec82bb381eac4a445c35bbfbfcc324135a742c"
|
17
|
+
type: "object"
|
18
|
+
required: true
|
19
|
+
properties:
|
20
|
+
auth:
|
21
|
+
type: "object"
|
22
|
+
required: true
|
23
|
+
properties:
|
24
|
+
RAX-KSKEY:apiKeyCredentials:
|
25
|
+
type: "object"
|
26
|
+
required: true
|
27
|
+
properties:
|
28
|
+
username:
|
29
|
+
type: "string"
|
30
|
+
required: true
|
31
|
+
apiKey:
|
32
|
+
type: "string"
|
33
|
+
required: true
|
34
|
+
Cloud Servers:
|
35
|
+
servers:
|
36
|
+
- syd.servers.api.rackspacecloud.com
|
37
|
+
- iad.servers.api.rackspacecloud.com
|
38
|
+
- ord.servers.api.rackspacecloud.com
|
39
|
+
- dfw.servers.api.rackspacecloud.com
|
40
|
+
- hkg.servers.api.rackspacecloud.com
|
41
|
+
services:
|
42
|
+
List Servers:
|
43
|
+
method: get
|
44
|
+
uriTemplate: /v2/{tenant_id}/servers/detail{?limit}
|
45
|
+
Create Server:
|
46
|
+
method: post
|
47
|
+
uriTemplate: /v2/{tenant_id}/servers{?limit}
|
48
|
+
responseStatusCode: 202
|
49
|
+
Get Server Details:
|
50
|
+
method: get
|
51
|
+
uriTemplate: /v2/{tenant_id}/servers/{id}
|
52
|
+
Attach Volume:
|
53
|
+
method: post
|
54
|
+
uriTemplate: /v2/{tenant_id}/servers/{server_id}/os-volume_attachments{?limit}
|
55
|
+
# Documented code is 202, but I'm receiving 200
|
56
|
+
responseStatusCode: 200
|
57
|
+
List Extensions:
|
58
|
+
method: get
|
59
|
+
uriTemplate: /v2/{tenant_id}/extensions{?limit}
|
60
|
+
Get Image Details:
|
61
|
+
method: get
|
62
|
+
uriTemplate: /v2/{tenant_id}/images/{image_id}
|
63
|
+
Get Flavor Details:
|
64
|
+
method: get
|
65
|
+
uriTemplate: /v2/{tenant_id}/flavors/{flavor_id}
|
66
|
+
Cloud Files:
|
67
|
+
servers:
|
68
|
+
- snet-storage101.dfw1.clouddrive.com
|
69
|
+
- storage101.dfw1.clouddrive.com
|
70
|
+
- snet-storage101.iad3.clouddrive.com
|
71
|
+
- storage101.iad3.clouddrive.com
|
72
|
+
- storage101.ord1.clouddrive.com
|
73
|
+
- snet-storage101.ord1.clouddrive.com
|
74
|
+
- snet-storage101.syd2.clouddrive.com
|
75
|
+
- storage101.syd2.clouddrive.com
|
76
|
+
- snet-storage101.hkg1.clouddrive.com
|
77
|
+
- storage101.hkg1.clouddrive.com
|
78
|
+
services:
|
79
|
+
List Containers:
|
80
|
+
method: get
|
81
|
+
# uriTemplate only supports RFC 6570 level 0
|
82
|
+
# uriTemplate: v1/{account}{?limit,marker,end_marker,format}
|
83
|
+
# Fog and php-opencloud require a trailing '/' before '?', which works
|
84
|
+
# but is inconsistent with documentation
|
85
|
+
uriTemplate: /v1/{account}{?format,limit}
|
86
|
+
Get Object Metadata:
|
87
|
+
method: head
|
88
|
+
uriTemplate: /v1/{account}/{container}/{object}{?format}
|
89
|
+
CDN:
|
90
|
+
servers:
|
91
|
+
- cdn1.clouddrive.com
|
92
|
+
- cdn4.clouddrive.com
|
93
|
+
- cdn2.clouddrive.com
|
94
|
+
- cdn5.clouddrive.com
|
95
|
+
- cdn6.clouddrive.com
|
96
|
+
services:
|
97
|
+
Load Balancers:
|
98
|
+
servers:
|
99
|
+
- syd.loadbalancers.api.rackspacecloud.com
|
100
|
+
- iad.loadbalancers.api.rackspacecloud.com
|
101
|
+
- ord.loadbalancers.api.rackspacecloud.com
|
102
|
+
- dfw.loadbalancers.api.rackspacecloud.com
|
103
|
+
- hkg.loadbalancers.api.rackspacecloud.com
|
104
|
+
services:
|
105
|
+
Create:
|
106
|
+
method: post
|
107
|
+
uriTemplate: /loadbalancers
|
108
|
+
Add Node:
|
109
|
+
method: post
|
110
|
+
uriTemplate: /loadbalancers/{loadBalancerId}/nodes
|
111
|
+
List Load Balancers:
|
112
|
+
method: get
|
113
|
+
uriTemplate: /v1.0/{token_id}/loadbalancers{.format}{?limit}
|
114
|
+
Block Storage:
|
115
|
+
# Note that OpenStack docs currently have v2, Rackspace is v1
|
116
|
+
servers:
|
117
|
+
- syd.blockstorage.api.rackspacecloud.com
|
118
|
+
- iad.blockstorage.api.rackspacecloud.com
|
119
|
+
- ord.blockstorage.api.rackspacecloud.com
|
120
|
+
- dfw.blockstorage.api.rackspacecloud.com
|
121
|
+
- hkg.blockstorage.api.rackspacecloud.com
|
122
|
+
services:
|
123
|
+
Create Volume:
|
124
|
+
method: post
|
125
|
+
uriTemplate: /v1/{tenant_id}/volumes
|
126
|
+
List Volumes:
|
127
|
+
method: get
|
128
|
+
uriTemplate: /v1/{token_id}/volumes{?limit}
|
129
|
+
Cloud Database:
|
130
|
+
servers:
|
131
|
+
- syd.databases.api.rackspacecloud.com
|
132
|
+
- iad.databases.api.rackspacecloud.com
|
133
|
+
- ord.databases.api.rackspacecloud.com
|
134
|
+
- dfw.databases.api.rackspacecloud.com
|
135
|
+
- hkg.databases.api.rackspacecloud.com
|
136
|
+
services:
|
137
|
+
Create Instance:
|
138
|
+
method: post
|
139
|
+
uriTemplate: /instances
|
140
|
+
Create Database:
|
141
|
+
method: post
|
142
|
+
uriTemplate: /instances/{instanceId}/databases
|
143
|
+
List Instances:
|
144
|
+
method: get
|
145
|
+
uriTemplate: /v1.0/{token_id}/instances{?limit}
|
146
|
+
DNS:
|
147
|
+
servers:
|
148
|
+
- dns.api.rackspacecloud.com
|
149
|
+
services:
|
150
|
+
Create Domain:
|
151
|
+
method: post
|
152
|
+
uriTemplate: /domains
|
153
|
+
Add Records:
|
154
|
+
method: post
|
155
|
+
uriTemplate: /domains/{domainId}/records
|
156
|
+
List Domains:
|
157
|
+
method: get
|
158
|
+
uriTemplate: /v1.0/{token_id}/domains{?limit}
|
159
|
+
Monitoring:
|
160
|
+
servers:
|
161
|
+
- monitoring.api.rackspacecloud.com
|
162
|
+
services:
|
163
|
+
Backups:
|
164
|
+
servers:
|
165
|
+
- backup.api.rackspacecloud.com
|
166
|
+
- syd.backup.api.rackspacecloud.com
|
167
|
+
- iad.backup.api.rackspacecloud.com
|
168
|
+
- ord.backup.api.rackspacecloud.com
|
169
|
+
- dfw.backup.api.rackspacecloud.com
|
170
|
+
- hkg.backup.api.rackspacecloud.com
|
171
|
+
services:
|
172
|
+
Create Backup Configuration:
|
173
|
+
method: post
|
174
|
+
uriTemplate: /backup-configuration
|
175
|
+
Start or Stop a Backup Manually:
|
176
|
+
method: post
|
177
|
+
uriTemplate: /backup/action-requested
|
178
|
+
Autoscale:
|
179
|
+
servers:
|
180
|
+
- syd.autoscale.api.rackspacecloud.com
|
181
|
+
- iad.autoscale.api.rackspacecloud.com
|
182
|
+
- ord.autoscale.api.rackspacecloud.com
|
183
|
+
- dfw.autoscale.api.rackspacecloud.com
|
184
|
+
- hkg.autoscale.api.rackspacecloud.com
|
185
|
+
services:
|
186
|
+
List Groups:
|
187
|
+
method: get
|
188
|
+
uriTemplate: /v1.0/{token_id}/groups{?limit}
|
189
|
+
Cloud Queues:
|
190
|
+
servers:
|
191
|
+
- snet-hkg.queues.api.rackspacecloud.com
|
192
|
+
- hkg.queues.api.rackspacecloud.com
|
193
|
+
- snet-iad.queues.api.rackspacecloud.com
|
194
|
+
- iad.queues.api.rackspacecloud.com
|
195
|
+
- snet-dfw.queues.api.rackspacecloud.com
|
196
|
+
- dfw.queues.api.rackspacecloud.com
|
197
|
+
- snet-syd.queues.api.rackspacecloud.com
|
198
|
+
- syd.queues.api.rackspacecloud.com
|
199
|
+
- snet-ord.queues.api.rackspacecloud.com
|
200
|
+
- ord.queues.api.rackspacecloud.com
|
201
|
+
services:
|
202
|
+
List Queues:
|
203
|
+
method: get
|
204
|
+
uriTemplate: /v1/{token_id}/queues{?limit}
|
205
|
+
responseStatusCode: 204
|
206
|
+
Cloud Networks:
|
207
|
+
servers:
|
208
|
+
- syd.servers.api.rackspacecloud.com
|
209
|
+
- iad.servers.api.rackspacecloud.com
|
210
|
+
- ord.servers.api.rackspacecloud.com
|
211
|
+
- dfw.servers.api.rackspacecloud.com
|
212
|
+
- hkg.servers.api.rackspacecloud.com
|
213
|
+
services:
|
214
|
+
List Networks:
|
215
|
+
method: get
|
216
|
+
uriTemplate: /v2/{token_id}/os-networksv2{?limit}
|
217
|
+
Cloud Monitoring:
|
218
|
+
servers:
|
219
|
+
- monitoring.api.rackspacecloud.com
|
220
|
+
services:
|
221
|
+
Get Account:
|
222
|
+
method: get
|
223
|
+
uriTemplate: /v1.0/{token_id}/account
|
224
|
+
# Need
|
225
|
+
# Cloud Networks / List Networks
|
226
|
+
# Load Balancers / List Load Balancers
|
227
|
+
|
228
|
+
# Did not List Containers
|
229
|
+
|
data/polytrix.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'polytrix/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "polytrix"
|
8
|
+
spec.version = Polytrix::VERSION
|
9
|
+
spec.authors = ["Max Lincoln"]
|
10
|
+
spec.email = ["max@devopsy.com"]
|
11
|
+
spec.summary = %q{A polyglot test runner for sample code}
|
12
|
+
spec.description = %q{A polyglot test runner for sample code}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "mixlib-shellout", "~> 1.3"
|
22
|
+
spec.add_dependency "middleware", "~> 0.1"
|
23
|
+
spec.add_dependency "rspec", "~> 2.14"
|
24
|
+
spec.add_dependency "hashie", "~> 2.0"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
end
|
data/scripts/bootstrap
ADDED
data/scripts/cibuild
ADDED
data/sdks/fog/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/sdks/fog/Gemfile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fog'
|
4
|
+
|
5
|
+
connection_opts = {
|
6
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
7
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
8
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
9
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
10
|
+
}
|
11
|
+
|
12
|
+
# Compute services:
|
13
|
+
compute = Fog::Compute.new(connection_opts.merge({:provider => 'rackspace'}))
|
14
|
+
puts "Servers: #{compute.servers.all}"
|
15
|
+
puts "Networks: #{compute.networks.all}"
|
16
|
+
|
17
|
+
load_balancers = Fog::Rackspace::LoadBalancers.new(connection_opts)
|
18
|
+
puts "Cloud Load Balancers: #{load_balancers.load_balancers.all}"
|
19
|
+
|
20
|
+
storage = Fog::Storage.new(connection_opts.merge({:provider => 'rackspace'}))
|
21
|
+
puts "Cloud Files Containers: #{storage.directories.all}"
|
22
|
+
|
23
|
+
databases = Fog::Rackspace::Databases.new(connection_opts)
|
24
|
+
puts "Cloud Databases: #{databases.instances.all}"
|
25
|
+
|
26
|
+
dns = Fog::DNS::Rackspace.new(connection_opts)
|
27
|
+
puts "Cloud DNS: #{dns.zones.all}"
|
28
|
+
|
29
|
+
identity = Fog::Rackspace::Identity.new(connection_opts)
|
30
|
+
puts "Cloud Identity Users: #{identity.users.all}"
|
31
|
+
|
32
|
+
monitoring = Fog::Rackspace::Monitoring.new(connection_opts)
|
33
|
+
puts "Cloud Monitoring Account: #{monitoring.list_entities}"
|
34
|
+
|
35
|
+
block_storage = Fog::Rackspace::BlockStorage.new(connection_opts)
|
36
|
+
puts "Cloud Block Storage Volumes: #{block_storage.volumes.all}"
|
37
|
+
|
38
|
+
# Cloud Backup?
|
39
|
+
|
40
|
+
autoscale = Fog::Rackspace::AutoScale.new(connection_opts)
|
41
|
+
puts "Autoscale Scaling Groups: #{autoscale.groups.all}"
|
42
|
+
|
43
|
+
# Cloud Queues
|
44
|
+
queues = Fog::Rackspace::Queues.new(connection_opts)
|
45
|
+
puts "Cloud Queues: #{queues.queues.all}"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This example demonstrates creating a server with the Rackpace Open Cloud
|
4
|
+
|
5
|
+
require 'fog'
|
6
|
+
|
7
|
+
service = Fog::Compute.new({
|
8
|
+
:provider => 'rackspace',
|
9
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
10
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
11
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
12
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
13
|
+
})
|
14
|
+
|
15
|
+
puts "Authenticated"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fog'
|
4
|
+
connection_opts = {
|
5
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
6
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
7
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
8
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
9
|
+
}
|
10
|
+
storage = Fog::Storage.new(connection_opts.merge({:provider => 'rackspace'}))
|
11
|
+
|
12
|
+
container_name = 'my-site'
|
13
|
+
folder_to_upload = ENV['TEST_DIRECTORY']
|
14
|
+
username = ENV['RAX_USERNAME']
|
15
|
+
api_key = ENV['RAX_API_KEY']
|
16
|
+
auth_endpoint = ENV['RAX_AUTH_URL']
|
17
|
+
|
18
|
+
directory = storage.directories.get container_name
|
19
|
+
directory.public = true
|
20
|
+
directory.save
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fog'
|
4
|
+
connection_opts = {
|
5
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
6
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
7
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
8
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
9
|
+
}
|
10
|
+
storage = Fog::Storage.new(connection_opts.merge({:provider => 'rackspace'}))
|
11
|
+
|
12
|
+
container_name = ENV['CONTAINER_NAME']
|
13
|
+
username = ENV['RAX_USERNAME']
|
14
|
+
api_key = ENV['RAX_API_KEY']
|
15
|
+
auth_endpoint = ENV['RAX_AUTH_URL']
|
16
|
+
|
17
|
+
storage.directories.create :key => 'my-site'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fog'
|
4
|
+
Excon.defaults[:ssl_verify_peer] = false
|
5
|
+
|
6
|
+
service = Fog::Compute.new({
|
7
|
+
:provider => 'rackspace',
|
8
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
9
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
10
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
11
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
12
|
+
})
|
13
|
+
|
14
|
+
server = service.servers.create :name => 'Fog Server',
|
15
|
+
:flavor_id => ENV['SERVER1_FLAVOR'],
|
16
|
+
:image_id => ENV['SERVER1_IMAGE']
|
17
|
+
|
18
|
+
puts "\n"
|
19
|
+
|
20
|
+
begin
|
21
|
+
# Check every 5 seconds to see if server is in the active state (ready?).
|
22
|
+
# If the server has not been built in 5 minutes (600 seconds) an exception will be raised.
|
23
|
+
server.wait_for(600, 5) do
|
24
|
+
print "."
|
25
|
+
STDOUT.flush
|
26
|
+
ready?
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "[DONE]\n\n"
|
30
|
+
|
31
|
+
rescue Fog::Errors::TimeoutError
|
32
|
+
puts "[TIMEOUT]\n\n"
|
33
|
+
|
34
|
+
puts "This server is currently #{server.progress}% into the build process and is taking longer to complete than expected."
|
35
|
+
puts "You can continute to monitor the build process through the web console at https://mycloud.rackspace.com/\n\n"
|
36
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fog'
|
3
|
+
|
4
|
+
service = Fog::Storage.new({
|
5
|
+
:provider => 'rackspace',
|
6
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
7
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
8
|
+
:rackspace_region => ENV['RAX_REGION'],
|
9
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
10
|
+
})
|
11
|
+
# directory = service.directories.get ENV['TEST_DIRECTORY']
|
12
|
+
# directory.files.head_object ENV['TEST_FILE']
|
13
|
+
service.head_object ENV['TEST_DIRECTORY'], ENV['TEST_FILE']
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fog'
|
3
|
+
|
4
|
+
service = Fog::Storage.new({
|
5
|
+
:provider => 'rackspace',
|
6
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
7
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
8
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
9
|
+
})
|
10
|
+
containers = service.get_containers
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fog'
|
2
|
+
|
3
|
+
volume_name = 'my_volume'
|
4
|
+
connection_opts = {
|
5
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
6
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
7
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
8
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
9
|
+
}
|
10
|
+
|
11
|
+
compute = Fog::Compute.new(connection_opts.merge(:provider => 'rackspace'))
|
12
|
+
|
13
|
+
server = compute.servers.create :name => 'Fog Server',
|
14
|
+
:flavor_id => ENV['SERVER1_FLAVOR'],
|
15
|
+
:image_id => ENV['SERVER1_IMAGE']
|
16
|
+
|
17
|
+
server.wait_for(600, 5) do
|
18
|
+
print "."
|
19
|
+
STDOUT.flush
|
20
|
+
ready?
|
21
|
+
end
|
22
|
+
|
23
|
+
server = server.reload
|
24
|
+
|
25
|
+
cbs_service = Fog::Rackspace::BlockStorage.new(connection_opts)
|
26
|
+
|
27
|
+
puts "\nCreating Volume\n"
|
28
|
+
volume = cbs_service.volumes.create(:size => 100, :display_name => volume_name)
|
29
|
+
puts "\nAttaching volume\n"
|
30
|
+
attachment = server.attach_volume volume
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fog'
|
4
|
+
connection_opts = {
|
5
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
6
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
7
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym,
|
8
|
+
:rackspace_auth_url => "#{ENV['RAX_AUTH_URL']}/v2.0"
|
9
|
+
}
|
10
|
+
storage = Fog::Storage.new(connection_opts.merge({:provider => 'rackspace'}))
|
11
|
+
|
12
|
+
container_name = 'my-site'
|
13
|
+
folder_to_upload = ENV['TEST_DIRECTORY']
|
14
|
+
username = ENV['RAX_USERNAME']
|
15
|
+
api_key = ENV['RAX_API_KEY']
|
16
|
+
auth_endpoint = ENV['RAX_AUTH_URL']
|
17
|
+
|
18
|
+
puts 'Uploading folder'
|
19
|
+
local_directory = Pathname.new folder_to_upload
|
20
|
+
remote_directory = storage.directories.create :key => container_name
|
21
|
+
Dir["#{folder_to_upload}/**.*"].each do |file|
|
22
|
+
file_key = Pathname.new(file).relative_path_from local_directory
|
23
|
+
remote_directory.files.create :key => file_key.to_s, :body => File.open(file)
|
24
|
+
end
|
25
|
+
puts 'Done uploading'
|
@@ -0,0 +1 @@
|
|
1
|
+
bundle install
|
@@ -0,0 +1 @@
|
|
1
|
+
bundle exec ruby "$args"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"github.com/rackspace/gophercloud"
|
5
|
+
"os"
|
6
|
+
)
|
7
|
+
|
8
|
+
func main() {
|
9
|
+
var provider = os.Getenv("RAX_AUTH_URL") + "/v2.0/tokens"
|
10
|
+
var username = os.Getenv("RAX_USERNAME")
|
11
|
+
var api_key = os.Getenv("RAX_API_KEY")
|
12
|
+
_, err := gophercloud.Authenticate(
|
13
|
+
provider,
|
14
|
+
gophercloud.AuthOptions{
|
15
|
+
Username: username,
|
16
|
+
ApiKey: api_key,
|
17
|
+
},
|
18
|
+
)
|
19
|
+
if err != nil {
|
20
|
+
panic(err)
|
21
|
+
}
|
22
|
+
println("Authenticated")
|
23
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
export GOPATH=`pwd`/go
|
3
|
+
CHALLENGES_DIR=$(dirname $1)
|
4
|
+
export SDK_PROVIDER=${RAX_AUTH_URL}/v2.0/tokens
|
5
|
+
# export SDK_PROVIDER=rackspace-us
|
6
|
+
export SDK_USERNAME=$RAX_USERNAME
|
7
|
+
export SDK_API_KEY=$RAX_API_KEY
|
8
|
+
export SDK_PASSWORD=none
|
9
|
+
# go run $1 $CHALLENGES_DIR/libargs.go
|
10
|
+
go run $1
|
@@ -0,0 +1 @@
|
|
1
|
+
target/
|