class NgrokAPI::Services::TLSCertificatesClient

TLS Certificates are pairs of x509 certificates and their matching private

key that can be used to terminate TLS traffic. TLS certificates are unused
until they are attached to a Domain. TLS Certificates may also be
provisioned by ngrok automatically for domains on which you have enabled
automated certificate provisioning.

ngrok.com/docs/api#api-tls-certificates

Constants

LIST_PROPERTY

The List Property from the resulting API for list calls

PATH

The API path for the requests

Attributes

client[R]

Public Class Methods

new(client:) click to toggle source
# File lib/ngrokapi/services/tls_certificates_client.rb, line 21
def initialize(client:)
  @client = client
end

Public Instance Methods

create(description: "", metadata: "", certificate_pem:, private_key_pem:) click to toggle source

Upload a new TLS certificate

@param [string] description human-readable description of this TLS certificate. optional, max 255 bytes. @param [string] metadata arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes. @param [string] certificate_pem chain of PEM-encoded certificates, leaf first. See ‘Certificate Bundles` <`_”>ngrok.com/docs/ngrok-link#tls-certificates-key>`_. @return [NgrokAPI::Models::TLSCertificate] result from the API request

ngrok.com/docs/api#api-tls-certificates-create

# File lib/ngrokapi/services/tls_certificates_client.rb, line 35
def create(description: "", metadata: "", certificate_pem:, private_key_pem:)
  path = '/tls_certificates'
  replacements = {
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  data[:certificate_pem] = certificate_pem if certificate_pem
  data[:private_key_pem] = private_key_pem if private_key_pem
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::TLSCertificate.new(client: self, attrs: result)
end
create!(description: "", metadata: "", certificate_pem:, private_key_pem:) click to toggle source

Upload a new TLS certificate Throws an exception if API error.

@param [string] description human-readable description of this TLS certificate. optional, max 255 bytes. @param [string] metadata arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes. @param [string] certificate_pem chain of PEM-encoded certificates, leaf first. See ‘Certificate Bundles` <`_”>ngrok.com/docs/ngrok-link#tls-certificates-key>`_. @return [NgrokAPI::Models::TLSCertificate] result from the API request

ngrok.com/docs/api#api-tls-certificates-create

# File lib/ngrokapi/services/tls_certificates_client.rb, line 59
def create!(description: "", metadata: "", certificate_pem:, private_key_pem:)
  path = '/tls_certificates'
  replacements = {
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  data[:certificate_pem] = certificate_pem if certificate_pem
  data[:private_key_pem] = private_key_pem if private_key_pem
  result = @client.post(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TLSCertificate.new(client: self, attrs: result)
end
delete(id: "") click to toggle source

Delete a TLS certificate

@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request

ngrok.com/docs/api#api-tls-certificates-delete

# File lib/ngrokapi/services/tls_certificates_client.rb, line 79
def delete(id: "")
  path = '/tls_certificates/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements)
end
delete!(id: "") click to toggle source

Delete a TLS certificate Throws an exception if API error.

@param [string] id a resource identifier @return [NgrokAPI::Models::Empty] result from the API request

ngrok.com/docs/api#api-tls-certificates-delete

# File lib/ngrokapi/services/tls_certificates_client.rb, line 95
def delete!(id: "")
  path = '/tls_certificates/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements, danger: true)
end
get(id: "") click to toggle source

Get detailed information about a TLS certificate

@param [string] id a resource identifier @return [NgrokAPI::Models::TLSCertificate] result from the API request

ngrok.com/docs/api#api-tls-certificates-get

# File lib/ngrokapi/services/tls_certificates_client.rb, line 110
def get(id: "")
  path = '/tls_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::TLSCertificate.new(client: self, attrs: result)
end
get!(id: "") click to toggle source

Get detailed information about a TLS certificate Throws an exception if API error.

@param [string] id a resource identifier @return [NgrokAPI::Models::TLSCertificate] result from the API request

ngrok.com/docs/api#api-tls-certificates-get

# File lib/ngrokapi/services/tls_certificates_client.rb, line 128
def get!(id: "")
  path = '/tls_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TLSCertificate.new(client: self, attrs: result)
end
list(before_id: nil, limit: nil, url: nil) click to toggle source

List all TLS certificates on this account

@param [string] before_id @param [string] limit @param [string] url optional and mutually exclusive from before_id and limit @return [NgrokAPI::Models::Listable] result from the API request

ngrok.com/docs/api#api-tls-certificates-list

# File lib/ngrokapi/services/tls_certificates_client.rb, line 147
def list(before_id: nil, limit: nil, url: nil)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    url: url,
    path: PATH
  )

  NgrokAPI::Models::Listable.new(
    client: self,
    attrs: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::TLSCertificate
  )
end
list!(before_id: nil, limit: nil, url: nil) click to toggle source

List all TLS certificates on this account Throws an exception if API error.

@param [string] before_id @param [string] limit @param [string] url optional and mutually exclusive from before_id and limit @return [NgrokAPI::Models::Listable] result from the API request

ngrok.com/docs/api#api-tls-certificates-list

# File lib/ngrokapi/services/tls_certificates_client.rb, line 173
def list!(before_id: nil, limit: nil, url: nil)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    danger: true,
    url: url,
    path: PATH
  )

  NgrokAPI::Models::Listable.new(
    client: self,
    attrs: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::TLSCertificate,
    danger: true
  )
end
update(id: "", description: nil, metadata: nil) click to toggle source

Update attributes of a TLS Certificate by ID

@param [string] id @param [string] description human-readable description of this TLS certificate. optional, max 255 bytes. @param [string] metadata arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes. @return [NgrokAPI::Models::TLSCertificate] result from the API request

ngrok.com/docs/api#api-tls-certificates-update

# File lib/ngrokapi/services/tls_certificates_client.rb, line 200
def update(id: "", description: nil, metadata: nil)
  path = '/tls_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::TLSCertificate.new(client: self, attrs: result)
end
update!(id: "", description: nil, metadata: nil) click to toggle source

Update attributes of a TLS Certificate by ID Throws an exception if API error.

@param [string] id @param [string] description human-readable description of this TLS certificate. optional, max 255 bytes. @param [string] metadata arbitrary user-defined machine-readable data of this TLS certificate. optional, max 4096 bytes. @return [NgrokAPI::Models::TLSCertificate] result from the API request

ngrok.com/docs/api#api-tls-certificates-update

# File lib/ngrokapi/services/tls_certificates_client.rb, line 222
def update!(id: "", description: nil, metadata: nil)
  path = '/tls_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] = metadata if metadata
  result = @client.patch(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TLSCertificate.new(client: self, attrs: result)
end