class OneviewSDK::API200::ClientCertificate

Client certificate resource implementation

Constants

BASE_URI
DEFAULT_REQUEST_HEADER

Public Class Methods

import(client, certificates, header = self::DEFAULT_REQUEST_HEADER) click to toggle source

Imports the given list of SSL certificates into the appliance trust store. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Array<ClientCertificate>] certificates The Client Certificate list @param [Hash] header The header options of request (key-value pairs) @option header [String] :requestername 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" }.

@option header [String] :Accept-Language 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.

@raise [ArgumentError] if the certificates list is nil or empty @return [Array<ClientCertificate>] list of Client Certificate imported

# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 68
def self.import(client, certificates, header = self::DEFAULT_REQUEST_HEADER)
  raise ArgumentError, 'the certificates list should be valid' if certificates.nil? || certificates.empty?
  options = {}.merge(header)
  options['body'] = certificates.map(&:data)
  response = client.rest_post(self::BASE_URI + '?multiResource=true', options)
  body = client.response_handler(response)
  body.map { |data| new(client, data) }
end
new(client, params = {}, api_ver = nil) click to toggle source

Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.

Calls superclass method OneviewSDK::Resource::new
# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 39
def initialize(client, params = {}, api_ver = nil)
  super
  # Default values
  @data['type'] ||= 'SSLCertificateDTO'
  @data['uri']  ||= "#{self.class::BASE_URI}/#{@data['aliasName']}" if @data['aliasName']
end
remove(client, alias_names, force = false, header = self::DEFAULT_REQUEST_HEADER) click to toggle source

Removes a list of SSL certificates based on the list of alias names provided as filter criteria. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Array<String>] alias_names The alias names list used as filter to remove the client certificates @param [Boolean] force If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself @param [Hash] header The header options of request (key-value pairs) @option header [String] :requestername 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" }.

@option header [String] :Accept-Language 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.

@raise [ArgumentError] if the certificates list is nil or empty

# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 107
def self.remove(client, alias_names, force = false, header = self::DEFAULT_REQUEST_HEADER)
  raise ArgumentError, 'the certificates list should be valid' if alias_names.nil? || alias_names.empty?
  uri = self::BASE_URI + build_query(multi_resource: true, force: force)
  uri += '&filter=' + alias_names.join('&filter=')
  response = client.rest_delete(uri, header)
  client.response_handler(response)
end
replace(client, certificates, force = false, header = self::DEFAULT_REQUEST_HEADER) click to toggle source

Replaces a list of existing SSL certificates with a new list of certificates. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Array<ClientCertificate>] certificates The Client Certificate list @param [Boolean] force If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself @param [Hash] header The header options of request (key-value pairs) @option header [String] :requestername 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" }.

@option header [String] :Accept-Language 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.

@return [Array<ClientCertificate>] list of the Client Certificate

# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 87
def self.replace(client, certificates, force = false, header = self::DEFAULT_REQUEST_HEADER)
  raise ArgumentError, 'the certificates list should be valid' if certificates.nil? || certificates.empty?
  options = {}.merge(header)
  options['body'] = certificates.map(&:data)
  uri = self::BASE_URI + build_query(multi_resource: true, force: force)
  response = client.rest_put(uri, options)
  body = client.response_handler(response)
  body.map { |data| new(client, data) }
end

Public Instance Methods

create(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 48
def create(*)
  unavailable_method
end
Also aliased as: import
delete(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 54
def delete(*)
  unavailable_method
end
Also aliased as: remove
import(*)

Imports the given SSL certificate into the appliance trust store @param [Hash] header The header options of request (key-value pairs) @option header [String] :requestername 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" }.

@return [ClientCertificate] self

Alias for: create
remove(*)

Removes the SSL certificate @param [Hash] header The header options of request (key-value pairs) @option header [String] :requestername 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" }.

@return [true] if resource was deleted successfully

Alias for: delete
validate(header = self.class::DEFAULT_REQUEST_HEADER) click to toggle source

Validates the input certificate by verifying if it is X509 compliant. @param [Hash] header The header options of request (key-value pairs) @option header [String] :requestername 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" }.

@option header [String] :Accept-Language 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.

@raise [OneviewSDK::IncompleteResource] if the client or the uri is not set @return [OneviewSDK::ClientCertificate] self

# File lib/oneview-sdk/resource/api200/client_certificate.rb, line 123
def validate(header = self.class::DEFAULT_REQUEST_HEADER)
  ensure_client && ensure_uri
  options = {}.merge(header)
  options['body'] = @data
  response = @client.rest_post(self.class::BASE_URI + '/validator', options, @api_version)
  body = @client.response_handler(response)
  set_all(body)
  self
end