Class: NgrokAPI::Services::EndpointConfigurationsClient

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

Overview

Endpoint Configurations are a reusable group of modules that encapsulate how traffic to a domain or address is handled. Endpoint configurations are only applied to Domains and TCP Addresses they have been attached to.

ngrok.com/docs/api#api-endpoint-configurations

Constant Summary collapse

PATH =

The API path for the requests

'/endpoint_configurations'
LIST_PROPERTY =

The List Property from the resulting API for list calls

'endpoint_configurations'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EndpointConfigurationsClient

Returns a new instance of EndpointConfigurationsClient.



19
20
21
# File 'lib/ngrokapi/services/endpoint_configurations_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/endpoint_configurations_client.rb', line 17

def client
  @client
end

Instance Method Details

#create(type: "", description: "", metadata: "", basic_auth: nil, circuit_breaker: nil, compression: nil, request_headers: nil, response_headers: nil, ip_policy: nil, mutual_tls: nil, tls_termination: nil, webhook_validation: nil, oauth: nil, logging: nil, saml: nil, oidc: nil, backend: nil) ⇒ NgrokAPI::Models::EndpointConfiguration

Create a new endpoint configuration

ngrok.com/docs/api#api-endpoint-configurations-create

Parameters:

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

    they type of traffic this endpoint configuration can be applied to. one of: http, https, tcp

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

    human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes

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

    arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes.

  • circuit_breaker (EndpointCircuitBreaker) (defaults to: nil)

    circuit breaker module configuration or null

  • compression (EndpointCompression) (defaults to: nil)

    compression module configuration or null

  • request_headers (EndpointRequestHeaders) (defaults to: nil)

    request headers module configuration or null

  • response_headers (EndpointResponseHeaders) (defaults to: nil)

    response headers module configuration or null

  • ip_policy (EndpointIPPolicyMutate) (defaults to: nil)

    ip policy module configuration or null

  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)

    mutual TLS module configuration or null

  • tls_termination (EndpointTLSTermination) (defaults to: nil)

    TLS termination module configuration or null

  • webhook_validation (EndpointWebhookValidation) (defaults to: nil)

    webhook validation module configuration or null

  • oauth (EndpointOAuth) (defaults to: nil)

    oauth module configuration or null

  • logging (EndpointLoggingMutate) (defaults to: nil)

    logging module configuration or null

  • saml (EndpointSAMLMutate) (defaults to: nil)

    saml module configuration or null

  • oidc (EndpointOIDC) (defaults to: nil)

    oidc module configuration or null

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ngrokapi/services/endpoint_configurations_client.rb', line 44

def create(type: "", description: "", metadata: "", basic_auth: nil, circuit_breaker: nil, compression: nil, request_headers: nil, response_headers: nil, ip_policy: nil, mutual_tls: nil, tls_termination: nil, webhook_validation: nil, oauth: nil, logging: nil, saml: nil, oidc: nil, backend: nil)
  path = '/endpoint_configurations'
  replacements = {
  }
  data = {}
  data[:type] = type if type
  data[:description] = description if description
  data[:metadata] =  if 
  data[:circuit_breaker] = circuit_breaker if circuit_breaker
  data[:compression] = compression if compression
  data[:request_headers] = request_headers if request_headers
  data[:response_headers] = response_headers if response_headers
  data[:ip_policy] = ip_policy if ip_policy
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:webhook_validation] = webhook_validation if webhook_validation
  data[:oauth] = oauth if oauth
  data[:logging] = logging if logging
  data[:saml] = saml if saml
  data[:oidc] = oidc if oidc
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::EndpointConfiguration.new(client: self, result: result)
end

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

Delete an endpoint configuration. This operation will fail if the endpoint configuration is still referenced by any reserved domain or reserved address.

ngrok.com/docs/api#api-endpoint-configurations-delete

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



76
77
78
79
80
81
82
# File 'lib/ngrokapi/services/endpoint_configurations_client.rb', line 76

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

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

Delete an endpoint configuration. This operation will fail if the endpoint configuration is still referenced by any reserved domain or reserved address. Throws an exception if API error.

ngrok.com/docs/api#api-endpoint-configurations-delete

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



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

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

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

Returns detailed information about an endpoint configuration

ngrok.com/docs/api#api-endpoint-configurations-get

Parameters:

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

    a resource identifier

Returns:



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

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

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

Returns detailed information about an endpoint configuration Throws an exception if API error.

ngrok.com/docs/api#api-endpoint-configurations-get

Parameters:

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

    a resource identifier

Returns:



126
127
128
129
130
131
132
133
134
# File 'lib/ngrokapi/services/endpoint_configurations_client.rb', line 126

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

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

Returns a list of all endpoint configurations on this account

ngrok.com/docs/api#api-endpoint-configurations-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:



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

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

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

Returns a list of all endpoint configurations on this account Throws an exception if API error.

ngrok.com/docs/api#api-endpoint-configurations-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:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/ngrokapi/services/endpoint_configurations_client.rb', line 172

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

#update(id: "", description: nil, metadata: nil, basic_auth: nil, circuit_breaker: nil, compression: nil, request_headers: nil, response_headers: nil, ip_policy: nil, mutual_tls: nil, tls_termination: nil, webhook_validation: nil, oauth: nil, logging: nil, saml: nil, oidc: nil, backend: nil) ⇒ NgrokAPI::Models::EndpointConfiguration

Updates an endpoint configuration. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API.

