Class: SilverlineAPI::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/librato_silverline_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Container

Returns a new instance of Container.



171
172
173
174
175
176
177
178
179
# File 'lib/librato_silverline_api.rb', line 171

def initialize(args = {})
  @name = args[:name]
  @cpu = args[:cpu] ? Axis.new(args[:cpu]) : Axis.new
  @mem = args[:mem] ? Axis.new(args[:mem]) : Axis.new
  @network_rbw = args[:network_rbw] ? Axis.new(args[:network_rbw]) : Axis.new
  @network_wbw = args[:network_wbw] ? Axis.new(args[:network_wbw]) : Axis.new
  @storage_rbw = args[:storage_rbw] ? Axis.new(args[:storage_rbw]) : Axis.new
  @storage_wbw = args[:storage_wbw] ? Axis.new(args[:storage_wbw]) : Axis.new
end

Instance Attribute Details

#cpuObject

Returns the value of attribute cpu.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def cpu
  @cpu
end

#memObject

Returns the value of attribute mem.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def mem
  @mem
end

#nameObject

Returns the value of attribute name.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def name
  @name
end

#network_rbwObject

Returns the value of attribute network_rbw.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def network_rbw
  @network_rbw
end

#network_wbwObject

Returns the value of attribute network_wbw.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def network_wbw
  @network_wbw
end

#storage_rbwObject

Returns the value of attribute storage_rbw.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def storage_rbw
  @storage_rbw
end

#storage_wbwObject

Returns the value of attribute storage_wbw.



169
170
171
# File 'lib/librato_silverline_api.rb', line 169

def storage_wbw
  @storage_wbw
end

Instance Method Details

#to_json(x = nil) ⇒ Object



181
182
183
184
185
186
187
188
189
190
191
# File 'lib/librato_silverline_api.rb', line 181

def to_json(x = nil)
  {
    :name => @name,
    :cpu => @cpu,
    :mem => @mem,
    :network_rbw => @network_rbw,
    :network_wbw => @network_wbw,
    :storage_rbw => @storage_rbw,
    :storage_wbw => @storage_wbw
  }.to_json
end