epc 1.0.2
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 +1 -0
- data/Gemfile +22 -0
- data/Rakefile +67 -0
- data/Rakefile.gem +1 -0
- data/bin/epc +10 -0
- data/lib/epc.rb +126 -0
- data/lib/epc/client/base_client.rb +80 -0
- data/lib/epc/client/http_client.rb +19 -0
- data/lib/epc/client/json_client.rb +48 -0
- data/lib/epc/command/archive_project_command.rb +24 -0
- data/lib/epc/command/archive_solution_command.rb +21 -0
- data/lib/epc/command/attach_library_command.rb +82 -0
- data/lib/epc/command/attach_libraryset_command.rb +32 -0
- data/lib/epc/command/attach_runtime_command.rb +27 -0
- data/lib/epc/command/base_command.rb +451 -0
- data/lib/epc/command/bind_service_command.rb +35 -0
- data/lib/epc/command/build_command.rb +83 -0
- data/lib/epc/command/config/create_config_command.rb +55 -0
- data/lib/epc/command/copy_deployment_command.rb +21 -0
- data/lib/epc/command/create_command.rb +13 -0
- data/lib/epc/command/create_dependency_command.rb +43 -0
- data/lib/epc/command/define_service_command.rb +37 -0
- data/lib/epc/command/delete_config_command.rb +63 -0
- data/lib/epc/command/delete_dependency_command.rb +40 -0
- data/lib/epc/command/delete_group_command.rb +40 -0
- data/lib/epc/command/delete_library_command.rb +30 -0
- data/lib/epc/command/delete_librarylanguage_command.rb +40 -0
- data/lib/epc/command/delete_libraryset_command.rb +40 -0
- data/lib/epc/command/delete_project_command.rb +54 -0
- data/lib/epc/command/delete_role_command.rb +25 -0
- data/lib/epc/command/delete_serviceversion_command.rb +52 -0
- data/lib/epc/command/delete_solution_command.rb +39 -0
- data/lib/epc/command/delete_user_command.rb +31 -0
- data/lib/epc/command/deploy_command.rb +142 -0
- data/lib/epc/command/deployment/create_deployment_command.rb +82 -0
- data/lib/epc/command/detach_library_command.rb +35 -0
- data/lib/epc/command/detach_libraryset_command.rb +8 -0
- data/lib/epc/command/group/create_group_command.rb +21 -0
- data/lib/epc/command/info_command.rb +11 -0
- data/lib/epc/command/library/create_library_command.rb +45 -0
- data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +24 -0
- data/lib/epc/command/libraryset/create_libraryset_command.rb +54 -0
- data/lib/epc/command/list_approvals_command.rb +27 -0
- data/lib/epc/command/list_attachedlibraries_command.rb +42 -0
- data/lib/epc/command/list_boundservices_command.rb +40 -0
- data/lib/epc/command/list_config_command.rb +60 -0
- data/lib/epc/command/list_dependencies_command.rb +43 -0
- data/lib/epc/command/list_deployments_command.rb +68 -0
- data/lib/epc/command/list_groups_command.rb +19 -0
- data/lib/epc/command/list_libraries_command.rb +19 -0
- data/lib/epc/command/list_librarylanguages_command.rb +19 -0
- data/lib/epc/command/list_librarysets_command.rb +26 -0
- data/lib/epc/command/list_objectroles_command.rb +25 -0
- data/lib/epc/command/list_objecttypes_command.rb +20 -0
- data/lib/epc/command/list_permissiongroups_command.rb +20 -0
- data/lib/epc/command/list_projects_command.rb +36 -0
- data/lib/epc/command/list_projecttypes_command.rb +20 -0
- data/lib/epc/command/list_rolepermissions_command.rb +21 -0
- data/lib/epc/command/list_roles_command.rb +26 -0
- data/lib/epc/command/list_runtimes_command.rb +16 -0
- data/lib/epc/command/list_service_types_command.rb +19 -0
- data/lib/epc/command/list_servicedefinitions_command.rb +19 -0
- data/lib/epc/command/list_serviceversions_command.rb +21 -0
- data/lib/epc/command/list_solutions_command.rb +25 -0
- data/lib/epc/command/list_stages_command.rb +21 -0
- data/lib/epc/command/list_users_command.rb +26 -0
- data/lib/epc/command/list_versions_command.rb +39 -0
- data/lib/epc/command/login_command.rb +32 -0
- data/lib/epc/command/logout_command.rb +20 -0
- data/lib/epc/command/objectrole/create_objectrole_command.rb +19 -0
- data/lib/epc/command/project/create_project_command.rb +78 -0
- data/lib/epc/command/pull_command.rb +209 -0
- data/lib/epc/command/push_command.rb +194 -0
- data/lib/epc/command/refresh_solution_command.rb +71 -0
- data/lib/epc/command/renew_command.rb +19 -0
- data/lib/epc/command/request_passwordchange_command.rb +23 -0
- data/lib/epc/command/role/create_role_command.rb +17 -0
- data/lib/epc/command/serviceversion/create_serviceversion_command.rb +33 -0
- data/lib/epc/command/show_deployment_command.rb +57 -0
- data/lib/epc/command/show_group_command.rb +35 -0
- data/lib/epc/command/show_libraryset_command.rb +54 -0
- data/lib/epc/command/show_project_command.rb +74 -0
- data/lib/epc/command/show_projecttype_command.rb +18 -0
- data/lib/epc/command/show_role_command.rb +46 -0
- data/lib/epc/command/show_solution_command.rb +54 -0
- data/lib/epc/command/show_user_command.rb +42 -0
- data/lib/epc/command/solution/create_solution_command.rb +34 -0
- data/lib/epc/command/solution/list_solutions_command.rb +25 -0
- data/lib/epc/command/solution/update_solution_command.rb +43 -0
- data/lib/epc/command/submit_deployment_command.rb +19 -0
- data/lib/epc/command/target_command.rb +26 -0
- data/lib/epc/command/unarchive_project_command.rb +23 -0
- data/lib/epc/command/unarchive_solution_command.rb +21 -0
- data/lib/epc/command/unbind_service_command.rb +42 -0
- data/lib/epc/command/undefine_service_command.rb +33 -0
- data/lib/epc/command/undeploy_command.rb +106 -0
- data/lib/epc/command/update_config_command.rb +62 -0
- data/lib/epc/command/update_deploymentproject_command.rb +54 -0
- data/lib/epc/command/update_group_command.rb +43 -0
- data/lib/epc/command/update_librarylanguage_command.rb +28 -0
- data/lib/epc/command/update_libraryset_command.rb +80 -0
- data/lib/epc/command/update_project_command.rb +49 -0
- data/lib/epc/command/update_role_command.rb +47 -0
- data/lib/epc/command/update_rolepermissions_command.rb +83 -0
- data/lib/epc/command/update_solution_command.rb +45 -0
- data/lib/epc/command/update_user_command.rb +57 -0
- data/lib/epc/command/user/create_user_command.rb +27 -0
- data/lib/epc/command/vote_deployment_command.rb +29 -0
- data/lib/epc/config.rb +245 -0
- data/lib/epc/error/basic_error.rb +6 -0
- data/lib/epc/error/fatal_error.rb +6 -0
- data/lib/epc/error/input_error.rb +6 -0
- data/lib/epc/error/internal_error.rb +6 -0
- data/lib/epc/help.rb +292 -0
- data/lib/epc/persistent_attributes.rb +18 -0
- data/lib/epc/runner.rb +177 -0
- data/lib/epc/tabular_outputter.rb +161 -0
- data/lib/epc/version.rb +3 -0
- data/lib/fixnum.rb +9 -0
- data/lib/object.rb +13 -0
- data/test/command/archive_project_command_test.rb +41 -0
- data/test/command/archive_solution_command_test.rb +40 -0
- data/test/command/attach_library_command_test.rb +124 -0
- data/test/command/attach_libraryset_command_test.rb +49 -0
- data/test/command/attach_runtime_command_test.rb +44 -0
- data/test/command/base_command_test.rb +276 -0
- data/test/command/bind_service_command_test.rb +46 -0
- data/test/command/build_command_test.rb +103 -0
- data/test/command/copy_deployment_command_test.rb +38 -0
- data/test/command/create_config_command_test.rb +124 -0
- data/test/command/create_dependency_command_test.rb +55 -0
- data/test/command/create_deployment_command_test.rb +136 -0
- data/test/command/create_group_command_test.rb +34 -0
- data/test/command/create_library_command_test.rb +61 -0
- data/test/command/create_librarylanguage_command_test.rb +51 -0
- data/test/command/create_libraryset_command_test.rb +81 -0
- data/test/command/create_objectrole_command_test.rb +37 -0
- data/test/command/create_project_command_test.rb +102 -0
- data/test/command/create_role_command_test.rb +31 -0
- data/test/command/create_serviceversion_command_test.rb +60 -0
- data/test/command/create_solution_command_test.rb +70 -0
- data/test/command/create_user_command_test.rb +54 -0
- data/test/command/define_service_command_test.rb +55 -0
- data/test/command/delete_config_command_test.rb +82 -0
- data/test/command/delete_dependency_command_test.rb +50 -0
- data/test/command/delete_group_command_test.rb +56 -0
- data/test/command/delete_library_command_test.rb +43 -0
- data/test/command/delete_librarylanguage_command_test.rb +55 -0
- data/test/command/delete_libraryset_command_test.rb +55 -0
- data/test/command/delete_project_command_test.rb +76 -0
- data/test/command/delete_role_command_test.rb +41 -0
- data/test/command/delete_serviceversion_command_test.rb +53 -0
- data/test/command/delete_solution_command_test.rb +79 -0
- data/test/command/delete_user_command_test.rb +56 -0
- data/test/command/deploy_command_test.rb +185 -0
- data/test/command/detach_library_command_test.rb +53 -0
- data/test/command/info_command_test.rb +17 -0
- data/test/command/list_approvals_command_test.rb +41 -0
- data/test/command/list_boundservices_command_test.rb +46 -0
- data/test/command/list_config_command_test.rb +72 -0
- data/test/command/list_dependencies_command_test.rb +46 -0
- data/test/command/list_deployments_command_test.rb +112 -0
- data/test/command/list_deploymentstages_command_test.rb +44 -0
- data/test/command/list_libraries_command_test.rb +42 -0
- data/test/command/list_librarylanguages_command_test.rb +34 -0
- data/test/command/list_librarysets_command_test.rb +33 -0
- data/test/command/list_objectroles_command_test.rb +41 -0
- data/test/command/list_objecttypes_command_test.rb +25 -0
- data/test/command/list_permissiongroups_command_test.rb +25 -0
- data/test/command/list_projects_command_test.rb +63 -0
- data/test/command/list_projecttypes_command_test.rb +39 -0
- data/test/command/list_rolepermissions_command_test.rb +39 -0
- data/test/command/list_roles_command_test.rb +46 -0
- data/test/command/list_runtimes_command_test.rb +30 -0
- data/test/command/list_service_types_command_test.rb +44 -0
- data/test/command/list_servicedefinitions_command_test.rb +44 -0
- data/test/command/list_serviceversions_command_test.rb +47 -0
- data/test/command/list_solutions_command_test.rb +48 -0
- data/test/command/list_users_command_test.rb +33 -0
- data/test/command/login_command_test.rb +83 -0
- data/test/command/logout_command_test.rb +30 -0
- data/test/command/pull_command_test.rb +229 -0
- data/test/command/push_command_test.rb +246 -0
- data/test/command/refresh_solution_command_test.rb +35 -0
- data/test/command/renew_command_test.rb +43 -0
- data/test/command/request_passwordchange_command_test.rb +31 -0
- data/test/command/show_group_command_test.rb +50 -0
- data/test/command/show_libraryset_command_test.rb +51 -0
- data/test/command/show_project_command_test.rb +57 -0
- data/test/command/show_projecttype_command_test.rb +46 -0
- data/test/command/show_role_command_test.rb +37 -0
- data/test/command/show_solution_command_test.rb +59 -0
- data/test/command/show_user_command_test.rb +50 -0
- data/test/command/submit_deployment_command_test.rb +37 -0
- data/test/command/target_command_test.rb +58 -0
- data/test/command/unarchive_project_command_test.rb +45 -0
- data/test/command/unarchive_solution_command_test.rb +43 -0
- data/test/command/unbind_service_command_test.rb +48 -0
- data/test/command/undefine_service_command_test.rb +49 -0
- data/test/command/update_config_command_test.rb +74 -0
- data/test/command/update_deploymentproject_command_test.rb +77 -0
- data/test/command/update_group_command_test.rb +69 -0
- data/test/command/update_librarylanguage_command_test.rb +43 -0
- data/test/command/update_libraryset_command_test.rb +113 -0
- data/test/command/update_project_command_test.rb +56 -0
- data/test/command/update_role_command_test.rb +42 -0
- data/test/command/update_rolepermissions_command_test.rb +54 -0
- data/test/command/update_solution_command_test.rb +58 -0
- data/test/command/update_user_command_test.rb +76 -0
- data/test/command/vote_deployment_command_test.rb +33 -0
- data/test/config_test.rb +70 -0
- data/test/successful_test.rb +21 -0
- data/test/test_files/pom.xml +273 -0
- data/test/test_helper.rb +25 -0
- metadata +470 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListGroupsCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute
|
5
|
+
status, response, headers = client.get(EPC::Config::GROUPS_PATH)
|
6
|
+
if status.failure?
|
7
|
+
say("Request failed: [#{response[:message]}]")
|
8
|
+
elsif response.empty?
|
9
|
+
say("No groups created.")
|
10
|
+
say("You can create one with epc create group")
|
11
|
+
else
|
12
|
+
groups_table = EPC::TabularOutputter.new(response, [:id, :name])
|
13
|
+
say(groups_table.print)
|
14
|
+
end
|
15
|
+
return status
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListLibrariesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(*args)
|
5
|
+
status, response, headers = client.get(EPC::Config::LIBRARIES_PATH)
|
6
|
+
|
7
|
+
if status.failure?
|
8
|
+
say("Libraries retrieval failed with [#{response[:message]}]")
|
9
|
+
elsif response.empty?
|
10
|
+
say("You have no libraries created. You can create them with epc create library.")
|
11
|
+
else
|
12
|
+
libraries_table = EPC::TabularOutputter.new(response, {:id => "ID", :name => "NAME", :language => "LANGUAGE", :library_version => "VERSION", :group => "GROUP", :scope => "SCOPE"})
|
13
|
+
say(libraries_table.print)
|
14
|
+
end
|
15
|
+
return status
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListLibrarylanguagesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute
|
5
|
+
status, response, headers = client.get(EPC::Config::LIBRARY_LANGUAGES_PATH)
|
6
|
+
if status.failure?
|
7
|
+
say("Request failed: [#{response[:message]}]")
|
8
|
+
elsif response.empty?
|
9
|
+
say("No languages created")
|
10
|
+
say("You can create one with epc create library-language")
|
11
|
+
else
|
12
|
+
langs_table = EPC::TabularOutputter.new(response, [:id, :name])
|
13
|
+
say(langs_table.print)
|
14
|
+
end
|
15
|
+
return status
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'time'
|
2
|
+
module EPC::Command
|
3
|
+
class ListLibrarysetsCommand < BaseCommand
|
4
|
+
|
5
|
+
def execute
|
6
|
+
status, response, headers = client.get(EPC::Config::LIBRARY_SETS_PATH)
|
7
|
+
if status.failure?
|
8
|
+
say("Request failed: [#{response[:message]}]")
|
9
|
+
elsif response.empty?
|
10
|
+
say("No sets created")
|
11
|
+
say("You can create one with epc create library-set")
|
12
|
+
else
|
13
|
+
response.each do |set|
|
14
|
+
set[:created_by] = "#{set[:created_by][:name]}(#{set[:created_by][:id]})" rescue nil
|
15
|
+
set[:last_updated_by] = "#{set[:last_updated_by][:name]}(#{set[:last_updated_by][:id]})" rescue nil
|
16
|
+
set[:created_at] = Time.parse(set[:created_at]).strftime("%m/%d/%Y %I:%M%p") rescue nil
|
17
|
+
set[:updated_at] = Time.parse(set[:updated_at]).strftime("%m/%d/%Y %I:%M%p") rescue nil
|
18
|
+
end
|
19
|
+
sets_table = EPC::TabularOutputter.new(response, [:id, :name, :created_by, :created_at, :last_updated_by, :updated_at])
|
20
|
+
say(sets_table.print)
|
21
|
+
end
|
22
|
+
return status
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListObjectrolesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(obj = nil)
|
5
|
+
|
6
|
+
raise FatalError, "You must specify an ObjectType and ObjectId" if obj.blank?
|
7
|
+
|
8
|
+
obj_type, obj_id = obj.split(":")
|
9
|
+
|
10
|
+
raise FatalError, "Parameters specified incorrectly" if obj_type.blank? || obj_id.blank?
|
11
|
+
|
12
|
+
status, response, headers = client.get(EPC::Config::ROLES_PATH + "/for_object/#{obj_type}/#{obj_id}")
|
13
|
+
|
14
|
+
if status.successful?
|
15
|
+
roles_table = EPC::TabularOutputter.new(response, [:id, :name])
|
16
|
+
say(roles_table.print)
|
17
|
+
else
|
18
|
+
say("Request failed: [#{response[:message]}]")
|
19
|
+
end
|
20
|
+
|
21
|
+
return status
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListObjecttypesCommand < BaseCommand
|
3
|
+
def execute
|
4
|
+
status, response, headers = client.get(EPC::Config::OBJECT_TYPES_PATH)
|
5
|
+
|
6
|
+
if status.failure?
|
7
|
+
say("Request failed: [#{response[:message]}]")
|
8
|
+
else
|
9
|
+
object_types = []
|
10
|
+
response.each do |type_name, identifier|
|
11
|
+
object_types << {:type_name => type_name, :identifier => identifier}
|
12
|
+
end
|
13
|
+
obj_table = EPC::TabularOutputter.new(object_types, [:type_name, :identifier])
|
14
|
+
say(obj_table.print)
|
15
|
+
end
|
16
|
+
|
17
|
+
return status
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListPermissiongroupsCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute
|
5
|
+
|
6
|
+
status, response, headers = client.get(EPC::Config::PERMISSIONS_PATH)
|
7
|
+
|
8
|
+
if status.failure?
|
9
|
+
say("Request failed: [#{response[:message]}]")
|
10
|
+
else
|
11
|
+
response.sort!{|grp1, grp2| grp1[:group_name] <=> grp2[:group_name] }
|
12
|
+
p_groups_table = EPC::TabularOutputter.new(response, [:group_name, :action])
|
13
|
+
|
14
|
+
say(p_groups_table.print)
|
15
|
+
end
|
16
|
+
|
17
|
+
return status
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListProjectsCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(solution_name = nil)
|
5
|
+
path = File.expand_path(".")
|
6
|
+
|
7
|
+
if numeric?(solution_name)
|
8
|
+
solution_id = solution_name.to_i
|
9
|
+
else
|
10
|
+
solution_id, solution_name = infer_solution_context(solution_name, path)
|
11
|
+
end
|
12
|
+
|
13
|
+
if solution_id.nil?
|
14
|
+
say("Solution could not be inferred")
|
15
|
+
say(EPC::Help::COMMAND_USAGES[:list_projects])
|
16
|
+
return 1
|
17
|
+
end
|
18
|
+
|
19
|
+
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}/projects")
|
20
|
+
|
21
|
+
if status.failure?
|
22
|
+
say("Projects retrieval failed with [#{response[:message]}]")
|
23
|
+
elsif response.empty?
|
24
|
+
say("You have no projects created. You can create them with epc create project.")
|
25
|
+
else
|
26
|
+
response.each {|project| project[:last_build_status] = nil if project[:last_build_status] == "N/A"}
|
27
|
+
response.each {|project| project[:last_build_status] = (project[:last_build_status] ? "BUILT" : "FAILED" rescue "") unless project[:last_build_status].nil?}
|
28
|
+
response.each { |resp| resp[:type] = resp[:project_type][:name] }
|
29
|
+
projects_table = EPC::TabularOutputter.new(response, {:id => "ID", :name => "NAME", :last_build_status => "BUILD_STATUS", :type => "TYPE"})
|
30
|
+
say(projects_table.print)
|
31
|
+
end
|
32
|
+
return status
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListProjecttypesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute
|
5
|
+
status, response, headers = client.get(EPC::Config::PROJECT_TYPES_PATH)
|
6
|
+
|
7
|
+
if status.failure?
|
8
|
+
say("Request failed: [#{response[:message]}]")
|
9
|
+
elsif response.empty?
|
10
|
+
say("No project types defined")
|
11
|
+
else
|
12
|
+
types_table = EPC::TabularOutputter.new(response, [:id, :name])
|
13
|
+
say(types_table.print)
|
14
|
+
end
|
15
|
+
return status
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListRolepermissionsCommand < BaseCommand
|
3
|
+
def execute
|
4
|
+
|
5
|
+
status, response, headers = client.get(EPC::Config::PERMISSIONS_PATH)
|
6
|
+
|
7
|
+
if status.successful?
|
8
|
+
if response.empty?
|
9
|
+
say("No permissions defined")
|
10
|
+
else
|
11
|
+
permissions_table = EPC::TabularOutputter.new(response, [:id, :group_name, :target_type, :action])
|
12
|
+
say(permissions_table.print)
|
13
|
+
end
|
14
|
+
else
|
15
|
+
say("Request failed: [#{response[:message]}]")
|
16
|
+
end
|
17
|
+
|
18
|
+
return status
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListRolesCommand < BaseCommand
|
3
|
+
def execute
|
4
|
+
|
5
|
+
if @options[:user].present?
|
6
|
+
status, response, headers = client.get(EPC::Config::USERS_PATH + "/#{@options[:user]}?include=roles")
|
7
|
+
response = response[:roles]
|
8
|
+
else
|
9
|
+
status, response, headers = client.get(EPC::Config::ROLES_PATH + "?system_roles=true")
|
10
|
+
end
|
11
|
+
|
12
|
+
if status.successful?
|
13
|
+
if response.empty?
|
14
|
+
say("No roles defined")
|
15
|
+
else
|
16
|
+
roles_table = EPC::TabularOutputter.new(response, [:id, :name])
|
17
|
+
say(roles_table.print)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
say("Request failed: [#{response[:message]}]")
|
21
|
+
end
|
22
|
+
|
23
|
+
return status
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListRuntimesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(*args)
|
5
|
+
status, response, headers = client.get(EPC::Config::RUNTIMES_PATH)
|
6
|
+
if status.failure?
|
7
|
+
say("Request failed with: [#{response['message']}]")
|
8
|
+
else
|
9
|
+
runtime_envs_table = EPC::TabularOutputter.new(response, [:id, :name])
|
10
|
+
say(runtime_envs_table.print)
|
11
|
+
end
|
12
|
+
return status
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListServicetypesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(*args)
|
5
|
+
status, response, headers = client.get(EPC::Config::SERVICE_TYPES_PATH)
|
6
|
+
|
7
|
+
if status.failure?
|
8
|
+
say("Service types retrieval failed with [#{response[:message]}]")
|
9
|
+
elsif response.empty?
|
10
|
+
say("There are no service types available")
|
11
|
+
else
|
12
|
+
service_types_table = EPC::TabularOutputter.new(response, [:id, :name])
|
13
|
+
say(service_types_table.print)
|
14
|
+
end
|
15
|
+
return status
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListServicedefinitionsCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(*args)
|
5
|
+
status, response, headers = client.get(EPC::Config::SERVICE_DEFINITIONS_PATH)
|
6
|
+
if status.failure?
|
7
|
+
say("Request failed with: [#{response['message']}]")
|
8
|
+
elsif response.empty?
|
9
|
+
say("No service definitions found. You can define one with #{EPC::Help::COMMAND_USAGES[:define_service]}")
|
10
|
+
else
|
11
|
+
response.each { |resp| resp[:definition_type] = resp[:service_type][:name] }
|
12
|
+
definitions_table = EPC::TabularOutputter.new(response, [:id, :name, :definition_type])
|
13
|
+
say(definitions_table.print)
|
14
|
+
end
|
15
|
+
return status
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListServiceversionsCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute()
|
5
|
+
status, response, headers = client.get(EPC::Config::SERVICE_VERSIONS_PATH)
|
6
|
+
|
7
|
+
if status.failure?
|
8
|
+
say("Request failed: [#{response[:message]}]")
|
9
|
+
elsif response.empty?
|
10
|
+
say("No service-versions have been defined.")
|
11
|
+
say("You can define one with epc create service-version.")
|
12
|
+
else
|
13
|
+
service_versions_table = EPC::TabularOutputter.new(response, {:id => "ID", :label => "LABEL", :service_definition_id => "DEFINITION ID", :service_definition_name => "DEFINITION NAME"})
|
14
|
+
say(service_versions_table.print)
|
15
|
+
end
|
16
|
+
return status
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'time'
|
2
|
+
module EPC::Command
|
3
|
+
class ListSolutionsCommand < BaseCommand
|
4
|
+
|
5
|
+
def execute(*args)
|
6
|
+
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH)
|
7
|
+
|
8
|
+
if status.failure?
|
9
|
+
say("Solutions retrieval failed with [#{response[:message]}]")
|
10
|
+
elsif response.empty?
|
11
|
+
say("You have no solutions created. You can create them with epc create solution.")
|
12
|
+
else
|
13
|
+
response.each do |resp|
|
14
|
+
resp[:created_at] = Time.parse(resp[:created_at]).strftime("%m/%d/%Y %I:%M%p")
|
15
|
+
resp[:creator_id] = resp[:created_by][:id] rescue nil
|
16
|
+
resp[:creator_name] = resp[:created_by][:name] rescue nil
|
17
|
+
end
|
18
|
+
solutions_table = EPC::TabularOutputter.new(response, [:id, :name, :build_status, :created_at, :creator_id, :creator_name])
|
19
|
+
say(solutions_table.print)
|
20
|
+
end
|
21
|
+
return status
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListStagesCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute
|
5
|
+
status, response, headers = client.get(EPC::Config::DEPLOYMENT_STAGES_PATH)
|
6
|
+
if status.failure?
|
7
|
+
say("Request failed: [#{response[:message]}]")
|
8
|
+
elsif response.empty?
|
9
|
+
say("No deployment stages available yet.")
|
10
|
+
else
|
11
|
+
response.each do |resp|
|
12
|
+
resp[:uri] = resp[:runtime_envs].collect{|r| "#{r[:default_uri_base]}(#{r[:name]})"}.join("\n")
|
13
|
+
end
|
14
|
+
stages_table = EPC::TabularOutputter.new(response, [:id, :name, :uri])
|
15
|
+
say(stages_table.print(:line_separator => true))
|
16
|
+
end
|
17
|
+
return status
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'time'
|
2
|
+
module EPC::Command
|
3
|
+
class ListUsersCommand < BaseCommand
|
4
|
+
|
5
|
+
def execute
|
6
|
+
|
7
|
+
status, response, headers = client.get(EPC::Config::USERS_PATH)
|
8
|
+
|
9
|
+
if status != 200
|
10
|
+
say("Request failed: [#{response[:message]}]")
|
11
|
+
elsif response.empty?
|
12
|
+
say("No users defined")
|
13
|
+
else
|
14
|
+
response.each do |resp|
|
15
|
+
resp[:created_at] = Time.parse(resp[:created_at]).strftime("%m/%d/%Y %I:%M%p")
|
16
|
+
end
|
17
|
+
users_table = EPC::TabularOutputter.new(response, [:id, :name, :email, :created_at])
|
18
|
+
say(users_table.print)
|
19
|
+
end
|
20
|
+
|
21
|
+
return status
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'time'
|
2
|
+
module EPC::Command
|
3
|
+
class ListVersionsCommand < BaseCommand
|
4
|
+
|
5
|
+
def execute(project = nil)
|
6
|
+
solution = @options[:solution_name]
|
7
|
+
path = File.expand_path(".")
|
8
|
+
|
9
|
+
|
10
|
+
solution_id, solution_name = infer_solution_context(solution, path, :get_solution_name => true)
|
11
|
+
project_id, project_name = infer_project_context(project, path, solution_id, {:get_project_name => true})
|
12
|
+
|
13
|
+
if project_id.nil?
|
14
|
+
say("Project could not be inferred")
|
15
|
+
say(EPC::Help::COMMAND_USAGES[:list_versions])
|
16
|
+
return 1
|
17
|
+
end
|
18
|
+
|
19
|
+
status, response, headers = client.get(EPC::Config::PROJECTS_PATH + "/#{project_id}/versions")
|
20
|
+
|
21
|
+
|
22
|
+
if status.failure?
|
23
|
+
say("Request failed: [#{response[:message]}]")
|
24
|
+
elsif response.empty?
|
25
|
+
say("There are no project versions available")
|
26
|
+
else
|
27
|
+
response.each do |resp|
|
28
|
+
resp[:build_date] = Time.parse(resp[:build_date]).strftime("%m/%d/%Y %I:%M%p") rescue "N/A"
|
29
|
+
resp[:created_at] = Time.parse(resp[:created_at]).strftime("%m/%d/%Y %I:%M%p") rescue "N/A"
|
30
|
+
resp[:built] = resp[:built] == 't' ? "BUILT" : "" rescue ""
|
31
|
+
end
|
32
|
+
versions_table = EPC::TabularOutputter.new(response, {:id => "VERSION", :event => "EVENT", :whodunnit => "USER", :created_at => "DATE", :built => "BUILD STATUS", :build_date => "BUILD DATE"})
|
33
|
+
say(versions_table.print)
|
34
|
+
end
|
35
|
+
return status
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|