Class: NgrokAPI::Services::ReservedDomainsClient

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

Overview

Reserved Domains are hostnames that you can listen for traffic on. Domains can be used to listen for http, https or tls traffic. You may use a domain that you own by creating a CNAME record specified in the returned resource. This CNAME record points traffic for that domain to ngrok’s edge servers.

ngrok.com/docs/api#api-reserved-domains

Constant Summary collapse

PATH =

The API path for the requests

'/reserved_domains'
LIST_PROPERTY =

The List Property from the resulting API for list calls

'reserved_domains'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ReservedDomainsClient

Returns a new instance of ReservedDomainsClient.



22
23
24
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 22

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



20
21
22
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 20

def client
  @client
end

Instance Method Details

#create(name: "", domain: "", region: "", description: "", metadata: "", http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, error_redirect_url: nil, resolves_to: nil) ⇒ NgrokAPI::Models::ReservedDomain

Create a new reserved domain.

ngrok.com/docs/api#api-reserved-domains-create

Parameters:

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

    hostname of the reserved domain

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

    deprecated: With the launch of the ngrok Global Network domains traffic is now handled globally. This field applied only to endpoints. Note that agents may still connect to specific regions. Optional, null by default. (au, eu, ap, us, jp, in, sa)

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

    human-readable description of what this reserved domain will be used for

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

    arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.

  • certificate_id (string) (defaults to: nil)

    ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with certificate_management_policy.

  • certificate_management_policy (ReservedDomainCertPolicy) (defaults to: nil)

    configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with certificate_id.

  • resolves_to (List<ReservedDomainResolvesToEntry>) (defaults to: nil)

    DNS resolver targets configured for the reserved domain, or empty for “global” resolution.

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 39

def create(name: "", domain: "", region: "", description: "", metadata: "", http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, error_redirect_url: nil, resolves_to: nil)
  path = '/reserved_domains'
  replacements = {
  }
  data = {}
  data[:domain] = domain if domain
  data[:region] = region if region
  data[:description] = description if description
  data[:metadata] =  if 
  data[:certificate_id] = certificate_id if certificate_id
  data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy
  data[:resolves_to] = resolves_to if resolves_to
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result)
end

#create!(name: "", domain: "", region: "", description: "", metadata: "", http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, error_redirect_url: nil, resolves_to: nil) ⇒ NgrokAPI::Models::ReservedDomain

Create a new reserved domain. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-create

Parameters:

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

    hostname of the reserved domain

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

    deprecated: With the launch of the ngrok Global Network domains traffic is now handled globally. This field applied only to endpoints. Note that agents may still connect to specific regions. Optional, null by default. (au, eu, ap, us, jp, in, sa)

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

    human-readable description of what this reserved domain will be used for

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

    arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.

  • certificate_id (string) (defaults to: nil)

    ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with certificate_management_policy.

  • certificate_management_policy (ReservedDomainCertPolicy) (defaults to: nil)

    configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with certificate_id.

  • resolves_to (List<ReservedDomainResolvesToEntry>) (defaults to: nil)

    DNS resolver targets configured for the reserved domain, or empty for “global” resolution.

Returns:



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 69

def create!(name: "", domain: "", region: "", description: "", metadata: "", http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, error_redirect_url: nil, resolves_to: nil)
  path = '/reserved_domains'
  replacements = {
  }
  data = {}
  data[:domain] = domain if domain
  data[:region] = region if region
  data[:description] = description if description
  data[:metadata] =  if 
  data[:certificate_id] = certificate_id if certificate_id
  data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy
  data[:resolves_to] = resolves_to if resolves_to
  result = @client.post(path % replacements, data: data, danger: true)
  NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result)
end

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

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



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

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

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

Delete a reserved domain. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-delete

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



108
109
110
111
112
113
114
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 108

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

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

Detach the certificate attached to a reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-certificate

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



311
312
313
314
315
316
317
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 311

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

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

Detach the certificate attached to a reserved domain. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-delete-certificate

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



327
328
329
330
331
332
333
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 327

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

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

Detach the certificate management policy attached to a reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-certificate-management-policy

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



280
281
282
283
284
285
286
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 280

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

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

Detach the certificate management policy attached to a reserved domain. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-delete-certificate-management-policy

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



296
297
298
299
300
301
302
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 296

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

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

Get the details of a reserved domain.

ngrok.com/docs/api#api-reserved-domains-get

Parameters:

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

    a resource identifier

Returns:



123
124
125
126
127
128
129
130
131
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 123

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

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

Get the details of a reserved domain. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-get

Parameters:

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

    a resource identifier

Returns:



141
142
143
144
145
146
147
148
149
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 141

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

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

List all reserved domains on this account.

ngrok.com/docs/api#api-reserved-domains-list

