dtk-client 0.11.7 → 0.11.8

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/dtk-client.gemspec +2 -2
  4. data/lib/cli/command/account/add_to_group.rb +33 -0
  5. data/lib/cli/command/account/chmod.rb +33 -0
  6. data/lib/cli/command/account/create_namespace.rb +32 -0
  7. data/lib/cli/command/account/delete_namespace.rb +32 -0
  8. data/lib/cli/command/account/list_namespaces.rb +30 -0
  9. data/lib/cli/command/account/remove_from_group.rb +33 -0
  10. data/lib/cli/command/account.rb +14 -1
  11. data/lib/cli/command/module/delete_from_remote.rb +5 -3
  12. data/lib/cli/command/module/install.rb +242 -102
  13. data/lib/cli/command/module/list_remotes.rb +1 -1
  14. data/lib/cli/command/module/publish.rb +3 -2
  15. data/lib/cli/command/module/pull_dtkn.rb +2 -2
  16. data/lib/cli/command/module/push.rb +2 -1
  17. data/lib/cli/command/module/push_dtkn.rb +3 -2
  18. data/lib/cli/command/module/unpublish.rb +42 -0
  19. data/lib/cli/command/module/update.rb +33 -0
  20. data/lib/cli/command/module.rb +3 -1
  21. data/lib/cli/command/token.rb +9 -3
  22. data/lib/cli/context.rb +7 -5
  23. data/lib/cli/directory_parser/file_system.rb +76 -36
  24. data/lib/cli/processor/plugin/gli.rb +2 -0
  25. data/lib/cli/version.rb +1 -1
  26. data/lib/client/error/subclasses.rb +12 -0
  27. data/lib/client/git_repo/adapter/git_gem.rb +3 -1
  28. data/lib/client/operation/account/add_to_group.rb +29 -0
  29. data/lib/client/operation/account/chmod.rb +29 -0
  30. data/lib/client/operation/account/create_namespace.rb +29 -0
  31. data/lib/client/operation/account/delete_namespace.rb +29 -0
  32. data/lib/client/operation/account/list_namespaces.rb +29 -0
  33. data/lib/client/operation/account/remove_from_group.rb +29 -0
  34. data/lib/client/operation/account.rb +14 -1
  35. data/lib/client/operation/client_module_dir/git_repo/internal.rb +4 -22
  36. data/lib/client/operation/client_module_dir/git_repo.rb +5 -6
  37. data/lib/client/operation/client_module_dir/service_instance/internal/module_info.rb +67 -0
  38. data/lib/client/operation/client_module_dir/service_instance/internal.rb +106 -0
  39. data/lib/client/operation/client_module_dir/service_instance.rb +30 -0
  40. data/lib/client/operation/client_module_dir.rb +5 -0
  41. data/lib/client/operation/module/clone_module.rb +2 -2
  42. data/lib/client/operation/module/delete_from_remote.rb +7 -31
  43. data/lib/client/operation/module/install/dependent_modules/component_module.rb +1 -2
  44. data/lib/client/operation/module/install/dependent_modules/local_dependencies.rb +1 -1
  45. data/lib/client/operation/module/install/print_helper.rb +1 -1
  46. data/lib/client/operation/module/install.rb +25 -19
  47. data/lib/client/operation/module/install_from_catalog.rb +15 -29
  48. data/lib/client/operation/module/list_remotes.rb +4 -11
  49. data/lib/client/operation/module/publish.rb +17 -31
  50. data/lib/client/operation/module/pull_dtkn.rb +37 -28
  51. data/lib/client/operation/module/push.rb +69 -5
  52. data/lib/client/operation/module/push_dtkn.rb +25 -13
  53. data/lib/client/operation/module/stage.rb +3 -3
  54. data/lib/client/operation/module/unpublish.rb +60 -0
  55. data/lib/client/operation/module/update.rb +59 -0
  56. data/lib/client/operation/module.rb +23 -9
  57. data/lib/client/operation/service/clone_service.rb +3 -0
  58. data/lib/client/operation.rb +7 -0
  59. metadata +38 -5
@@ -25,7 +25,7 @@ module DTK::Client
25
25
  arg = {}
