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.
@@ -0,0 +1,89 @@
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::ListCompanies < 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).companies)
26
+ end
27
+
28
+ def man
29
+ <<-EOM
30
+ NAME
31
+
32
+ #{File.basename(__FILE__)}
33
+
34
+ PURPOSE
35
+
36
+ Lists the names of all the companies you belong to. Ordinary users
37
+ belong to only one company. For ordinary users, your userName is
38
+ the same as your companyName. For example, if you signed up as
39
+ 'bob', then your userName is bob and your company is bob.
40
+
41
+ USAGE
42
+
43
+ #{File.basename(__FILE__)} --help
44
+ #{File.basename(__FILE__)} <userName>
45
+
46
+ PARAMETERS
47
+
48
+ <userName>
49
+
50
+ The user name you log into the site with. When provided, lists
51
+ the companies associated with that user name.
52
+
53
+ Note:
54
+
55
+ --help, -h
56
+
57
+ Displays this help page then quits.
58
+
59
+ RESULT
60
+
61
+ Outputs a simple JSON list of strings to STDOUT.
62
+
63
+ REST API
64
+
65
+ Equivalent is 'GET /companies/'.
66
+
67
+ NOTES
68
+
69
+ Use #{File.basename(__FILE__)} to find your companyName for
70
+ use with the other tools.
71
+
72
+ Security prevents you from obtaining information about which other
73
+ users belong to which companies.
74
+
75
+ COPYRIGHT
76
+
77
+ Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
78
+ All rights reserved.
79
+
80
+ SELF TEST
81
+
82
+ #{self_test}
83
+
84
+ EOM
85
+ end
86
+
87
+ end
88
+
89
+ StormMQ::Application::ListCompanies.run
@@ -0,0 +1,131 @@
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::ListExchanges < 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).exchanges(@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 exchanges and their state for an
37
+ Environment.
38
+
39
+ USAGE
40
+
41
+ #{File.basename(__FILE__)} --help
42
+ #{File.basename(__FILE__)} <userName> <systemName> <companyName> <environmentName>
43
+
44
+ For ordinary users, your companyName is the same as your userName.
45
+
46
+ For recently signed up users, the systemName is the same as your
47
+ userName.
48
+
49
+ For recently signed up users, the environmentName is one of:
50
+
51
+ * development
52
+ * testing
53
+ * production
54
+
55
+ PARAMETERS
56
+
57
+ <userName>
58
+
59
+ The user name you log into the site with.
60
+
61
+ <systemName>
62
+
63
+ If you're not sure if you've already created a system, use:
64
+
65
+ stormmq-list-systems <userName>
66
+
67
+ A systemName can not contain a '/' or ':'
68
+
69
+ <companyName>
70
+
71
+ For ordinary users, this is the same as your userName.
72
+ If you're not sure of your companyName, you can retrieve it with:
73
+
74
+ stormmq-list-companies <userName>
75
+
76
+ <environmentName>
77
+
78
+ One of:
79
+
80
+ * development
81
+ * testing
82
+ * production
83
+
84
+ For the default system created when you signed up, or for any
85
+ system created by stormmq-create-system <userName>
86
+ (except advanced use).
87
+
88
+ --help, -h
89
+
90
+ Displays this help page then quits.
91
+
92
+ RESULT
93
+
94
+ Outputs a pretty-printed complex JSON list to STDOUT.
95
+
96
+ REST API
97
+
98
+ Equivalent is GET /companies/<companyName>/<systemName>/<environmentName>/exchanges/.
99
+
100
+ NOTES
101
+
102
+ Output is not JSON, so not suitable for use with XHTML, etc, response documents.
103
+
104
+ To find you companyName, use:
105
+
106
+ stormmq-list-companies
107
+
108
+ To delete your default system, use:
109
+
110
+ stormmq-delete-system <userName>
111
+
112
+ To create a new system, use:
113
+
114
+ stormmq-create-system <userName> <systemName>
115
+
116
+ COPYRIGHT
117
+
118
+ Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
119
+ All rights reserved.
120
+
121
+ SELF TEST
122
+
123
+ #{self_test}
124
+
125
+ EOM
126
+ end
127
+
128
+
129
+ end
130
+
131
+ StormMQ::Application::ListExchanges.run
@@ -0,0 +1,131 @@
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::ListQueues < 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).queues(@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 queues and their state for an
37
+ Environment.
38
+
39
+ USAGE
40
+
41
+ #{File.basename(__FILE__)} --help
42
+ #{File.basename(__FILE__)} <userName> <systemName> <companyName> <environmentName>
43
+
44
+ For ordinary users, your companyName is the same as your userName.
45
+
46
+ For recently signed up users, the systemName is the same as your
47
+ userName.
48
+
49
+ For recently signed up users, the environmentName is one of:
50
+
51
+ * development
52
+ * testing
53
+ * production
54
+
55
+ PARAMETERS
56
+
57
+ <userName>
58
+
59
+ The user name you log into the site with.
60
+
61
+ <systemName>
62
+
63
+ If you're not sure if you've already created a system, use:
64
+
65
+ stormmq-list-systems <userName>
66
+
67
+ A systemName can not contain a '/' or ':'
68
+
69
+ <companyName>
70
+
71
+ For ordinary users, this is the same as your userName.
72
+ If you're not sure of your companyName, you can retrieve it with:
73
+
74
+ stormmq-list-companies <userName>
75
+
76
+ <environmentName>
77
+
78
+ One of:
79
+
80
+ * development
81
+ * testing
82
+ * production
83
+
84
+ For the default system created when you signed up, or for any
85
+ system created by stormmq-create-system <userName>
86
+ (except advanced use).
87
+
88
+ --help, -h
89
+
90
+ Displays this help page then quits.
91
+
92
+ RESULT
93
+
94
+ Outputs a pretty-printed complex JSON list to STDOUT.
95
+
96
+ REST API
97
+
98
+ Equivalent is GET /companies/<companyName>/<systemName>/<environmentName>/queues/.
99
+
100
+ NOTES
101
+
102
+ Output is not JSON, so not suitable for use with XHTML, etc, response documents.
103
+
104
+ To find you companyName, use:
105
+
106
+ stormmq-list-companies
107
+
108
+ To delete your default system, use:
109
+
110
+ stormmq-delete-system <userName>
111
+
112
+ To create a new system, use:
113
+
114
+ stormmq-create-system <userName> <systemName>
115
+
116
+ COPYRIGHT
117
+
118
+ Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
119
+ All rights reserved.
120
+
121
+ SELF TEST
122
+
123
+ #{self_test}
124
+
125
+ EOM
126
+ end
127
+
128
+
129
+ end
130
+
131
+ StormMQ::Application::ListQueues.run
@@ -0,0 +1,111 @@
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::ListSystems < StormMQ::Application
17
+
18
+ def initialize
19
+ synopsis "--help | <userName> | <userName> <companyName>"
20
+ options :help
21
+ expected_args [1,2]
22
+ end
23
+
24
+ def main
25
+ user = argv[0]
26
+ company = argv[1] || user
27
+ puts JSON.pretty_generate(self.rest_client(user).systems(company))
28
+ end
29
+
30
+ def man
31
+ <<-EOM
32
+ NAME
33
+
34
+ #{File.basename(__FILE__)}
35
+
36
+ PURPOSE
37
+
38
+ Lists the names of all the systems you've created in our Messaging
39
+ Cloud. A system is a logical view of resources. When you activate
40
+ your account, we'll create a default system for you, named the same
41
+ as your userName (we were going to call it default, but we worried
42
+ that'd be too easy to guess). Typically you'd only need one system,
43
+ e.g. 'AccountRocks', 'InflationSwapCalculator', 'Jibbit-X', etc.
44
+ A system has environments. A system-environment pair matches an
45
+ AMQP Virtual Host.
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, once you activated your account, we created a
65
+ system with the same name as your userName. If you're not sure of
66
+ any systems you've subsequently created you can retrieve them with:
67
+
68
+ stormmq-list-systems <userName>
69
+
70
+ --help, -h
71
+
72
+ Displays this help page then quits.
73
+
74
+ RESULT
75
+
76
+ Outputs a simple JSON list of strings to STDOUT.
77
+
78
+ REST API
79
+
80
+ Equivalent is GET /companies/<companyName>/.
81
+
82
+ NOTES
83
+
84
+ To find you companyName, use:
85
+
86
+ stormmq-list-companies
87
+
88
+ To delete your default system, use:
89
+
90
+ stormmq-delete-system <userName>
91
+
92
+ To create a new system, use:
93
+
94
+ stormmq-create-system <userName> <systemName>
95
+
96
+ COPYRIGHT
97
+
98
+ Copyright (c) 2010, Tony Byrne & StormMQ Ltd.
99
+ All rights reserved.
100
+
101
+ SELF TEST
102
+
103
+ #{self_test}
104
+
105
+ EOM
106
+ end
107
+
108
+
109
+ end
110
+
111
+ StormMQ::Application::ListSystems.run