Class: VCAP::Services::Api::ServiceGatewayClient
- Inherits:
-
Object
- Object
- VCAP::Services::Api::ServiceGatewayClient
show all
- Defined in:
- lib/services/api/clients/service_gateway_client.rb
Defined Under Namespace
Classes: UnexpectedResponse
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ServiceGatewayClient.
26
27
28
29
30
31
32
33
34
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 26
def initialize(host, token, port=80)
@host = host
@port = port
@token = token
@hdrs = {
'Content-Type' => 'application/json',
VCAP::Services::Api::GATEWAY_TOKEN_HEADER => @token
}
end
|
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
24
25
26
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 24
def host
@host
end
|
#port ⇒ Object
Returns the value of attribute port.
24
25
26
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 24
def port
@port
end
|
#token ⇒ Object
Returns the value of attribute token.
24
25
26
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 24
def token
@token
end
|
Instance Method Details
#create_snapshot(args) ⇒ Object
46
47
48
49
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 46
def create_snapshot(args)
resp = perform_request(Net::HTTP::Post, "/gateway/v1/configurations/#{args[:service_id]}/snapshots")
VCAP::Services::Api::Job.decode(resp.body)
end
|
#enum_snapshots(args) ⇒ Object
51
52
53
54
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 51
def enum_snapshots(args)
resp = perform_request(Net::HTTP::Get, "/gateway/v1/configurations/#{args[:service_id]}/snapshots")
VCAP::Services::Api::SnapshotList.decode(resp.body)
end
|
#import_from_data(args) ⇒ Object
76
77
78
79
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 76
def import_from_data(args)
resp = perform_request(Net::HTTP::Put, "/gateway/v1/configurations/#{args[:service_id]}/serialized/data", args[:msg])
VCAP::Services::Api::Job.decode(resp.body)
end
|
#import_from_url(args) ⇒ Object
71
72
73
74
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 71
def import_from_url(args)
resp = perform_request(Net::HTTP::Put, "/gateway/v1/configurations/#{args[:service_id]}/serialized/url", args[:msg])
VCAP::Services::Api::Job.decode(resp.body)
end
|
#job_info(args) ⇒ Object
81
82
83
84
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 81
def job_info(args)
resp = perform_request(Net::HTTP::Get, "/gateway/v1/configurations/#{args[:service_id]}/jobs/#{args[:job_id]}")
VCAP::Services::Api::Job.decode(resp.body)
end
|
#provision(args) ⇒ Object
#rollback_snapshot(args) ⇒ Object
61
62
63
64
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 61
def rollback_snapshot(args)
resp = perform_request(Net::HTTP::Put, "/gateway/v1/configurations/#{args[:service_id]}/snapshots/#{args[:snapshot_id]}")
VCAP::Services::Api::Job.decode(resp.body)
end
|
#serialized_url(args) ⇒ Object
66
67
68
69
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 66
def serialized_url(args)
resp = perform_request(Net::HTTP::Get, "/gateway/v1/configurations/#{args[:service_id]}/serialized/url")
VCAP::Services::Api::Job.decode(resp.body)
end
|
#snapshot_details(args) ⇒ Object
56
57
58
59
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 56
def snapshot_details(args)
resp = perform_request(Net::HTTP::Get, "/gateway/v1/configurations/#{args[:service_id]}/snapshots/#{args[:snapshot_id]}")
VCAP::Services::Api::Snapshot.decode(resp.body)
end
|
#unbind(args) ⇒ Object
92
93
94
95
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 92
def unbind(args)
msg = VCAP::Services::Api::GatewayUnbindRequest.new(args)
perform_request(Net::HTTP::Delete, "/gateway/v1/configurations/#{msg.service_id}/handles/#{msg.handle_id}", msg)
end
|
#unprovision(args) ⇒ Object
42
43
44
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 42
def unprovision(args)
perform_request(Net::HTTP::Delete, "/gateway/v1/configurations/#{args[:service_id]}")
end
|