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: ErrorResponse, GatewayInternalResponse, HttpClient, NotFoundResponse, UnexpectedResponse
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(url, token, timeout, request_id) ⇒ ServiceGatewayClient
Returns a new instance of ServiceGatewayClient.
64
65
66
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 64
def initialize(url, token, timeout, request_id)
@http_client = HttpClient.new(url, token, timeout, request_id)
end
|
Instance Attribute Details
#http_client ⇒ Object
Returns the value of attribute http_client.
62
63
64
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 62
def http_client
@http_client
end
|
Instance Method Details
#bind(args) ⇒ Object
79
80
81
82
83
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 79
def bind(args)
msg = GatewayBindRequest.new(args)
resp = http_client.perform_request(:post, "/gateway/v1/configurations/#{msg.service_id}/handles", msg)
GatewayHandleResponse.decode(resp)
end
|
#create_serialized_url(args) ⇒ Object
130
131
132
133
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 130
def create_serialized_url(args)
resp = http_client.perform_request(:post, "/gateway/v1/configurations/#{args[:service_id]}/serialized/url/snapshots/#{args[:snapshot_id]}")
Job.decode(resp)
end
|
#create_snapshot(args) ⇒ Object
100
101
102
103
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 100
def create_snapshot(args)
resp = http_client.perform_request(:post, "/gateway/v1/configurations/#{args[:service_id]}/snapshots")
Job.decode(resp)
end
|
#delete_snapshot(args) ⇒ Object
125
126
127
128
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 125
def delete_snapshot(args)
resp = http_client.perform_request(:delete, "/gateway/v1/configurations/#{args[:service_id]}/snapshots/#{args[:snapshot_id]}")
Job.decode(resp)
end
|
#enum_snapshots(args) ⇒ Object
105
106
107
108
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 105
def enum_snapshots(args)
resp = http_client.perform_request(:get, "/gateway/v1/configurations/#{args[:service_id]}/snapshots")
SnapshotList.decode(resp)
end
|
#import_from_url(args) ⇒ Object
140
141
142
143
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 140
def import_from_url(args)
resp = http_client.perform_request(:put, "/gateway/v1/configurations/#{args[:service_id]}/serialized/url", args[:msg])
Job.decode(resp)
end
|
#job_info(args) ⇒ Object
Snapshotting has never been enabled in production - we can probably remove these
95
96
97
98
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 95
def job_info(args)
resp = http_client.perform_request(:get, "/gateway/v1/configurations/#{args[:service_id]}/jobs/#{args[:job_id]}")
Job.decode(resp)
end
|
#provision(args) ⇒ Object
#rollback_snapshot(args) ⇒ Object
120
121
122
123
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 120
def rollback_snapshot(args)
resp = http_client.perform_request(:put, "/gateway/v1/configurations/#{args[:service_id]}/snapshots/#{args[:snapshot_id]}")
Job.decode(resp)
end
|
#serialized_url(args) ⇒ Object
135
136
137
138
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 135
def serialized_url(args)
resp = http_client.perform_request(:get, "/gateway/v1/configurations/#{args[:service_id]}/serialized/url/snapshots/#{args[:snapshot_id]}")
SerializedURL.decode(resp)
end
|
#snapshot_details(args) ⇒ Object
110
111
112
113
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 110
def snapshot_details(args)
resp = http_client.perform_request(:get, "/gateway/v1/configurations/#{args[:service_id]}/snapshots/#{args[:snapshot_id]}")
Snapshot.decode(resp)
end
|
#unbind(args) ⇒ Object
85
86
87
88
89
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 85
def unbind(args)
msg = GatewayUnbindRequest.new(args)
http_client.perform_request(:delete, "/gateway/v1/configurations/#{msg.service_id}/handles/#{msg.handle_id}", msg)
EMPTY_REQUEST
end
|
#unprovision(args) ⇒ Object
74
75
76
77
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 74
def unprovision(args)
http_client.perform_request(:delete, "/gateway/v1/configurations/#{args[:service_id]}")
EMPTY_REQUEST
end
|
#update_snapshot_name(args) ⇒ Object
115
116
117
118
|
# File 'lib/services/api/clients/service_gateway_client.rb', line 115
def update_snapshot_name(args)
http_client.perform_request(:post, "/gateway/v1/configurations/#{args[:service_id]}/snapshots/#{args[:snapshot_id]}/name", args[:msg])
EMPTY_REQUEST
end
|