epc 1.0.3 → 1.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.
Files changed (196) hide show
  1. data/lib/epc.rb +25 -5
  2. data/lib/epc/client/json_client.rb +4 -4
  3. data/lib/epc/command/archive_command.rb +7 -6
  4. data/lib/epc/command/attachto_command.rb +13 -0
  5. data/lib/epc/command/base_command.rb +120 -29
  6. data/lib/epc/command/config/create_config_command.rb +7 -11
  7. data/lib/epc/command/config/delete_config_command.rb +5 -5
  8. data/lib/epc/command/config/list_configs_command.rb +5 -5
  9. data/lib/epc/command/config/update_config_command.rb +11 -10
  10. data/lib/epc/command/copy_command.rb +14 -0
  11. data/lib/epc/command/create_command.rb +9 -5
  12. data/lib/epc/command/delete_command.rb +9 -9
  13. data/lib/epc/command/{copy_deployment_command.rb → deployment/copy_deployment_command.rb} +6 -5
  14. data/lib/epc/command/deployment/create_deployment_command.rb +15 -15
  15. data/lib/epc/command/deployment/list_deployments_command.rb +2 -4
  16. data/lib/epc/command/deployment/show_deployment_command.rb +5 -7
  17. data/lib/epc/command/deployment/submit_deployment_command.rb +15 -0
  18. data/lib/epc/command/deployment/update_deployment_command.rb +5 -14
  19. data/lib/epc/command/deployment/vote_deployment_command.rb +23 -0
  20. data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
  21. data/lib/epc/command/detachfrom_command.rb +13 -0
  22. data/lib/epc/command/group/create_group_command.rb +3 -3
  23. data/lib/epc/command/group/delete_group_command.rb +4 -5
  24. data/lib/epc/command/group/show_group_command.rb +2 -3
  25. data/lib/epc/command/group/update_group_command.rb +9 -7
  26. data/lib/epc/command/library/create_library_command.rb +1 -2
  27. data/lib/epc/command/library/delete_library_command.rb +4 -5
  28. data/lib/epc/command/library/list_libraries_command.rb +1 -1
  29. data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +1 -1
  30. data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +3 -5
  31. data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
  32. data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +4 -5
  33. data/lib/epc/command/libraryset/create_libraryset_command.rb +5 -4
  34. data/lib/epc/command/libraryset/delete_libraryset_command.rb +4 -6
  35. data/lib/epc/command/libraryset/list_librarysets_command.rb +2 -2
  36. data/lib/epc/command/libraryset/show_libraryset_command.rb +3 -3
  37. data/lib/epc/command/libraryset/update_libraryset_command.rb +4 -3
  38. data/lib/epc/command/list_command.rb +10 -14
  39. data/lib/epc/command/list_objecttypes_command.rb +1 -1
  40. data/lib/epc/command/objectrole/create_objectrole_command.rb +4 -5
  41. data/lib/epc/command/objectrole/list_objectroles_command.rb +3 -8
  42. data/lib/epc/command/objectrole/update_objectrole_command.rb +3 -1
  43. data/lib/epc/command/permission/list_permissions_command.rb +1 -1
  44. data/lib/epc/command/permissiongroup/list_permissiongroups_command.rb +1 -1
  45. data/lib/epc/command/plugin/create_plugin_command.rb +1 -2
  46. data/lib/epc/command/plugin/delete_plugin_command.rb +4 -6
  47. data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
  48. data/lib/epc/command/plugin/show_plugin_command.rb +2 -5
  49. data/lib/epc/command/plugin/update_plugin_command.rb +2 -6
  50. data/lib/epc/command/project/archive_project_command.rb +3 -12
  51. data/lib/epc/command/project/attachto_project_command.rb +133 -0
  52. data/lib/epc/command/project/create_project_command.rb +6 -6
  53. data/lib/epc/command/project/delete_project_command.rb +3 -24
  54. data/lib/epc/command/project/detachfrom_project_command.rb +66 -0
  55. data/lib/epc/command/project/list_projects_command.rb +12 -7
  56. data/lib/epc/command/project/show_project_command.rb +26 -25
  57. data/lib/epc/command/project/show_project_snapshot_command.rb +41 -0
  58. data/lib/epc/command/project/unarchive_project_command.rb +3 -10
  59. data/lib/epc/command/project/update_project_command.rb +5 -18
  60. data/lib/epc/command/projecttype/create_projecttype_command.rb +37 -0
  61. data/lib/epc/command/projecttype/delete_projecttype_command.rb +24 -0
  62. data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
  63. data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -4
  64. data/lib/epc/command/projecttype/update_projecttype_command.rb +61 -0
  65. data/lib/epc/command/push_command.rb +14 -8
  66. data/lib/epc/command/role/create_role_command.rb +26 -3
  67. data/lib/epc/command/role/delete_role_command.rb +3 -5
  68. data/lib/epc/command/role/list_roles_command.rb +7 -3
  69. data/lib/epc/command/role/show_role_command.rb +8 -5
  70. data/lib/epc/command/role/update_role_command.rb +14 -66
  71. data/lib/epc/command/runtime/create_runtime_command.rb +34 -0
  72. data/lib/epc/command/runtime/delete_runtime_command.rb +24 -0
  73. data/lib/epc/command/runtime/list_runtimes_command.rb +2 -2
  74. data/lib/epc/command/runtime/update_runtime_command.rb +49 -0
  75. data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +17 -0
  76. data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +5 -6
  77. data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +18 -0
  78. data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +2 -2
  79. data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
  80. data/lib/epc/command/serviceversion/create_serviceversion_command.rb +8 -12
  81. data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -5
  82. data/lib/epc/command/serviceversion/list_serviceversions_command.rb +8 -1
  83. data/lib/epc/command/show_command.rb +8 -9
  84. data/lib/epc/command/show_metrics_command.rb +3 -3
  85. data/lib/epc/command/solution/archive_solution_command.rb +3 -10
  86. data/lib/epc/command/solution/create_solution_command.rb +2 -2
  87. data/lib/epc/command/solution/delete_solution_command.rb +3 -7
  88. data/lib/epc/command/solution/list_solutions_command.rb +11 -3
  89. data/lib/epc/command/solution/show_solution_command.rb +4 -6
  90. data/lib/epc/command/solution/unarchive_solution_command.rb +3 -8
  91. data/lib/epc/command/solution/update_solution_command.rb +4 -6
  92. data/lib/epc/command/submit_command.rb +16 -0
  93. data/lib/epc/command/unarchive_command.rb +7 -6
  94. data/lib/epc/command/update_command.rb +9 -8
  95. data/lib/epc/command/user/create_user_command.rb +2 -3
  96. data/lib/epc/command/user/delete_user_command.rb +3 -5
  97. data/lib/epc/command/user/list_users_command.rb +1 -1
  98. data/lib/epc/command/user/show_user_command.rb +2 -4
  99. data/lib/epc/command/user/update_user_command.rb +3 -14
  100. data/lib/epc/command/userproperty/list_user_properties_command.rb +23 -0
  101. data/lib/epc/command/vote_command.rb +16 -0
  102. data/lib/epc/config.rb +7 -1
  103. data/lib/epc/help.rb +51 -48
  104. data/lib/epc/modules/config.rb +39 -0
  105. data/lib/epc/modules/role.rb +133 -0
  106. data/lib/epc/runner.rb +23 -12
  107. data/lib/epc/version.rb +1 -1
  108. data/test/command/archive_project_command_test.rb +2 -13
  109. data/test/command/archive_solution_command_test.rb +4 -14
  110. data/test/command/copy_deployment_command_test.rb +4 -8
  111. data/test/command/create_config_command_test.rb +23 -23
  112. data/test/command/create_deployment_command_test.rb +33 -32
  113. data/test/command/create_group_command_test.rb +2 -2
  114. data/test/command/create_library_command_test.rb +6 -6
  115. data/test/command/create_librarylanguage_command_test.rb +3 -3
  116. data/test/command/create_libraryset_command_test.rb +6 -26
  117. data/test/command/create_objectrole_command_test.rb +4 -13
  118. data/test/command/create_project_command_test.rb +27 -13
  119. data/test/command/create_role_command_test.rb +3 -2
  120. data/test/command/create_runtime_command_test.rb +37 -0
  121. data/test/command/create_servicedefinition_command_test.rb +4 -17
  122. data/test/command/create_serviceversion_command_test.rb +8 -22
  123. data/test/command/create_solution_command_test.rb +5 -5
  124. data/test/command/create_user_command_test.rb +4 -4
  125. data/test/command/delete_config_command_test.rb +8 -15
  126. data/test/command/delete_library_command_test.rb +3 -4
  127. data/test/command/delete_librarylanguage_command_test.rb +3 -4
  128. data/test/command/delete_libraryset_command_test.rb +3 -4
  129. data/test/command/delete_plugin_command_test.rb +3 -4
  130. data/test/command/delete_project_command_test.rb +2 -10
  131. data/test/command/delete_projecttype_command_test.rb +31 -0
  132. data/test/command/delete_role_command_test.rb +5 -14
  133. data/test/command/delete_runtime_command_test.rb +31 -0
  134. data/test/command/delete_servicedefinition_command_test.rb +31 -0
  135. data/test/command/delete_serviceversion_command_test.rb +3 -2
  136. data/test/command/delete_solution_command_test.rb +3 -16
  137. data/test/command/delete_user_command_test.rb +3 -3
  138. data/test/command/list_config_command_test.rb +1 -0
  139. data/test/command/list_deployments_command_test.rb +11 -41
  140. data/test/command/list_objectroles_command_test.rb +4 -14
  141. data/test/command/list_projects_command_test.rb +0 -14
  142. data/test/command/list_roles_command_test.rb +3 -1
  143. data/test/command/list_runtimes_command_test.rb +2 -3
  144. data/test/command/list_runtimetypes_command_test.rb +29 -0
  145. data/test/command/list_userproperties_command_test.rb +33 -0
  146. data/test/command/push_command_test.rb +9 -1
  147. data/test/command/show_deployment_command_test.rb +36 -0
  148. data/test/command/show_group_command_test.rb +2 -1
  149. data/test/command/show_libraryset_command_test.rb +5 -3
  150. data/test/command/show_metrics_command_test.rb +4 -4
  151. data/test/command/show_plugin_command_test.rb +4 -4
  152. data/test/command/show_project_command_test.rb +5 -17
  153. data/test/command/show_project_snapshot_test.rb +33 -0
  154. data/test/command/show_projecttype_command_test.rb +5 -11
  155. data/test/command/show_role_command_test.rb +5 -12
  156. data/test/command/show_solution_command_test.rb +2 -15
  157. data/test/command/show_user_command_test.rb +4 -3
  158. data/test/command/submit_deployment_command_test.rb +4 -11
  159. data/test/command/unarchive_project_command_test.rb +2 -14
  160. data/test/command/unarchive_solution_command_test.rb +6 -16
  161. data/test/command/update_config_command_test.rb +14 -3
  162. data/test/command/update_deployment_command_test.rb +12 -26
  163. data/test/command/update_group_command_test.rb +2 -10
  164. data/test/command/update_librarylanguage_command_test.rb +5 -3
  165. data/test/command/update_libraryset_command_test.rb +4 -2
  166. data/test/command/update_plugin_command_test.rb +5 -4
  167. data/test/command/update_project_command_test.rb +6 -20
  168. data/test/command/update_role_command_test.rb +11 -8
  169. data/test/command/update_solution_command_test.rb +6 -12
  170. data/test/command/update_user_command_test.rb +3 -19
  171. data/test/command/vote_deployment_command_test.rb +2 -6
  172. metadata +66 -63
  173. data/lib/epc/command/attach_library_command.rb +0 -82
  174. data/lib/epc/command/attach_libraryset_command.rb +0 -31
  175. data/lib/epc/command/attach_runtime_command.rb +0 -26
  176. data/lib/epc/command/bind_service_command.rb +0 -35
  177. data/lib/epc/command/create_dependency_command.rb +0 -43
  178. data/lib/epc/command/dependency/delete_dependency_command.rb +0 -38
  179. data/lib/epc/command/detach_library_command.rb +0 -35
  180. data/lib/epc/command/detach_libraryset_command.rb +0 -8
  181. data/lib/epc/command/list_versions_command.rb +0 -38
  182. data/lib/epc/command/submit_deployment_command.rb +0 -19
  183. data/lib/epc/command/unbind_service_command.rb +0 -42
  184. data/lib/epc/command/undefine_service_command.rb +0 -33
  185. data/lib/epc/command/update_rolepermissions_command.rb +0 -83
  186. data/lib/epc/command/vote_deployment_command.rb +0 -29
  187. data/test/command/attach_library_command_test.rb +0 -124
  188. data/test/command/attach_libraryset_command_test.rb +0 -49
  189. data/test/command/attach_runtime_command_test.rb +0 -44
  190. data/test/command/bind_service_command_test.rb +0 -46
  191. data/test/command/create_dependency_command_test.rb +0 -55
  192. data/test/command/create_plugin_command_test.rb +0 -44
  193. data/test/command/delete_dependency_command_test.rb +0 -42
  194. data/test/command/detach_library_command_test.rb +0 -53
  195. data/test/command/unbind_service_command_test.rb +0 -48
  196. data/test/command/undefine_service_command_test.rb +0 -49