26
26
  unless options[:n].nil?
27
27
  arg = {
28
- :module_namespace => options[:n]
28
+ :namespace => options[:n]
29
29
  }
30
30
  end
31
31
 
@@ -19,11 +19,12 @@ module DTK::Client
19
19
  module CLI::Command
20
20
  module Module
21
21
  subcommand_def 'publish' do |c|
22
- command_body c, 'publish', 'Publish module installed on server to the repo manager' do |sc|
22
+ command_body c, 'publish', 'Publish module installed on server to the dtk network' do |sc|
23
23
  sc.flag Token.directory_path, :desc => 'Absolute or relative path to module directory containing updates to publish; not need if in the module directory'
24
+ sc.switch Token.update_lock
24
25
  sc.action do |_global_options, options, _args|
25
26
  module_ref = module_ref_object_from_options_or_context(options)
26
- Operation::Module.publish(:module_ref => module_ref, :directory_path => options[:directory_path])
27
+ Operation::Module.publish(:module_ref => module_ref, update_lock_file: options['update-lock'], :directory_path => options[:directory_path], :base_dsl_file_obj => @base_dsl_file_obj)
27
28
  end
28
29
  end
29
30
  end
@@ -19,7 +19,7 @@ module DTK::Client
19
19
  module CLI::Command
20
20
  module Module
21
21
  subcommand_def 'pull-dtkn' do |c|
22
- command_body c, 'pull-dtkn', 'Pull content from repo manager to client module directory and push to server' do |sc|
22
+ command_body c, 'pull-dtkn', 'Pull content from dtk network to client module directory and push to server' do |sc|
23
23
  sc.flag Token.directory_path, :desc => 'Absolute or relative path to module directory containing content to update; not need if in the module directory'
24
24
  sc.switch Token.force
25
25
  sc.switch Token.update_deps
@@ -35,7 +35,7 @@ module DTK::Client
35
35
  :update_deps => options[:update_deps]
36
36
  }
37
37
  Operation::Module.pull_dtkn(operation_args)
38
- Operation::Module.push(operation_args.merge(:method => "pulled"))
38
+ # Operation::Module.push(operation_args.merge(:method => "pulled"))
39
39
  end
40
40
  end
41
41
  end
@@ -21,9 +21,10 @@ module DTK::Client
21
21
  subcommand_def 'push' do |c|
22
22
  command_body c, :push, 'Push content from client module directory to server' do |sc|
23
23
  sc.flag Token.directory_path, :desc => 'Absolute or relative path to module directory containing updates to push; not need if in the module directory'
24
+ sc.switch Token.update_lock
24
25
  sc.action do |_global_options, options, _args|
25
26
  module_ref = module_ref_object_from_options_or_context(options)
26
- Operation::Module.push(:module_ref => module_ref, :base_dsl_file_obj => @base_dsl_file_obj)
27
+ Operation::Module.push(module_ref: module_ref, update_lock_file: options['update-lock'], base_dsl_file_obj: @base_dsl_file_obj, context: self)
27
28
  end
28
29
  end
29
30
  end
@@ -19,11 +19,12 @@ module DTK::Client
19
19
  module CLI::Command
20
20
  module Module
21
21
  subcommand_def 'push-dtkn' do |c|
22
- command_body c, 'push-dtkn', 'Push content from client module directory to repo manager' do |sc|
22
+ command_body c, 'push-dtkn', 'Push content from client module directory to dtk network' do |sc|
23
23
  sc.flag Token.directory_path, :desc => 'Absolute or relative path to module directory containing updates to push; not need if in the module directory'
24
+ sc.switch Token.update_lock
24
25
  sc.action do |_global_options, options, _args|
25
26
  module_ref = module_ref_object_from_options_or_context(options)
26
- Operation::Module.push_dtkn(:module_ref => module_ref, :base_dsl_file_obj => @base_dsl_file_obj, :directory_path => options[:directory_path])
27
+ Operation::Module.push_dtkn(:module_ref => module_ref, :base_dsl_file_obj => @base_dsl_file_obj, :directory_path => options[:directory_path], update_lock_file: options['update-lock'])
27
28
  end
28
29
  end
