Class: NgrokAPI::Services::SSHUserCertificatesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/services/ssh_user_certificates_client.rb

Overview

SSH User Certificates are presented by SSH clients when connecting to an SSH

server to authenticate their connection. The SSH server must trust the SSH
Certificate Authority used to sign the certificate.

ngrok.com/docs/api#api-ssh-user-certificates

Constant Summary collapse

PATH =

The API path for the requests

'/ssh_user_certificates'
LIST_PROPERTY =

The List Property from the resulting API for list calls

'ssh_user_certificates'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SSHUserCertificatesClient

Returns a new instance of SSHUserCertificatesClient.



19
20
21
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 19

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



17
18
19
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 17

def client
  @client
end

Instance Method Details

#create(ssh_certificate_authority_id:, public_key:, principals: [], critical_options: {}, extensions: {}, valid_after: "", valid_until: "", description: "", metadata: "") ⇒ NgrokAPI::Models::SSHUserCertificate

Create a new SSH User Certificate

ngrok.com/docs/api#api-ssh-user-certificates-create

Parameters:

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 38

def create(
  ssh_certificate_authority_id:,
  public_key:,
  principals: [],
  critical_options: {},
  extensions: {},
  valid_after: "",
  valid_until: "",
  description: "",
  metadata: ""
)
  path = '/ssh_user_certificates'
  replacements = {
  }
  data = {}
  data[:ssh_certificate_authority_id] = ssh_certificate_authority_id if ssh_certificate_authority_id
  data[:public_key] = public_key if public_key
  data[:principals] = principals if principals
  data[:critical_options] = critical_options if critical_options
  data[:extensions] = extensions if extensions
  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::SSHUserCertificate.new(client: self, result: result)
end

#delete(id: "") ⇒ NgrokAPI::Models::Empty

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



73
74
75
76
77
78
79
80
81
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 73

def delete(
  id: ""
)
  path = '/ssh_user_certificates/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements)
end

#delete!(id: "") ⇒ NgrokAPI::Models::Empty

Delete an SSH User Certificate Throws an exception if API error.

ngrok.com/docs/api#api-ssh-user-certificates-delete

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



91
92
93
94
95
96
97
98
99
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 91

def delete!(
  id: ""
)
  path = '/ssh_user_certificates/%{id}'
  replacements = {
    id: id,
  }
  @client.delete(path % replacements, danger: true)
end

#get(id: "") ⇒ NgrokAPI::Models::SSHUserCertificate

Get detailed information about an SSH User Certficate

ngrok.com/docs/api#api-ssh-user-certificates-get

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 108

def get(
  id: ""
)
  path = '/ssh_user_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::SSHUserCertificate.new(client: self, result: result)
end

#get!(id: "") ⇒ NgrokAPI::Models::SSHUserCertificate

Get detailed information about an SSH User Certficate Throws an exception if API error.

ngrok.com/docs/api#api-ssh-user-certificates-get

Parameters:

  • id (string) (defaults to: "")

    a resource identifier

Returns:



128
129
130
131
132
133
134
135
136
137
138
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 128

def get!(
  id: ""
)
  path = '/ssh_user_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::SSHUserCertificate.new(client: self, result: result)
end

#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable

List all SSH User Certificates issued on this account

ngrok.com/docs/api#api-ssh-user-certificates-list

Parameters:

  • before_id (string) (defaults to: nil)
  • limit (string) (defaults to: nil)
  • url (string) (defaults to: nil)

    optional and mutually exclusive from before_id and limit

Returns:



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 149

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,
    result: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::SSHUserCertificate
  )
end

#update(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::SSHUserCertificate

Parameters:

  • id (string) (defaults to: "")
  • description (string) (defaults to: nil)

    human-readable description of this SSH User Certificate. optional, max 255 bytes.

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this SSH User Certificate. optional, max 4096 bytes.

Returns:



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 177

def update(
  id: "",
  description: nil,
  metadata: nil
)
  path = '/ssh_user_certificates/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::SSHUserCertificate.new(client: self, result: result)
end

#update!(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::SSHUserCertificate

Update an SSH User Certificate Throws an exception if API error.

ngrok.com/docs/api#api-ssh-user-certificates-update

Parameters:

  • id (string) (defaults to: "")
  • description (string) (defaults to: nil)

    human-readable description of this SSH User Certificate. optional, max 255 bytes.

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this SSH User Certificate. optional, max 4096 bytes.

Returns:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ngrokapi/services/ssh_user_certificates_client.rb', line 203

def update!(
  id: "",
  description: nil,
  metadata: nil
)
  path = '/ssh_user_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::SSHUserCertificate.new(client: self, result: result)
end