Class: ChefSSL::Client::Request
- Inherits:
-
Object
- Object
- ChefSSL::Client::Request
- Defined in:
- lib/chef-ssl/client/request.rb
Instance Attribute Summary collapse
-
#ca ⇒ Object
readonly
Returns the value of attribute ca.
-
#csr ⇒ Object
readonly
Returns the value of attribute csr.
-
#days ⇒ Object
readonly
Returns the value of attribute days.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host, data, csr = nil) ⇒ Request
constructor
A new instance of Request.
- #issue_certificate(cert_text) ⇒ Object
- #subject ⇒ Object
- #to_pem ⇒ Object
Constructor Details
#initialize(host, data, csr = nil) ⇒ Request
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/chef-ssl/client/request.rb', line 7 def initialize(host, data, csr=nil) @host = host @csr = csr || EaSSL::SigningRequest.new.load(data['csr']) @type = data['type'] @ca = data['ca'] @id = data['id'] @name = data['name'] @key = data['key'] @days = data['days'] || (365 * 5) end |
Instance Attribute Details
#ca ⇒ Object (readonly)
Returns the value of attribute ca.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def ca @ca end |
#csr ⇒ Object (readonly)
Returns the value of attribute csr.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def csr @csr end |
#days ⇒ Object (readonly)
Returns the value of attribute days.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def days @days end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def host @host end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/chef-ssl/client/request.rb', line 5 def type @type end |
Class Method Details
.create(key, type, options) ⇒ Object
31 32 33 34 35 |
# File 'lib/chef-ssl/client/request.rb', line 31 def self.create(key, type, ) name = EaSSL::CertificateName.new() csr = EaSSL::SigningRequest.new(:name => name, :key => key) self.new('localhost', { 'type' => type }, csr) end |
Instance Method Details
#issue_certificate(cert_text) ⇒ Object
26 27 28 29 |
# File 'lib/chef-ssl/client/request.rb', line 26 def issue_certificate(cert_text) cert = EaSSL::Certificate.new({}).load(cert_text) IssuedCertificate.new(self, cert) end |
#subject ⇒ Object
18 19 20 |
# File 'lib/chef-ssl/client/request.rb', line 18 def subject @csr.subject.to_s end |
#to_pem ⇒ Object
22 23 24 |
# File 'lib/chef-ssl/client/request.rb', line 22 def to_pem @csr.to_pem end |