Parameters:

  • before_id (string) (defaults to: nil)

    Expects a resource ID as its input. Returns earlier entries in the result set, sorted by ID.

  • limit (string) (defaults to: nil)

    Constrains the number of results in the dataset. See the API Overview <https://ngrok.com/docs/api/index#pagination>_ for details.

  • filter (string) (defaults to: nil)

    A CEL expression to filter the list results. Supports logical and comparison operators to match on fields such as id, metadata, created_at, and more. See ngrok API Filtering for syntax and field details: https://ngrok.com/docs/api/api-filtering <https://ngrok.com/docs/api/api-filtering>_.

  • url (string) (defaults to: nil)

    optional and mutually exclusive from before_id and limit

Returns:



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 161

def list(
  before_id: nil,
  limit: nil,
  filter: nil,
  url: nil
)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    filter: filter,
    url: url,
    path: PATH
  )

  NgrokAPI::Models::Listable.new(
    client: self,
    attrs: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::ReservedDomain
  )
end

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

List all reserved domains on this account. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-list

Parameters:

  • before_id (string) (defaults to: nil)

    Expects a resource ID as its input. Returns earlier entries in the result set, sorted by ID.

  • limit (string) (defaults to: nil)

    Constrains the number of results in the dataset. See the API Overview <https://ngrok.com/docs/api/index#pagination>_ for details.

  • filter (string) (defaults to: nil)

    A CEL expression to filter the list results. Supports logical and comparison operators to match on fields such as id, metadata, created_at, and more. See ngrok API Filtering for syntax and field details: https://ngrok.com/docs/api/api-filtering <https://ngrok.com/docs/api/api-filtering>_.

  • url (string) (defaults to: nil)

    optional and mutually exclusive from before_id and limit

Returns:



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 194

def list!(
  before_id: nil,
  limit: nil,
  filter: nil,
  url: nil
)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    filter: filter,
    danger: true,
    url: url,
    path: PATH
  )

  NgrokAPI::Models::Listable.new(
    client: self,
    attrs: result,
    list_property: LIST_PROPERTY,
    klass: NgrokAPI::Models::ReservedDomain,
    danger: true
  )
end

#update(id: "", description: nil, metadata: nil, http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, region: nil, error_redirect_url: nil, resolves_to: nil) ⇒ NgrokAPI::Models::ReservedDomain

Update the attributes of a reserved domain.

ngrok.com/docs/api#api-reserved-domains-update

Parameters:

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

    human-readable description of what this reserved domain will be used for

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.

  • certificate_id (string) (defaults to: nil)

    ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with certificate_management_policy.

  • certificate_management_policy (ReservedDomainCertPolicy) (defaults to: nil)

    configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with certificate_id.

  • resolves_to (List<ReservedDomainResolvesToEntry>) (defaults to: nil)

    DNS resolver targets configured for the reserved domain, or empty for “global” resolution.

Returns:



230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 230

def update(id: "", description: nil, metadata: nil, http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, region: nil, error_redirect_url: nil, resolves_to: nil)
  path = '/reserved_domains/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:certificate_id] = certificate_id if certificate_id
  data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy
  data[:resolves_to] = resolves_to if resolves_to
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result)
end

#update!(id: "", description: nil, metadata: nil, http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, region: nil, error_redirect_url: nil, resolves_to: nil) ⇒ NgrokAPI::Models::ReservedDomain

Update the attributes of a reserved domain. Throws an exception if API error.

ngrok.com/docs/api#api-reserved-domains-update

Parameters:

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

    human-readable description of what this reserved domain will be used for

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this reserved domain. Optional, max 4096 bytes.

  • certificate_id (string) (defaults to: nil)

    ID of a user-uploaded TLS certificate to use for connections to targeting this domain. Optional, mutually exclusive with certificate_management_policy.

  • certificate_management_policy (ReservedDomainCertPolicy) (defaults to: nil)

    configuration for automatic management of TLS certificates for this domain, or null if automatic management is disabled. Optional, mutually exclusive with certificate_id.

  • resolves_to (List<ReservedDomainResolvesToEntry>) (defaults to: nil)

    DNS resolver targets configured for the reserved domain, or empty for “global” resolution.

Returns:



258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 258

def update!(id: "", description: nil, metadata: nil, http_endpoint_configuration_id: nil, https_endpoint_configuration_id: nil, certificate_id: nil, certificate_management_policy: nil, region: nil, error_redirect_url: nil, resolves_to: nil)
  path = '/reserved_domains/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:certificate_id] = certificate_id if certificate_id
  data[:certificate_management_policy] = certificate_management_policy if certificate_management_policy
  data[:resolves_to] = resolves_to if resolves_to
  result = @client.patch(path % replacements, data: data, danger: true)
  NgrokAPI::Models::ReservedDomain.new(client: self, attrs: result)
end