Class: Jenkins2::CLI::AssignRole
Overview
Provides assign-role command in CLI. Requires role-strategy plugin enabled.
Instance Attribute Summary
#errors, #options
Class Method Summary
collapse
Instance Method Summary
collapse
#call, class_to_command, #initialize, #parse, subcommands
Constructor Details
This class inherits a constructor from Jenkins2::CLI
Class Method Details
.description ⇒ Object
78
79
80
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 78
def self.description
'Assign role to user in role-strategy plugin.'
end
|
Instance Method Details
#add_options ⇒ Object
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 82
def add_options
parser.separator 'Mandatory arguments:'
parser.on '--role ROLE', 'Role name.' do |r|
options[:role] = r
end
parser.on '--type TYPE', 'Role type. One of: globalRoles, projectRoles, slaveRoles.' do |t|
options[:type] = t
end
parser.on '--rsuser USER', 'Username.' do |u|
options[:rsuser] = u
end
end
|
#mandatory_arguments ⇒ Object
95
96
97
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 95
def mandatory_arguments
super + %i[role type rsuser]
end
|
#run ⇒ Object
99
100
101
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 99
def run
jc.roles.assign(role: options[:role], type: options[:type], rsuser: options[:rsuser])
end
|