admin-vmc-plugin 0.0.1

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/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ require "rake"
2
+
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
4
+ require "admin-vmc-plugin/version"
5
+
6
+ task :default => :spec
7
+
8
+ desc "Run specs"
9
+ task :spec => ["bundler:install", "test:spec"]
10
+
11
+ desc "Run integration tests"
12
+ task :test => ["bundler:install", "test:integration"]
13
+
14
+ task :build do
15
+ sh "gem build admin-vmc-plugin.gemspec"
16
+ end
17
+
18
+ task :install => :build do
19
+ sh "gem install --local admin-vmc-plugin-#{VMCAdmin::VERSION}.gem"
20
+ end
21
+
22
+ task :uninstall do
23
+ sh "gem uninstall admin-vmc-plugin"
24
+ end
25
+
26
+ task :reinstall => [:uninstall, :install]
27
+
28
+ task :release => :build do
29
+ sh "gem push admin-vmc-plugin-#{VMCAdmin::VERSION}.gem"
30
+ end
31
+
32
+ namespace "bundler" do
33
+ desc "Install gems"
34
+ task "install" do
35
+ sh("bundle install")
36
+ end
37
+ end
38
+
39
+ namespace "test" do
40
+ task "spec" do |t|
41
+ # nothing
42
+ end
43
+
44
+ task "integration" do |t|
45
+ sh("cd spec && bundle exec rake spec")
46
+ end
47
+ end
@@ -0,0 +1 @@
1
+ require "admin-vmc-plugin/service_auth_token"
@@ -0,0 +1,82 @@
1
+ require "vmc/cli"
2
+
3
+ module VMCAdmin
4
+ class ServiceAuthToken < VMC::CLI
5
+ desc "List service auth tokens"
6
+ group :admin
7
+ def service_auth_tokens(input)
8
+ spaced(client.service_auth_tokens) do |t|
9
+ line "#{c(t.label, :name)}:"
10
+
11
+ indented do
12
+ line "guid: #{t.guid}"
13
+ line "provider: #{t.provider}"
14
+ end
15
+ end
16
+ end
17
+
18
+
19
+ desc "Create a service auth token"
20
+ group :admin
21
+ input(:label, :argument => :optional, :desc => "Auth token label") {
22
+ ask("Label")
23
+ }
24
+ input :provider, :argument => :optional, :default => "core",
25
+ :desc => "Auth token provider"
26
+ input(:token, :desc => "Auth token value") {
27
+ ask("Token")
28
+ }
29
+ def create_service_auth_token(input)
30
+ sat = client.service_auth_token
31
+ sat.label = input[:label]
32
+ sat.provider = input[:provider]
33
+ sat.token = input[:token]
34
+
35
+ with_progress("Creating service auth token") do
36
+ sat.create!
37
+ end
38
+ end
39
+
40
+
41
+ desc "Update a service auth token"
42
+ group :admin
43
+ input(:service_auth_token, :argument => :optional,
44
+ :from_given => proc { |guid| client.service_auth_token(guid) },
45
+ :desc => "Auth token to delete") {
46
+ tokens = client.service_auth_tokens
47
+ fail "No tokens!" if tokens.empty?
48
+
49
+ ask("Which token?", :choices => tokens, :display => proc(&:label))
50
+ }
51
+ input(:token, :desc => "Auth token value") {
52
+ ask("Token")
53
+ }
54
+ def update_service_auth_token(input)
55
+ sat = input[:service_auth_token]
56
+ sat.token = input[:token]
57
+
58
+ with_progress("Updating token #{c(sat.label, :name)}") do
59
+ sat.update!
60
+ end
61
+ end
62
+
63
+
64
+ desc "Delete a service auth token"
65
+ group :admin
66
+ input(:service_auth_token, :argument => :optional,
67
+ :from_given => proc { |guid| client.service_auth_token(guid) },
68
+ :desc => "Auth token to delete") {
69
+ tokens = client.service_auth_tokens
70
+ fail "No tokens!" if tokens.empty?
71
+
72
+ ask("Which token?", :choices => tokens, :display => proc(&:label))
73
+ }
74
+ def delete_service_auth_token(input)
75
+ sat = input[:service_auth_token]
76
+
77
+ with_progress("Deleting token #{c(sat.label, :name)}") do
78
+ sat.delete!
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,3 @@
1
+ module VMCAdmin
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: admin-vmc-plugin
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Alex Suraci
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-07-26 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: cfoundry
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 15
29
+ segments:
30
+ - 0
31
+ - 3
32
+ - 14
33
+ version: 0.3.14
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description:
37
+ email:
38
+ - asuraci@vmware.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - Rakefile
47
+ - lib/admin-vmc-plugin/plugin.rb
48
+ - lib/admin-vmc-plugin/service_auth_token.rb
49
+ - lib/admin-vmc-plugin/version.rb
50
+ homepage: http://cloudfoundry.com/
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project: admin-vmc-plugin
79
+ rubygems_version: 1.8.23
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Cloud Foundry administration commands.
83
+ test_files: []
84
+