-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfig.ru
632 lines (565 loc) · 13.3 KB
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
#\ -s puma
# -*- coding: utf-8 -*-
# gems
require 'rubygems'
require 'bundler/setup'
require 'sinatra'
if ENV['RACK_ENV'] == 'production'
# production config / requires
else
# development or testing only
use Rack::ShowExceptions
end
# require the dependencies
require File.join(File.dirname(__FILE__), 'app', 'init')
require 'app/api_base'
require 'app/stack_api_app'
require 'app/offering_api_app'
require 'app/portfolio_api_app'
require 'app/identity_api_app'
require 'app/tutorial_state_api_app'
require 'app/org_api_app'
require 'app/policy_api_app'
require 'app/cloud_account_api_app'
require 'app/cloud_api_app'
require 'app/project_api_app'
require 'app/provisioning_api_app'
require 'app/report_api_app'
require 'app/source_control_repository_api_app'
require 'app/continuous_integration_server_api_app'
require 'app/root_app'
require 'app/resource_api_base'
require 'app/assembly_api_app'
## AWS Apps
require 'app/aws/aws_compute_app'
require 'app/aws/aws_autoscale_app'
require 'app/aws/aws_block_storage_app'
require 'app/aws/aws_object_storage_app'
require 'app/aws/aws_monitor_app'
require 'app/aws/aws_notification_app'
require 'app/aws/aws_dns_app'
require 'app/aws/aws_rds_app'
require 'app/aws/aws_load_balancer_app'
require 'app/aws/aws_cache_app'
require 'app/aws/aws_beanstalk_app'
require 'app/aws/aws_iam_app'
require 'app/aws/aws_queue_app'
require 'app/aws/aws_simpledb_app'
require 'app/aws/aws_cf_app'
## Google Apps
require 'app/google/google_compute_app'
require 'app/google/google_object_storage_app'
## Openstack Apps
require 'app/openstack/openstack_compute_app'
require 'app/openstack/openstack_block_storage_app'
require 'app/openstack/openstack_object_storage_app'
require 'app/openstack/openstack_identity_app'
require 'app/openstack/openstack_network_app'
## VMware Vcloud Apps
require 'app/vcloud/vcloud_app'
require 'app/vcloud/vcloud_compute_app'
require 'app/vcloud/vcloud_network_app'
require 'app/vcloud/vcloud_catalog_app'
## TopStack Apps
require 'app/topstack/topstack_autoscale_app'
require 'app/topstack/topstack_load_balancer_app'
require 'app/topstack/topstack_monitor_app'
require 'app/topstack/topstack_rds_app'
require 'app/topstack/topstack_queue_app'
require 'app/topstack/topstack_cache_app'
require 'app/topstack/topstack_dns_app'
require 'app/orchestration/config_managers_api_app'
require 'app/orchestration/config_manager_validator_api_app'
require 'app/orchestration/chef_api_app'
require 'app/orchestration/puppet_api_app'
require 'app/orchestration/salt_api_app'
require 'app/orchestration/ansible_api_app'
require 'app/packed_images/packed_images_app'
require 'app/queue_item_api_app'
# By default, Ruby buffers its output to stdout. To take advantage of
# Heroku's realtime logging, you will need to disable this buffering
# to have log messages sent straight to Heroku's logging
# infrastructure
# http://devcenter.heroku.com/articles/ruby#logging
$stdout.sync = true
# Sinatra now has logging - disable for tests
configure(:test) { disable :logging }
=begin
register Sinatra::CrossOrigin
configure do
set :cross_origin, true
set :allow_origin, "*"
set :allow_methods, [:get, :post, :options, :put, :delete]
set :allow_credentials, true
set :allow_headers, "X-HTTP-Method-Override"
set :max_age, "1728000"
end
=end
require 'rack-methodoverride-with-params'
use Rack::MethodOverrideWithParams
set :method_override, :true
# Following are Swagger directives, for REST API documentation.
##~ sapi = source2swagger.namespace("CloudMux")
##~ sapi.swaggerVersion = "1.1"
##~ sapi.apiVersion = "1.0"
#
# API Documentation and static files (stylesheets, etc)
#
map "/" do
run RootApp
end
#
# Identity Accounts API (internal)
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/identity.{format}", :format => "json"
##~ a.description = "Manage system accounts"
map "/identity/v1/accounts" do
run IdentityApiApp
end
#
# Identity Orgs API (internal)
#
map "/identity/v1/orgs" do
run OrgApiApp
end
#
# Identity Policies API (internal)
#
map "/identity/v1/policies" do
run PolicyApiApp
end
#
# Clouds API (internal)
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/clouds.{format}", :format => "json"
##~ a.description = "Manage defined clouds"
map "/stackstudio/v1/clouds" do
run CloudApiApp
end
map "/api/v1/clouds" do
run CloudApiApp
end
#
# Cloud Accounts API (internal)
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/cloud_accounts.{format}", :format => "json"
##~ a.description = "Manage defined clouds"
map "/stackstudio/v1/cloud_accounts" do
run CloudAccountApiApp
end
map "/api/v1/cloud_accounts" do
run CloudAccountApiApp
end
#
# Stacks API (internal)
#
map "/stackstudio/v1/stacks" do
run StackApiApp
end
#
# Tutorial States API (internal)
#
map "/stackstudio/v1/tutorial_states" do
run TutorialStateApiApp
end
#
# Offerings API (internal)
#
map "/stackstudio/v1/offerings" do
run OfferingApiApp
end
#
# Portfolios API (internal)
#
map "/stackstudio/v1/portfolios" do
run PortfolioApiApp
end
#
# Projects API (internal)
#
map "/stackstudio/v1/projects" do
run ProjectApiApp
end
#
# Provisioning API (internal)
#
map "/stackstudio/v1/provisioning" do
run ProvisioningApiApp
end
#
# Reports API (internal)
#
map "/stackstudio/v1/report" do
run ReportApiApp
end
#
# Source Control Repositories API (internal)
#
map "/api/v1/source_control_repositories" do
run SourceControlRepositoryApiApp
end
#
# Continuous Integration Servers API (internal)
#
map "/api/v1/continuous_integration_servers" do
run ContinuousIntegrationServerApiApp
end
#
# Chef Management API
#
map "/stackstudio/v1/orchestration/chef" do
run ChefApiApp
end
#
# Configuration Management Validator API
#
map "/api/v1/validator" do
run ConfigManagerValidatorApiApp
end
#
# Puppet Management API
#
map "/stackstudio/v1/orchestration/puppet" do
run PuppetApiApp
end
#
# Salt Management API
#
map "/stackstudio/v1/orchestration/salt" do
run SaltApiApp
end
#
# Ansible Management API
#
map "/stackstudio/v1/orchestration/ansible" do
run AnsibleApiApp
end
#
# Assemblies API (internal)
#
map "/stackstudio/v1/assemblies" do
run AssemblyApiApp
end
#
# AWS Compute API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_compute.{format}", :format => "json"
##~ a.description = "AWS Cloud Compute API"
map "/stackstudio/v1/cloud_management/aws/compute" do
run AwsComputeApp
end
map "/api/v1/cloud_management/aws/compute" do
run AwsComputeApp
end
#
# AWS Autoscale API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_autoscale.{format}", :format => "json"
##~ a.description = "AWS AutoScale API"
map "/stackstudio/v1/cloud_management/aws/autoscale" do
run AwsAutoscaleApp
end
#
# AWS Block Storage API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_block_storage.{format}", :format => "json"
##~ a.description = "AWS Block Storage API"
map "/stackstudio/v1/cloud_management/aws/block_storage" do
run AwsBlockStorageApp
end
#
# AWS Object Storage API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_object_storage.{format}", :format => "json"
##~ a.description = "AWS Object Storage API"
map "/stackstudio/v1/cloud_management/aws/object_storage" do
run AwsObjectStorageApp
end
#
# AWS Monitor API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_monitor.{format}", :format => "json"
##~ a.description = "AWS monitor API"
map "/stackstudio/v1/cloud_management/aws/monitor" do
run AwsMonitorApp
end
#
# AWS Notification API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_notification.{format}", :format => "json"
##~ a.description = "AWS Notification API"
map "/stackstudio/v1/cloud_management/aws/notification" do
run AwsNotificationApp
end
#
# AWS DNS API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_dns.{format}", :format => "json"
##~ a.description = "AWS DNS API"
map "/stackstudio/v1/cloud_management/aws/dns" do
run AwsDnsApp
end
#
# AWS RDS API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_rds.{format}", :format => "json"
##~ a.description = "AWS RDS API"
map "/stackstudio/v1/cloud_management/aws/rds" do
run AwsRdsApp
end
#
# AWS Load Balancer API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_load_balancer.{format}", :format => "json"
##~ a.description = "AWS Load Balancer API"
map "/stackstudio/v1/cloud_management/aws/load_balancer" do
run AwsLoadBalancerApp
end
#
# AWS Cache API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_cache.{format}", :format => "json"
##~ a.description = "AWS Cache API"
map "/stackstudio/v1/cloud_management/aws/cache" do
run AwsCacheApp
end
#
# AWS Beanstalk API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_beanstalk.{format}", :format => "json"
##~ a.description = "AWS Beanstalk API"
map "/stackstudio/v1/cloud_management/aws/beanstalk" do
run AwsBeanstalkApp
end
#
# AWS IAM API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_iam.{format}", :format => "json"
##~ a.description = "AWS IAM API"
map "/stackstudio/v1/cloud_management/aws/iam" do
run AwsIamApp
end
#
# AWS Queue API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_queue.{format}", :format => "json"
##~ a.description = "AWS Queue API"
map "/stackstudio/v1/cloud_management/aws/queue" do
run AwsQueueApp
end
#
# AWS SimpleDB API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/aws_simple_db.{format}", :format => "json"
##~ a.description = "AWS Simple DB API"
map "/stackstudio/v1/cloud_management/aws/simple_db" do
run AwsSimpleDBApp
end
map "/stackstudio/v1/cloud_management/aws/cloud_formation" do
run AwsCloudFormationApp
end
#
# Openstack Compute API
#
map "/stackstudio/v1/cloud_management/openstack/compute" do
run OpenstackComputeApp
end
##~ a = sapi.apis.add
##
##~ a.set :path => "/openstack_compute.{format}", :format => "json"
##~ a.description = "OpenStack Cloud Compute API"
map "/api/v1/cloud_management/openstack/compute" do
run OpenstackComputeApp
end
#
# Openstack Block Storage API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/openstack_block_storage.{format}", :format => "json"
##~ a.description = "OpenStack Block Storage API"
map "/stackstudio/v1/cloud_management/openstack/block_storage" do
run OpenstackBlockStorageApp
end
#
# Openstack Object Storage API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/openstack_object_storage.{format}", :format => "json"
##~ a.description = "OpenStack Object Storage API"
map "/stackstudio/v1/cloud_management/openstack/object_storage" do
run OpenstackObjectStorageApp
end
#
# Openstack Identity API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/openstack_identity.{format}", :format => "json"
##~ a.description = "OpenStack Identity API"
map "/stackstudio/v1/cloud_management/openstack/identity" do
run OpenstackIdentityApp
end
#
# Openstack Network API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/openstack_network.{format}", :format => "json"
##~ a.description = "OpenStack Network API"
map "/stackstudio/v1/cloud_management/openstack/network" do
run OpenstackNetworkApp
end
#
# TopStack LoadBalancer API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_load_balancer.{format}", :format => "json"
##~ a.description = "TopStack Load Balancer API"
map "/stackstudio/v1/cloud_management/topstack/load_balancer" do
run TopStackLoadBalancerApp
end
#
# TopStack AutoScale API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_autoscale.{format}", :format => "json"
##~ a.description = "TopStack AutoScale API"
map "/stackstudio/v1/cloud_management/topstack/autoscale" do
run TopStackAutoscaleApp
end
#
# TopStack Monitor API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_monitor.{format}", :format => "json"
##~ a.description = "TopStack Monitor API"
map "/stackstudio/v1/cloud_management/topstack/monitor" do
run TopStackMonitorApp
end
#
# TopStack RDS API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_rds.{format}", :format => "json"
##~ a.description = "TopStack RDS API"
map "/stackstudio/v1/cloud_management/topstack/rds" do
run TopStackRdsApp
end
#
# TopStack Queue API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_queue.{format}", :format => "json"
##~ a.description = "TopStack Queue API"
map "/stackstudio/v1/cloud_management/topstack/queue" do
run TopStackQueueApp
end
#
# TopStack Cache API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_cache.{format}", :format => "json"
##~ a.description = "TopStack Cache API"
map "/stackstudio/v1/cloud_management/topstack/cache" do
run TopStackCacheApp
end
#
# TopStack DNS API
#
##~ a = sapi.apis.add
##
##~ a.set :path => "/topstack_dns.{format}", :format => "json"
##~ a.description = "TopStack DNS API"
map "/stackstudio/v1/cloud_management/topstack/dns" do
run TopStackDnsApp
end
#
# Google Compute API
#
map "/stackstudio/v1/cloud_management/google/compute" do
run GoogleComputeApp
end
#
# Google Cloud Storage API
#
map "/stackstudio/v1/cloud_management/google/object_storage" do
run GoogleObjectStorageApp
end
#
# VCloud Compute API
#
map "/stackstudio/v1/cloud_management/vcloud/compute" do
run VCloudComputeApp
end
map "/stackstudio/v1/cloud_management/vcloud/networks" do
run VCloudNetworkApp
end
map "/stackstudio/v1/cloud_management/vcloud/catalogs" do
run VCloudCatalogApp
end
#
# Configuration Managers API
#
map "/stackstudio/v1/orchestration/managers" do
run ConfigManagerApiApp
end
#
# Configuration Managers API
#
map "/api/v1/orchestration/managers" do
run ConfigManagerApiApp
end
#
# Packed Images API
#
map "/stackstudio/v1/packed_images" do
run PackedImagesApiApp
end
#
# Queue Items API
#
map "/stackstudio/v1/queue/item" do
run QueueItemApiApp
end