Class: CloudControl::API::VIP

Inherits:
Core
  • Object
show all
Defined in:
lib/cloudcontrol/api/vip.rb

Instance Attribute Summary

Attributes inherited from Core

#client

Instance Method Summary collapse

Methods inherited from Core

#endpoint, #get, #get_simple, #initialize, #log, #org_endpoint, #org_id, #perform, #post, #post_simple, #query_params, #request_query_string, #request_simple_body, #request_xml_body, #simple_params, #single, #xml_params

Constructor Details

This class inherits a constructor from CloudControl::API::Core

Instance Method Details

#probe_createObject

Note this is for TCP, UDP & ICMP only additional xml fields need to be added to be complete Examples name = Probe1, type = TCP, probeIntervalSeconds = “60”, errorCountBeforeServerFail = “5” maxReplyWaitSeconds = “10”



38
39
40
41
42
# File 'lib/cloudcontrol/api/vip.rb', line 38

def probe_create
  org_endpoint "/network/#{network_id}/probe"
  xml_params(name: name, type: type, probeIntervalSeconds: probeIntervalSeconds, errorCountBeforeServerFail: errorCountBeforeServerFail, successCountBeforeServerEnable: successCountBeforeServerEnable, failedProbeIntervalSeconds: failedProbeIntervalSeconds, maxReplyWaitSeconds: maxReplyWaitSeconds)
  post
end

#probe_delete(network_id, probe_id) ⇒ Object



45
46
47
48
# File 'lib/cloudcontrol/api/vip.rb', line 45

def probe_delete (network_id, probe_id)
  org_endpoint "/network/#{network_id}/probe/{probe_id}?delete"
  get
end

#probe_from_server_farm(network_id, server_farm_id, probe_id) ⇒ Object

Examples probe_id = TCP1



100
101
102
103
104
# File 'lib/cloudcontrol/api/vip.rb', line 100

def probe_from_server_farm (network_id, server_farm_id, probe_id)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}/removeProbe"
  xml_params(probe_id: probe_id)
  post
end

#probe_list(network_id) ⇒ Object

Probe section



31
32
33
34
# File 'lib/cloudcontrol/api/vip.rb', line 31

def probe_list (network_id)
  org_endpoint "/network/#{network_id}/probe"
  get
end

#probe_to_server_farm(network_id, server_farm_id, probe_id) ⇒ Object

Examples probe_id = TCP1



93
94
95
96
97
# File 'lib/cloudcontrol/api/vip.rb', line 93

def probe_to_server_farm (network_id, server_farm_id, probe_id)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}/addProbe"
  xml_params(probe_id: probe_id)
  post
end

#real_server_create(network_id, name, server_id, in_service) ⇒ Object

Examples name = RealServer1, server_id = “415a7f70-1008-42a3-8375-5dcf52636cc5”, in_service = true/false



11
12
13
14
15
# File 'lib/cloudcontrol/api/vip.rb', line 11

def real_server_create (network_id, name, server_id, in_service)
  org_endpoint "/network/#{network_id}/realServer"
  xml_params(tag: "NewRealServer", schema: "vip", name: name, server_id: server_id, in_service: in_service)
  post
end

#real_server_delete(network_id, rserver_id) ⇒ Object



18
19
20
21
# File 'lib/cloudcontrol/api/vip.rb', line 18

def real_server_delete (network_id, rserver_id)
  org_endpoint "/network/#{network_id}/realServer/#{rserver_id}?delete"
  get
end

#real_server_from_server_farm(network_id, server_farm_id, real_server_id, real_server_port) ⇒ Object

Examples realServerId = “RealServer1”, realSeverPort = “80”



85
86
87
88
89
# File 'lib/cloudcontrol/api/vip.rb', line 85

def real_server_from_server_farm (network_id, server_farm_id, real_server_id, real_server_port)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}/removeRealServer"
  simple_params(real_server_id: real_server_id, real_server_port: real_server_port)
  post_simple
end

#real_server_modify(network_id, rserver_id, in_service) ⇒ Object



24
25
26
27
28
# File 'lib/cloudcontrol/api/vip.rb', line 24

def real_server_modify (network_id, rserver_id, in_service)
  org_endpoint "/network/#{network_id}/realServer/#{rserver_id}"
  xml_params(in_service: in_service)
  post
end

#real_server_to_server_farm(network_id, server_farm_id, real_server_id, real_server_port) ⇒ Object

Examples realServerId = “RealServer1”, realSeverPort = “80”



78
79
80
81
82
# File 'lib/cloudcontrol/api/vip.rb', line 78

def real_server_to_server_farm (network_id, server_farm_id, real_server_id, real_server_port)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}/addRealServer"
  simple_params(real_server_id: real_server_id, real_server_port: real_server_port)
  post_simple
end

#real_servers_list(network_id) ⇒ Object

Real Server section



5
6
7
8
# File 'lib/cloudcontrol/api/vip.rb', line 5

def real_servers_list (network_id)
  org_endpoint "/network/#{network_id}/realServer"
  get
end

#server_farm_create(network_id, name, real_server_id, port, predictor) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/cloudcontrol/api/vip.rb', line 62

def server_farm_create (network_id, name, real_server_id, port, predictor)
  if ["ROUND_ROBIN", "LEAST_CONNECTIONS"].include? predictor
    org_endpoint "/network/#{network_id}/serverFarm"
    xml_params(schema: "vip", tag: "NewServerFarm", name: name, predictor: predictor, real_server: {id: real_server_id, port: port})
    post
  else
    raise "Unknown predictor: #{predictor}"
  end
end

#server_farm_delete(network_id, server_farm_id) ⇒ Object



72
73
74
75
# File 'lib/cloudcontrol/api/vip.rb', line 72

def server_farm_delete (network_id, server_farm_id)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}?delete"
  get
end

#server_farm_details(network_id, server_farm_id) ⇒ Object



57
58
59
60
# File 'lib/cloudcontrol/api/vip.rb', line 57

def server_farm_details (network_id, server_farm_id)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}"
  get
end

#server_farm_list(network_id) ⇒ Object

Server Farm Section



52
53
54
55
# File 'lib/cloudcontrol/api/vip.rb', line 52

def server_farm_list (network_id)
  org_endpoint "/network/#{network_id}/serverFarm"
  get
end

#server_farm_predictor(network_id, server_farm_id, predictor) ⇒ Object

Examples predictor= LEAST_CONNECTIONS | ROUND_ROBIN



107
108
109
110
111
# File 'lib/cloudcontrol/api/vip.rb', line 107

def server_farm_predictor(network_id, server_farm_id, predictor)
  org_endpoint "/network/#{network_id}/serverFarm/#{server_farm_id}"
  xml_params(predictor: predictor)
  post
end

#vip_create(network_id, name, port, protocol, server_farm_id) ⇒ Object



118
119
120
121
122
# File 'lib/cloudcontrol/api/vip.rb', line 118

def vip_create(network_id, name, port, protocol, server_farm_id)
  org_endpoint "/network/#{network_id}/vip"
  xml_params(schema: "vip", tag: "NewVip", name: name, port: port, protocol: protocol, vip_target_type: "SERVER_FARM", vip_target_id: server_farm_id, reply_to_icmp: true, in_service: true)
  post
end

#vip_list(network_id) ⇒ Object



113
114
115
116
# File 'lib/cloudcontrol/api/vip.rb', line 113

def vip_list(network_id)
  org_endpoint "/network/#{network_id}/vip"
  get
end