Module: Nomad

Defined in:
lib/nomad.rb,
lib/nomad/api.rb,
lib/nomad/size.rb,
lib/nomad/client.rb,
lib/nomad/errors.rb,
lib/nomad/api/job.rb,
lib/nomad/request.rb,
lib/nomad/version.rb,
lib/nomad/api/node.rb,
lib/nomad/defaults.rb,
lib/nomad/duration.rb,
lib/nomad/response.rb,
lib/nomad/api/agent.rb,
lib/nomad/stringify.rb,
lib/nomad/api/region.rb,
lib/nomad/api/status.rb,
lib/nomad/api/system.rb,
lib/nomad/api/operator.rb,
lib/nomad/api/validate.rb,
lib/nomad/configurable.rb,
lib/nomad/api/allocation.rb,
lib/nomad/api/evaluation.rb

Defined Under Namespace

Modules: API, Configurable, Defaults, Stringify Classes: Agent, AgentJoin, AgentMember, AgentMembers, AgentSelf, Alloc, Allocation, AllocationMetric, Client, Duration, Eval, Evaluation, HTTPClientError, HTTPConnectionError, HTTPError, HTTPServerError, Job, JobArtifact, JobChildren, JobConstraint, JobCreate, JobDispatchPayload, JobEphemeralDisk, JobItem, JobLogConfig, JobParameterizedJob, JobPeriodic, JobRestartPolicy, JobService, JobServiceCheck, JobSummary, JobTask, JobTaskGroup, JobTaskGroupSummary, JobTemplate, JobUpdate, JobValidation, JobVault, JobVersion, Network, Node, NodeEvaluation, NodeItem, NomadError, Operator, Port, Region, Request, Resources, Response, Server, Size, Status, System, TaskEvent, TaskState, Validate

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientNomad::Client (readonly)

API client object based off the configured options in Configurable.


17
18
19
# File 'lib/nomad.rb', line 17

def client
  @client
end

Class Method Details

.method_missing(m, *args, &block) ⇒ Object

Delegate all methods to the client object, essentially making the module object behave like a Client.


35
36
37
38
39
40
41
# File 'lib/nomad.rb', line 35

def method_missing(m, *args, &block)
  if @client.respond_to?(m)
    @client.send(m, *args, &block)
  else
    super
  end
end

.respond_to_missing?(m, include_private = false) ⇒ Boolean

Delegating respond_to to the Client.


44
45
46
# File 'lib/nomad.rb', line 44

def respond_to_missing?(m, include_private = false)
  @client.respond_to?(m, include_private) || super
end

.setup!Object


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nomad.rb', line 19

def setup!
  @client = Nomad::Client.new

  # Set secure SSL options
  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options].tap do |opts|
    opts &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS)
    opts |= OpenSSL::SSL::OP_NO_COMPRESSION if defined?(OpenSSL::SSL::OP_NO_COMPRESSION)
    opts |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2)
    opts |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3)
  end

  self
end