@@ -2,14 +2,12 @@ module EPC::Command
2
2
  class UpdateSolutionCommand < BaseCommand
3
3
  UPDATABLE_ATTRIBUTES = ["name"]
4
4
 
5
- def execute(solution = nil, *args)
5
+ def execute(args)
6
+ require_object
7
+
6
8
  path = File.expand_path(".")
7
9
  path = project_solution_path(path)
8
10
 
9
- solution_id, solution_name = infer_solution_context(@options[:solution_name], path)
10
-
11
- raise FatalError, "Solution could not be determined" if solution_id.nil?
12
-
13
11
  args_hash = {}
14
12
  args.each do |arg|
15
13
  key, val = arg.split("=")
@@ -31,7 +29,7 @@ module EPC::Command
31
29
 
32
30
 
33
31
  if args_hash.present?
34
- status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}", args_hash)
32
+ status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{object_id}", args_hash)
35
33
  if status.failure?
36
34
  say("Update failed with: [#{response['message']}]")
37
35
  else
@@ -0,0 +1,16 @@
1
+ module EPC::Command
2
+ class SubmitCommand < BaseCommand
3
+
4
+ def execute(*args)
5
+ raise FatalError, "You need to specify the object for the command" if args.blank?
6
+ params = resolve_context(args)
7
+ @klass_name = "EPC::Command::Submit#{@object_type.to_s.gsub("-","").capitalize}Command"
8
+ command = eval(@klass_name)
9
+ command.include_module(object_type)
10
+ command = command.new(client, @options)
11
+ command.context_params = context_params
12
+ command.execute(params)
13
+ end
14
+
15
+ end
16
+ end
@@ -1,12 +1,13 @@
1
1
  module EPC::Command
