mystro-client 0.1.0 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,8 +1,24 @@
1
1
  # Changelog
2
2
 
3
- ## v0.1.0.rc3:
3
+ ## v0.2.0:
4
+ * fixes for new mystro version
5
+ * orgs
6
+ * initial release
7
+ * update ruby version
8
+ * ruby version file
4
9
  * add cssh support for linux users
5
10
 
6
11
  ## v0.1.0.rc2:
12
+ * add cssh support for linux users
13
+
14
+ ## v0.1.0.rc3:
15
+ * add cssh support for linux users
16
+ * fix mystro-common dependency
17
+
18
+ ## v0.1.0.rc1:
19
+ * initial release
20
+ * update ruby version
21
+ * ruby version file
22
+ * add cssh support for linux users
7
23
  * fix mystro-common dependency
8
24
 
data/bin/mystro CHANGED
@@ -9,17 +9,17 @@ require 'mystro/client'
9
9
 
10
10
  name = File.basename(__FILE__)
11
11
 
12
- def get_client(klass, account=nil)
12
+ def get_client(klass, organization=nil)
13
13
  s = Mystro.config.server
14
- a = account || Mystro.config.default_account
14
+ a = organization || Mystro.config.default_organization
15
15
  t = Mystro.config.token
16
- #Mystro::Log.debug "server: '#{s}' account: '#{a}' token: '#{t}'"
16
+ #Mystro::Log.debug "server: '#{s}' organization: '#{a}' token: '#{t}'"
17
17
  Mystro::Client.new(klass, s, a, t)
18
18
  end
19
19
 
20
20
  module Mystro
21
21
  class Command < Clamp::Command
22
- option %w{-x --account}, "ACCOUNT", "the account to filter with", default: nil, environment_variable: "MYSTRO_ACCOUNT"
22
+ option %w{-x --organization}, "ORGANIZATION", "the organization to filter with", default: nil, environment_variable: "MYSTRO_ORGANIZATION"
23
23
  option %w{-d --debug}, :flag, "turn on debugging", default: false do |v|
24
24
  Mystro::Log.console_debug
25
25
  end
@@ -32,7 +32,7 @@ module Mystro
32
32
  parameter "PATTERN ...", "name or pattern of server"
33
33
 
34
34
  def execute
35
- client = get_client(:compute, account)
35
+ client = get_client(:compute, organization)
36
36
  list = client.search(pattern_list.join(","))
37
37
 
38
38
  raise "no servers matched" if list.count == 0
@@ -53,7 +53,7 @@ module Mystro
53
53
  parameter "PATTERN ...", "name or pattern of servers"
54
54
 
55
55
  def execute
56
- client = get_client(:compute, account)
56
+ client = get_client(:compute, organization)
57
57
  list = client.search(pattern_list.join(","))
58
58
  puts "servers found: #{list.map{|e| e["name"]}.join(", ")}"
59
59
  cmd = "csshx --login #{user} #{list.map {|e| e["long"]||e["dns"]}.join(" ")}"
@@ -67,7 +67,7 @@ module Mystro
67
67
  parameter "PATTERN ...", "name or pattern of servers"
68
68
 
69
69
  def execute
70
- client = get_client(:compute, account)
70
+ client = get_client(:compute, organization)
71
71
  list = client.search(pattern_list.join(","))
72
72
  puts "servers found: #{list.map{|e| e["name"]}.join(", ")}"
73
73
  cmd = "cssh --username #{user} #{"--options #{options}" if options} #{list.map {|e| e["long"]||e["dns"]}.join(" ")}"
@@ -81,9 +81,9 @@ module Mystro
81
81
  subcommand "list", "list computes" do
82
82
  option %w{-a --all}, :flag, "show private ip information", default: false
83
83
  def execute
84
- client = get_client(:compute, account)
84
+ client = get_client(:compute, organization)
85
85
  list = client.list
86
- keys = %w{Account Environment Name Roles IP DNS}
86
+ keys = %w{Organization Environment Name Roles IP DNS}
87
87
  if all?
88
88
  keys << 'private_ip'
89
89
  keys << 'private_dns'
@@ -95,9 +95,9 @@ module Mystro
95
95
  parameter "[PATTERN] ...", "show only matching this pattern"
96
96
  option %w{-a --all}, :flag, "show private ip information", default: false
97
97
  def execute
98
- client = get_client(:compute, account)
98
+ client = get_client(:compute, organization)
99
99
  list = client.search(pattern_list.join(","))
100
- keys = %w{Account Environment Name Roles IP DNS}
100
+ keys = %w{Organization Environment Name Roles IP DNS}
101
101
  if all?
102
102
  keys << 'private_ip'
103
103
  keys << 'private_dns'
@@ -111,19 +111,19 @@ module Mystro
111
111
  self.default_subcommand = "list"
112
112
  subcommand "list", "list balancers" do
113
113
  def execute
114
- client = get_client(:balancer, account)
114
+ client = get_client(:balancer, organization)
115
115
  list = client.list
116
- Mystro::Log.warn Mystro::CLI.list(%{Account Name}, list)
116
+ Mystro::Log.warn Mystro::CLI.list(%{Organization Name}, list)
117
117
  end
118
118
  end
119
119
  end
120
120
 
121
- subcommand "account", "manage accounts" do
121
+ subcommand "organization", "manage organizations" do
122
122
  self.default_subcommand = "list"
123
- subcommand "list", "list accounts" do
123
+ subcommand "list", "list organizations" do
124
124
  def execute
125
125
  ap Mystro.config.to_hash
126
- client = get_client(:account, account)
126
+ client = get_client(:organization, organization)
127
127
  list = client.list