ngrok.com/docs/api#api-endpoint-configurations-update

Parameters:

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

    unique identifier of this endpoint configuration

  • description (string) (defaults to: nil)

    human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes.

  • circuit_breaker (EndpointCircuitBreaker) (defaults to: nil)

    circuit breaker module configuration or null

  • compression (EndpointCompression) (defaults to: nil)

    compression module configuration or null

  • request_headers (EndpointRequestHeaders) (defaults to: nil)

    request headers module configuration or null

  • response_headers (EndpointResponseHeaders) (defaults to: nil)

    response headers module configuration or null

  • ip_policy (EndpointIPPolicyMutate) (defaults to: nil)

    ip policy module configuration or null

  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)

    mutual TLS module configuration or null

  • tls_termination (EndpointTLSTermination) (defaults to: nil)

    TLS termination module configuration or null

  • webhook_validation (EndpointWebhookValidation) (defaults to: nil)

    webhook validation module configuration or null

  • oauth (EndpointOAuth) (defaults to: nil)

    oauth module configuration or null

  • logging (EndpointLoggingMutate) (defaults to: nil)

    logging module configuration or null

  • saml (EndpointSAMLMutate) (defaults to: nil)

    saml module configuration or null

  • oidc (EndpointOIDC) (defaults to: nil)

    oidc module configuration or null

Returns:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/ngrokapi/services/endpoint_configurations_client.rb', line 215

def update(id: "", description: nil, metadata: nil, basic_auth: nil, circuit_breaker: nil, compression: nil, request_headers: nil, response_headers: nil, ip_policy: nil, mutual_tls: nil, tls_termination: nil, webhook_validation: nil, oauth: nil, logging: nil, saml: nil, oidc: nil, backend: nil)
  path = '/endpoint_configurations/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:circuit_breaker] = circuit_breaker if circuit_breaker
  data[:compression] = compression if compression
  data[:request_headers] = request_headers if request_headers
  data[:response_headers] = response_headers if response_headers
  data[:ip_policy] = ip_policy if ip_policy
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:webhook_validation] = webhook_validation if webhook_validation
  data[:oauth] = oauth if oauth
  data[:logging] = logging if logging
  data[:saml] = saml if saml
  data[:oidc] = oidc if oidc
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::EndpointConfiguration.new(client: self, result: result)
end

#update!(id: "", description: nil, metadata: nil, basic_auth: nil, circuit_breaker: nil, compression: nil, request_headers: nil, response_headers: nil, ip_policy: nil, mutual_tls: nil, tls_termination: nil, webhook_validation: nil, oauth: nil, logging: nil, saml: nil, oidc: nil, backend: nil) ⇒ NgrokAPI::Models::EndpointConfiguration

Updates an endpoint configuration. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API. Throws an exception if API error.

ngrok.com/docs/api#api-endpoint-configurations-update

Parameters:

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

    unique identifier of this endpoint configuration

  • description (string) (defaults to: nil)

    human-readable description of what this endpoint configuration will be do when applied or what traffic it will be applied to. Optional, max 255 bytes

  • metadata (string) (defaults to: nil)

    arbitrary user-defined machine-readable data of this endpoint configuration. Optional, max 4096 bytes.

  • circuit_breaker (EndpointCircuitBreaker) (defaults to: nil)

    circuit breaker module configuration or null

  • compression (EndpointCompression) (defaults to: nil)

    compression module configuration or null

  • request_headers (EndpointRequestHeaders) (defaults to: nil)

    request headers module configuration or null

  • response_headers (EndpointResponseHeaders) (defaults to: nil)

    response headers module configuration or null

  • ip_policy (EndpointIPPolicyMutate) (defaults to: nil)

    ip policy module configuration or null

  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)

    mutual TLS module configuration or null

  • tls_termination (EndpointTLSTermination) (defaults to: nil)

    TLS termination module configuration or null

  • webhook_validation (EndpointWebhookValidation) (defaults to: nil)

    webhook validation module configuration or null

  • oauth (EndpointOAuth) (defaults to: nil)

    oauth module configuration or null

  • logging (EndpointLoggingMutate) (defaults to: nil)

    logging module configuration or null

  • saml (EndpointSAMLMutate) (defaults to: nil)

    saml module configuration or null

  • oidc (EndpointOIDC) (defaults to: nil)

    oidc module configuration or null

Returns:



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/ngrokapi/services/endpoint_configurations_client.rb', line 264

def update!(id: "", description: nil, metadata: nil, basic_auth: nil, circuit_breaker: nil, compression: nil, request_headers: nil, response_headers: nil, ip_policy: nil, mutual_tls: nil, tls_termination: nil, webhook_validation: nil, oauth: nil, logging: nil, saml: nil, oidc: nil, backend: nil)
  path = '/endpoint_configurations/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:circuit_breaker] = circuit_breaker if circuit_breaker
  data[:compression] = compression if compression
  data[:request_headers] = request_headers if request_headers
  data[:response_headers] = response_headers if response_headers
  data[:ip_policy] = ip_policy if ip_policy
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:webhook_validation] = webhook_validation if webhook_validation
  data[:oauth] = oauth if oauth
  data[:logging] = logging if logging
  data[:saml] = saml if saml
  data[:oidc] = oidc if oidc
  result = @client.patch(path % replacements, data: data, danger: true)
  NgrokAPI::Models::EndpointConfiguration.new(client: self, result: result)
end