2
2
  class UnarchiveCommand < BaseCommand
3
3
 
4
- def execute(object = nil)
5
- @object_type, @object_id = object.split(":") rescue [nil, nil]
6
- raise FatalError, "Object incorrectly specified" if @object_type.blank?
7
- klass = "EPC::Command::Unarchive#{@object_type.to_s.gsub("-","").capitalize}Command"
8
- command = eval(klass).new(client, @options)
9
- command.go(@object_id)
4
+ def execute(*args)
5
+ raise FatalError, "You need to specify the object for the command" if args.blank?
6
+ params = resolve_context(args)
7
+ @klass_name = "EPC::Command::Unarchive#{@object_type.to_s.gsub("-","").capitalize}Command"
8
+ command = eval(@klass_name).new(client, @options)
9
+ command.context_params = context_params
10
+ command.go(params)
10
11
  end
11
12
  end
12
13
  end
@@ -1,14 +1,15 @@
1
1
  module EPC::Command
2
2
  class UpdateCommand < BaseCommand
3
3
 
4
- def execute(object = nil, *params)
5
- @object_type, @object_id = object.split(":") rescue [nil, nil]
6
- raise FatalError, "Object incorrectly specified" if @object_type.blank?
7
- klass = "EPC::Command::Update#{@object_type.to_s.gsub("-","").capitalize}Command"
8
- params = normalize_params(params)
9
- command = eval(klass).new(client, @options)
10
- check_params
11
- command.go(@object_id, *params)
4
+ def execute(*args)
5
+ raise FatalError, "You need to specify the object for the command" if args.blank?
6
+ params = resolve_context(args, {:skip_object_resolution => Proc.new{|type, id| type.downcase == "config" || type.downcase == "objectrole"}})
7
+ @klass_name = "EPC::Command::Update#{@object_type.to_s.gsub("-","").capitalize}Command"
8
+ command = eval(@klass_name)
9
+ command.include_module(object_type)
10
+ command = command.new(client, @options)
11
+ command.context_params = context_params
12
+ command.go(params)
12
13
  end