29
30
  end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ module CLI::Command
20
+ module Module
21
+ subcommand_def 'unpublish' do |c|
22
+ c.arg Token::Arg.module_name
23
+ command_body c, 'unpublish', 'Unpublish module version from the DTK remote catalog (DTKN)' do |sc|
24
+ sc.flag Token.version
25
+ sc.switch Token.skip_prompt
26
+ sc.switch Token.force, :desc => 'Force delete'
27
+
28
+ sc.action do |_global_options, options, args|
29
+ module_ref = module_ref_object_from_options_or_context?(:module_ref => args[0], :version => options[:version])
30
+ operation_args = {
31
+ :module_ref => module_ref,
32
+ :skip_prompt => options[:skip_prompt],
33
+ :force => options[:f]
34
+ }
35
+ Operation::Module.unpublish(operation_args)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+
@@ -0,0 +1,33 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ module CLI::Command
20
+ module Module
21
+ subcommand_def 'update' do |c|
22
+ command_body c, 'update', 'Update module dependencies to the latest available on dtk network' do |sc|
23
+ sc.flag Token.directory_path, :desc => 'Absolute or relative path to module directory containing updates to publish; not need if in the module directory'
24
+ sc.action do |_global_options, options, _args|
25
+ module_ref = module_ref_object_from_options_or_context(options)
26
+ Operation::Module.update(:module_ref => module_ref, :directory_path => options[:directory_path], :base_dsl_file_obj => @base_dsl_file_obj)
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -32,7 +32,9 @@ module DTK::Client
32
32
  'push',
33
33
  'push-dtkn',
34
34
  'stage',
35
- 'uninstall'
35
+ 'uninstall',
36
+ 'unpublish'
37
+ # 'update'
36
38
  ]
37
39
 
38
40
  command_def :desc => 'Subcommands for interacting with DTK modules'
@@ -57,7 +57,7 @@ module DTK::Client
57
57
  # Switch constructor args order: key, desc, opts={}
58
58
  :all => Switch.new(:all, 'All'),
59
59
  :base => Switch.new(:base, 'Create base service instance'),
60
- :breakpoint => Switch.new([:b, :breakpoint], 'Add breakpoint'),
60
+ :breakpoint => Switch.new([:b, :breakpoint], 'Add breakpoint'),
61
61
  :delete => Switch.new(:delete, 'Delete'),
62
62
  :force => Switch.new([:f, :force], 'Force'),
63
63
  :purge => Switch.new(:purge, 'Purge'),
@@ -69,7 +69,9 @@ module DTK::Client
69
69
  :dependencies => Switch.new(:deps, 'Dependencies'),
70
70
  :u => Switch.new([:u, :unset], 'Unset attribute'),
71
71
  :recursive => Switch.new(:r, 'Recursive'),
72
- :update_deps => Switch.new('update-deps', "Skip prompt and update all dependencies or skip prompt and don't update all dependencies (on master)", :negatable => true, :default_value => 'prompt')
72
+ :update_deps => Switch.new('update-deps', "Skip prompt and update all dependencies or skip prompt and don't update all dependencies (on master)", :negatable => true, :default_value => 'prompt'),
73
+ :skip_server => Switch.new('skip-server', 'Do not install module on server'),
74
+ :update_lock => Switch.new([:u, 'update-lock'], 'Update lock file with new dependencies')
73
75
  }
74
76
 
75
77
  ARG_TOKENS = {
@@ -90,7 +92,11 @@ module DTK::Client
90
92
  :base_cmp => 'BASE-COMPONENT',
91
93
  :deps_on_cmp => 'DEPENDS-ON-COMPONENT',
92
94
  :service => 'SERVICE',
93
- :service_name => 'SERVICE-NAME'
95
+ :service_name => 'SERVICE-NAME',
96
+ :namespace => 'NAMESPACE',
97
+ :user => 'USER',
98
+ :permissions => 'PERMISSIONS',
99
+ :group => 'GROUP',
94
100
  }
95
101
 
96
102
  end
data/lib/cli/context.rb CHANGED
@@ -58,9 +58,15 @@ module DTK::Client
58
58
  end
59
59
  end
60
60
 
