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.
Constants
- LIST_PROPERTY
The List Property from the resulting API for list calls
- PATH
The API path for the requests
Attributes
Public Class Methods
# File lib/ngrokapi/services/tls_certificates_client.rb, line 21 def initialize(client:) @client = client end
Public Instance Methods
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
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 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 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 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 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 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 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 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 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