13
14
 
14
15
  end
@@ -1,8 +1,7 @@
1
1
  module EPC::Command
2
2
  class CreateUserCommand < BaseCommand
3
- def execute(*params)
4
-
5
- email = params[1]
3
+ def execute(args = [])
4
+ email = args[0]
6
5
 
7
6
  raise FatalError, "You must supply an email address" if email.blank?
8
7
 
@@ -1,15 +1,13 @@
1
1
  module EPC::Command
2
2
  class DeleteUserCommand < DeleteCommand
3
- def execute(user = nil, *args)
3
+ def execute(args = [])
4
4
 
5
- proceed = ask_yn("Are you sure you want to delete the [#{user}] user? [Yn] ")
5
+ proceed = ask_yn("Are you sure you want to delete the [#{object_id}] user? [Yn] ")
6
6
  if proceed.upcase == "N"
7
7
  return 1
8
8
  end
9
9
 
10
- user_id = retrieve_identifier_for("User", user)
11
-
12
- status, response, headers = client.delete(EPC::Config::USERS_PATH + "/#{user_id}")
10
+ status, response, headers = client.delete(EPC::Config::USERS_PATH + "/#{object_id}")
13
11
 
14
12
  if status == 200
15
13
  say("User deleted")
@@ -2,7 +2,7 @@ require 'time'
2
2
  module EPC::Command
3
3
  class ListUsersCommand < BaseCommand
4
4
 
5
- def execute(target = nil)
5
+ def execute(args = [])
6
6
 
7
7
  status, response, headers = client.get(EPC::Config::USERS_PATH)
8
8
 
@@ -1,11 +1,9 @@
1
1
  module EPC::Command
2
2
  class ShowUserCommand < ShowCommand
3
3
 
4
- def execute(user = nil, *args)
4
+ def execute(args = [])
5
5
 
6
- user_id = retrieve_identifier_for("User", user)
7
-
8
- status, response, headers = client.get(EPC::Config::USERS_PATH + "/#{user_id}?include=user_groups")
6
+ status, response, headers = client.get(EPC::Config::USERS_PATH + "/#{object_id}?include=user_groups")
9
7
 
10
8
  if status != 200
11
9
  say("Request failed: [#{response[:message]}]")
@@ -3,14 +3,10 @@ module EPC::Command
3
3
 
4
4
  required_options :email, :password, :mode => :any?, :message => "You must specify the attribute to be updated: email/password"
5
5
 
6
- def execute(user = nil, *args)
6
+ def execute(args)
7
7
 
8
8
  if @options[:password].present?
