Class: Jenkins2::CLI::GetCredentialsAsXml

Inherits:
Jenkins2::CLI show all
Defined in:
lib/jenkins2/cli/credentials.rb

Instance Attribute Summary

Attributes inherited from Jenkins2::CLI

#errors, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jenkins2::CLI

#call, class_to_command, #initialize, #parse, subcommands

Constructor Details

This class inherits a constructor from Jenkins2::CLI

Class Method Details

.descriptionObject



103
104
105
# File 'lib/jenkins2/cli/credentials.rb', line 103

def self.description
	'Get a credential as XML (secrets redacted).'
end

Instance Method Details

#add_optionsObject



107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/jenkins2/cli/credentials.rb', line 107

def add_options
	parser.separator 'Mandatory arguments:'
	parser.on '--store STORE', 'Store id. (e.g. "system")' do |s|
		options[:store] = s
	end
	parser.on '--domain DOMAIN', 'Domain id. (e.g. "_")' do |d|
		options[:domain] = d
	end
	parser.on '--credential ID', 'Credential id.' do |c|
		options[:credential] = c
	end
end

#mandatory_argumentsObject



120
121
122
# File 'lib/jenkins2/cli/credentials.rb', line 120

def mandatory_arguments
	super + %i[store domain credential]
end

#runObject



124
125
126
127
# File 'lib/jenkins2/cli/credentials.rb', line 124

def run
	jc.credentials.store(options[:store]).domain(options[:domain]).
		credential(options[:credential]).config_xml
end