epc 1.0.2 → 1.0.3
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/lib/epc.rb +71 -54
- data/lib/epc/command/archive_command.rb +12 -0
- data/lib/epc/command/attach_libraryset_command.rb +1 -2
- data/lib/epc/command/attach_runtime_command.rb +0 -1
- data/lib/epc/command/base_command.rb +52 -63
- data/lib/epc/command/config/delete_config_command.rb +57 -0
- data/lib/epc/command/{list_config_command.rb → config/list_configs_command.rb} +1 -1
- data/lib/epc/command/config/update_config_command.rb +56 -0
- data/lib/epc/command/create_command.rb +0 -1
- data/lib/epc/command/delete_command.rb +16 -0
- data/lib/epc/command/{delete_dependency_command.rb → dependency/delete_dependency_command.rb} +14 -16
- data/lib/epc/command/deploy_command.rb +1 -2
- data/lib/epc/command/deployment/list_deployments_command.rb +49 -0
- data/lib/epc/command/deployment/show_deployment_command.rb +61 -0
- data/lib/epc/command/{update_deploymentproject_command.rb → deployment/update_deployment_command.rb} +3 -3
- data/lib/epc/command/{list_stages_command.rb → deploymentstage/list_deploymentstages_command.rb} +1 -1
- data/lib/epc/command/group/delete_group_command.rb +25 -0
- data/lib/epc/command/{list_groups_command.rb → group/list_groups_command.rb} +1 -1
- data/lib/epc/command/{show_group_command.rb → group/show_group_command.rb} +2 -9
- data/lib/epc/command/{update_group_command.rb → group/update_group_command.rb} +3 -20
- data/lib/epc/command/library/create_library_command.rb +2 -5
- data/lib/epc/command/library/delete_library_command.rb +23 -0
- data/lib/epc/command/{list_libraries_command.rb → library/list_libraries_command.rb} +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +24 -0
- data/lib/epc/command/{list_librarylanguages_command.rb → librarylanguage/list_librarylanguages_command.rb} +1 -1
- data/lib/epc/command/{update_librarylanguage_command.rb → librarylanguage/update_librarylanguage_command.rb} +6 -10
- data/lib/epc/command/libraryset/create_libraryset_command.rb +1 -6
- data/lib/epc/command/{delete_libraryset_command.rb → libraryset/delete_libraryset_command.rb} +2 -18
- data/lib/epc/command/{list_librarysets_command.rb → libraryset/list_librarysets_command.rb} +1 -1
- data/lib/epc/command/{show_libraryset_command.rb → libraryset/show_libraryset_command.rb} +2 -17
- data/lib/epc/command/{update_libraryset_command.rb → libraryset/update_libraryset_command.rb} +4 -16
- data/lib/epc/command/list_command.rb +22 -0
- data/lib/epc/command/list_metrics_command.rb +25 -0
- data/lib/epc/command/list_objecttypes_command.rb +2 -4
- data/lib/epc/command/list_versions_command.rb +0 -1
- data/lib/epc/command/{list_objectroles_command.rb → objectrole/list_objectroles_command.rb} +3 -3
- data/lib/epc/command/objectrole/update_objectrole_command.rb +14 -0
- data/lib/epc/command/{list_rolepermissions_command.rb → permission/list_permissions_command.rb} +2 -2
- data/lib/epc/command/{list_permissiongroups_command.rb → permissiongroup/list_permissiongroups_command.rb} +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +42 -0
- data/lib/epc/command/plugin/delete_plugin_command.rb +26 -0
- data/lib/epc/command/plugin/list_plugins_command.rb +19 -0
- data/lib/epc/command/plugin/show_plugin_command.rb +29 -0
- data/lib/epc/command/plugin/update_plugin_command.rb +53 -0
- data/lib/epc/command/{archive_project_command.rb → project/archive_project_command.rb} +4 -3
- data/lib/epc/command/{delete_project_command.rb → project/delete_project_command.rb} +11 -7
- data/lib/epc/command/{list_projects_command.rb → project/list_projects_command.rb} +8 -9
- data/lib/epc/command/{show_project_command.rb → project/show_project_command.rb} +64 -29
- data/lib/epc/command/{unarchive_project_command.rb → project/unarchive_project_command.rb} +5 -4
- data/lib/epc/command/{update_project_command.rb → project/update_project_command.rb} +11 -5
- data/lib/epc/command/{list_projecttypes_command.rb → projecttype/list_projecttypes_command.rb} +1 -1
- data/lib/epc/command/{show_projecttype_command.rb → projecttype/show_projecttype_command.rb} +4 -3
- data/lib/epc/command/pull_command.rb +33 -35
- data/lib/epc/command/{delete_role_command.rb → role/delete_role_command.rb} +3 -4
- data/lib/epc/command/{list_roles_command.rb → role/list_roles_command.rb} +4 -3
- data/lib/epc/command/{show_role_command.rb → role/show_role_command.rb} +18 -10
- data/lib/epc/command/role/update_role_command.rb +95 -0
- data/lib/epc/command/{list_runtimes_command.rb → runtime/list_runtimes_command.rb} +0 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +23 -0
- data/lib/epc/command/{list_servicedefinitions_command.rb → servicedefinition/list_servicedefinitions_command.rb} +1 -0
- data/lib/epc/command/{list_service_types_command.rb → servicetype/list_servicetypes_command.rb} +0 -0
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +24 -0
- data/lib/epc/command/{list_serviceversions_command.rb → serviceversion/list_serviceversions_command.rb} +1 -1
- data/lib/epc/command/show_command.rb +27 -0
- data/lib/epc/command/show_instances_command.rb +33 -0
- data/lib/epc/command/show_metrics_command.rb +55 -0
- data/lib/epc/command/{archive_solution_command.rb → solution/archive_solution_command.rb} +2 -1
- data/lib/epc/command/solution/create_solution_command.rb +0 -1
- data/lib/epc/command/{delete_solution_command.rb → solution/delete_solution_command.rb} +5 -10
- data/lib/epc/command/solution/list_solutions_command.rb +1 -1
- data/lib/epc/command/{show_solution_command.rb → solution/show_solution_command.rb} +12 -7
- data/lib/epc/command/{unarchive_solution_command.rb → solution/unarchive_solution_command.rb} +1 -1
- data/lib/epc/command/solution/update_solution_command.rb +2 -1
- data/lib/epc/command/unarchive_command.rb +12 -0
- data/lib/epc/command/update_command.rb +15 -0
- data/lib/epc/command/update_rolepermissions_command.rb +2 -2
- data/lib/epc/command/{delete_user_command.rb → user/delete_user_command.rb} +4 -12
- data/lib/epc/command/{list_users_command.rb → user/list_users_command.rb} +1 -1
- data/lib/epc/command/{show_user_command.rb → user/show_user_command.rb} +3 -17
- data/lib/epc/command/{update_user_command.rb → user/update_user_command.rb} +2 -4
- data/lib/epc/config.rb +4 -1
- data/lib/epc/help.rb +50 -35
- data/lib/epc/runner.rb +16 -5
- data/lib/epc/version.rb +1 -1
- data/lib/epc/vertical_bar.rb +40 -0
- data/test/command/create_library_command_test.rb +5 -2
- data/test/command/create_libraryset_command_test.rb +1 -1
- data/test/command/create_plugin_command_test.rb +44 -0
- data/test/command/create_servicedefinition_command_test.rb +43 -0
- data/test/command/delete_config_command_test.rb +0 -11
- data/test/command/delete_dependency_command_test.rb +3 -11
- data/test/command/delete_library_command_test.rb +2 -15
- data/test/command/delete_librarylanguage_command_test.rb +2 -24
- data/test/command/delete_libraryset_command_test.rb +2 -24
- data/test/command/delete_plugin_command_test.rb +32 -0
- data/test/command/delete_project_command_test.rb +0 -6
- data/test/command/delete_role_command_test.rb +1 -1
- data/test/command/delete_serviceversion_command_test.rb +0 -22
- data/test/command/delete_solution_command_test.rb +4 -4
- data/test/command/delete_user_command_test.rb +2 -24
- data/test/command/list_config_command_test.rb +3 -3
- data/test/command/list_deployments_command_test.rb +17 -20
- data/test/command/list_deploymentstages_command_test.rb +2 -2
- data/test/command/list_metrics_command_test.rb +40 -0
- data/test/command/{list_rolepermissions_command_test.rb → list_permissions_command_test.rb} +2 -2
- data/test/command/list_plugins_command_test.rb +27 -0
- data/test/command/list_projects_command_test.rb +3 -5
- data/test/command/list_roles_command_test.rb +2 -3
- data/test/command/pull_command_test.rb +13 -9
- data/test/command/show_group_command_test.rb +1 -23
- data/test/command/show_instances_command_test.rb +33 -0
- data/test/command/show_libraryset_command_test.rb +0 -11
- data/test/command/show_metrics_command_test.rb +51 -0
- data/test/command/show_plugin_command_test.rb +28 -0
- data/test/command/show_project_command_test.rb +1 -1
- data/test/command/show_projecttype_command_test.rb +0 -5
- data/test/command/show_role_command_test.rb +1 -1
- data/test/command/show_solution_command_test.rb +1 -1
- data/test/command/show_user_command_test.rb +2 -22
- data/test/command/update_config_command_test.rb +3 -9
- data/test/command/{update_deploymentproject_command_test.rb → update_deployment_command_test.rb} +6 -11
- data/test/command/update_group_command_test.rb +1 -20
- data/test/command/update_librarylanguage_command_test.rb +0 -15
- data/test/command/update_libraryset_command_test.rb +0 -13
- data/test/command/update_plugin_command_test.rb +41 -0
- data/test/command/update_project_command_test.rb +3 -3
- data/test/command/update_role_command_test.rb +2 -1
- data/test/command/update_solution_command_test.rb +3 -9
- data/test/command/update_user_command_test.rb +0 -6
- metadata +177 -165
- data/lib/epc/command/define_service_command.rb +0 -37
- data/lib/epc/command/delete_config_command.rb +0 -63
- data/lib/epc/command/delete_group_command.rb +0 -40
- data/lib/epc/command/delete_library_command.rb +0 -30
- data/lib/epc/command/delete_librarylanguage_command.rb +0 -40
- data/lib/epc/command/delete_serviceversion_command.rb +0 -52
- data/lib/epc/command/list_approvals_command.rb +0 -27
- data/lib/epc/command/list_attachedlibraries_command.rb +0 -42
- data/lib/epc/command/list_boundservices_command.rb +0 -40
- data/lib/epc/command/list_dependencies_command.rb +0 -43
- data/lib/epc/command/list_deployments_command.rb +0 -68
- data/lib/epc/command/list_solutions_command.rb +0 -25
- data/lib/epc/command/show_deployment_command.rb +0 -57
- data/lib/epc/command/update_config_command.rb +0 -62
- data/lib/epc/command/update_role_command.rb +0 -47
- data/lib/epc/command/update_solution_command.rb +0 -45
- data/test/command/define_service_command_test.rb +0 -55
- data/test/command/delete_group_command_test.rb +0 -56
- data/test/command/list_approvals_command_test.rb +0 -41
- data/test/command/list_boundservices_command_test.rb +0 -46
- data/test/command/list_dependencies_command_test.rb +0 -46
- data/test/command/update_rolepermissions_command_test.rb +0 -54
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class UpdateRoleCommand < UpdateCommand
|
|
3
|
+
|
|
4
|
+
required_options :add_user, :remove_user, :add_group, :remove_group, :add_grant, :remove_grant, :mode => :any?, :message => "You must specify a user/group/grant to added or removed"
|
|
5
|
+
|
|
6
|
+
def execute(role = nil, *args)
|
|
7
|
+
role_id = retrieve_identifier_for("Role", role)
|
|
8
|
+
|
|
9
|
+
if @options[:add_user].present?
|
|
10
|
+
user_id = retrieve_identifier_for("User", @options[:add_user])
|
|
11
|
+
params = []
|
|
12
|
+
params << {:member_id => user_id.to_i, :member_type => "User"}
|
|
13
|
+
|
|
14
|
+
status, response, headers = client.put(EPC::Config::ROLES_PATH + "/#{role_id}/assign_members", {:role_memberships => params})
|
|
15
|
+
say("User added to role") if status.successful?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if @options[:remove_user].present?
|
|
20
|
+
user_id = retrieve_identifier_for("User", @options[:add_user])
|
|
21
|
+
status, response, headers = client.delete(EPC::Config::ROLES_PATH + "/#{role_id}/remove_member", {:member_id => @options[:remove_user], :member_type => "User"})
|
|
22
|
+
say("User removed from role") if status.successful?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if @options[:add_group].present?
|
|
26
|
+
group_id = retrieve_identifier_for("UserGroup", @options[:add_group])
|
|
27
|
+
params = []
|
|
28
|
+
params << {:member_id => group_id.to_i, :member_type => "UserGroup"}
|
|
29
|
+
|
|
30
|
+
status, response, headers = client.put(EPC::Config::ROLES_PATH + "/#{role_id}/assign_members", {:role_memberships => params})
|
|
31
|
+
say("UserGroup added to role") if status.successful?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if @options[:remove_group].present?
|
|
36
|
+
group_id = retrieve_identifier_for("UserGroup", @options[:remove_group])
|
|
37
|
+
status, response, headers = client.delete(EPC::Config::ROLES_PATH + "/#{role_id}/remove_member", {:member_id => group_id, :member_type => "UserGroup"})
|
|
38
|
+
say("UserGroup removed from role") if status.successful?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if @options[:add_grant].present?
|
|
44
|
+
secured_type, action, secured_id = @options[:add_grant].split(":")
|
|
45
|
+
raise FatalError, "Grant incorrectly specified" if secured_type.blank? || action.blank?
|
|
46
|
+
|
|
47
|
+
params = {}
|
|
48
|
+
params[:grant_action] = action
|
|
49
|
+
params[:permitted_type] = "Role"
|
|
50
|
+
params[:permitted_id] = role_id.to_i
|
|
51
|
+
params[:secured_type] = secured_type
|
|
52
|
+
params[:secured_id] = secured_id if secured_id.present?
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
status, response, headers = client.post(EPC::Config::GRANTS_PATH, params)
|
|
56
|
+
|
|
57
|
+
if status.successful?
|
|
58
|
+
say("Role permission updated")
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if @options[:remove_grant].present?
|
|
64
|
+
secured_type, action, secured_id = @options[:remove_grant].split(":")
|
|
65
|
+
status, response, headers = client.get(EPC::Config::ROLES_PATH + "/#{role_id}/grants")
|
|
66
|
+
|
|
67
|
+
if status.successful?
|
|
68
|
+
grant_id = response.detect do |g|
|
|
69
|
+
found = (g[:action] == action)
|
|
70
|
+
found = found && (g[:secured_type].to_s == secured_type)
|
|
71
|
+
if secured_id.blank?
|
|
72
|
+
found = found && g[:secured_id].blank?
|
|
73
|
+
else
|
|
74
|
+
found = found && (g[:secured_id].to_s == secured_id)
|
|
75
|
+
end
|
|
76
|
+
found
|
|
77
|
+
end[:id] rescue nil
|
|
78
|
+
|
|
79
|
+
raise FatalError, "Permission couldn't be determined" if grant_id.blank?
|
|
80
|
+
|
|
81
|
+
status, response, headers = client.delete(EPC::Config::GRANTS_PATH + "/#{grant_id}")
|
|
82
|
+
|
|
83
|
+
if status.successful?
|
|
84
|
+
say("Role permission deleted")
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
say("Request failed: [#{response[:message]}]") unless status.successful?
|
|
92
|
+
return status
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class CreateServicedefinitionCommand < BaseCommand
|
|
3
|
+
|
|
4
|
+
def execute(target, *args)
|
|
5
|
+
|
|
6
|
+
service_name = args.first
|
|
7
|
+
service_type = args[1]
|
|
8
|
+
|
|
9
|
+
raise FatalError, "You must specify both the service definition name and service type" if service_name.blank? || service_type.blank?
|
|
10
|
+
|
|
11
|
+
service_type_id = retrieve_identifier_for("ServiceType", service_type)
|
|
12
|
+
|
|
13
|
+
status, response, headers = client.post(EPC::Config::SERVICE_DEFINITIONS_PATH, {:name => service_name, :type_id => service_type_id})
|
|
14
|
+
if status.failure?
|
|
15
|
+
say("Service definition failed with: [#{response[:message]}]")
|
|
16
|
+
else
|
|
17
|
+
say("#{service_name} has been defined.")
|
|
18
|
+
end
|
|
19
|
+
return status
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
data/lib/epc/command/{list_service_types_command.rb → servicetype/list_servicetypes_command.rb}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class DeleteServiceversionCommand < DeleteCommand
|
|
3
|
+
|
|
4
|
+
def execute(service_version = nil, *args)
|
|
5
|
+
|
|
6
|
+
proceed = ask_yn("Are you sure you want to delete the [#{service_version}] service_version. Correct? [Yn] ")
|
|
7
|
+
if proceed.upcase == 'N'
|
|
8
|
+
return 1
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
service_version_id = retrieve_identifier_for("ServiceVersion", (service_version.split(":") rescue service_version))
|
|
12
|
+
|
|
13
|
+
status, response, headers = client.delete(EPC::Config::SERVICE_VERSIONS_PATH + "/#{service_version_id}")
|
|
14
|
+
|
|
15
|
+
if status.successful?
|
|
16
|
+
say("Service version deleted.")
|
|
17
|
+
else
|
|
18
|
+
say("Request failed: [#{response[:message]}]")
|
|
19
|
+
end
|
|
20
|
+
return status
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class ShowCommand < BaseCommand
|
|
3
|
+
|
|
4
|
+
def execute(object = nil, *params)
|
|
5
|
+
@object_type = object.split(":").first rescue nil
|
|
6
|
+
@object_id = object.split(":")[1..-1].join(":") rescue nil
|
|
7
|
+
raise FatalError, "Object incorrectly specified" if @object_type.blank?
|
|
8
|
+
klass = "EPC::Command::Show#{@object_type.to_s.gsub("-","").capitalize}Command"
|
|
9
|
+
params = normalize_params(params)
|
|
10
|
+
command = eval(klass).new(client, @options)
|
|
11
|
+
check_params
|
|
12
|
+
command.go(@object_id, *params)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def show?(entity)
|
|
18
|
+
translated_entity = translate_showparam(entity)
|
|
19
|
+
return @response[translated_entity].present? && (@showables.include?(entity) || @showables.blank?)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def translate_showparam(entity)
|
|
23
|
+
return @showable_translations[entity] if @showable_translations.present? && @showable_translations.include?(entity)
|
|
24
|
+
return entity
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class ShowInstancesCommand < BaseCommand
|
|
3
|
+
|
|
4
|
+
def execute(deployed_project_id=nil, *args)
|
|
5
|
+
deployed_project_id = args[1]
|
|
6
|
+
|
|
7
|
+
if deployed_project_id.nil?
|
|
8
|
+
say("You must specify the deployed project id.")
|
|
9
|
+
say(EPC::Help::COMMAND_USAGES[:show_instances])
|
|
10
|
+
return 1
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
opts = options[:include_inactive] ? '?include_inactive=true' : ''
|
|
14
|
+
path = "#{deployed_project_id}/instances#{opts}"
|
|
15
|
+
url = "#{EPC::Config::INSTANCES_PATH}/#{path}"
|
|
16
|
+
|
|
17
|
+
status, response, headers = client.get(url)
|
|
18
|
+
unless status.successful?
|
|
19
|
+
say("Request failed: [#{response[:message]}]")
|
|
20
|
+
return status
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
values = []
|
|
24
|
+
response.each_pair do |k,v|
|
|
25
|
+
values << {instance_id: "#{k}", active: "#{v[:active]}"}
|
|
26
|
+
end
|
|
27
|
+
table = EPC::TabularOutputter.new(values, [:instance_id, :active])
|
|
28
|
+
say(table.print(:line_separator => true))
|
|
29
|
+
|
|
30
|
+
status
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class ShowMetricsCommand < BaseCommand
|
|
3
|
+
|
|
4
|
+
def execute(*args)
|
|
5
|
+
|
|
6
|
+
id = args[2]
|
|
7
|
+
metrics = args[3]
|
|
8
|
+
|
|
9
|
+
if id.nil?
|
|
10
|
+
say("You must specify the target object id.")
|
|
11
|
+
say(EPC::Help::COMMAND_USAGES[:show_metrics])
|
|
12
|
+
return 1
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
if metrics.nil?
|
|
16
|
+
say("You must specify the metrics to display.")
|
|
17
|
+
say(EPC::Help::COMMAND_USAGES[:show_metrics])
|
|
18
|
+
return 1
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
path = "#{CGI.escape(id)}/metrics/#{CGI.escape(metrics)}"
|
|
22
|
+
opts = []
|
|
23
|
+
opts << "start=#{CGI.escape(options[:start])}" if options[:start]
|
|
24
|
+
opts << "stop=#{CGI.escape(options[:stop])}" if options[:stop]
|
|
25
|
+
opts << "step=#{CGI.escape(options[:step])}" if options[:step]
|
|
26
|
+
path += "?#{opts.join('&')}" unless opts.empty?
|
|
27
|
+
url = "#{EPC::Config::MONITORED_PATH}/#{path}"
|
|
28
|
+
|
|
29
|
+
# todo: why doesn't this auto-follow the redirect?
|
|
30
|
+
status, response, headers = client.get(url)
|
|
31
|
+
unless status == 302
|
|
32
|
+
say("Request failed: [#{response[:message]}]")
|
|
33
|
+
return status
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
status, response, headers = http_client.get(headers[:uri])
|
|
37
|
+
unless status.successful?
|
|
38
|
+
say("Request failed: [#{response[:message]}]")
|
|
39
|
+
return status
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
response = JSON.parse(response) if response
|
|
43
|
+
say response.inspect
|
|
44
|
+
|
|
45
|
+
response.each_pair do |id,v|
|
|
46
|
+
v.each_pair do |metric, details|
|
|
47
|
+
say "#{id} #{metric} start: #{details['start']} stop: #{details['stop']} step: #{details['step']}"
|
|
48
|
+
say(EPC::VerticalBar.new(details['data']).print)
|
|
49
|
+
end
|
|
50
|
+
end if @options[:graph]
|
|
51
|
+
|
|
52
|
+
status
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
|
-
class DeleteSolutionCommand <
|
|
3
|
-
def execute(solution_name = nil)
|
|
4
|
-
path = "."
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
class DeleteSolutionCommand < DeleteCommand
|
|
3
|
+
def execute(solution_name = nil, *args)
|
|
4
|
+
path = File.expand_path(".")
|
|
5
|
+
solution_name = nil if solution_name.blank?
|
|
8
6
|
solution_id, solution_name = infer_solution_context(solution_name, path, :get_solution_name => true)
|
|
9
7
|
|
|
10
|
-
if solution_id.
|
|
11
|
-
say("Solution could not be inferred")
|
|
12
|
-
return 1
|
|
13
|
-
end
|
|
8
|
+
raise FatalError, "Solution could not be inferred" if solution_id.blank?
|
|
14
9
|
|
|
15
10
|
proceed = ask_yn("Are you sure you want to delete [#{solution_id} - #{solution_name}]. Correct? [Yn] ")
|
|
16
11
|
if proceed.upcase == 'N'
|
|
@@ -6,7 +6,7 @@ module EPC::Command
|
|
|
6
6
|
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH)
|
|
7
7
|
|
|
8
8
|
if status.failure?
|
|
9
|
-
say("
|
|
9
|
+
say("Solutions retrieval failed with [#{response[:message]}]")
|
|
10
10
|
elsif response.empty?
|
|
11
11
|
say("You have no solutions created. You can create them with epc create solution.")
|
|
12
12
|
else
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'time'
|
|
2
2
|
module EPC::Command
|
|
3
|
-
class ShowSolutionCommand <
|
|
3
|
+
class ShowSolutionCommand < ShowCommand
|
|
4
4
|
|
|
5
|
-
def execute(solution_name = nil)
|
|
5
|
+
def execute(solution_name = nil, *args)
|
|
6
6
|
path = File.expand_path(".")
|
|
7
7
|
|
|
8
8
|
solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
|
|
@@ -14,7 +14,8 @@ module EPC::Command
|
|
|
14
14
|
say("Request failed: [#{response[:message]}]")
|
|
15
15
|
return status
|
|
16
16
|
end
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
@showables = args[1..-1].map(&:to_sym) rescue []
|
|
18
19
|
|
|
19
20
|
response[:build_date] = Time.parse(response[:build_date]).strftime("%m/%d/%Y %I:%M%p") rescue nil
|
|
20
21
|
response[:updated_at] = Time.parse(response[:updated_at]).strftime("%m/%d/%Y %I:%M%p") rescue nil
|
|
@@ -34,15 +35,19 @@ module EPC::Command
|
|
|
34
35
|
deployments_table = EPC::TabularOutputter.new(response[:deployments], {:id => "ID", :deployment_stage_name => "STAGE", :status => "STATUS", :updated_at => "LAST UPDATE"})
|
|
35
36
|
config_values_table = EPC::TabularOutputter.new(response[:config_values], [:name, :value, :require, :value_type])
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
@response = response
|
|
39
|
+
|
|
40
|
+
if @showables.blank?
|
|
41
|
+
say("\nSolution details:")
|
|
42
|
+
say(solution_table.print)
|
|
43
|
+
end
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
if show? :projects
|
|
41
46
|
say("\nProjects:")
|
|
42
47
|
say(projects_table.print)
|
|
43
48
|
end
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
if show? :deployments
|
|
46
51
|
say("\nDeployments:")
|
|
47
52
|
say(deployments_table.print)
|
|
48
53
|
end
|
|
@@ -2,7 +2,7 @@ module EPC::Command
|
|
|
2
2
|
class UpdateSolutionCommand < BaseCommand
|
|
3
3
|
UPDATABLE_ATTRIBUTES = ["name"]
|
|
4
4
|
|
|
5
|
-
def execute(*args)
|
|
5
|
+
def execute(solution = nil, *args)
|
|
6
6
|
path = File.expand_path(".")
|
|
7
7
|
path = project_solution_path(path)
|
|
8
8
|
|
|
@@ -13,6 +13,7 @@ module EPC::Command
|
|
|
13
13
|
args_hash = {}
|
|
14
14
|
args.each do |arg|
|
|
15
15
|
key, val = arg.split("=")
|
|
16
|
+
next if key.nil?
|
|
16
17
|
args_hash[key] = val
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class UnarchiveCommand < BaseCommand
|
|
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)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module EPC::Command
|
|
2
|
+
class UpdateCommand < BaseCommand
|
|
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)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|