9
- if numeric?(user)
10
- email = get_resource_attribute(EPC::Config::USERS_PATH, :email, :id, user.to_i)
11
- else
12
- email = user
13
- end
9
+ email = get_resource_attribute(EPC::Config::USERS_PATH, :email, :id, object_id.to_i)
14
10
  raise FatalError, "User could not be determined" if email.blank?
15
11
 
16
12
  raise FatalError, "You need to specify the password change token with the --token option" if @options[:token].blank?
@@ -27,19 +23,12 @@ module EPC::Command
27
23
  end
28
24
 
29
25
  if @options[:email].present? || @options[:name].present?
30
- if numeric?(user)
31
- user_id = user.to_i
32
- else
33
- user_id = get_resource_id(EPC::Config::USERS_PATH, :email, user)
34
- end
35
-
36
- raise FatalError, "User could not be determined" if user_id.blank?
37
26
 
38
27
  params = {}
39
28
  params[:email] = @options[:email] if @options[:email].present?
40
29
  params[:name] = @options[:name] if @options[:name].present?
41
30
 
42
- status, response, headers = client.put(EPC::Config::USERS_PATH + "/#{user_id}", params)
31
+ status, response, headers = client.put(EPC::Config::USERS_PATH + "/#{object_id}", params)
43
32
 
44
33
  if status.successful?
45
34
  say("User updated")
@@ -0,0 +1,23 @@
1
+ require 'time'
2
+ module EPC::Command
3
+ class ListUserpropertiesCommand < BaseCommand
4
+
5
+ def execute(args = [])
6
+ user_id = retrieve_identifier_for("User", EPC::Config.username)
7
+
8
+ status, response, headers = client.get(EPC::Config::ENTITY_PROPERTIES_PATH + "/for/User/#{user_id}")
9
+
10
+ if status.failure?
11
+ say("Request failed with [#{response[:message]}]")
12
+ elsif response.empty?
13
+ say("No properties found for current user.")
14
+ else
15
+ response.each {|property| property[:created_at] = Time.parse(property[:created_at]).strftime("%m/%d/%Y %I:%M%p") rescue nil }
16
+ properties_table = EPC::TabularOutputter.new(response, [:id, :name, :created_at])
17
+ say(properties_table.print)
18
+ end
19
+ return status
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ module EPC::Command
2
+ class VoteCommand < BaseCommand
3
+
4
+ def execute(*args)
5
+ raise FatalError, "You need to specify the object for the command" if args.blank?
6
+ params = resolve_context(args)
7
+ @klass_name = "EPC::Command::Vote#{@object_type.to_s.gsub("-","").capitalize}Command"
8
+ command = eval(@klass_name)
9
+ command.include_module(object_type)
10
+ command = command.new(client, @options)
11
+ command.context_params = context_params
12
+ command.execute(params)
13
+ end
14
+
15
+ end
16
+ end
@@ -41,6 +41,7 @@ module EPC
41
41
  METRICS_PATH = "#{SCOPE}/metrics"
42
42
  INSTANCES_PATH = "#{SCOPE}/deployed_projects"
43
43
  PLUGINS_PATH = "#{SCOPE}/plugins"
44
+ ENTITY_PROPERTIES_PATH = "#{SCOPE}/entity_properties"
44
45
 
45
46
  class << self
46
47
  def target_file
@@ -138,7 +139,12 @@ module EPC
138
139
  def remove_auth_token
139
140
  FileUtils.rm_f(File.expand_path(token_file))
140
141
  end
141
-
142
+
143
+ def module_exists?(class_name)
144
+ return EPC::Command.const_defined?(class_name)
145
+ rescue NameError
146
+ return false
147
+ end
142
148
 
143
149
  def underscore(camel_cased_word)
144
150
  camel_cased_word.to_s.gsub(/::/, '/').
@@ -4,7 +4,7 @@ module EPC
4
4
  :info => 'epc info',
5
5
  :target => 'epc target <url>',
6
6
  :login => 'epc login <email> [--passwd PASS]',
7
- :list_solutions => 'epc list solutions',
7
+ :list_solutions => 'epc list solutions [--archived]',
8
8
  :create_solution => 'epc create solution <name>',
9
9
  :show_solution => 'epc show Solution:solution_identifier',
10
10
  :update_solution => 'epc update Solution:solution_identifier name=value',
@@ -12,40 +12,33 @@ module EPC
12
12
  :archive_solution => 'epc archive Solution:solution_identifier',
13
13
  :unarchive_solution => 'epc unarchive Solution:solution_identifier',
14
14
  :refresh_solution => 'epc refresh solution [SOLUTION]',
15
- :list_projects => 'epc list projects [Solution:solution_id]',
16
- :create_project => 'epc create project <name> [uri-name] <--type PROJECT_TYPE>',
15
+ :list_projects => 'epc list projects [Solution:solution_id] [--archived]',
16
+ :create_project => 'epc create project <name> [uri-name] <--type PROJECT_TYPE> <--memory MEMORY>',
17
17
  :show_project => 'epc show Project:project_identifier',
