Module: Marathon
- Defined in:
- lib/marathon.rb,
lib/marathon/version.rb
Overview
The top-level module for this gem. It’s purpose is to hold global configuration variables that are used as defaults in other classes.
Defined Under Namespace
Modules: Error Classes: App, Apps, Base, Connection, Constraint, Container, ContainerDocker, ContainerDockerPortMapping, ContainerVolume, Deployment, DeploymentAction, DeploymentInfo, DeploymentStep, Deployments, EventSubscriptions, Group, Groups, HealthCheck, Leader, MarathonInstance, Queue, Queues, Task, Tasks, Util
Constant Summary collapse
- DEFAULT_URL =
'http://localhost:8080'
- VERSION =
'2.2.0'
Class Method Summary collapse
-
.connection ⇒ Object
Set a new connection.
-
.env_options ⇒ Object
Get marathon options from environment.
-
.env_url ⇒ Object
Get the marathon url from environment.
-
.info ⇒ Object
Get information about the marathon server.
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.logger=(value) ⇒ Object
Sets the attribute logger.
- .metrics ⇒ Object
-
.options ⇒ Object
Get options for connecting to marathon API.
-
.options=(new_options) ⇒ Object
Set new options.
-
.ping ⇒ Object
Ping marathon.
- .reset_connection! ⇒ Object
- .reset_singleton! ⇒ Object
-
.singleton ⇒ Object
Returns the value of attribute singleton.
-
.url ⇒ Object
Get the marathon API URL.
-
.url=(new_url) ⇒ Object
Set a new url.
Class Method Details
.connection ⇒ Object
Set a new connection
136 137 138 |
# File 'lib/marathon.rb', line 136 def connection singleton.connection end |
.env_options ⇒ Object
Get marathon options from environment
104 105 106 107 108 109 110 |
# File 'lib/marathon.rb', line 104 def opts = {} opts[:username] = ENV['MARATHON_USER'] if ENV['MARATHON_USER'] opts[:password] = ENV['MARATHON_PASSWORD'] if ENV['MARATHON_PASSWORD'] opts[:insecure] = ENV['MARATHON_INSECURE'] == 'true' if ENV['MARATHON_INSECURE'] opts end |
.env_url ⇒ Object
Get the marathon url from environment
99 100 101 |
# File 'lib/marathon.rb', line 99 def env_url ENV['MARATHON_URL'] end |
.info ⇒ Object
Get information about the marathon server
150 151 152 |
# File 'lib/marathon.rb', line 150 def info singleton.info end |
.logger ⇒ Object
Returns the value of attribute logger.
11 12 13 |
# File 'lib/marathon.rb', line 11 def logger @logger end |
.logger=(value) ⇒ Object
Sets the attribute logger
11 12 13 |
# File 'lib/marathon.rb', line 11 def logger=(value) @logger = value end |
.metrics ⇒ Object
159 160 161 |
# File 'lib/marathon.rb', line 159 def metrics singleton.metrics end |
.options ⇒ Object
Get options for connecting to marathon API
119 120 121 |
# File 'lib/marathon.rb', line 119 def @options ||= end |
.options=(new_options) ⇒ Object
Set new options
130 131 132 133 |
# File 'lib/marathon.rb', line 130 def () @options = .merge( || {}) reset_singleton! end |
.ping ⇒ Object
Ping marathon
155 156 157 |
# File 'lib/marathon.rb', line 155 def ping singleton.ping end |
.reset_connection! ⇒ Object
145 146 147 |
# File 'lib/marathon.rb', line 145 def reset_connection! reset_singleton! end |
.reset_singleton! ⇒ Object
141 142 143 |
# File 'lib/marathon.rb', line 141 def reset_singleton! @singleton = MarathonInstance.new(url, ) end |
.singleton ⇒ Object
Returns the value of attribute singleton.
94 95 96 |
# File 'lib/marathon.rb', line 94 def singleton @singleton end |
.url ⇒ Object
Get the marathon API URL
113 114 115 116 |
# File 'lib/marathon.rb', line 113 def url @url ||= env_url || DEFAULT_URL @url end |
.url=(new_url) ⇒ Object
Set a new url
124 125 126 127 |
# File 'lib/marathon.rb', line 124 def url=(new_url) @url = new_url reset_singleton! end |