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.
- data/lib/epc.rb +25 -5
- data/lib/epc/client/json_client.rb +4 -4
- data/lib/epc/command/archive_command.rb +7 -6
- data/lib/epc/command/attachto_command.rb +13 -0
- data/lib/epc/command/base_command.rb +120 -29
- data/lib/epc/command/config/create_config_command.rb +7 -11
- data/lib/epc/command/config/delete_config_command.rb +5 -5
- data/lib/epc/command/config/list_configs_command.rb +5 -5
- data/lib/epc/command/config/update_config_command.rb +11 -10
- data/lib/epc/command/copy_command.rb +14 -0
- data/lib/epc/command/create_command.rb +9 -5
- data/lib/epc/command/delete_command.rb +9 -9
- data/lib/epc/command/{copy_deployment_command.rb → deployment/copy_deployment_command.rb} +6 -5
- data/lib/epc/command/deployment/create_deployment_command.rb +15 -15
- data/lib/epc/command/deployment/list_deployments_command.rb +2 -4
- data/lib/epc/command/deployment/show_deployment_command.rb +5 -7
- data/lib/epc/command/deployment/submit_deployment_command.rb +15 -0
- data/lib/epc/command/deployment/update_deployment_command.rb +5 -14
- data/lib/epc/command/deployment/vote_deployment_command.rb +23 -0
- data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
- data/lib/epc/command/detachfrom_command.rb +13 -0
- data/lib/epc/command/group/create_group_command.rb +3 -3
- data/lib/epc/command/group/delete_group_command.rb +4 -5
- data/lib/epc/command/group/show_group_command.rb +2 -3
- data/lib/epc/command/group/update_group_command.rb +9 -7
- data/lib/epc/command/library/create_library_command.rb +1 -2
- data/lib/epc/command/library/delete_library_command.rb +4 -5
- data/lib/epc/command/library/list_libraries_command.rb +1 -1
- data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +3 -5
- data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
- data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +4 -5
- data/lib/epc/command/libraryset/create_libraryset_command.rb +5 -4
- data/lib/epc/command/libraryset/delete_libraryset_command.rb +4 -6
- data/lib/epc/command/libraryset/list_librarysets_command.rb +2 -2
- data/lib/epc/command/libraryset/show_libraryset_command.rb +3 -3
- data/lib/epc/command/libraryset/update_libraryset_command.rb +4 -3
- data/lib/epc/command/list_command.rb +10 -14
- data/lib/epc/command/list_objecttypes_command.rb +1 -1
- data/lib/epc/command/objectrole/create_objectrole_command.rb +4 -5
- data/lib/epc/command/objectrole/list_objectroles_command.rb +3 -8
- data/lib/epc/command/objectrole/update_objectrole_command.rb +3 -1
- data/lib/epc/command/permission/list_permissions_command.rb +1 -1
- data/lib/epc/command/permissiongroup/list_permissiongroups_command.rb +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +1 -2
- data/lib/epc/command/plugin/delete_plugin_command.rb +4 -6
- data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
- data/lib/epc/command/plugin/show_plugin_command.rb +2 -5
- data/lib/epc/command/plugin/update_plugin_command.rb +2 -6
- data/lib/epc/command/project/archive_project_command.rb +3 -12
- data/lib/epc/command/project/attachto_project_command.rb +133 -0
- data/lib/epc/command/project/create_project_command.rb +6 -6
- data/lib/epc/command/project/delete_project_command.rb +3 -24
- data/lib/epc/command/project/detachfrom_project_command.rb +66 -0
- data/lib/epc/command/project/list_projects_command.rb +12 -7
- data/lib/epc/command/project/show_project_command.rb +26 -25
- data/lib/epc/command/project/show_project_snapshot_command.rb +41 -0
- data/lib/epc/command/project/unarchive_project_command.rb +3 -10
- data/lib/epc/command/project/update_project_command.rb +5 -18
- data/lib/epc/command/projecttype/create_projecttype_command.rb +37 -0
- data/lib/epc/command/projecttype/delete_projecttype_command.rb +24 -0
- data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
- data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -4
- data/lib/epc/command/projecttype/update_projecttype_command.rb +61 -0
- data/lib/epc/command/push_command.rb +14 -8
- data/lib/epc/command/role/create_role_command.rb +26 -3
- data/lib/epc/command/role/delete_role_command.rb +3 -5
- data/lib/epc/command/role/list_roles_command.rb +7 -3
- data/lib/epc/command/role/show_role_command.rb +8 -5
- data/lib/epc/command/role/update_role_command.rb +14 -66
- data/lib/epc/command/runtime/create_runtime_command.rb +34 -0
- data/lib/epc/command/runtime/delete_runtime_command.rb +24 -0
- data/lib/epc/command/runtime/list_runtimes_command.rb +2 -2
- data/lib/epc/command/runtime/update_runtime_command.rb +49 -0
- data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +17 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +5 -6
- data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +18 -0
- data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +2 -2
- data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
- data/lib/epc/command/serviceversion/create_serviceversion_command.rb +8 -12
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -5
- data/lib/epc/command/serviceversion/list_serviceversions_command.rb +8 -1
- data/lib/epc/command/show_command.rb +8 -9
- data/lib/epc/command/show_metrics_command.rb +3 -3
- data/lib/epc/command/solution/archive_solution_command.rb +3 -10
- data/lib/epc/command/solution/create_solution_command.rb +2 -2
- data/lib/epc/command/solution/delete_solution_command.rb +3 -7
- data/lib/epc/command/solution/list_solutions_command.rb +11 -3
- data/lib/epc/command/solution/show_solution_command.rb +4 -6
- data/lib/epc/command/solution/unarchive_solution_command.rb +3 -8
- data/lib/epc/command/solution/update_solution_command.rb +4 -6
- data/lib/epc/command/submit_command.rb +16 -0
- data/lib/epc/command/unarchive_command.rb +7 -6
- data/lib/epc/command/update_command.rb +9 -8
- data/lib/epc/command/user/create_user_command.rb +2 -3
- data/lib/epc/command/user/delete_user_command.rb +3 -5
- data/lib/epc/command/user/list_users_command.rb +1 -1
- data/lib/epc/command/user/show_user_command.rb +2 -4
- data/lib/epc/command/user/update_user_command.rb +3 -14
- data/lib/epc/command/userproperty/list_user_properties_command.rb +23 -0
- data/lib/epc/command/vote_command.rb +16 -0
- data/lib/epc/config.rb +7 -1
- data/lib/epc/help.rb +51 -48
- data/lib/epc/modules/config.rb +39 -0
- data/lib/epc/modules/role.rb +133 -0
- data/lib/epc/runner.rb +23 -12
- data/lib/epc/version.rb +1 -1
- data/test/command/archive_project_command_test.rb +2 -13
- data/test/command/archive_solution_command_test.rb +4 -14
- data/test/command/copy_deployment_command_test.rb +4 -8
- data/test/command/create_config_command_test.rb +23 -23
- data/test/command/create_deployment_command_test.rb +33 -32
- data/test/command/create_group_command_test.rb +2 -2
- data/test/command/create_library_command_test.rb +6 -6
- data/test/command/create_librarylanguage_command_test.rb +3 -3
- data/test/command/create_libraryset_command_test.rb +6 -26
- data/test/command/create_objectrole_command_test.rb +4 -13
- data/test/command/create_project_command_test.rb +27 -13
- data/test/command/create_role_command_test.rb +3 -2
- data/test/command/create_runtime_command_test.rb +37 -0
- data/test/command/create_servicedefinition_command_test.rb +4 -17
- data/test/command/create_serviceversion_command_test.rb +8 -22
- data/test/command/create_solution_command_test.rb +5 -5
- data/test/command/create_user_command_test.rb +4 -4
- data/test/command/delete_config_command_test.rb +8 -15
- data/test/command/delete_library_command_test.rb +3 -4
- data/test/command/delete_librarylanguage_command_test.rb +3 -4
- data/test/command/delete_libraryset_command_test.rb +3 -4
- data/test/command/delete_plugin_command_test.rb +3 -4
- data/test/command/delete_project_command_test.rb +2 -10
- data/test/command/delete_projecttype_command_test.rb +31 -0
- data/test/command/delete_role_command_test.rb +5 -14
- data/test/command/delete_runtime_command_test.rb +31 -0
- data/test/command/delete_servicedefinition_command_test.rb +31 -0
- data/test/command/delete_serviceversion_command_test.rb +3 -2
- data/test/command/delete_solution_command_test.rb +3 -16
- data/test/command/delete_user_command_test.rb +3 -3
- data/test/command/list_config_command_test.rb +1 -0
- data/test/command/list_deployments_command_test.rb +11 -41
- data/test/command/list_objectroles_command_test.rb +4 -14
- data/test/command/list_projects_command_test.rb +0 -14
- data/test/command/list_roles_command_test.rb +3 -1
- data/test/command/list_runtimes_command_test.rb +2 -3
- data/test/command/list_runtimetypes_command_test.rb +29 -0
- data/test/command/list_userproperties_command_test.rb +33 -0
- data/test/command/push_command_test.rb +9 -1
- data/test/command/show_deployment_command_test.rb +36 -0
- data/test/command/show_group_command_test.rb +2 -1
- data/test/command/show_libraryset_command_test.rb +5 -3
- data/test/command/show_metrics_command_test.rb +4 -4
- data/test/command/show_plugin_command_test.rb +4 -4
- data/test/command/show_project_command_test.rb +5 -17
- data/test/command/show_project_snapshot_test.rb +33 -0
- data/test/command/show_projecttype_command_test.rb +5 -11
- data/test/command/show_role_command_test.rb +5 -12
- data/test/command/show_solution_command_test.rb +2 -15
- data/test/command/show_user_command_test.rb +4 -3
- data/test/command/submit_deployment_command_test.rb +4 -11
- data/test/command/unarchive_project_command_test.rb +2 -14
- data/test/command/unarchive_solution_command_test.rb +6 -16
- data/test/command/update_config_command_test.rb +14 -3
- data/test/command/update_deployment_command_test.rb +12 -26
- data/test/command/update_group_command_test.rb +2 -10
- data/test/command/update_librarylanguage_command_test.rb +5 -3
- data/test/command/update_libraryset_command_test.rb +4 -2
- data/test/command/update_plugin_command_test.rb +5 -4
- data/test/command/update_project_command_test.rb +6 -20
- data/test/command/update_role_command_test.rb +11 -8
- data/test/command/update_solution_command_test.rb +6 -12
- data/test/command/update_user_command_test.rb +3 -19
- data/test/command/vote_deployment_command_test.rb +2 -6
- metadata +66 -63
- data/lib/epc/command/attach_library_command.rb +0 -82
- data/lib/epc/command/attach_libraryset_command.rb +0 -31
- data/lib/epc/command/attach_runtime_command.rb +0 -26
- data/lib/epc/command/bind_service_command.rb +0 -35
- data/lib/epc/command/create_dependency_command.rb +0 -43
- data/lib/epc/command/dependency/delete_dependency_command.rb +0 -38
- data/lib/epc/command/detach_library_command.rb +0 -35
- data/lib/epc/command/detach_libraryset_command.rb +0 -8
- data/lib/epc/command/list_versions_command.rb +0 -38
- data/lib/epc/command/submit_deployment_command.rb +0 -19
- data/lib/epc/command/unbind_service_command.rb +0 -42
- data/lib/epc/command/undefine_service_command.rb +0 -33
- data/lib/epc/command/update_rolepermissions_command.rb +0 -83
- data/lib/epc/command/vote_deployment_command.rb +0 -29
- data/test/command/attach_library_command_test.rb +0 -124
- data/test/command/attach_libraryset_command_test.rb +0 -49
- data/test/command/attach_runtime_command_test.rb +0 -44
- data/test/command/bind_service_command_test.rb +0 -46
- data/test/command/create_dependency_command_test.rb +0 -55
- data/test/command/create_plugin_command_test.rb +0 -44
- data/test/command/delete_dependency_command_test.rb +0 -42
- data/test/command/detach_library_command_test.rb +0 -53
- data/test/command/unbind_service_command_test.rb +0 -48
- data/test/command/undefine_service_command_test.rb +0 -49
@@ -0,0 +1,34 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class CreateRuntimeCommand < CreateCommand
|
3
|
+
|
4
|
+
def execute(args = [])
|
5
|
+
require_target
|
6
|
+
|
7
|
+
raise FatalError, "You need to specify all mandatory parameters" if args.size < 5
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
params[:name] = args[0]
|
11
|
+
params[:target] = args[1]
|
12
|
+
params[:runtime_env_type_id] = target_id
|
13
|
+
params[:deployment_stage_id] = retrieve_identifier_for("DeploymentStage", args[2])
|
14
|
+
params[:username] = args[3]
|
15
|
+
params[:password] = args[4]
|
16
|
+
params[:info] = @options[:info] if @options[:info].present?
|
17
|
+
params[:agility_topology_id] = @options[:agility_topology] if @options[:agility_topology].present?
|
18
|
+
params[:agility_environment_id] = @options[:agility_environment] if @options[:agility_environment].present?
|
19
|
+
|
20
|
+
status, response, headers = client.post(EPC::Config::RUNTIMES_PATH, params)
|
21
|
+
|
22
|
+
if status.successful?
|
23
|
+
say("Runtime [#{args[0]}] created")
|
24
|
+
else
|
25
|
+
say("Request failed: [#{response[:message]}]")
|
26
|
+
end
|
27
|
+
|
28
|
+
return status
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class DeleteRuntimeCommand < DeleteCommand
|
3
|
+
|
4
|
+
def execute(args)
|
5
|
+
|
6
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] runtime? [Yn] ")
|
7
|
+
if proceed.upcase == 'N'
|
8
|
+
return 1
|
9
|
+
end
|
10
|
+
|
11
|
+
status, response, headers = client.delete(EPC::Config::RUNTIMES_PATH + "/#{object_id}")
|
12
|
+
|
13
|
+
if status.successful?
|
14
|
+
say("Runtime deleted")
|
15
|
+
else
|
16
|
+
say("Request failed: [#{response[:message]}]")
|
17
|
+
end
|
18
|
+
|
19
|
+
return status
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListRuntimesCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
status, response, headers = client.get(EPC::Config::RUNTIMES_PATH)
|
6
6
|
if status.failure?
|
7
|
-
say("Request failed with: [#{response[
|
7
|
+
say("Request failed with: [#{response[:message]}]")
|
8
8
|
else
|
9
9
|
runtime_envs_table = EPC::TabularOutputter.new(response, [:id, :name])
|
10
10
|
say(runtime_envs_table.print)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class UpdateRuntimeCommand < UpdateCommand
|
3
|
+
|
4
|
+
UPDATABLE_ATTRIBUTES = ["name", "target", "deployment_stage", "username", "password", "agility_topology", "agility_environment", "runtime_env_type_id", "info"]
|
5
|
+
|
6
|
+
def execute(args)
|
7
|
+
|
8
|
+
raise FatalError, "You need to specify at least one attribute to update" if args.size < 1
|
9
|
+
params = {}
|
10
|
+
|
11
|
+
args.each do |arg|
|
12
|
+
key, val = arg.split("=")
|
13
|
+
next if key.blank?
|
14
|
+
params[key] = val
|
15
|
+
end
|
16
|
+
|
17
|
+
params.each do |attr, val|
|
18
|
+
unless UPDATABLE_ATTRIBUTES.include?(attr)
|
19
|
+
params.delete(attr)
|
20
|
+
say("Cannot update #{attr}. Updatable attributes are: [#{UPDATABLE_ATTRIBUTES.join(', ')}]")
|
21
|
+
next
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
raise InputError, "You need to specify at least one attribute to update" if params.blank?
|
26
|
+
|
27
|
+
status, response, headers = client.get(EPC::Config::RUNTIMES_PATH + "/#{object_id}")
|
28
|
+
|
29
|
+
unless status.successful?
|
30
|
+
say("Request failed: [#{response[:message]}]")
|
31
|
+
return 1
|
32
|
+
end
|
33
|
+
|
34
|
+
runtime_attrs = response.merge(params.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo})
|
35
|
+
|
36
|
+
status, response, headers = client.put(EPC::Config::RUNTIMES_PATH + "/#{object_id}", runtime_attrs)
|
37
|
+
|
38
|
+
if status.successful?
|
39
|
+
say("Plugin updated")
|
40
|
+
else
|
41
|
+
say("Request failed: [#{response[:message]}]")
|
42
|
+
end
|
43
|
+
|
44
|
+
return status
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class ListRuntimetypesCommand < ListCommand
|
3
|
+
def execute(args = [])
|
4
|
+
status, response, headers = client.get(EPC::Config::RUNTIMES_PATH + "_types")
|
5
|
+
|
6
|
+
if status.successful?
|
7
|
+
types_table = EPC::TabularOutputter.new(response, [:id, :name])
|
8
|
+
say(types_table.print)
|
9
|
+
else
|
10
|
+
say("Request failed: [#{response[:message]}]")
|
11
|
+
end
|
12
|
+
|
13
|
+
return status
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class CreateServicedefinitionCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
|
6
|
-
|
7
|
-
service_type = args[1]
|
6
|
+
require_target
|
8
7
|
|
9
|
-
|
8
|
+
service_name = args.first
|
10
9
|
|
11
|
-
|
10
|
+
raise FatalError, "You must specify the name of the service definition" if service_name.blank?
|
12
11
|
|
13
|
-
status, response, headers = client.post(EPC::Config::SERVICE_DEFINITIONS_PATH, {:name => service_name, :type_id =>
|
12
|
+
status, response, headers = client.post(EPC::Config::SERVICE_DEFINITIONS_PATH, {:name => service_name, :type_id => target_id})
|
14
13
|
if status.failure?
|
15
14
|
say("Service definition failed with: [#{response[:message]}]")
|
16
15
|
else
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module EPC::Command
|
2
|
+
class DeleteServicedefinitionCommand < BaseCommand
|
3
|
+
|
4
|
+
def execute(args = [])
|
5
|
+
require_object
|
6
|
+
|
7
|
+
status, response, headers = client.delete(EPC::Config::SERVICE_DEFINITIONS_PATH + "/#{object_id}")
|
8
|
+
|
9
|
+
if status.successful?
|
10
|
+
say("Service definition deleted")
|
11
|
+
else
|
12
|
+
say("Request failed: [#{response[:message]}]")
|
13
|
+
end
|
14
|
+
|
15
|
+
return status
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListServicedefinitionsCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
|
6
6
|
status, response, headers = client.get(EPC::Config::SERVICE_DEFINITIONS_PATH)
|
7
7
|
if status.failure?
|
8
8
|
say("Request failed with: [#{response['message']}]")
|
9
9
|
elsif response.empty?
|
10
|
-
say("No service definitions found. You can
|
10
|
+
say("No service definitions found. You can create one with #{EPC::Help::COMMAND_USAGES[:create_servicedefinition]}")
|
11
11
|
else
|
12
12
|
response.each { |resp| resp[:definition_type] = resp[:service_type][:name] }
|
13
13
|
definitions_table = EPC::TabularOutputter.new(response, [:id, :name, :definition_type])
|
@@ -1,24 +1,20 @@
|
|
1
1
|
module EPC::Command
|
2
|
-
class CreateServiceversionCommand <
|
2
|
+
class CreateServiceversionCommand < CreateCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
label =
|
6
|
-
definition = params[2]
|
4
|
+
def execute(args = [])
|
5
|
+
label = args[0]
|
7
6
|
|
8
|
-
|
7
|
+
require_target
|
9
8
|
|
10
|
-
if
|
11
|
-
definition_id = definition.to_i
|
12
|
-
else
|
13
|
-
definition_id = get_resource_id(EPC::Config::SERVICE_DEFINITIONS_PATH, "name", definition)
|
14
|
-
end
|
9
|
+
raise FatalError, "You need to specify the label for this service definition" if label.blank?
|
15
10
|
|
16
|
-
|
11
|
+
@options[:backwards_compatible] = "false" if @options[:backwards_compatible].blank?
|
12
|
+
@options[:reversible] = "false" if @options[:reversible].blank?
|
17
13
|
|
18
14
|
up_script = read_file(@options[:up_script]) unless blank?(@options[:up_script])
|
19
15
|
down_script = read_file(@options[:down_script]) unless blank?(@options[:down_script])
|
20
16
|
|
21
|
-
status, response, headers = client.post(EPC::Config::SERVICE_VERSIONS_PATH, {:label => label, :
|
17
|
+
status, response, headers = client.post(EPC::Config::SERVICE_VERSIONS_PATH, {:label => label, :service_definition_id => target_id, :up_script => up_script, :down_script => down_script, :backwards_compatible => @options[:backwards_compatible], :reversible => @options[:reversible]})
|
22
18
|
|
23
19
|
if status.successful?
|
24
20
|
say("Service version successfully created.")
|
@@ -1,16 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteServiceversionCommand < DeleteCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
|
6
|
-
proceed = ask_yn("Are you sure you want to delete the [#{
|
6
|
+
proceed = ask_yn("Are you sure you want to delete the [#{object_id}] service_version. Correct? [Yn] ")
|
7
7
|
if proceed.upcase == 'N'
|
8
8
|
return 1
|
9
9
|
end
|
10
|
-
|
11
|
-
service_version_id = retrieve_identifier_for("ServiceVersion", (service_version.split(":") rescue service_version))
|
12
10
|
|
13
|
-
status, response, headers = client.delete(EPC::Config::SERVICE_VERSIONS_PATH + "/#{
|
11
|
+
status, response, headers = client.delete(EPC::Config::SERVICE_VERSIONS_PATH + "/#{object_id}")
|
14
12
|
|
15
13
|
if status.successful?
|
16
14
|
say("Service version deleted.")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ListServiceversionsCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
4
|
+
def execute(args = [])
|
5
5
|
status, response, headers = client.get(EPC::Config::SERVICE_VERSIONS_PATH)
|
6
6
|
|
7
7
|
if status.failure?
|
@@ -10,6 +10,13 @@ module EPC::Command
|
|
10
10
|
say("No service-versions have been defined.")
|
11
11
|
say("You can define one with epc create service-version.")
|
12
12
|
else
|
13
|
+
response.each do |service_version|
|
14
|
+
service_version[:service_definition_id], service_version[:service_definition_name] = if service_version[:service_definition].present?
|
15
|
+
[service_version[:service_definition][:id], service_version[:service_definition][:name]]
|
16
|
+
else
|
17
|
+
[nil, nil]
|
18
|
+
end
|
19
|
+
end
|
13
20
|
service_versions_table = EPC::TabularOutputter.new(response, {:id => "ID", :label => "LABEL", :service_definition_id => "DEFINITION ID", :service_definition_name => "DEFINITION NAME"})
|
14
21
|
say(service_versions_table.print)
|
15
22
|
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ShowCommand < BaseCommand
|
3
3
|
|
4
|
-
def execute(
|
5
|
-
|
6
|
-
|
7
|
-
raise FatalError, "
|
8
|
-
|
9
|
-
|
10
|
-
command =
|
11
|
-
|
12
|
-
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)
|
7
|
+
raise FatalError, "Could not determine ObjectType" if @object_type.blank?
|
8
|
+
@klass_name = "EPC::Command::Show#{@object_type.to_s.gsub("-","").capitalize}Command"
|
9
|
+
command = eval(@klass_name).new(client, @options)
|
10
|
+
command.context_params = context_params
|
11
|
+
command.execute(params)
|
13
12
|
end
|
14
13
|
|
15
14
|
private
|
@@ -1,15 +1,9 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class ArchiveSolutionCommand < ArchiveCommand
|
3
|
-
def execute(
|
3
|
+
def execute(args = [])
|
4
|
+
require_object
|
4
5
|
|
5
|
-
|
6
|
-
path = File.expand_path(path)
|
7
|
-
|
8
|
-
solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
|
9
|
-
|
10
|
-
raise FatalError, "Solution could not be inferred" if solution_id.nil?
|
11
|
-
|
12
|
-
status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}", {:archived => true, :name => solution_name})
|
6
|
+
status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{object_id}", {:archived => true})
|
13
7
|
if status.successful?
|
14
8
|
say("Solution has been archived.")
|
15
9
|
else
|
@@ -19,4 +13,3 @@ module EPC::Command
|
|
19
13
|
end
|
20
14
|
end
|
21
15
|
end
|
22
|
-
|
@@ -1,18 +1,14 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class DeleteSolutionCommand < DeleteCommand
|
3
|
-
def execute(
|
3
|
+
def execute(args = [])
|
4
4
|
path = File.expand_path(".")
|
5
|
-
solution_name = nil if solution_name.blank?
|
6
|
-
solution_id, solution_name = infer_solution_context(solution_name, path, :get_solution_name => true)
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
proceed = ask_yn("Are you sure you want to delete [#{solution_id} - #{solution_name}]. Correct? [Yn] ")
|
6
|
+
proceed = ask_yn("Are you sure you want to delete [#{object_id}]. Correct? [Yn] ")
|
11
7
|
if proceed.upcase == 'N'
|
12
8
|
return 1
|
13
9
|
end
|
14
10
|
|
15
|
-
status, response, message = client.delete(EPC::Config::SOLUTIONS_PATH + "/#{
|
11
|
+
status, response, message = client.delete(EPC::Config::SOLUTIONS_PATH + "/#{object_id}")
|
16
12
|
if status.successful?
|
17
13
|
remove_solution_metadata(project_solution_path(path)) if EPC::Config.is_solution_dir?(path) || EPC::Config.is_project_dir?(path)
|
18
14
|
say("Solution deleted.")
|
@@ -2,8 +2,15 @@ require 'time'
|
|
2
2
|
module EPC::Command
|
3
3
|
class ListSolutionsCommand < BaseCommand
|
4
4
|
|
5
|
-
def execute(
|
6
|
-
|
5
|
+
def execute(args = [])
|
6
|
+
fields = [:id, :name, :build_status, :created_at, :creator_id, :creator_name]
|
7
|
+
path = if @options[:archived]
|
8
|
+
fields << :archived
|
9
|
+
"?include=archived"
|
10
|
+
else
|
11
|
+
""
|
12
|
+
end
|
13
|
+
status, response, headers = client.get(EPC::Config::SOLUTIONS_PATH + path)
|
7
14
|
|
8
15
|
if status.failure?
|
9
16
|
say("Solutions retrieval failed with [#{response[:message]}]")
|
@@ -14,8 +21,9 @@ module EPC::Command
|
|
14
21
|
resp[:created_at] = Time.parse(resp[:created_at]).strftime("%m/%d/%Y %I:%M%p")
|
15
22
|
resp[:creator_id] = resp[:created_by][:id] rescue nil
|
16
23
|
resp[:creator_name] = resp[:created_by][:name] rescue nil
|
24
|
+
resp[:archived] = ((resp[:archived].to_s == "true") ? 't' : 'f') if @options[:archived]
|
17
25
|
end
|
18
|
-
solutions_table = EPC::TabularOutputter.new(response,
|
26
|
+
solutions_table = EPC::TabularOutputter.new(response, fields)
|
19
27
|
say(solutions_table.print)
|
20
28
|
end
|
21
29
|
return status
|
@@ -2,14 +2,12 @@ require 'time'
|
|
2
2
|
module EPC::Command
|
3
3
|
class ShowSolutionCommand < ShowCommand
|
4
4
|
|
5
|
-
def execute(
|
6
|
-
|
7
|
-
|
8
|
-
solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})
|
5
|
+
def execute(args = [])
|
6
|
+
require_object
|
9
7
|
|
10
|
-
|
8
|
+
path = File.expand_path(".")
|
11
9
|
|
12
|
-
status, response, message = client.get(EPC::Config::SOLUTIONS_PATH + "/#{
|
10
|
+
status, response, message = client.get(EPC::Config::SOLUTIONS_PATH + "/#{object_id}?include=config_values,projects,deployments,deployment_configs")
|
13
11
|
if status.failure?
|
14
12
|
say("Request failed: [#{response[:message]}]")
|
15
13
|
return status
|
@@ -1,20 +1,15 @@
|
|
1
1
|
module EPC::Command
|
2
2
|
class UnarchiveSolutionCommand < UnarchiveCommand
|
3
|
-
def execute(
|
4
|
-
path = "."
|
5
|
-
path = File.expand_path(path)
|
3
|
+
def execute(args = [])
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
raise FatalError, "Solution could not be inferred" if solution_id.nil?
|
10
|
-
|
11
|
-
status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}", {:archived => false, :name => solution_name})
|
5
|
+
status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{object_id}", {:archived => false})
|
12
6
|
if status.successful?
|
13
7
|
say("Solution has been unarchived.")
|
14
8
|
else
|
15
9
|
say("Solution could not be unarchived. Request failed with: [#{response[:message]}]")
|
16
10
|
end
|
17
11
|
return status
|
12
|
+
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|