Class: Deployment
- Inherits:
-
HasOptions
- Object
- HasOptions
- Deployment
- Defined in:
- lib/conan/manifest_builder.rb
Constant Summary collapse
- @@paas_domain =
'mtnsatcloud.com'
Instance Attribute Summary collapse
-
#additional_mappings ⇒ Object
Returns the value of attribute additional_mappings.
-
#app_ids ⇒ Object
Returns the value of attribute app_ids.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#facility_id ⇒ Object
Returns the value of attribute facility_id.
-
#org ⇒ Object
Returns the value of attribute org.
-
#ship ⇒ Object
Returns the value of attribute ship.
-
#shipcloud ⇒ Object
Returns the value of attribute shipcloud.
Attributes inherited from HasOptions
Instance Method Summary collapse
- #active_healthcheck_url(app) ⇒ Object
- #active_urls(app) ⇒ Object
- #agnostic_dns_name(app) ⇒ Object
- #apps(*app_ids) ⇒ Object
- #dns_name(app) ⇒ Object
- #enabled(b) ⇒ Object
- #enabled? ⇒ Boolean
- #facility(facility_id) ⇒ Object
- #hostnames(*hostnames) ⇒ Object
- #inactive_healthcheck_url(app) ⇒ Object
- #inactive_urls(app) ⇒ Object
-
#initialize(environment, org, ship) ⇒ Deployment
constructor
A new instance of Deployment.
- #manifest_url(app) ⇒ Object
- #name(app) ⇒ Object
- #paas_target ⇒ Object
- #to_s ⇒ Object
- #unique_name(app) ⇒ Object
Methods inherited from HasOptions
Constructor Details
#initialize(environment, org, ship) ⇒ Deployment
Returns a new instance of Deployment.
455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/conan/manifest_builder.rb', line 455 def initialize(environment, org, ship) # inherit options from the environment #super(environment.options) # TODO: copy?! super({}) @environment = environment @org = org @ship = ship @shipcloud = "#{org}-#{ship}" @app_ids = [] @additional_mappings = [] @facility_id = nil @enabled = true @randomid = SecureRandom.hex(3) end |
Instance Attribute Details
#additional_mappings ⇒ Object
Returns the value of attribute additional_mappings.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def additional_mappings @additional_mappings end |
#app_ids ⇒ Object
Returns the value of attribute app_ids.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def app_ids @app_ids end |
#environment ⇒ Object
Returns the value of attribute environment.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def environment @environment end |
#facility_id ⇒ Object
Returns the value of attribute facility_id.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def facility_id @facility_id end |
#org ⇒ Object
Returns the value of attribute org.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def org @org end |
#ship ⇒ Object
Returns the value of attribute ship.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def ship @ship end |
#shipcloud ⇒ Object
Returns the value of attribute shipcloud.
453 454 455 |
# File 'lib/conan/manifest_builder.rb', line 453 def shipcloud @shipcloud end |
Instance Method Details
#active_healthcheck_url(app) ⇒ Object
520 521 522 |
# File 'lib/conan/manifest_builder.rb', line 520 def active_healthcheck_url(app) "http://#{dns_name(app)}/status/healthcheck" end |
#active_urls(app) ⇒ Object
508 509 510 |
# File 'lib/conan/manifest_builder.rb', line 508 def active_urls(app) [ dns_name(app), agnostic_dns_name(app) ] + @additional_mappings end |
#agnostic_dns_name(app) ⇒ Object
504 505 506 |
# File 'lib/conan/manifest_builder.rb', line 504 def agnostic_dns_name(app) "#{@environment.id}.#{app.url_segment}.#{@@paas_domain}" end |
#apps(*app_ids) ⇒ Object
470 471 472 |
# File 'lib/conan/manifest_builder.rb', line 470 def apps(*app_ids) @app_ids = app_ids end |
#dns_name(app) ⇒ Object
500 501 502 |
# File 'lib/conan/manifest_builder.rb', line 500 def dns_name(app) "#{@environment.id}.#{app.url_segment}.#{@ship}.#{@org}.#{@@paas_domain}" end |
#enabled(b) ⇒ Object
484 485 486 |
# File 'lib/conan/manifest_builder.rb', line 484 def enabled(b) @enabled = b end |
#enabled? ⇒ Boolean
488 489 490 |
# File 'lib/conan/manifest_builder.rb', line 488 def enabled? @enabled end |
#facility(facility_id) ⇒ Object
474 475 476 |
# File 'lib/conan/manifest_builder.rb', line 474 def facility(facility_id) @facility_id = facility_id end |
#hostnames(*hostnames) ⇒ Object
478 479 480 481 482 |
# File 'lib/conan/manifest_builder.rb', line 478 def hostnames(*hostnames) hostnames.each do |hostname| @additional_mappings.push(hostname) unless hostname.empty? end end |
#inactive_healthcheck_url(app) ⇒ Object
524 525 526 |
# File 'lib/conan/manifest_builder.rb', line 524 def inactive_healthcheck_url(app) "http://inactive.#{dns_name(app)}/status/healthcheck" end |
#inactive_urls(app) ⇒ Object
512 513 514 |
# File 'lib/conan/manifest_builder.rb', line 512 def inactive_urls(app) active_urls(app).map{ |url| "inactive.#{url}" } end |
#manifest_url(app) ⇒ Object
516 517 518 |
# File 'lib/conan/manifest_builder.rb', line 516 def manifest_url(app) "http://#{dns_name(app)}/status/manifest" end |
#name(app) ⇒ Object
492 493 494 |
# File 'lib/conan/manifest_builder.rb', line 492 def name(app) "#{app.id}-#{@environment.id}-#{@ship}" end |
#paas_target ⇒ Object
528 529 530 |
# File 'lib/conan/manifest_builder.rb', line 528 def paas_target "https://api.paas.#{@ship}.#{@org}.#{@@paas_domain}" end |
#to_s ⇒ Object
532 533 534 |
# File 'lib/conan/manifest_builder.rb', line 532 def to_s "#{org}-#{ship}" end |
#unique_name(app) ⇒ Object
496 497 498 |
# File 'lib/conan/manifest_builder.rb', line 496 def unique_name(app) "#{name(app)}-#{@randomid}" end |