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
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
|
-
class DeleteUserCommand <
|
|
3
|
-
def execute(user = nil)
|
|
4
|
-
|
|
5
|
-
raise FatalError, "You need to specify a user id/email" if user.nil?
|
|
2
|
+
class DeleteUserCommand < DeleteCommand
|
|
3
|
+
def execute(user = nil, *args)
|
|
6
4
|
|
|
7
5
|
proceed = ask_yn("Are you sure you want to delete the [#{user}] user? [Yn] ")
|
|
8
6
|
if proceed.upcase == "N"
|
|
9
7
|
return 1
|
|
10
8
|
end
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
else
|
|
15
|
-
user_id = get_resource_id(EPC::Config::USERS_PATH, :email, user)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
raise FatalError, "User could not be determined" if user_id.blank? || user_id == 0
|
|
19
|
-
|
|
10
|
+
user_id = retrieve_identifier_for("User", user)
|
|
11
|
+
|
|
20
12
|
status, response, headers = client.delete(EPC::Config::USERS_PATH + "/#{user_id}")
|
|
21
13
|
|
|
22
14
|
if status == 200
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
|
-
class ShowUserCommand <
|
|
2
|
+
class ShowUserCommand < ShowCommand
|
|
3
3
|
|
|
4
|
-
def execute(user = nil)
|
|
5
|
-
if user.nil?
|
|
6
|
-
say("You need to specify a user id/email")
|
|
7
|
-
say(EPC::Help::COMMAND_USAGES[:show_user])
|
|
8
|
-
return 1
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
if numeric?(user)
|
|
12
|
-
user_id = user.to_i
|
|
13
|
-
else
|
|
14
|
-
user_id = get_resource_id(EPC::Config::USERS_PATH, :email, user)
|
|
15
|
-
end
|
|
4
|
+
def execute(user = nil, *args)
|
|
16
5
|
|
|
17
|
-
|
|
18
|
-
say("User could not be found")
|
|
19
|
-
return 1
|
|
20
|
-
end
|
|
6
|
+
user_id = retrieve_identifier_for("User", user)
|
|
21
7
|
|
|
22
8
|
status, response, headers = client.get(EPC::Config::USERS_PATH + "/#{user_id}?include=user_groups")
|
|
23
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module EPC::Command
|
|
2
2
|
class UpdateUserCommand < BaseCommand
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
required_options :email, :password, :mode => :any?, :message => "You must specify the attribute to be updated: email/password"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
def execute(user = nil, *args)
|
|
7
7
|
|
|
8
8
|
if @options[:password].present?
|
|
9
9
|
if numeric?(user)
|
|
@@ -49,8 +49,6 @@ module EPC::Command
|
|
|
49
49
|
|
|
50
50
|
return status
|
|
51
51
|
end
|
|
52
|
-
|
|
53
|
-
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
end
|
data/lib/epc/config.rb
CHANGED
|
@@ -37,7 +37,10 @@ module EPC
|
|
|
37
37
|
PERMISSIONS_PATH = "#{SCOPE}/permissions"
|
|
38
38
|
GRANTS_PATH = "#{SCOPE}/grants"
|
|
39
39
|
OBJECT_TYPES_PATH = "#{SCOPE}/object_type_identifiers"
|
|
40
|
-
|
|
40
|
+
MONITORED_PATH = "#{SCOPE}/monitored"
|
|
41
|
+
METRICS_PATH = "#{SCOPE}/metrics"
|
|
42
|
+
INSTANCES_PATH = "#{SCOPE}/deployed_projects"
|
|
43
|
+
PLUGINS_PATH = "#{SCOPE}/plugins"
|
|
41
44
|
|
|
42
45
|
class << self
|
|
43
46
|
def target_file
|
data/lib/epc/help.rb
CHANGED
|
@@ -6,20 +6,20 @@ module EPC
|
|
|
6
6
|
:login => 'epc login <email> [--passwd PASS]',
|
|
7
7
|
:list_solutions => 'epc list solutions',
|
|
8
8
|
:create_solution => 'epc create solution <name>',
|
|
9
|
-
:show_solution => 'epc show
|
|
10
|
-
:update_solution => 'epc update
|
|
9
|
+
:show_solution => 'epc show Solution:solution_identifier',
|
|
10
|
+
:update_solution => 'epc update Solution:solution_identifier name=value',
|
|
11
11
|
:delete_solution => 'epc delete solution SOLUTION',
|
|
12
|
-
:archive_solution => 'epc archive
|
|
13
|
-
:unarchive_solution => 'epc unarchive
|
|
12
|
+
:archive_solution => 'epc archive Solution:solution_identifier',
|
|
13
|
+
:unarchive_solution => 'epc unarchive Solution:solution_identifier',
|
|
14
14
|
:refresh_solution => 'epc refresh solution [SOLUTION]',
|
|
15
|
-
:list_projects => 'epc list projects [
|
|
15
|
+
:list_projects => 'epc list projects [Solution:solution_id]',
|
|
16
16
|
:create_project => 'epc create project <name> [uri-name] <--type PROJECT_TYPE>',
|
|
17
|
-
:show_project => 'epc show
|
|
18
|
-
:update_project => 'epc update
|
|
17
|
+
:show_project => 'epc show Project:project_identifier',
|
|
18
|
+
:update_project => 'epc update Project:project_identifier <attribute=value>',
|
|
19
19
|
:delete_project => 'epc delete project [-s SOLUTION] [PROJECT] [--force]',
|
|
20
20
|
:attach_runtime => 'epc attach runtime <runtime_id> [-p PROJECT] [--stage STAGE]',
|
|
21
21
|
:list_servicetypes => 'epc list service-types',
|
|
22
|
-
:
|
|
22
|
+
:create_servicedefinition => 'epc create service-definition <service_name> <service_type>',
|
|
23
23
|
:undefine_service => 'epc undefine service <SERVICE>',
|
|
24
24
|
:list_servicedefinitions => 'epc list service-definitions',
|
|
25
25
|
:create_serviceversion => 'epc create service-version <label> <definition_name_or_id> [--up-script file] [--down-script file]',
|
|
@@ -33,11 +33,11 @@ module EPC
|
|
|
33
33
|
:pull => 'epc pull [SOLUTION]',
|
|
34
34
|
:build => 'epc build [project_name=version] [--note NOTE] [--timeout value | --nopoll]',
|
|
35
35
|
:list_deploymentconfigs => 'epc list deployment-configs [--stage STAGE] [-p PROJECT]',
|
|
36
|
-
:
|
|
36
|
+
:list_deploymentstages => 'epc list stages',
|
|
37
37
|
:create_deployment => 'epc create deployment [-s SOLUTION] <stage name: development|testing|staging|production> [-p project_id:version:instances] [--replaces deployment_id]',
|
|
38
|
-
:show_deployment => 'epc show
|
|
38
|
+
:show_deployment => 'epc show Deployment:deployment_identifier',
|
|
39
39
|
:submit_deployment => 'epc submit deployment <DEPLOYMENT_ID>',
|
|
40
|
-
:list_deployments => 'epc list deployments [
|
|
40
|
+
:list_deployments => 'epc list deployments [<Solution:solution_id> | <DeploymentStage:deployment_stage_id> | <User:user_id>]',
|
|
41
41
|
:copy_deployment => 'epc copy deployment <DEPLOYMENT_ID> <STAGE>',
|
|
42
42
|
:approve_deployment => 'epc approve deployment <DEPLOYMENT_ID>',
|
|
43
43
|
:deny_deployment => 'epc deny deployment <DEPLOYMENT_ID>',
|
|
@@ -46,7 +46,7 @@ module EPC
|
|
|
46
46
|
:delete_dependency => 'epc delete dependency [-s SOLUTION] [-p PROJECT] <DEPENDENCY_ID>',
|
|
47
47
|
:create_library => 'epc create library <name> <language> <version> <group> [-f file] [--scope runtime | compile | provided | test]',
|
|
48
48
|
:list_libraries => 'epc list libraries',
|
|
49
|
-
:delete_library => 'epc delete
|
|
49
|
+
:delete_library => 'epc delete Library:library_identifier',
|
|
50
50
|
:attach_library => 'epc attach library [-s SOLUTION] [-p PROJECT] <name> <version> <group> [-f FILE] [--pom POM FILE]',
|
|
51
51
|
:detach_library => 'epc detach library [-s SOLUTION] [-p PROJECT] <LIBRARY>',
|
|
52
52
|
:deploy => 'epc deploy [stage] [-d DEPLOYMENT_ID] [--timeout value | --nopoll]',
|
|
@@ -56,46 +56,55 @@ module EPC
|
|
|
56
56
|
:logout => 'epc logout',
|
|
57
57
|
:create_config => 'epc create config <TargetType:TargetId> [--required] [--no_override] [--value-type TYPE] name=value',
|
|
58
58
|
:list_config => 'epc list config <TargetType:TargetType>',
|
|
59
|
+
:delete_config => 'epc delete Config:key_identifier <TargetType:TargetId>',
|
|
59
60
|
:list_projecttypes => 'epc list project-types',
|
|
60
|
-
:show_projecttype => 'epc show
|
|
61
|
-
:
|
|
61
|
+
:show_projecttype => 'epc show ProjectType:project_type_identifier',
|
|
62
|
+
:update_deployment => 'epc update Deployment:deployment_identifier Project:project_identifier [--instances instance_count] [--uris comma_separated_uris]',
|
|
62
63
|
:list_versions => 'epc list versions [-s SOLUTION] PROJECT',
|
|
63
|
-
:update_config => 'epc update
|
|
64
|
-
:archive_project => 'epc archive
|
|
65
|
-
:unarchive_project => 'epc unarchive
|
|
64
|
+
:update_config => 'epc update Config:config_identifier TargetType:TargetId [--required] [--no_override] name=value',
|
|
65
|
+
:archive_project => 'epc archive Project:project_identifier',
|
|
66
|
+
:unarchive_project => 'epc unarchive Project:project_identifier',
|
|
66
67
|
:list_attachedlibraries => 'epc list attached-libraries [-s SOLUTION] [PROJECT] [--json]',
|
|
67
68
|
:create_group => 'epc create group <name>',
|
|
68
69
|
:delete_group => 'epc delete group <GROUP>',
|
|
69
70
|
:list_groups => 'epc list groups',
|
|
70
|
-
:update_group => 'epc update
|
|
71
|
-
:show_group => 'epc show
|
|
72
|
-
:list_roles => 'epc list roles [
|
|
71
|
+
:update_group => 'epc update Group:group_identifier:group_identifier [--add-user USER_ID] [--remove-user USER_ID]',
|
|
72
|
+
:show_group => 'epc show Group:group_identifier',
|
|
73
|
+
:list_roles => 'epc list roles [User:user_id]',
|
|
73
74
|
:list_objectroles => 'epc list object-roles <ObjectType:ObjectId>',
|
|
74
75
|
:delete_role => 'epc delete role',
|
|
75
|
-
:update_role => 'epc update
|
|
76
|
+
: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
|
+
: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]',
|
|
76
78
|
:create_role => 'epc create role <name>',
|
|
77
79
|
:create_objectrole => 'epc create role <name> <ObjectType:ObjectId>',
|
|
78
|
-
:show_role => 'epc show
|
|
80
|
+
:show_role => 'epc show Role:role_identifier [users|groups|grants]',
|
|
79
81
|
:list_users => 'epc list users',
|
|
80
82
|
:delete_user => 'epc delete user <user_id>|<email>',
|
|
81
|
-
:show_user => 'epc show
|
|
83
|
+
:show_user => 'epc show User:user_identifier',
|
|
82
84
|
:create_librarylanguage => 'epc create library-language <name>',
|
|
83
85
|
:list_librarylanguages => 'epc list library-languages',
|
|
84
|
-
:delete_librarylanguage => 'epc delete
|
|
85
|
-
:update_librarylanguage => 'epc update
|
|
86
|
+
:delete_librarylanguage => 'epc delete LibraryLanguage:language_identifier',
|
|
87
|
+
:update_librarylanguage => 'epc update LibraryLanguage:language_identifier <new-name>',
|
|
86
88
|
:create_libraryset => 'epc create library-set <name> <language> [--file file]',
|
|
87
|
-
:show_libraryset => 'epc show
|
|
88
|
-
:list_librarysets => 'epc
|
|
89
|
-
:update_libraryset => 'epc update library-
|
|
89
|
+
:show_libraryset => 'epc show LibrarySet:libraryset_identifier [--json]',
|
|
90
|
+
:list_librarysets => 'epc list library-sets',
|
|
91
|
+
:update_libraryset => 'epc update LibrarySet:library-set_identifier [--add-library id|name:version:group] [--remove-library id|name:version:group] [--file file]',
|
|
90
92
|
:delete_libraryset => 'epc delete library-set name|id [-y]',
|
|
91
93
|
:attach_libraryset => 'epc attach library-set name|id [-s solution] [-p project]',
|
|
92
94
|
:detach_libraryset => 'epc detach library-set name|id [-s solution] [-p project]',
|
|
93
95
|
:request_passwordchange => 'epc request password-change <email>',
|
|
94
|
-
:update_user => 'epc update
|
|
95
|
-
:
|
|
96
|
-
:
|
|
96
|
+
:update_user => 'epc update User:user_identifier [--passwd password] [--token token] [--email new_email] [--name new_name]',
|
|
97
|
+
:list_metrics => 'epc list metrics [--target target]',
|
|
98
|
+
:show_metrics => 'epc show metrics <id> <metric list> [--start start] [--stop stop] [--step step] [--graph]',
|
|
99
|
+
:show_instances => 'epc show instances <deployed-project-id>',
|
|
100
|
+
:list_permissions => 'epc list permissions',
|
|
101
|
+
:update_rolepermissions => 'epc update role-permissions ',
|
|
97
102
|
:list_permissiongroups => 'epc list permission-groups',
|
|
98
|
-
:list_objecttypes => 'epc list object-types'
|
|
103
|
+
:list_objecttypes => 'epc list object-types',
|
|
104
|
+
: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
|
+
:show_plugin => 'epc show Plugin:Name:Version:Group',
|
|
106
|
+
:list_plugins => 'epc list plugins',
|
|
107
|
+
:update_plugin => 'epc update Plugin:Name:Version:Group attribute=new value'
|
|
99
108
|
}
|
|
100
109
|
|
|
101
110
|
def display_usage
|
|
@@ -112,7 +121,7 @@ module EPC
|
|
|
112
121
|
say verbose_usage
|
|
113
122
|
return
|
|
114
123
|
end
|
|
115
|
-
key = commands.join('_').gsub("-", "").to_sym
|
|
124
|
+
key = commands.join('_').gsub("-", "").downcase.to_sym
|
|
116
125
|
if COMMAND_USAGES.keys.include?(key)
|
|
117
126
|
say("Usage: #{COMMAND_USAGES[key]}")
|
|
118
127
|
else
|
|
@@ -184,7 +193,7 @@ Currently available epc commands are:
|
|
|
184
193
|
|
|
185
194
|
Services
|
|
186
195
|
list service-types List available service types provided by ePaas
|
|
187
|
-
|
|
196
|
+
create service-definition Defines a service
|
|
188
197
|
undefine service Undefines a service
|
|
189
198
|
list service-definitions Lists services
|
|
190
199
|
create service-version Creates a service version from an existing
|
|
@@ -199,7 +208,7 @@ Currently available epc commands are:
|
|
|
199
208
|
build Builds a previously pushed project
|
|
200
209
|
show deployment Retrieves detailed information about
|
|
201
210
|
the deployment
|
|
202
|
-
list stages
|
|
211
|
+
list deployment-stages Lists available stages for deploying.
|
|
203
212
|
create deployment Creates a deployment for a solution
|
|
204
213
|
and the given stage
|
|
205
214
|
list deployments Lists all deployments created
|
|
@@ -283,6 +292,12 @@ Currently available epc commands are:
|
|
|
283
292
|
logout Logs current user out of the target system
|
|
284
293
|
|
|
285
294
|
|
|
295
|
+
Metrics
|
|
296
|
+
list metrics Lists available metrics
|
|
297
|
+
show instances Lists instances of a DeployedProject
|
|
298
|
+
show metrics Retrieves (and optionally graphs) metrics for a deployed project
|
|
299
|
+
|
|
300
|
+
|
|
286
301
|
Help
|
|
287
302
|
help Shows the usage for the command
|
|
288
303
|
|
data/lib/epc/runner.rb
CHANGED
|
@@ -13,7 +13,7 @@ class EPC::Runner
|
|
|
13
13
|
def initialize(args = [])
|
|
14
14
|
@args = args
|
|
15
15
|
@options = Hash.new
|
|
16
|
-
@parent_commands = %w(list
|
|
16
|
+
@parent_commands = %w(list define undefine refresh approve deny bind unbind attach detach submit copy set request)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def run
|
|
@@ -39,10 +39,10 @@ class EPC::Runner
|
|
|
39
39
|
# say("USAGE: " + EPC::Help::COMMAND_USAGES[command_name.split("_")[0...-1].join("_").to_sym])
|
|
40
40
|
say(ex.to_s)
|
|
41
41
|
exit 1
|
|
42
|
-
rescue ArgumentError => ex
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
# rescue ArgumentError => ex
|
|
43
|
+
# command_name = EPC::Config.underscore(command_klass.class.to_s.split("::").last)
|
|
44
|
+
# say("Wrong number of attributes for #{command_name}")
|
|
45
|
+
# # say("USAGE: " + EPC::Help::COMMAND_USAGES[command_name.split("_")[0...-1].join("_").to_sym])
|
|
46
46
|
exit 1
|
|
47
47
|
rescue BaseClient::HTTPException => ex
|
|
48
48
|
say(ex.to_s)
|
|
@@ -114,12 +114,23 @@ class EPC::Runner
|
|
|
114
114
|
opts.on('--remove-library LIB') { |lib| @options[:remove_library] = lib}
|
|
115
115
|
opts.on('--token TOKEN') { |token| @options[:token] = token}
|
|
116
116
|
opts.on('--name NAME') { |name| @options[:name] = name}
|
|
117
|
+
opts.on('--include-inactive') { |bool| @options[:include_inactive] = true}
|
|
118
|
+
opts.on('--target TARGET') { |target| @options[:target] = target}
|
|
119
|
+
opts.on('--metrics METRICS') { |metrics| @options[:metrics] = metrics}
|
|
120
|
+
opts.on('--start START') { |start| @options[:start] = start}
|
|
121
|
+
opts.on('--stop STOP') { |stop| @options[:stop] = stop}
|
|
122
|
+
opts.on('--step STEP') { |step| @options[:step] = step}
|
|
123
|
+
opts.on('--graph') { |bool| @options[:graph] = true}
|
|
117
124
|
opts.on('--add-grant grant') { |grant| @options[:add_grant] = grant}
|
|
118
125
|
opts.on('--remove-grant grant') { |grant| @options[:remove_grant] = grant}
|
|
119
126
|
opts.on('--add-group group') { |group| @options[:add_group] = group}
|
|
120
127
|
opts.on('--remove-group group') { |group| @options[:remove_group] = group}
|
|
121
128
|
opts.on('--nopoll') { |poll| @options[:no_poll] = true}
|
|
122
129
|
opts.on('--timeout TIMEOUT') { |timeout| @options[:timeout] = timeout}
|
|
130
|
+
opts.on('--extensions') { |ext| @options[:extensions] = true}
|
|
131
|
+
opts.on('--inherited') { |inherited| @options[:inherited] = true}
|
|
132
|
+
opts.on('--configuration CONFIGURATION') { |configuration| @options[:configuration] = configuration}
|
|
133
|
+
opts.on('--executions executions') { |executions| @options[:executions] = executions}
|
|
123
134
|
|
|
124
135
|
opts.on('-p NAME') do |name|
|
|
125
136
|
if @options[:project_name].nil?
|
data/lib/epc/version.rb
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module EPC
|
|
2
|
+
|
|
3
|
+
class VerticalBar
|
|
4
|
+
|
|
5
|
+
WIDTH = 80
|
|
6
|
+
HEIGHT = 16
|
|
7
|
+
|
|
8
|
+
def initialize(array)
|
|
9
|
+
@values = array
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def print
|
|
13
|
+
content = ""
|
|
14
|
+
return result unless @values && !@values.empty?
|
|
15
|
+
|
|
16
|
+
# adjust X axis for WIDTH cols
|
|
17
|
+
if @values.length > WIDTH
|
|
18
|
+
old_values = @values
|
|
19
|
+
@values = []
|
|
20
|
+
0.upto(WIDTH - 1) {|i| @values << old_values[i * old_values.length / WIDTH]}
|
|
21
|
+
end
|
|
22
|
+
min = @values.inject {|min,ea| ea.nil? ? min : (min < ea ? min : ea)} # can't use @values.min - may contain nils
|
|
23
|
+
max = @values.inject {|max,ea| ea.nil? ? max : (max > ea ? max : ea)} # can't use @values.max - may contain nils
|
|
24
|
+
spread = [max - min, 1].max
|
|
25
|
+
|
|
26
|
+
display = Array.new(HEIGHT).collect { Array.new(WIDTH, ' ') } # initialize display with blanks
|
|
27
|
+
@values.each_with_index do |e, i|
|
|
28
|
+
if e
|
|
29
|
+
num = (e - min) * HEIGHT / spread
|
|
30
|
+
(HEIGHT - 1).downto(HEIGHT - 1 - num) {|j| display[j][i] = '^'}
|
|
31
|
+
else
|
|
32
|
+
display[HEIGHT - 1][i] = '_'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
display.each {|ar| ar.each {|e| content << e}; content << "\n"}
|
|
36
|
+
content
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -16,7 +16,7 @@ class CreateLibraryCommandTest < Test::Unit::TestCase
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
should "determine the language id based on the name" do
|
|
19
|
-
@command.expects(:
|
|
19
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
20
20
|
@mock_client.expects(:post).returns([201, {}, {}])
|
|
21
21
|
@command.expects(:say)
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ class CreateLibraryCommandTest < Test::Unit::TestCase
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
should "fail if it can't determine the language id" do
|
|
27
|
-
@command.expects(:
|
|
27
|
+
@command.expects(:retrieve_identifier_for).returns(nil)
|
|
28
28
|
assert_raise EPC::Error::InputError do
|
|
29
29
|
assert_equal(@command.execute("", "lib1", "ruby", "1"), 1)
|
|
30
30
|
end
|
|
@@ -32,6 +32,7 @@ class CreateLibraryCommandTest < Test::Unit::TestCase
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
should "fail if status is not 200" do
|
|
35
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
35
36
|
@mock_client.expects(:post).returns([404, {:message => "Not Found"}, {}])
|
|
36
37
|
@command.expects(:say).with("Request failed: [Not Found]")
|
|
37
38
|
|
|
@@ -39,6 +40,7 @@ class CreateLibraryCommandTest < Test::Unit::TestCase
|
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
should "create a library" do
|
|
43
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
42
44
|
@mock_client.expects(:post).with(EPC::Config::LIBRARIES_PATH, {:name => "lib1", :language_id => 1, :library_version => "0.2", :group => "my_grp"}).
|
|
43
45
|
returns([201, {:id => 1}, {}])
|
|
44
46
|
@command.expects(:say).with("Created library [lib1] with ID [1]")
|
|
@@ -48,6 +50,7 @@ class CreateLibraryCommandTest < Test::Unit::TestCase
|
|
|
48
50
|
|
|
49
51
|
context "library with a file to upload" do
|
|
50
52
|
should "upload the file" do
|
|
53
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
51
54
|
@mock_client.expects(:post).returns([201, {:id => 1, :url => "http://foo", :signature => "abc"}, {}])
|
|
52
55
|
@command.expects(:say).with("Created library [lib1] with ID [1]")
|
|
53
56
|
@command.expects(:sha1).with("/a/file")
|
|
@@ -30,7 +30,7 @@ class CreateLibrarysetCommandTest < Test::Unit::TestCase
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
should "retrieve the language id" do
|
|
33
|
-
@command.expects(:
|
|
33
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
34
34
|
@mock_client.expects(:post).with(EPC::Config::LIBRARY_SETS_PATH, {:name => "rubylibs", :language_id => 1}).returns([201, {}, {}])
|
|
35
35
|
@command.expects(:say)
|
|
36
36
|
assert_equal(@command.execute("", "rubylibs", "ruby"), 201)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class CreatePluginCommandTest < Test::Unit::TestCase
|
|
4
|
+
should_require_login
|
|
5
|
+
|
|
6
|
+
context "execute" do
|
|
7
|
+
setup do
|
|
8
|
+
@mock_client = mock("Client")
|
|
9
|
+
@command = EPC::Command::CreatePluginCommand.new(@mock_client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
should "fail if mandatory attributes not specified" do
|
|
13
|
+
assert_raise EPC::Error::FatalError do
|
|
14
|
+
@command.execute("")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
should "request creation of the plugin" do
|
|
19
|
+
@mock_client.expects(:post).with(EPC::Config::PLUGINS_PATH, {:name => "plugin_name", :plugin_version => "plugin_version", :group => "group", :extensions => false, :inherited => false}).returns([200, {}, {}])
|
|
20
|
+
@command.expects(:say).with("Plugin [plugin_name] created.")
|
|
21
|
+
@command.execute("", "plugin_name", "plugin_version", "group")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
should "report reason for request failure" do
|
|
25
|
+
@mock_client.expects(:post).with(EPC::Config::PLUGINS_PATH, {:name => "plugin_name", :plugin_version => "plugin_version", :group => "group", :extensions => false, :inherited => false}).returns([500, {:message => "System Exception"}, {}])
|
|
26
|
+
@command.expects(:say).with("Request failed: [System Exception]")
|
|
27
|
+
@command.execute("", "plugin_name", "plugin_version", "group")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context "parse_plugin_opt" do
|
|
31
|
+
should "should retrieve contents of file when option begins with 'file:'" do
|
|
32
|
+
@command.expects(:read_file).with("path_to_file").returns("contents of file")
|
|
33
|
+
assert_equal @command.send(:parse_plugin_opt, "file:path_to_file"), "contents of file"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
should "should return the content of the option when no file specified" do
|
|
37
|
+
assert_equal @command.send(:parse_plugin_opt, "option"), "option"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
end
|