Class: CloudflareClient::Zone::KeylessSSL

Inherits:
Base show all
Defined in:
lib/cloudflare_client/zone/keyless_ssl.rb

Constant Summary

Constants inherited from CloudflareClient::Zone

VALID_ZONE_STATUSES

Constants inherited from CloudflareClient

API_BASE, POSSIBLE_API_SETTINGS, VALID_BUNDLE_METHODS, VALID_DIRECTIONS, VALID_MATCHES, VERSION

Instance Attribute Summary

Attributes inherited from Base

#zone_id

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods inherited from CloudflareClient::Zone

#create_zone, #delete_zone, #edit_zone, #purge_zone_cache, #update_zone_settings, #zone, #zone_activation_check, #zone_setting, #zone_settings, #zones

Methods inherited from CloudflareClient

#initialize

Constructor Details

This class inherits a constructor from CloudflareClient::Zone::Base

Instance Method Details

#create(host:, port:, certificate:, name: nil, bundle_method: 'ubiquitous') ⇒ Object

create a keyless ssl config



7
8
9
10
11
12
13
14
15
16
# File 'lib/cloudflare_client/zone/keyless_ssl.rb', line 7

def create(host:, port:, certificate:, name: nil, bundle_method: 'ubiquitous')
  raise 'host required' if host.nil?
  raise 'certificate required' if certificate.nil?
  bundle_method_check(bundle_method)

  data        = {host: host, port: port, certificate: certificate, bundle_method: bundle_method}
  data[:name] = name ? name : "#{host} Keyless SSL"

  cf_post(path: "/zones/#{zone_id}/keyless_certificates", data: data)
end

#delete(id:) ⇒ Object

delete a custom_ssl_config



51
52
53
54
55
# File 'lib/cloudflare_client/zone/keyless_ssl.rb', line 51

def delete(id:)
  id_check('id', id)

  cf_delete(path: "/zones/#{zone_id}/keyless_certificates/#{id}")
end

#listObject

list all the keyless ssl configs



20
21
22
# File 'lib/cloudflare_client/zone/keyless_ssl.rb', line 20

def list
  cf_get(path: "/zones/#{zone_id}/keyless_certificates")
end

#show(id:) ⇒ Object

details of a keyless_ssl_config



26
27
28
29
30
# File 'lib/cloudflare_client/zone/keyless_ssl.rb', line 26

def show(id:)
  id_check('id', id)

  cf_get(path: "/zones/#{zone_id}/keyless_certificates/#{id}")
end

#update(id:, host: nil, name: nil, port: nil, enabled: nil) ⇒ Object

updates a keyless ssl config



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cloudflare_client/zone/keyless_ssl.rb', line 34

def update(id:, host: nil, name: nil, port: nil, enabled: nil)
  id_check('id', id)
  unless enabled.nil?
    raise 'enabled must be true||false' unless enabled == true || enabled == false
  end

  data           = {}
  data[:host]    = host unless host.nil?
  data[:name]    = name ? name : "#{host} Keyless SSL"
  data[:port]    = port unless port.nil?
  data[:enabled] = enabled unless enabled.nil?

  cf_patch(path: "/zones/#{zone_id}/keyless_certificates/#{id}", data: data)
end