Class: OneviewSDK::API200::WebServerCertificate

Inherits:
Resource show all
Defined in:
lib/oneview-sdk/resource/api200/web_server_certificate.rb

Overview

Web Server Certificate certificate resource implementation

Constant Summary collapse

BASE_URI =
'/rest/certificates/https'.freeze

Constants inherited from Resource

Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#==, #[], #[]=, build_query, #deep_merge!, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #initialize, #like?, #refresh, #schema, schema, #set, #set_all, #to_file

Constructor Details

This class inherits a constructor from OneviewSDK::Resource

Class Method Details

.get_certificate(client, address, options = { 'requestername' => 'DEFAULT' }) ⇒ Boolean, WebServerCertificate

Retrieves the existing SSL certificate information

Parameters:

  • client (OneviewSDK::Client)

    The client object for the OneView appliance

  • address (String)

    The hostname or IP address

  • options (Hash) (defaults to: { 'requestername' => 'DEFAULT' })

    The header options of request (key-value pairs)

Options Hash (options):

  • :requestername (String)

    Used to identify requester to allow querying of proper trust store. Default value is “DEFAULT”. List of valid input values are { “DEFAULT”, “AUTHN”, “RABBITMQ”, “ILOOA” }.

  • :Accept-Language (String)

    The language code requested in the response. If a suitable match to the requested language is not available, en-US or the appliance locale is used.

Returns:



57
58
59
60
61
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 57

def self.get_certificate(client, address, options = { 'requestername' => 'DEFAULT' })
  response = client.rest_api(:get, self::BASE_URI + "/remote/#{address}", options)
  body = client.response_handler(response)
  new(client, body)
end

Instance Method Details

#createResource

Note:

Calls the refresh method to set additional data

Creates a Certificate Signing Request (CSR) using input certificate data and returns the newly-created CSR.

Returns:

Raises:



78
79
80
81
82
83
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 78

def create
  ensure_client
  response = @client.rest_post(self.class::BASE_URI + '/certificaterequest', { 'body' => @data }, @api_version)
  body = @client.response_handler(response)
  set_all(body)
end

#create!Object

Method is not available

Raises:



34
35
36
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 34

def create!(*)
  unavailable_method
end

#create_self_signedResource

Creates a new self-signed appliance certificate based on the certificate data provided.

Returns:

Raises:



89
90
91
92
93
94
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 89

def create_self_signed
  ensure_client
  response = @client.rest_put(self.class::BASE_URI, { 'body' => @data }, @api_version)
  body = @client.response_handler(response)
  set_all(body)
end

#deleteObject

Method is not available

Raises:



28
29
30
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 28

def delete(*)
  unavailable_method
end

#importResource

Imports a signed server certificate into the appliance

Returns:

Raises:



66
67
68
69
70
71
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 66

def import
  ensure_client
  response = @client.rest_put(self.class::BASE_URI + '/certificaterequest', { 'body' => @data }, @api_version)
  body = @client.response_handler(response)
  set_all(body)
end

#retrieve!Boolean

Retrieves the existing SSL certificate information

Returns:

  • (Boolean)

    Whether or not retrieve was successful



40
41
42
43
44
45
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 40

def retrieve!
  response = @client.rest_get(self.class::BASE_URI)
  body = @client.response_handler(response)
  set_all(body)
  true
end

#updateObject

Method is not available

Raises:



22
23
24
# File 'lib/oneview-sdk/resource/api200/web_server_certificate.rb', line 22

def update(*)
  unavailable_method
end