saklient 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9bd88b2b564abfa841ba4ea1d3a4690129c36fc5
|
|
4
|
+
data.tar.gz: bf4d4494c832dc366f38c151631697cd5734fc67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d95ad8fedd4a2da51becafba0dcd7d855c2b320a618b27280eb234148c009350c81f071a05fb3dd898798fea439d0a827a4377b6435f03b14aaa79fcf4f7329d
|
|
7
|
+
data.tar.gz: f90d83eb6a37ff23b6ca447557d446d21b39c8e9e814d0d1cc451c818b4dbccfa7a33e2b7c8d001dbabc778ff9e4b0cc09338d1d3662b2730dce0f7e0de06a7a
|
|
@@ -13,7 +13,8 @@ module Saklient
|
|
|
13
13
|
def initialize(token, secret)
|
|
14
14
|
@config = {
|
|
15
15
|
api_root: 'https://secure.sakura.ad.jp/cloud/',
|
|
16
|
-
api_root_suffix: nil
|
|
16
|
+
api_root_suffix: nil,
|
|
17
|
+
timeout_sec: 180
|
|
17
18
|
}
|
|
18
19
|
set_access_key token, secret
|
|
19
20
|
self
|
|
@@ -44,6 +45,10 @@ module Saklient
|
|
|
44
45
|
@config[:secret] = secret
|
|
45
46
|
end
|
|
46
47
|
|
|
48
|
+
def set_timeout(sec)
|
|
49
|
+
@config[:timeout_sec] = sec
|
|
50
|
+
end
|
|
51
|
+
|
|
47
52
|
def request(method, path, params={})
|
|
48
53
|
json = params.to_json
|
|
49
54
|
|
|
@@ -73,7 +78,7 @@ module Saklient
|
|
|
73
78
|
|
|
74
79
|
extra_headers = {
|
|
75
80
|
'Content-Type' => 'application/x-www-form-urlencoded',
|
|
76
|
-
'User-Agent' => 'saklient.ruby ver-0.0.
|
|
81
|
+
'User-Agent' => 'saklient.ruby ver-0.0.6 rev-705e6fc541c30cec41e72e5e531418d64f196863',
|
|
77
82
|
'X-Requested-With' => 'XMLHttpRequest',
|
|
78
83
|
'X-Sakura-HTTP-Method' => method,
|
|
79
84
|
'X-Sakura-Error-Level' => 'warning',
|
|
@@ -94,7 +99,10 @@ module Saklient
|
|
|
94
99
|
http.use_ssl = true
|
|
95
100
|
# http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
96
101
|
end
|
|
97
|
-
res = http.start {|conn|
|
|
102
|
+
res = http.start {|conn|
|
|
103
|
+
conn.read_timeout = @config[:timeout_sec]
|
|
104
|
+
conn.request req
|
|
105
|
+
}
|
|
98
106
|
|
|
99
107
|
ret = JSON.parse(res.body, {:symbolize_names => true})
|
|
100
108
|
status = res.code.to_i
|
|
@@ -168,6 +168,13 @@ module Saklient
|
|
|
168
168
|
return _sort_by_name(reverse)
|
|
169
169
|
end
|
|
170
170
|
|
|
171
|
+
# @param [bool] reverse
|
|
172
|
+
# @return [Model_Disk]
|
|
173
|
+
def sort_by_connection_order(reverse = false)
|
|
174
|
+
Saklient::Util::validate_type(reverse, 'bool')
|
|
175
|
+
return _sort('ConnectionOrder', reverse)
|
|
176
|
+
end
|
|
177
|
+
|
|
171
178
|
# @private
|
|
172
179
|
# @param [Saklient::Cloud::Client] client
|
|
173
180
|
def initialize(client)
|
|
@@ -150,6 +150,16 @@ module Saklient
|
|
|
150
150
|
return reload
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
+
# 指定したIDのスイッチに接続します.
|
|
154
|
+
#
|
|
155
|
+
# @param [String] swytchId 接続先のスイッチID.
|
|
156
|
+
# @return [Iface] this
|
|
157
|
+
def connect_to_swytch_by_id(swytchId)
|
|
158
|
+
Saklient::Util::validate_type(swytchId, 'String')
|
|
159
|
+
@_client.request('PUT', _api_path + '/' + Saklient::Util::url_encode(_id) + '/to/switch/' + swytchId)
|
|
160
|
+
return reload
|
|
161
|
+
end
|
|
162
|
+
|
|
153
163
|
# 共有セグメントに接続します.
|
|
154
164
|
#
|
|
155
165
|
# @return [Iface] this
|
|
@@ -299,7 +299,7 @@ module Saklient
|
|
|
299
299
|
# @return [Array<Disk>]
|
|
300
300
|
def find_disks
|
|
301
301
|
model = Saklient::Util::create_class_instance('saklient.cloud.models.Model_Disk', [@_client])
|
|
302
|
-
return model.with_server_id(_id).find
|
|
302
|
+
return model.with_server_id(_id).sort_by_connection_order.find
|
|
303
303
|
end
|
|
304
304
|
|
|
305
305
|
# サーバにインタフェースを1つ増設し, それを取得します.
|
data/lib/saklient/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: saklient
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- townewgokgok
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -317,3 +317,4 @@ test_files:
|
|
|
317
317
|
- spec/server_spec.rb
|
|
318
318
|
- spec/swytch_spec.rb
|
|
319
319
|
- spec/util_spec.rb
|
|
320
|
+
has_rdoc:
|