leofs_manager_client 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -121,6 +121,19 @@ module LeoFSManager
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
class LoginInfo
|
125
|
+
attr_reader :id, :role_id, :access_key_id, :secret_key, :created_at
|
126
|
+
|
127
|
+
def initialize(h)
|
128
|
+
h = h[:user]
|
129
|
+
@id = h[:id]
|
130
|
+
@role_id = h[:role_id]
|
131
|
+
@access_key_id = h[:access_key_id]
|
132
|
+
@secret_key = h[:secret_key]
|
133
|
+
@created_at = h[:created_at]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
124
137
|
class User
|
125
138
|
attr_reader :user_id, :access_key_id, :created_at
|
126
139
|
|
data/lib/leofs_manager_client.rb
CHANGED
@@ -26,10 +26,11 @@ require "time"
|
|
26
26
|
require_relative "leofs_manager_client/leofs_manager_models"
|
27
27
|
|
28
28
|
module LeoFSManager
|
29
|
-
VERSION = "0.2.
|
29
|
+
VERSION = "0.2.10"
|
30
30
|
|
31
31
|
class Client
|
32
32
|
CMD_VERSION = "version"
|
33
|
+
CMD_LOGIN = "login %s %s"
|
33
34
|
CMD_STATUS = "status %s"
|
34
35
|
CMD_START = "start"
|
35
36
|
CMD_DETACH = "detach %s"
|
@@ -83,6 +84,13 @@ module LeoFSManager
|
|
83
84
|
Status.new(sender(CMD_STATUS % node))
|
84
85
|
end
|
85
86
|
|
87
|
+
# Login as specifies user
|
88
|
+
# Return::
|
89
|
+
# LoginInfo
|
90
|
+
def login(user_id, password)
|
91
|
+
LoginInfo.new(sender(CMD_LOGIN % [user_id, password]))
|
92
|
+
end
|
93
|
+
|
86
94
|
# Launch LeoFS's storage cluster
|
87
95
|
# Return::
|
88
96
|
# _nil_
|
data/spec/dummy_tcp_server.rb
CHANGED
@@ -24,6 +24,16 @@ require "socket"
|
|
24
24
|
|
25
25
|
module Dummy
|
26
26
|
module Response
|
27
|
+
Login = {
|
28
|
+
:user => {
|
29
|
+
:id => "foo",
|
30
|
+
:role_id => 0,
|
31
|
+
:access_key_id => "855d2f9bf21f51b4fd38",
|
32
|
+
:secret_key => "ea6d9540d6385f32d674c925929748e00e0e961a",
|
33
|
+
:created_at => "2012-11-29 17:18:39 +0900"
|
34
|
+
}
|
35
|
+
}.to_json
|
36
|
+
|
27
37
|
Status = {
|
28
38
|
:system_info => {
|
29
39
|
:version => "0.10.1",
|
@@ -125,6 +135,8 @@ module Dummy
|
|
125
135
|
line.rstrip!
|
126
136
|
begin
|
127
137
|
case line
|
138
|
+
when "login"
|
139
|
+
Response::Login
|
128
140
|
when "status"
|
129
141
|
Response::Status
|
130
142
|
when "s3-get-buckets"
|
@@ -55,6 +55,12 @@ describe LeoFSManager do
|
|
55
55
|
lambda { Client.new }.should raise_error
|
56
56
|
end
|
57
57
|
|
58
|
+
describe "#login" do
|
59
|
+
it "returns LoginInfo" do
|
60
|
+
subject.login("user_id", "pass").should be_a LoginInfo
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
58
64
|
describe "#status" do
|
59
65
|
its(:status) { should be_a Status }
|
60
66
|
its("status.system_info") { should be_a Status::System }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leofs_manager_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-12-05 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Client for LeoFS Manager
|
16
16
|
email:
|