class Bim::Action::Sync
Sync
class used by Bim::Subcommands::Sync
Constants
- FAILOVER_STATE_PATH
- SYNC_PATH
- SYNC_STATE_PATH
Public Class Methods
failover_state()
click to toggle source
# File lib/bim/action/sync.rb, line 32 def failover_state uri = URI.join(Bim::BASE_URL, Bim::Action::Sync::FAILOVER_STATE_PATH) req = request(uri, Bim::AUTH, 'application/json') body = JSON.parse(http(uri).request(req).body) body['entries'].each_with_object({}) do |(_key, value), info| entries = value['nestedStats']['entries'] info['color'] = entries['color']['description'] info['summary'] = entries['summary']['description'] info['status'] = entries['status']['description'] end.to_json end
state()
click to toggle source
# File lib/bim/action/sync.rb, line 20 def state uri = URI.join(Bim::BASE_URL, Bim::Action::Sync::SYNC_STATE_PATH) req = request(uri, Bim::AUTH, 'application/json') res = http(uri).request(req) body = JSON.parse(res.body) body['entries'].each_with_object({}) do |(_key, value), info| entries = value['nestedStats']['entries'] info['color'] = entries['color']['description'] info['summary'] = entries['summary']['description'] end.to_json end
sync!(dest, overwrite: false)
click to toggle source
# File lib/bim/action/sync.rb, line 12 def sync!(dest, overwrite: false) msg = "you want to sync #{BIGIP_HOST} configuration to #{dest}? [y|n]" return { 'message' => "cancel sync #{BIGIP_HOST} to #{dest}" } unless yes_or_no?(msg) uri = URI.join(Bim::BASE_URL, Bim::Action::Sync::SYNC_PATH) j = { "command": 'run', "utilCmdArgs": "config-sync #{'force-full-load-push ' if overwrite}to-group #{dest}" } post(uri, j.to_json) end