Class: Jenkins2::CLI::UnassignRole
Overview
Provides unassign-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
106
107
108
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 106
def self.description
'Unassign role from user in role-strategy plugin.'
end
|
Instance Method Details
#add_options ⇒ Object
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 110
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
123
124
125
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 123
def mandatory_arguments
super + %i[role type rsuser]
end
|
#run ⇒ Object
127
128
129
|
# File 'lib/jenkins2/cli/role_strategy.rb', line 127
def run
jc.roles.unassign(role: options[:role], type: options[:type], rsuser: options[:rsuser])
end
|