Class: NgrokAPI::Services::ReservedDomainsClient

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

Overview

A client for interacting with the reserved_domains API

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

Constant Summary collapse

LIST_PROPERTY =

The List Property from the resulting API for list calls

'reserved_domains'
PATH =

The API path for reserved domains

'/reserved_domains'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ReservedDomainsClient

Returns a new instance of ReservedDomainsClient.



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

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



15
16
17
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 15

def client
  @client
end

Instance Method Details

#create(name: '', region: '', description: '', metadata: '', http_endpoint_configuration_id: '', https_endpoint_configuration_id: '', certificate_id: nil, certificate_management_policy: nil) ⇒ NgrokAPI::Models::ReservedDomain

Create a new reserved domain.

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

Parameters:

  • name (string) (defaults to: '')

    the domain name to reserve. It may be a full domain name like app.example.com. If the name does not contain a ‘.’ it will reserve that subdomain on ngrok.io.

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

    reserve the domain in this geographic ngrok datacenter. Optional, default is us. (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.

  • http_endpoint_configuration_id (string) (defaults to: '')

    ID of an endpoint configuration of type http that will be used to handle inbound http traffic to this domain

  • https_endpoint_configuration_id (string) (defaults to: '')

    ID of an endpoint configuration of type https that will be used to handle inbound https traffic to this domain

  • 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 (string) (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.

Returns:



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

def create(
  name: '',
  region: '',
  description: '',
  metadata: '',
  http_endpoint_configuration_id: '',
  https_endpoint_configuration_id: '',
  certificate_id: nil,
  certificate_management_policy: nil
)
  data = {
    name: name,
    region: region,
    description: description,
    metadata: ,
    http_endpoint_configuration_id: http_endpoint_configuration_id,
    https_endpoint_configuration_id: https_endpoint_configuration_id,
    certificate_id: certificate_id,
    certificate_management_policy: certificate_management_policy,
  }
  result = @client.post(PATH, data: data)
  NgrokAPI::Models::ReservedDomain.new(client: self, result: result)
end

#delete(id: nil) ⇒ nil

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



69
70
71
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 69

def delete(id: nil)
  @client.delete("#{PATH}/#{id}")
end

#delete!(id: nil) ⇒ nil

Delete a reserved domain. Throw an exception if 404.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



80
81
82
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 80

def delete!(id: nil)
  @client.delete("#{PATH}/#{id}", danger: true)
end

#delete_certificate(id: nil) ⇒ nil

Detach the certificate attached from a reserved domain.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



205
206
207
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 205

def delete_certificate(id: nil)
  @client.delete("#{PATH}/#{id}/certificate")
end

#delete_certificate!(id: nil) ⇒ nil

Detach the certificate attached from a reserved domain. Throw an exception if 404.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



216
217
218
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 216

def delete_certificate!(id: nil)
  @client.delete("#{PATH}/#{id}/certificate", danger: true)
end

#delete_certificate_management_policy(id: nil) ⇒ nil

Detach the certificate management policy attached from a reserved domain.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



227
228
229
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 227

def delete_certificate_management_policy(id: nil)
  @client.delete("#{PATH}/#{id}/certificate_management_policy")
end

#delete_certificate_management_policy!(id: nil) ⇒ nil

Detach the certificate management policy attached from a reserved domain.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



238
239
240
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 238

def delete_certificate_management_policy!(id: nil)
  @client.delete("#{PATH}/#{id}/certificate_management_policy", danger: true)
end

#delete_http_endpoint_config(id: nil) ⇒ nil

Detach the http endpoint configuration attached from a reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-http-endpoint-config

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



249
250
251
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 249

def delete_http_endpoint_config(id: nil)
  @client.delete("#{PATH}/#{id}/http_endpoint_configuration")
end

#delete_http_endpoint_config!(id: nil) ⇒ nil

Detach the http endpoint configuration attached from a reserved domain. Throw an exception if 404.

ngrok.com/docs/api#api-reserved-domains-delete-http-endpoint-config

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



260
261
262
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 260

def delete_http_endpoint_config!(id: nil)
  @client.delete("#{PATH}/#{id}/http_endpoint_configuration", danger: true)
end

#delete_https_endpoint_config(id: nil) ⇒ nil

Detach the https endpoint configuration attached from a reserved domain.

ngrok.com/docs/api#api-reserved-domains-delete-https-endpoint-config

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



271
272
273
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 271

def delete_https_endpoint_config(id: nil)
  @client.delete("#{PATH}/#{id}/https_endpoint_configuration")
end

#delete_https_endpoint_config!(id: nil) ⇒ nil

Detach the https endpoint configuration attached from a reserved domain. Throw an exception if 404.

ngrok.com/docs/api#api-reserved-domains-delete-https-endpoint-config

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:

  • (nil)

    result from delete request



282
283
284
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 282

def delete_https_endpoint_config!(id: nil)
  @client.delete("#{PATH}/#{id}/https_endpoint_configuration", danger: true)
end

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

Get the details of a reserved domain.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:



91
92
93
94
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 91

def get(id: nil)
  result = @client.get("#{PATH}/#{id}")
  NgrokAPI::Models::ReservedDomain.new(client: self, result: result)
end

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

Get the details of a reserved domain. Throw an exception if 404.

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

Parameters:

  • id (string) (defaults to: nil)

    a resource identifier

Returns:



103
104
105
106
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 103

def get!(id: nil)
  result = @client.get!("#{PATH}/#{id}")
  NgrokAPI::Models::ReservedDomain.new(client: self, result: result)
end

#list(before_id: nil, limit: 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)
  • limit (integer) (defaults to: nil)
  • url (string) (defaults to: nil)

    optional and mutually exclusive from before_id and limit

Returns:



117
118
119
120
121
122
123
124
125
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 117

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::ReservedDomain
  )
end

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

Update the attributes of a reserved domain.

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

Parameters:

  • id (string) (defaults to: nil)
  • 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.

  • http_endpoint_configuration_id (string) (defaults to: nil)

    ID of an endpoint configuration of type http that will be used to handle inbound http traffic to this domain

  • https_endpoint_configuration_id (string) (defaults to: nil)

    ID of an endpoint configuration of type https that will be used to handle inbound https traffic to this domain

  • 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 (string) (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.

Returns:



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 142

def update(
  id: nil,
  certificate_id: nil,
  certificate_management_policy: nil,
  description: nil,
  http_endpoint_configuration_id: nil,
  https_endpoint_configuration_id: nil,
  metadata: nil
)
  data = build_data(
    description: description,
    metadata: ,
    http_endpoint_configuration_id: http_endpoint_configuration_id,
    https_endpoint_configuration_id: https_endpoint_configuration_id,
    certificate_id: certificate_id,
    certificate_management_policy: certificate_management_policy
  )
  result = @client.patch("#{PATH}/#{id}", data: data)
  NgrokAPI::Models::ReservedDomain.new(client: self, result: result)
end

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

Update the attributes of a reserved domain. Throw an exception if 404.

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

Parameters:

  • id (string) (defaults to: nil)
  • 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.

  • http_endpoint_configuration_id (string) (defaults to: nil)

    ID of an endpoint configuration of type http that will be used to handle inbound http traffic to this domain

  • https_endpoint_configuration_id (string) (defaults to: nil)

    ID of an endpoint configuration of type https that will be used to handle inbound https traffic to this domain

  • 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 (string) (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.

Returns:



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/ngrokapi/services/reserved_domains_client.rb', line 176

def update!(
  id: nil,
  certificate_id: nil,
  certificate_management_policy: nil,
  description: nil,
  http_endpoint_configuration_id: nil,
  https_endpoint_configuration_id: nil,
  metadata: nil
)
  data = build_data(
    description: description,
    metadata: ,
    http_endpoint_configuration_id: http_endpoint_configuration_id,
    https_endpoint_configuration_id: https_endpoint_configuration_id,
    certificate_id: certificate_id,
    certificate_management_policy: certificate_management_policy
  )
  result = @client.patch("#{PATH}/#{id}", danger: true, data: data)
  NgrokAPI::Models::ReservedDomain.new(client: self, result: result)
end