61
+ def module_ref_object_from_options_or_context(options, module_refs_opts = {})
62
+ module_ref_object_from_options_or_context?(options, module_refs_opts) || raise_error_when_missing_context(:module_ref, options)
63
+ end
64
+
65
+ attr_reader :base_dsl_file_obj
66
+
61
67
  private
62
68
 
63
- attr_reader :context_attributes, :base_dsl_file_obj
69
+ attr_reader :context_attributes
64
70
 
65
71
  def module_ref_from_base_dsl_file?
66
72
  parsed_module_hash = parse_module_content_and_create_hash
@@ -161,10 +167,6 @@ module DTK::Client
161
167
  ::DTK::DSL::FileType::ServiceInstance::DSLFile::Top
162
168
  ]
163
169
 
164
- def module_ref_object_from_options_or_context(options, module_refs_opts = {})
165
- module_ref_object_from_options_or_context?(options, module_refs_opts) || raise_error_when_missing_context(:module_ref, options)
166
- end
167
-
168
170
  def module_ref_object_from_options_or_context?(options, module_refs_opts = {})
169
171
  # using :ignore_parsing_errors to ret namespace, name and version from .yaml file even if there are parsing errors
170
172
  @options.merge!(:ignore_parsing_errors => module_refs_opts[:ignore_parsing_errors])
@@ -26,10 +26,7 @@ module DTK::Client; module CLI
26
26
  # :dir_path - string
27
27
  # Returns FileObj object or nil that match a file_type
28
28
  def matching_file_obj?(file_types, opts = {})