128
128
  Mystro::Log.warn Mystro::CLI.list(%w{Name Enabled File}, list)
129
129
  end
@@ -135,7 +135,7 @@ module Mystro
135
135
  subcommand "list", "list templates" do
136
136
  def execute
137
137
  ap Mystro.config.to_hash
138
- client = get_client(:template, account)
138
+ client = get_client(:template, organization)
139
139
  list = client.list
140
140
  Mystro::Log.warn Mystro::CLI.list(%w{Name Enabled File}, list)
141
141
  end
@@ -146,7 +146,7 @@ module Mystro
146
146
  self.default_subcommand = "list"
147
147
  subcommand "list", "list environments" do
148
148
  def execute
149
- client = get_client(:environment, account)
149
+ client = get_client(:environment, organization)
150
150
  list = client.list
151
151
  Mystro::Log.warn Mystro::CLI.list(%w{Deleting Name Template Computes Balancers}, list)
152
152
  end
@@ -155,7 +155,7 @@ module Mystro
155
155
  subcommand "show", "show environment" do
156
156
  parameter "name", "id or name of environment"
157
157
  def execute
158
- client = get_client(:environment, account)
158
+ client = get_client(:environment, organization)
159
159
  response = client.show(name)
160
160
  Mystro::Log.warn Mystro::CLI.show(response) if response && response.count > 0
161
161
  end
@@ -164,7 +164,7 @@ module Mystro
164
164
  subcommand "destroy", "destroy environment" do
165
165
  parameter "name", "id or name of environment"
166
166
  def execute
167
- client = get_client(:environment, account)
167
+ client = get_client(:environment, organization)
168
168
  env = client.show(name)
169
169
  raise "environment not found" unless env["id"]
170
170
  response = client.destroy(env["id"])
@@ -180,7 +180,7 @@ module Mystro
180
180
  option %w{-p --protected}, :flag, "set protected flag on environment", default: false
181
181
 
182
182
  def execute
183
- client = get_client(:environment, account)
183
+ client = get_client(:environment, organization)
184
184
  response = client.create(name, template, protected?)
185
185
  if response && response.count > 0
186
186
  Mystro::Log.warn Mystro::CLI.show(response)
@@ -1,8 +1,8 @@
1
1
  module Mystro
2
2
  module Client
3
- class Account < Base
3
+ class Organization < Base
4
4
  def list
5
- api_get("accounts")
5
+ api_get("organizations")
6
6
  end
7
7
  end
8
8
  end
@@ -3,7 +3,7 @@ unless defined?(Mystro::Client::Version)
3
3
  module Client
4
4
  module Version
5
5
  MAJOR = 0
6
- MINOR = 1
6
+ MINOR = 2
7
7
  TINY = 0
8
8
  TAG = nil
9
9
  STRING = [MAJOR, MINOR, TINY, TAG].compact.join('.')
data/lib/mystro/client.rb CHANGED
@@ -8,9 +8,9 @@ require "mystro/client/cli"
8
8
  module Mystro
9
9
  module Client
10
10
  class << self
11
- def new(klass, server, account, token=nil)
11
+ def new(klass, server, organization, token=nil)
12
12
  k = "Mystro::Client::#{klass.to_s.capitalize}".constantize
13
- k.new(server,account,token)
13
+ k.new(server,organization,token)
14
14
  rescue => e
15
15
  Mystro::Log.error "class #{klass} not found or error instantiating"
16
16
  Mystro::Log.debug e
@@ -21,10 +21,10 @@ module Mystro
21
21
  class Base
22
22
  include HTTParty
23
23
 
24
- def initialize(server, account, token=nil)
24
+ def initialize(server, organization, token=nil)
25
25
  @server = server
26
26
  @token = token
27
- @account = account
27
+ @organization = organization
28
28
  end
29
29
 
30
30
  private
@@ -50,9 +50,9 @@ module Mystro
50
50
  end
51
51
 
52
52
  def api_call(m, u, data={}, headers={})
53
- raise "account must be set" unless @account
53
+ raise "organization must be set" unless @organization
54
54
  method = m.to_sym
55
- url = url("api/accounts/#@account/#{u}")
55
+ url = url("api/organizations/#@organization/#{u}")
56
56
 
57
57
  Mystro::Log.debug "<= #{url}"
58
58
  Mystro::Log.debug "=> #{data}" if data && data.count > 0
@@ -83,4 +83,4 @@ end
83
83
  require "mystro/client/compute"
84
84
  require "mystro/client/environment"
85
85
  require "mystro/client/template"
86
- require "mystro/client/account"
86
+ require "mystro/client/organization"
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency "mystro-common"
21
- gem.add_dependency "httparty" # talk to server's json api
22
- gem.add_dependency "clamp"
23
- gem.add_dependency "terminal-table"
20
+ gem.add_dependency 'mystro-common', '~> 0.2.0'
21
+ gem.add_dependency 'httparty' # talk to server's json api
22
+ gem.add_dependency 'clamp'
23
+ gem.add_dependency 'terminal-table'
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mystro-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-24 00:00:00.000000000 Z
12
+ date: 2013-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mystro-common
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 0.2.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: httparty
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -93,10 +93,10 @@ files:
93
93
  - bin/mystro
94
94
  - lib/mystro-client.rb
95
95
  - lib/mystro/client.rb
96
- - lib/mystro/client/account.rb
97
96
  - lib/mystro/client/cli.rb
98
97
  - lib/mystro/client/compute.rb
99
98
  - lib/mystro/client/environment.rb
99
+ - lib/mystro/client/organization.rb
100
100
  - lib/mystro/client/template.rb
101
101
  - lib/mystro/client/version.rb
102
102
  - mystro-client.gemspec