18
18
  :update_project => 'epc update Project:project_identifier <attribute=value>',
19
- :delete_project => 'epc delete project [-s SOLUTION] [PROJECT] [--force]',
19
+ :delete_project => 'epc delete Project:project_identifier [--force]',
20
20
  :attach_runtime => 'epc attach runtime <runtime_id> [-p PROJECT] [--stage STAGE]',
21
21
  :list_servicetypes => 'epc list service-types',
22
- :create_servicedefinition => 'epc create service-definition <service_name> <service_type>',
23
- :undefine_service => 'epc undefine service <SERVICE>',
24
- :list_servicedefinitions => 'epc list service-definitions',
25
- :create_serviceversion => 'epc create service-version <label> <definition_name_or_id> [--up-script file] [--down-script file]',
26
- :list_serviceversions => 'epc list service-versions',
27
- :delete_serviceversion => 'epc delete service-version (<version_id>) || (<version_label> <definition_name>)',
28
- :bind_service => 'epc bind service [-s SOLUTION] [-p PROJECT] <service version>',
29
- :unbind_service => 'epc unbind service [-s SOLUTION] [-p PROJECT] <service version>',
30
- :list_boundservices => 'epc list bound-services [-s SOLUTION] <PROJECT>',
22
+ :create_servicedefinition => 'epc create ServiceDefinition ServiceType:service_type_identifier <service_name>',
23
+ :delete_servicedefinition => 'epc delete ServiceDefinition:service_definition_identifier',
24
+ :list_servicedefinitions => 'epc list ServiceDefinitions',
25
+ :create_serviceversion => 'epc create ServiceVersion <ServiceDefinition:service_definition_identifier> <label> [--up-script file] [--down-script file]',
26
+ :list_serviceversions => 'epc list ServiceVersions',
27
+ :delete_serviceversion => 'epc delete ServiceVersion:service_version_identifier',
31
28
  :create_user => 'epc create user <email> [--name NAME]',
32
- :push => 'epc push [PROJECT NAME] [--note NOTE] [--timeout value | --nopoll]',
29
+ :push => 'epc push [PROJECT NAME] [--note NOTE] [--timeout value | --nopoll] [--direct-deploy file]',
33
30
  :pull => 'epc pull [SOLUTION]',
34
31
  :build => 'epc build [project_name=version] [--note NOTE] [--timeout value | --nopoll]',
35
- :list_deploymentconfigs => 'epc list deployment-configs [--stage STAGE] [-p PROJECT]',
36
32
  :list_deploymentstages => 'epc list stages',
37
- :create_deployment => 'epc create deployment [-s SOLUTION] <stage name: development|testing|staging|production> [-p project_id:version:instances] [--replaces deployment_id]',
33
+ :create_deployment => 'epc create Deployment Solution:solution_identifier <stage name: development|testing|staging|production> [-p project_id:version:instances:runtime_memory] [--replaces deployment_id]',
38
34
  :show_deployment => 'epc show Deployment:deployment_identifier',
39
- :submit_deployment => 'epc submit deployment <DEPLOYMENT_ID>',
35
+ :submit_deployment => 'epc submit Deployment:deployment_identifier',
40
36
  :list_deployments => 'epc list deployments [<Solution:solution_id> | <DeploymentStage:deployment_stage_id> | <User:user_id>]',
41
37
  :copy_deployment => 'epc copy deployment <DEPLOYMENT_ID> <STAGE>',
42
- :approve_deployment => 'epc approve deployment <DEPLOYMENT_ID>',
43
- :deny_deployment => 'epc deny deployment <DEPLOYMENT_ID>',
44
- :create_dependency => 'epc create dependency [PROJECT] [-s SOLUTION] <--depends DEPENDENCY> <--runtime | --compile>',
45
- :list_dependencies => 'epc list dependencies [-s SOLUTION] [PROJECT]',
46
- :delete_dependency => 'epc delete dependency [-s SOLUTION] [-p PROJECT] <DEPENDENCY_ID>',
47
- :create_library => 'epc create library <name> <language> <version> <group> [-f file] [--scope runtime | compile | provided | test]',
48
- :list_libraries => 'epc list libraries',
38
+ :approve_deployment => 'epc approve Deployment:deployment_identifier',
39
+ :deny_deployment => 'epc deny Deployment:deployment_identifier',
40
+ :create_library => 'epc create Library <name> <language> <version> <group> [-f file] [--scope runtime | compile | provided | test]',
41
+ :list_libraries => 'epc list Libraries',
49
42
  :delete_library => 'epc delete Library:library_identifier',
50
43
  :attach_library => 'epc attach library [-s SOLUTION] [-p PROJECT] <name> <version> <group> [-f FILE] [--pom POM FILE]',
51
44
  :detach_library => 'epc detach library [-s SOLUTION] [-p PROJECT] <LIBRARY>',
@@ -55,12 +48,11 @@ module EPC
55
48
  :renew => 'epc renew',
56
49
  :logout => 'epc logout',
