Class: NgrokAPI::Services::SSHHostCertificatesClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::SSHHostCertificatesClient
- Defined in:
- lib/ngrokapi/services/ssh_host_certificates_client.rb
Overview
SSH Host Certificates along with the corresponding private key allows an SSH server to assert its authenticity to connecting SSH clients who trust the SSH Certificate Authority that was used to sign the certificate.
Constant Summary collapse
- PATH =
The API path for the requests
'/ssh_host_certificates'
- LIST_PROPERTY =
The List Property from the resulting API for list calls
'ssh_host_certificates'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(ssh_certificate_authority_id:, public_key:, principals: [], valid_after: "", valid_until: "", description: "", metadata: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Create a new SSH Host Certificate.
-
#create!(ssh_certificate_authority_id:, public_key:, principals: [], valid_after: "", valid_until: "", description: "", metadata: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Create a new SSH Host Certificate Throws an exception if API error.
-
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an SSH Host Certificate.
-
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an SSH Host Certificate Throws an exception if API error.
-
#get(id: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Get detailed information about an SSH Host Certficate.
-
#get!(id: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Get detailed information about an SSH Host Certficate Throws an exception if API error.
-
#initialize(client:) ⇒ SSHHostCertificatesClient
constructor
A new instance of SSHHostCertificatesClient.
-
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all SSH Host Certificates issued on this account.
-
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all SSH Host Certificates issued on this account Throws an exception if API error.
-
#update(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::SSHHostCertificate
Update an SSH Host Certificate.
-
#update!(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::SSHHostCertificate
Update an SSH Host Certificate Throws an exception if API error.
Constructor Details
#initialize(client:) ⇒ SSHHostCertificatesClient
Returns a new instance of SSHHostCertificatesClient.
19 20 21 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 19 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
17 18 19 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 17 def client @client end |
Instance Method Details
#create(ssh_certificate_authority_id:, public_key:, principals: [], valid_after: "", valid_until: "", description: "", metadata: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Create a new SSH Host Certificate
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 36 def create(ssh_certificate_authority_id:, public_key:, principals: [], valid_after: "", valid_until: "", description: "", metadata: "") path = '/ssh_host_certificates' replacements = { } data = {} data[:ssh_certificate_authority_id] = if data[:public_key] = public_key if public_key data[:principals] = principals if principals data[:valid_after] = valid_after if valid_after data[:valid_until] = valid_until if valid_until data[:description] = description if description data[:metadata] = if result = @client.post(path % replacements, data: data) NgrokAPI::Models::SSHHostCertificate.new(client: self, attrs: result) end |
#create!(ssh_certificate_authority_id:, public_key:, principals: [], valid_after: "", valid_until: "", description: "", metadata: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Create a new SSH Host Certificate Throws an exception if API error.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 66 def create!(ssh_certificate_authority_id:, public_key:, principals: [], valid_after: "", valid_until: "", description: "", metadata: "") path = '/ssh_host_certificates' replacements = { } data = {} data[:ssh_certificate_authority_id] = if data[:public_key] = public_key if public_key data[:principals] = principals if principals data[:valid_after] = valid_after if valid_after data[:valid_until] = valid_until if valid_until data[:description] = description if description data[:metadata] = if result = @client.post(path % replacements, data: data, danger: true) NgrokAPI::Models::SSHHostCertificate.new(client: self, attrs: result) end |
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an SSH Host Certificate
89 90 91 92 93 94 95 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 89 def delete(id: "") path = '/ssh_host_certificates/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an SSH Host Certificate Throws an exception if API error.
105 106 107 108 109 110 111 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 105 def delete!(id: "") path = '/ssh_host_certificates/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Get detailed information about an SSH Host Certficate
120 121 122 123 124 125 126 127 128 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 120 def get(id: "") path = '/ssh_host_certificates/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::SSHHostCertificate.new(client: self, attrs: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::SSHHostCertificate
Get detailed information about an SSH Host Certficate Throws an exception if API error.
138 139 140 141 142 143 144 145 146 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 138 def get!(id: "") path = '/ssh_host_certificates/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::SSHHostCertificate.new(client: self, attrs: result) end |
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all SSH Host Certificates issued on this account
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 157 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::SSHHostCertificate ) end |
#list!(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all SSH Host Certificates issued on this account Throws an exception if API error.
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 183 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::SSHHostCertificate, danger: true ) end |
#update(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::SSHHostCertificate
Update an SSH Host Certificate
210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 210 def update(id: "", description: nil, metadata: nil) path = '/ssh_host_certificates/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = if result = @client.patch(path % replacements, data: data) NgrokAPI::Models::SSHHostCertificate.new(client: self, attrs: result) end |
#update!(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::SSHHostCertificate
Update an SSH Host Certificate Throws an exception if API error.
232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/ngrokapi/services/ssh_host_certificates_client.rb', line 232 def update!(id: "", description: nil, metadata: nil) path = '/ssh_host_certificates/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = if result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::SSHHostCertificate.new(client: self, attrs: result) end |