29
- ret = nil
30
- file_types = [file_types] unless file_types.kind_of?(Array)
31
-
32
- file_type, file_path = matching_type_and_path?(file_types, opts)
29
+ file_type, file_path = matching_type_and_path?(Array(file_types), opts)
33
30
  file_obj_opts = {
34
31
  dir_path: opts[:dir_path],
35
32
  current_dir: OsUtil.current_dir,
@@ -48,53 +45,52 @@ module DTK::Client; module CLI
48
45
  # opts can have keys:
49
46
  # :dir_path
50
47
  # :file_path
48
+ # :flag
51
49
  # returns nil or [file_type, path]
52
50
  def matching_type_and_path?(file_types, opts = {})
53
- ret = nil
54
- flag = opts[:flag]
55
- if path = opts[:file_path]
56
- file_types.each do | file_type |
57
- if file_type.matches?(path)
58
- return [file_type, path]
59
- end
51
+ matches =
52
+ if path = opts[:file_path]
53
+ file_types.map { | file_type | file_type.matches?(path) && [file_type, path] }.compact
54
+ else
55
+ base_dir = OsUtil.home_dir
56
+ current_dir = opts[:dir_path] || OsUtil.current_dir
57
+ most_nested_matching_types_and_paths(file_types, current_dir, base_dir, flag: opts[:flag])
60
58
  end
59
+
60
+ case matches.size
61
+ when 0
62
+ nil
63
+ when 1
64
+ matches.first
61
65
  else
62
- file_types.each do | file_type |
63
- if path = most_nested_matching_file_path?(file_type, flag, :current_dir => opts[:dir_path])
64
- return [file_type, path]
65
- end
66
- end
66
+ MultipleMatches.resolve(matches)
67
67
  end
68
- ret
69
68
  end
70
69
 
71
- # return either a string file path or of match to file_type working from current directory and 'outwards'
72
- # until base_path in file_type (if it exists)
73
70
  # opts can have keys
74
- # :current_dir if set means start from this dir; otherwise start from computed current dir
75
- def most_nested_matching_file_path?(file_type, flag, opts = {})
76
- base_dir = file_type.base_dir || OsUtil.home_dir
77
- current_dir = opts[:current_dir] || OsUtil.current_dir
78
- check_match_recurse_on_failure?(file_type, current_dir, base_dir, flag)
79
- end
71
+ # :flag
72
+ def most_nested_matching_types_and_paths(file_types, current_dir, base_dir, opts = {})
73
+ # matches will be an array of [file_type, path]
74
+ matches = []
75
+ file_types.each do |file_type|
76
+ matching_file_paths(current_dir, file_type).each { |path| matches << [file_type, path] }
77
+ end
78
+
79
+ return matches unless matches.empty?
80
80
 
81
- def check_match_recurse_on_failure?(file_type, current_dir, base_dir, flag)
82
- match = matching_file_paths(current_dir, file_type)
83
- if match.empty?
84
- unless current_dir == base_dir
85
- if parent_path = OsUtil.parent_dir?(current_dir)
86
- check_match_recurse_on_failure?(file_type, parent_path, base_dir, flag) unless flag
87
- end
81
+ next_level_matches = []
82
+ unless current_dir == base_dir or opts[:flag]
83
+ if parent_path = OsUtil.parent_dir?(current_dir)
84
+ next_level_matches = most_nested_matching_types_and_paths(file_types, parent_path, base_dir, opts)
88
85
  end
89
- elsif match.size == 1
90
- match.first
91
- else
92
- raise Error, "Unexpected that more than one match: #{match.join(', ')}"
93
86
  end
87
+ next_level_matches
94
88
  end
95
89
 
90
+
96
91
  # returns an array of strings that are file paths; except bakup files (e.g. bak.dtk.service.yaml)
97
92
  def matching_file_paths(dir_path, path_info)
93
+ return [] if File.exist?("#{dir_path}/.nested_module")
98
94
  Dir.glob("#{dir_path}/*").select { |file_path| File.file?(file_path) and !is_backup_file?(file_path) and path_info.matches?(file_path) }
99
95
  end
100
96
 
@@ -102,6 +98,50 @@ module DTK::Client; module CLI
102
98
  regex = Regexp.new("\.bak\.dtk\.(service|module)\.(yml|yaml)$")
103
99
  file_path =~ regex
104
100
  end
101
+
102
+ module MultipleMatches
103
+ def self.resolve(matches)
104
+ # first try to make decission based on user's input e.g. 'dtk module ...' or 'dtk service ...'
105
+ if input_rank = rank_based_on_input
106
+ top_match = matches.select { |match| match.first == input_rank }
107
+ return top_match.first if top_match && !top_match.empty?
108
+ end
109
+
110
+ augmented_matches = matches.map { |match| { match: match, ranking: type_ranking(match[0]) } }
111
+ not_treated_types = augmented_matches.select { |aug_match| aug_match[:ranking].nil? }
112
+ fail Error, "No ranking for types: #{not_treated_types.map { |aug_match| aug_match[:match][0] }.join(', ')}" unless not_treated_types.empty?
113
+
114
+ ndx_matches = {}
115
+ augmented_matches.each { |aug_match| (ndx_matches[aug_match[:ranking]] ||= []) << aug_match[:match] }
116
+ top_matches = ndx_matches[ndx_matches.keys.sort.first]
117
+ fail Error, "Cannot choice between types: #{top_matches.map{ |match| match[0] }.join(', ')}" if top_matches.size > 1
118
+ top_matches.first
119
+ end
120
+
121
+ def self.type_ranking(type)
122
+ ranking_for_types[type]
123
+ end
124
+
125
+ # lower is preferred
126
+ def self.ranking_for_types
127
+ @ranking_for_types ||= {
128
+ DTK::DSL::FileType::CommonModule::DSLFile::Top => 2,
129
+ DTK::DSL::FileType::ServiceInstance::DSLFile::Top => 1
130
+ }
131
+ end
132
+
133
+ def self.rank_based_on_input
134
+ input_types[ARGV.first]
135
+ end
136
+
137
+ def self.input_types
138
+ {
139
+ 'module' => DTK::DSL::FileType::CommonModule::DSLFile::Top,
140
+ 'service' => DTK::DSL::FileType::ServiceInstance::DSLFile::Top
141
+ }
142
+ end
143
+ end
144
+
105
145
  end
106
146
  end
107
147
  end; end
@@ -46,6 +46,8 @@ module DTK::Client; module CLI
46
46
  nil
47
47
  elsif err.kind_of?(Error)
48
48
  raise err
49
+ elsif err.kind_of?(DTK::Network::Client::Error)
50
+ raise Error::DtkNetwork.new(err.message, :backtrace => err.backtrace)
49
51
  else
50
52
  raise Error::Client.new(err.message, :backtrace => err.backtrace)
51
53
  end
data/lib/cli/version.rb CHANGED
@@ -18,7 +18,7 @@
18
18
  module DTK
19
19
  module Client
20
20
  module CLI
21
- VERSION="0.11.7"
21
+ VERSION="0.11.8"
22
22
  end
23
23
  end
24
24
  end
@@ -108,5 +108,17 @@ module DTK::Client
108
108
  super(msg_to_pass_to_super, :backtrace => NO_BACKTRACE)
109
109
  end
110
110
  end
111
+
112
+ class DtkNetwork < self
113
+ # opts can have keys
114
+ # :backtrace
115
+ def initialize(error_msg, opts = {})
116
+ msg_to_pass_to_super = "[DTK NETWORK ERROR] #{error_msg}"
117
+ super(msg_to_pass_to_super, opts.merge(:where => :dtk_network))
118
+ end
119
+ def self.label(*_args)
120
+ super(:dtk_network)
121
+ end
122
+ end
111
123
  end
112
124
  end
@@ -149,7 +149,9 @@ module DTK::Client
149
149
  end
150
150
 
151
151
  def untracked
152
- status.is_a?(Hash) ? status.untracked().keys : status.untracked().collect { |file| file.first }
152
+ @git_repo.lib.command_lines('ls-files', ['--others', '--exclude-standard'])
153
+ # Replaced below with above because did not take into account what was in .gitignore
154
+ # status.is_a?(Hash) ? status.untracked().keys : status.untracked().collect { |file| file.first }
153
155
  end
154
156
 
155
157
  def deleted
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ class Operation::Account
20
+ class AddToGroup < self
21
+ def self.execute(args = Args.new)
22
+ wrap_operation(args) do |args|
23
+ DtkNetworkClient::AddToGroup.run(args.required(:group), args.required(:user))
24
+ nil
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ class Operation::Account
20
+ class Chmod < self
21
+ def self.execute(args = Args.new)
22
+ wrap_operation(args) do |args|
23
+ DtkNetworkClient::Chmod.run(args.required(:namespace), args.required(:permissions))
24
+ nil
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ class Operation::Account
20
+ class CreateNamespace < self
21
+ def self.execute(args = Args.new)
22
+ wrap_operation(args) do |args|
23
+ DtkNetworkClient::CreateNamespace.run(args.required(:namespace))
24
+ nil
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ class Operation::Account
20
+ class DeleteNamespace < self
21
+ def self.execute(args = Args.new)
22
+ wrap_operation(args) do |args|
23
+ DtkNetworkClient::DeleteNamespace.run(args.required(:namespace))
24
+ nil
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ class Operation::Account
20
+ class ListNamespaces < self
21
+ def self.execute(args = Args.new)
22
+ wrap_operation(args) do |args|
23
+ response = DtkNetworkClient::ListNamespaces.run
24
+ Response.new(response)
25
+ end.set_render_as_table!
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK::Client
19
+ class Operation::Account
20
+ class RemoveFromGroup < self
21
+ def self.execute(args = Args.new)
22
+ wrap_operation(args) do |args|
23
+ DtkNetworkClient::RemoveFromGroup.run(args.required(:group), args.required(:user))
24
+ nil
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -19,7 +19,20 @@ module DTK::Client
19
19
  class Operation
20
20
  class Account < self
21
21
  RoutePrefix = 'account'
22
- OPERATIONS = [:list_ssh_keys, :delete_ssh_key, :add_ssh_key, :set_password, :set_catalog_credentials, :register_catalog_user]
22
+ OPERATIONS = [
23
+ :list_ssh_keys,
24
+ :delete_ssh_key,
25
+ :add_ssh_key,
26
+ :set_password,
27
+ :set_catalog_credentials,
28
+ :register_catalog_user,
29
+ :add_to_group,
30
+ :remove_from_group,
31
+ :create_namespace,
32
+ :chmod,
33
+ :delete_namespace,
34
+ :list_namespaces
35
+ ]
23
36
  OPERATIONS.each { |operation| require_relative("#{RoutePrefix}/#{operation}") }
24
37
 
25
38