57
50
  :create_config => 'epc create config <TargetType:TargetId> [--required] [--no_override] [--value-type TYPE] name=value',
58
- :list_config => 'epc list config <TargetType:TargetType>',
51
+ :list_configs => 'epc list config <TargetType:TargetType>',
59
52
  :delete_config => 'epc delete Config:key_identifier <TargetType:TargetId>',
60
53
  :list_projecttypes => 'epc list project-types',
61
54
  :show_projecttype => 'epc show ProjectType:project_type_identifier',
62
55
  :update_deployment => 'epc update Deployment:deployment_identifier Project:project_identifier [--instances instance_count] [--uris comma_separated_uris]',
63
- :list_versions => 'epc list versions [-s SOLUTION] PROJECT',
64
56
  :update_config => 'epc update Config:config_identifier TargetType:TargetId [--required] [--no_override] name=value',
65
57
  :archive_project => 'epc archive Project:project_identifier',
66
58
  :unarchive_project => 'epc unarchive Project:project_identifier',
@@ -71,40 +63,47 @@ module EPC
71
63
  :update_group => 'epc update Group:group_identifier:group_identifier [--add-user USER_ID] [--remove-user USER_ID]',
72
64
  :show_group => 'epc show Group:group_identifier',
73
65
  :list_roles => 'epc list roles [User:user_id]',
74
- :list_objectroles => 'epc list object-roles <ObjectType:ObjectId>',
75
- :delete_role => 'epc delete role',
66
+ :list_objectroles => 'epc list ObjectRoles <ObjectType:ObjectId>',
67
+ :delete_role => 'epc delete Role',
76
68
  :update_role => 'epc update Role:role_identifier [--add-user USER_ID] [--remove-user USER_ID] [--add-grant ObjectType:action:ObjectId] [--remove-grant ObjectType:action:ObjectId> [--file json]',
77
69
  :update_objectrole => 'epc update ObjectRole:ObjectType.ObjectID.role_identifier [--add-user USER_ID] [--remove-user USER_ID] [--add-grant ObjectType:action:ObjectId] [--remove-grant ObjectType:action:ObjectId> [--file json]',
78
- :create_role => 'epc create role <name>',
70
+ :create_role => 'epc create role <name> [--file json]',
79
71
  :create_objectrole => 'epc create role <name> <ObjectType:ObjectId>',
80
72
  :show_role => 'epc show Role:role_identifier [users|groups|grants]',
81
73
  :list_users => 'epc list users',
82
- :delete_user => 'epc delete user <user_id>|<email>',
74
+ :delete_user => 'epc delete User:user_identifier',
83
75
  :show_user => 'epc show User:user_identifier',
84
- :create_librarylanguage => 'epc create library-language <name>',
85
- :list_librarylanguages => 'epc list library-languages',
76
+ :create_librarylanguage => 'epc create LibraryLanguage <name>',
77
+ :list_librarylanguages => 'epc list LibraryLanguages',
86
78
  :delete_librarylanguage => 'epc delete LibraryLanguage:language_identifier',
87
79
  :update_librarylanguage => 'epc update LibraryLanguage:language_identifier <new-name>',
88
- :create_libraryset => 'epc create library-set <name> <language> [--file file]',
80
+ :create_libraryset => 'epc create LibrarySet <name> <language> [--file file]',
89
81
  :show_libraryset => 'epc show LibrarySet:libraryset_identifier [--json]',
90
- :list_librarysets => 'epc list library-sets',
82
+ :list_librarysets => 'epc list LibrarySets',
91
83
  :update_libraryset => 'epc update LibrarySet:library-set_identifier [--add-library id|name:version:group] [--remove-library id|name:version:group] [--file file]',
92
- :delete_libraryset => 'epc delete library-set name|id [-y]',
93
- :attach_libraryset => 'epc attach library-set name|id [-s solution] [-p project]',
94
- :detach_libraryset => 'epc detach library-set name|id [-s solution] [-p project]',
84
+ :delete_libraryset => 'epc delete LibrarySet:library_set_identifier [-y]',
95
85
  :request_passwordchange => 'epc request password-change <email>',
96
86
  :update_user => 'epc update User:user_identifier [--passwd password] [--token token] [--email new_email] [--name new_name]',
97
87
  :list_metrics => 'epc list metrics [--target target]',
98
88
  :show_metrics => 'epc show metrics <id> <metric list> [--start start] [--stop stop] [--step step] [--graph]',
99
89
  :show_instances => 'epc show instances <deployed-project-id>',
100
- :list_permissions => 'epc list permissions',
101
- :update_rolepermissions => 'epc update role-permissions ',
102
- :list_permissiongroups => 'epc list permission-groups',
103
- :list_objecttypes => 'epc list object-types',
90
+ :list_permissions => 'epc list Permissions',
91
+ :list_permissiongroups => 'epc list PermissionGroups',
92
+ :list_objecttypes => 'epc list ObjectTypes',
104
93
  :create_plugin => 'epc create plugin <name> <version> <group> [--inherited] [--extensions] [--executions executions|file:path_to_executions_file] [--configuration configuration|file:path_to_configuration_file]',
