stormmq-client 0.0.4
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.
- data/LICENSE +21 -0
- data/README +1 -0
- data/Rakefile +19 -0
- data/TODO +11 -0
- data/bin/stormmq-amqp-echo-test +204 -0
- data/bin/stormmq-create-system +211 -0
- data/bin/stormmq-delete-system +117 -0
- data/bin/stormmq-describe-company +106 -0
- data/bin/stormmq-describe-system +135 -0
- data/bin/stormmq-get-amqpuser-password +148 -0
- data/bin/stormmq-list-amqpusers +142 -0
- data/bin/stormmq-list-apis +86 -0
- data/bin/stormmq-list-bindings +130 -0
- data/bin/stormmq-list-clusters +101 -0
- data/bin/stormmq-list-companies +89 -0
- data/bin/stormmq-list-exchanges +131 -0
- data/bin/stormmq-list-queues +131 -0
- data/bin/stormmq-list-systems +111 -0
- data/bin/stormmq-url-signer +111 -0
- data/lib/stormmq/amqp.rb +92 -0
- data/lib/stormmq/application.rb +36 -0
- data/lib/stormmq/base64_extensions.rb +19 -0
- data/lib/stormmq/errors.rb +33 -0
- data/lib/stormmq/rest.rb +160 -0
- data/lib/stormmq/secret_keys.rb +70 -0
- data/lib/stormmq/url.rb +125 -0
- data/lib/stormmq/utils.rb +27 -0
- data/spec/stormmq/amqp_spec.rb +21 -0
- data/spec/stormmq/secret_keys_spec.rb +25 -0
- data/spec/stormmq/url_spec.rb +129 -0
- data/spec/stormmq/utils_spec.rb +13 -0
- metadata +254 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Please refer to the LICENSE file that accompanies this source
|
8
|
+
# for terms of use and redistribution.
|
9
|
+
#++
|
10
|
+
|
11
|
+
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib")
|
12
|
+
|
13
|
+
require 'stormmq/application'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
class StormMQ::Application::ListAMQPUsers < StormMQ::Application
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
synopsis "--help | <userName> <systemName> <companyName> <environmentName>"
|
20
|
+
options :help
|
21
|
+
expected_args :user, :system, :company, :environment
|
22
|
+
end
|
23
|
+
|
24
|
+
def main
|
25
|
+
puts JSON.pretty_generate(self.rest_client(@user).amqp_users(@company, @system, @environment))
|
26
|
+
end
|
27
|
+
|
28
|
+
def man
|
29
|
+
<<-EOM
|
30
|
+
NAME
|
31
|
+
|
32
|
+
#{File.basename(__FILE__)}
|
33
|
+
|
34
|
+
PURPOSE
|
35
|
+
|
36
|
+
Lists all the AMQP user names and passwords. For a recently signed
|
37
|
+
up user, we've created you a default system with a default AMQP
|
38
|
+
user name (amqpUserName) the same as your userName, so you don't
|
39
|
+
need this tool yet.
|
40
|
+
|
41
|
+
USAGE
|
42
|
+
|
43
|
+
#{File.basename(__FILE__)} --help
|
44
|
+
#{File.basename(__FILE__)} <userName> <systemName> <companyName> <environmentName>
|
45
|
+
|
46
|
+
For ordinary users, your companyName is the same as your userName.
|
47
|
+
|
48
|
+
For recently signed up users, the systemName is the same as your
|
49
|
+
userName.
|
50
|
+
|
51
|
+
For recently signed up users, the environmentName is one of:
|
52
|
+
|
53
|
+
* development
|
54
|
+
* testing
|
55
|
+
* production
|
56
|
+
|
57
|
+
For recently signed up users, the amqpUserName is the same as your
|
58
|
+
userName.
|
59
|
+
|
60
|
+
PARAMETERS
|
61
|
+
|
62
|
+
<userName>
|
63
|
+
|
64
|
+
The user name you log into the site with.
|
65
|
+
|
66
|
+
<systemName>
|
67
|
+
|
68
|
+
If you're not sure if you've already created a system, use:
|
69
|
+
|
70
|
+
stormmq-list-systems <userName>
|
71
|
+
|
72
|
+
A systemName can not contain a '/' or ':'
|
73
|
+
|
74
|
+
<companyName>
|
75
|
+
|
76
|
+
For ordinary users, this is the same as your userName.
|
77
|
+
If you're not sure of your companyName, you can retrieve it with:
|
78
|
+
|
79
|
+
stormmq-list-companies <userName>
|
80
|
+
|
81
|
+
<environmentName>
|
82
|
+
|
83
|
+
One of:
|
84
|
+
|
85
|
+
* development
|
86
|
+
* testing
|
87
|
+
* production
|
88
|
+
|
89
|
+
For the default system created when you signed up, or for any
|
90
|
+
system created by stormmq-create-system <userName>
|
91
|
+
(except advanced use).
|
92
|
+
|
93
|
+
--help, -h
|
94
|
+
|
95
|
+
Displays this help page then quits.
|
96
|
+
|
97
|
+
RESULT
|
98
|
+
|
99
|
+
Outputs a simple JSON object of string keys (user names to use with
|
100
|
+
AMQP) to string values (AMQP passwords, to be used as is without
|
101
|
+
decoding but excluding the quotes).
|
102
|
+
|
103
|
+
If using the default system created when you signed up, then the
|
104
|
+
user name to log on to AMQP ('amqpUserName') will be the same as
|
105
|
+
your userName.
|
106
|
+
|
107
|
+
REST API
|
108
|
+
|
109
|
+
Equivalent is GET /companies/<companyName>/<systemName>/<environmentName>/users/.
|
110
|
+
|
111
|
+
NOTES
|
112
|
+
|
113
|
+
Output is not JSON, so not suitable for use with XHTML, etc, response documents.
|
114
|
+
|
115
|
+
To find you companyName, use:
|
116
|
+
|
117
|
+
stormmq-list-companies
|
118
|
+
|
119
|
+
To delete your default system, use:
|
120
|
+
|
121
|
+
stormmq-delete-system <userName>
|
122
|
+
|
123
|
+
To create a new system, use:
|
124
|
+
|
125
|
+
stormmq-create-system <userName> <systemName>
|
126
|
+
|
127
|
+
COPYRIGHT
|
128
|
+
|
129
|
+
Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
130
|
+
All rights reserved.
|
131
|
+
|
132
|
+
SELF TEST
|
133
|
+
|
134
|
+
#{self_test}
|
135
|
+
|
136
|
+
EOM
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
StormMQ::Application::ListAMQPUsers.run
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Please refer to the LICENSE file that accompanies this source
|
8
|
+
# for terms of use and redistribution.
|
9
|
+
#++
|
10
|
+
|
11
|
+
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib")
|
12
|
+
|
13
|
+
require 'stormmq/application'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
class StormMQ::Application::ListAPIs < StormMQ::Application
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
synopsis "--help | <userName>"
|
20
|
+
options :help
|
21
|
+
expected_args :user
|
22
|
+
end
|
23
|
+
|
24
|
+
def main
|
25
|
+
puts JSON.pretty_generate(self.rest_client(@user).apis)
|
26
|
+
end
|
27
|
+
|
28
|
+
def man
|
29
|
+
<<-EOM
|
30
|
+
NAME
|
31
|
+
|
32
|
+
#{File.basename(__FILE__)}
|
33
|
+
|
34
|
+
PURPOSE
|
35
|
+
|
36
|
+
Describes all current APIs available (as JSON).
|
37
|
+
|
38
|
+
USAGE
|
39
|
+
|
40
|
+
#{File.basename(__FILE__)} --help
|
41
|
+
#{File.basename(__FILE__)} <userName>
|
42
|
+
|
43
|
+
PARAMETERS
|
44
|
+
|
45
|
+
<userName>
|
46
|
+
|
47
|
+
The user name you log into the site with. When provided, lists
|
48
|
+
the companies associated with that user name.
|
49
|
+
|
50
|
+
Note:
|
51
|
+
|
52
|
+
--help, -h
|
53
|
+
|
54
|
+
Displays this help page then quits.
|
55
|
+
|
56
|
+
RESULT
|
57
|
+
|
58
|
+
Outputs a pretty-printed complex JSON list to standard out.
|
59
|
+
|
60
|
+
REST API
|
61
|
+
|
62
|
+
Equivalent is 'GET /'.
|
63
|
+
|
64
|
+
NOTES
|
65
|
+
|
66
|
+
Use #{File.basename(__FILE__)} to verify that your setup works.
|
67
|
+
|
68
|
+
Pretty prints JSON, so not suitable for use with XHTML etc.,
|
69
|
+
response documents.
|
70
|
+
|
71
|
+
COPYRIGHT
|
72
|
+
|
73
|
+
Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
74
|
+
All rights reserved.
|
75
|
+
|
76
|
+
SELF TEST
|
77
|
+
|
78
|
+
#{self_test}
|
79
|
+
|
80
|
+
EOM
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
StormMQ::Application::ListAPIs.run
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Please refer to the LICENSE file that accompanies this source
|
8
|
+
# for terms of use and redistribution.
|
9
|
+
#++
|
10
|
+
|
11
|
+
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib")
|
12
|
+
|
13
|
+
require 'stormmq/application'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
class StormMQ::Application::ListBindings < StormMQ::Application
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
synopsis "--help | <userName> <systemName> <companyName> <environmentName>"
|
20
|
+
options :help
|
21
|
+
expected_args :user, :system, :company, :environment
|
22
|
+
end
|
23
|
+
|
24
|
+
def main
|
25
|
+
puts JSON.pretty_generate(self.rest_client(@user).bindings(@company, @system, @environment))
|
26
|
+
end
|
27
|
+
|
28
|
+
def man
|
29
|
+
<<-EOM
|
30
|
+
NAME
|
31
|
+
|
32
|
+
#{File.basename(__FILE__)}
|
33
|
+
|
34
|
+
PURPOSE
|
35
|
+
|
36
|
+
Describes the currently known queue bindings for an Environment.
|
37
|
+
|
38
|
+
USAGE
|
39
|
+
|
40
|
+
#{File.basename(__FILE__)} --help
|
41
|
+
#{File.basename(__FILE__)} <userName> <systemName> <companyName> <environmentName>
|
42
|
+
|
43
|
+
For ordinary users, your companyName is the same as your userName.
|
44
|
+
|
45
|
+
For recently signed up users, the systemName is the same as your
|
46
|
+
userName.
|
47
|
+
|
48
|
+
For recently signed up users, the environmentName is one of:
|
49
|
+
|
50
|
+
* development
|
51
|
+
* testing
|
52
|
+
* production
|
53
|
+
|
54
|
+
PARAMETERS
|
55
|
+
|
56
|
+
<userName>
|
57
|
+
|
58
|
+
The user name you log into the site with.
|
59
|
+
|
60
|
+
<systemName>
|
61
|
+
|
62
|
+
If you're not sure if you've already created a system, use:
|
63
|
+
|
64
|
+
stormmq-list-systems <userName>
|
65
|
+
|
66
|
+
A systemName can not contain a '/' or ':'
|
67
|
+
|
68
|
+
<companyName>
|
69
|
+
|
70
|
+
For ordinary users, this is the same as your userName.
|
71
|
+
If you're not sure of your companyName, you can retrieve it with:
|
72
|
+
|
73
|
+
stormmq-list-companies <userName>
|
74
|
+
|
75
|
+
<environmentName>
|
76
|
+
|
77
|
+
One of:
|
78
|
+
|
79
|
+
* development
|
80
|
+
* testing
|
81
|
+
* production
|
82
|
+
|
83
|
+
For the default system created when you signed up, or for any
|
84
|
+
system created by stormmq-create-system <userName>
|
85
|
+
(except advanced use).
|
86
|
+
|
87
|
+
--help, -h
|
88
|
+
|
89
|
+
Displays this help page then quits.
|
90
|
+
|
91
|
+
RESULT
|
92
|
+
|
93
|
+
Outputs a pretty-printed complex JSON list to STDOUT.
|
94
|
+
|
95
|
+
REST API
|
96
|
+
|
97
|
+
Equivalent is GET /companies/<companyName>/<systemName>/<environmentName>/bindings/.
|
98
|
+
|
99
|
+
NOTES
|
100
|
+
|
101
|
+
Output is not JSON, so not suitable for use with XHTML, etc, response documents.
|
102
|
+
|
103
|
+
To find you companyName, use:
|
104
|
+
|
105
|
+
stormmq-list-companies
|
106
|
+
|
107
|
+
To delete your default system, use:
|
108
|
+
|
109
|
+
stormmq-delete-system <userName>
|
110
|
+
|
111
|
+
To create a new system, use:
|
112
|
+
|
113
|
+
stormmq-create-system <userName> <systemName>
|
114
|
+
|
115
|
+
COPYRIGHT
|
116
|
+
|
117
|
+
Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
118
|
+
All rights reserved.
|
119
|
+
|
120
|
+
SELF TEST
|
121
|
+
|
122
|
+
#{self_test}
|
123
|
+
|
124
|
+
EOM
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
StormMQ::Application::ListBindings.run
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Please refer to the LICENSE file that accompanies this source
|
8
|
+
# for terms of use and redistribution.
|
9
|
+
#++
|
10
|
+
|
11
|
+
$:.unshift File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib")
|
12
|
+
|
13
|
+
require 'stormmq/application'
|
14
|
+
|
15
|
+
class StormMQ::Application::ListClusters < StormMQ::Application
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
synopsis "--help | <userName> | <userName> <companyName>"
|
19
|
+
options :help
|
20
|
+
expected_args [1,2]
|
21
|
+
end
|
22
|
+
|
23
|
+
def main
|
24
|
+
user = argv[0]
|
25
|
+
company = argv[1] || user
|
26
|
+
puts JSON.pretty_generate(self.rest_client(user).clusters(company))
|
27
|
+
end
|
28
|
+
|
29
|
+
def man
|
30
|
+
<<-EOM
|
31
|
+
NAME
|
32
|
+
|
33
|
+
#{File.basename(__FILE__)}
|
34
|
+
|
35
|
+
PURPOSE
|
36
|
+
|
37
|
+
Lists the names of the clusters in our Messaging Cloud you can
|
38
|
+
access through your company. You'll need this information if you're
|
39
|
+
creating complex system-environment combinations.
|
40
|
+
|
41
|
+
Currently, the only cluster everyone can access is free-1.
|
42
|
+
|
43
|
+
Ordinary users can only access free clusters. If you're sending a
|
44
|
+
lot of messages, you might want to use Contended Clusters or
|
45
|
+
Co-Located Dedicated Clusters. Please ask us for more information.
|
46
|
+
|
47
|
+
USAGE
|
48
|
+
|
49
|
+
#{File.basename(__FILE__)} --help
|
50
|
+
#{File.basename(__FILE__)} <userName>
|
51
|
+
#{File.basename(__FILE__)} <userName> <companyName>
|
52
|
+
|
53
|
+
The second form assumes your companyName is the same as your
|
54
|
+
userName. This is true for ordinary users.
|
55
|
+
|
56
|
+
PARAMETERS
|
57
|
+
|
58
|
+
<userName>
|
59
|
+
|
60
|
+
The user name you log into the site with.
|
61
|
+
|
62
|
+
<companyName>
|
63
|
+
|
64
|
+
For ordinary users, this is the same as your userName. If you're
|
65
|
+
not sure of your companyName, you can retrieve it with:
|
66
|
+
|
67
|
+
stormmq-list-companies <userName>
|
68
|
+
|
69
|
+
--help, -h
|
70
|
+
|
71
|
+
Displays this help page then quits.
|
72
|
+
|
73
|
+
RESULT
|
74
|
+
|
75
|
+
Outputs a simple JSON list of strings to STDOUT.
|
76
|
+
|
77
|
+
REST API
|
78
|
+
|
79
|
+
Equivalent is GET /clusters/<companyName>.
|
80
|
+
|
81
|
+
NOTES
|
82
|
+
|
83
|
+
To find you companyName, use:
|
84
|
+
|
85
|
+
stormmq-list-companies
|
86
|
+
|
87
|
+
COPYRIGHT
|
88
|
+
|
89
|
+
Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
|
90
|
+
All rights reserved.
|
91
|
+
|
92
|
+
SELF TEST
|
93
|
+
|
94
|
+
#{self_test}
|
95
|
+
|
96
|
+
EOM
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
StormMQ::Application::ListClusters.run
|