105
94
  :show_plugin => 'epc show Plugin:Name:Version:Group',
106
95
  :list_plugins => 'epc list plugins',
107
- :update_plugin => 'epc update Plugin:Name:Version:Group attribute=new value'
96
+ :update_plugin => 'epc update Plugin:Name:Version:Group attribute=new value',
97
+ :attachto_project => 'epc attach-to Project:project_identifier [Library|LibrarySet|ServiceVersion|Dependency]:[library_identifier|library_set_identifier|service_version_identifier|dependency_identifier]',
98
+ :detachfrom_project => 'epc detach-from Project:project_identifier [Library|LibrarySet|ServiceVersion|Dependency]:[library_identifier|library_set_identifier|service_version_identifier|dependency_identifier]',
99
+ :list_runtimetypes => 'epc list RuntimeTypes',
100
+ :create_runtime => 'epc create Runtime RuntimeType:runtime_type_identifier name target deployment_stage username password [--agility_topology id] [--agility-environment id]',
101
+ :update_runtime => 'epc update Runtime:runtime_identifier attribute=new_value',
102
+ :delete_runtime => 'epc delete Runtime:runtime_identifier',
103
+ :create_projecttype => 'epc create ProjectType name runtime framework build-type build-packaging deployable runtime-env-types',
104
+ :delete_projecttype => 'epc delete ProjectType:project_type_identifier',
105
+ :update_projecttype => 'epc update ProjectType:project_type_identifier attribute=value',
106
+ :snapshot => 'epc snapshot project_id:project_version'
108
107
  }
109
108
 
110
109
  def display_usage
@@ -156,10 +155,10 @@ Currently available epc commands are:
156
155
  delete solution Deletes the solution from the system and removes
157
156
  local metadata files.
158
157
  Does not remove local directories.
159
- archive solution Archives the solution. Arabeline, kschived solution do
158
+ archive solution Archives the solution. Archived solutions do
160
159
  not appear when listing solutions.
161
- unarchive solution Archives solution.
162
- The solution will appear in solution listings.
160
+ unarchive solution Unarchives solution.
161
+ The solution will appear in solutions listing.
163
162
  refresh solution Retrieves and stores attributes for a solution.
164
163
 
165
164
  pull Downloads and extracts a solution skeleton
@@ -173,6 +172,8 @@ Currently available epc commands are:
173
172
  update project Updates the specified attributes.
174
173
  delete project Deletes the project.Removes only the
175
174
  metadata files.
175
+ epc snapshot Returns a snapshot of the project and it's associations
176
+ for a given version.
176
177
  All other files are left intact.
177
178
  epc create dependency Creates a dependency such as parent_name_or_id will
178
179
  depend on dependency_name_or_id.
@@ -186,9 +187,11 @@ Currently available epc commands are:
186
187
  epc list bound-services Lists the services bound to the project
187
188
  attach runtime Sets the runtime environment the project
188
189
  will run on at deployment.
190
+ create ProjectType Creates a project type with the given options.
189
191
  list project-types Lists available project types.
190
192
  show project-type Show details about a project type
191
- list versions Lists the project versions.
193
+ update ProjectType Updates a project type with the given options.
194
+ delete ProjectType Removes a project type from the system.
192
195
 
193
196
 
194
197
  Services
@@ -203,8 +206,8 @@ Currently available epc commands are:
203
206
 
204
207
 
205
208
  Deployments
206
- push Zips the project and pushes it to the
207
- build manager repository
209
+ push Pushes project code to the repository
210
+ and builds as needed
208
211
  build Builds a previously pushed project
209
212
  show deployment Retrieves detailed information about
210
213
  the deployment
@@ -0,0 +1,39 @@
1
+ module EPC::Command
2
+ module Config
3
+
4
+ def self.included(base)
5
+ base.send :include, InstanceMethods
6
+ end
7
+
8
+
9
+ module InstanceMethods
10
+ def extract_configuration_level(path, target)
11
+ config_type, config_id = target rescue [nil, nil]
12
+
13
+ if config_id.nil?
14
+ if EPC::Config.is_project_dir?(path)
15
+ config_id = EPC::Config.get_project_value(path, "id")
16
+ config_type = "Project"
17
+ elsif EPC::Config.is_solution_dir?(path)
18
+ config_id = EPC::Config.get_solution_value(path, "id")
19
+ config_type = "Solution"
20
+ end
21
+ end
22
+
23
+ return [config_type, config_id]
24
+ end
25
+
26
+ def parse_config_value_file(file, config_type, config_id)
27
+ params = []
28
+ params = EPC::Config.read_content_as_json(file)
29
+ params.each do |param|
30
+ if param[:configurable_type].nil? || param[:configurable_id].nil?
31
+ param[:configurable_type] = config_type
32
+ param[:configurable_id] = config_id
33
+ end
34
+ end
35
+ params
36
+ end
37
+ end
38
+ end
39
+ end