Class: NgrokAPI::Services::EdgesTLSClient

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

Overview

Constant Summary collapse

PATH =

The API path for the requests

'/edges/tls'
LIST_PROPERTY =

The List Property from the resulting API for list calls

'tls_edges'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EdgesTLSClient

Returns a new instance of EdgesTLSClient.



17
18
19
# File 'lib/ngrokapi/services/edges_tls_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/edges_tls_client.rb', line 15

def client
  @client
end

Instance Method Details

#create(description: "", metadata: "", hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil) ⇒ NgrokAPI::Models::TLSEdge

Parameters:

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

    human-readable description of what this edge will be used for; optional, max 255 bytes.

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

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

  • hostports (List<string>) (defaults to: nil)

    hostports served by this edge

  • backend (EndpointBackendMutate) (defaults to: nil)

    edge modules

  • ip_restriction (EndpointIPPolicyMutate) (defaults to: nil)
  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)
  • tls_termination (EndpointTLSTermination) (defaults to: nil)
  • traffic_policy (EndpointTrafficPolicy) (defaults to: nil)

    the traffic policy associated with this edge or null

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ngrokapi/services/edges_tls_client.rb', line 35

def create(description: "", metadata: "", hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil)
  path = '/edges/tls'
  replacements = {
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:hostports] = hostports if hostports
  data[:backend] = backend if backend
  data[:ip_restriction] = ip_restriction if ip_restriction
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:traffic_policy] = traffic_policy if traffic_policy
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::TLSEdge.new(client: self, attrs: result)
end

#create!(description: "", metadata: "", hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil) ⇒ NgrokAPI::Models::TLSEdge

Create a TLS Edge Throws an exception if API error.

https://ngrok.com/docs/api#api-edges-tls-create

Parameters:

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

    human-readable description of what this edge will be used for; optional, max 255 bytes.

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

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

  • hostports (List<string>) (defaults to: nil)

    hostports served by this edge

  • backend (EndpointBackendMutate) (defaults to: nil)

    edge modules

  • ip_restriction (EndpointIPPolicyMutate) (defaults to: nil)
  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)
  • tls_termination (EndpointTLSTermination) (defaults to: nil)
  • traffic_policy (EndpointTrafficPolicy) (defaults to: nil)

    the traffic policy associated with this edge or null

Returns:



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

def create!(description: "", metadata: "", hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil)
  path = '/edges/tls'
  replacements = {
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:hostports] = hostports if hostports
  data[:backend] = backend if backend
  data[:ip_restriction] = ip_restriction if ip_restriction
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:traffic_policy] = traffic_policy if traffic_policy
  result = @client.post(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TLSEdge.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



252
253
254
255
256
257
258
# File 'lib/ngrokapi/services/edges_tls_client.rb', line 252

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

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

Delete a TLS Edge by ID Throws an exception if API error.

https://ngrok.com/docs/api#api-edges-tls-delete

Parameters:

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

    a resource identifier

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



268
269
270
271
272
273
274
# File 'lib/ngrokapi/services/edges_tls_client.rb', line 268

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

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

Parameters:

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

    a resource identifier

Returns:



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

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

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

Get a TLS Edge by ID Throws an exception if API error.

https://ngrok.com/docs/api#api-edges-tls-get

Parameters:

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

    a resource identifier

Returns:



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

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

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

Returns a list of all TLS Edges on this account

https://ngrok.com/docs/api#api-edges-tls-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:



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/ngrokapi/services/edges_tls_client.rb', line 128

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

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

Returns a list of all TLS Edges on this account Throws an exception if API error.

https://ngrok.com/docs/api#api-edges-tls-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:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/ngrokapi/services/edges_tls_client.rb', line 154

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::TLSEdge,
    danger: true
  )
end

#update(id: "", description: nil, metadata: nil, hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil) ⇒ NgrokAPI::Models::TLSEdge

Updates a TLS Edge by ID. 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.

https://ngrok.com/docs/api#api-edges-tls-update

Parameters:

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

    unique identifier of this edge

  • description (string) (defaults to: nil)

    human-readable description of what this edge will be used for; optional, max 255 bytes.

  • metadata (string) (defaults to: nil)

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

  • hostports (List<string>) (defaults to: nil)

    hostports served by this edge

  • backend (EndpointBackendMutate) (defaults to: nil)

    edge modules

  • ip_restriction (EndpointIPPolicyMutate) (defaults to: nil)
  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)
  • tls_termination (EndpointTLSTermination) (defaults to: nil)
  • traffic_policy (EndpointTrafficPolicy) (defaults to: nil)

    the traffic policy associated with this edge or null

Returns:



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/ngrokapi/services/edges_tls_client.rb', line 190

def update(id: "", description: nil, metadata: nil, hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil)
  path = '/edges/tls/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:hostports] = hostports if hostports
  data[:backend] = backend if backend
  data[:ip_restriction] = ip_restriction if ip_restriction
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:traffic_policy] = traffic_policy if traffic_policy
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::TLSEdge.new(client: self, attrs: result)
end

#update!(id: "", description: nil, metadata: nil, hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil) ⇒ NgrokAPI::Models::TLSEdge

Updates a TLS Edge by ID. 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.

https://ngrok.com/docs/api#api-edges-tls-update

Parameters:

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

    unique identifier of this edge

  • description (string) (defaults to: nil)

    human-readable description of what this edge will be used for; optional, max 255 bytes.

  • metadata (string) (defaults to: nil)

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

  • hostports (List<string>) (defaults to: nil)

    hostports served by this edge

  • backend (EndpointBackendMutate) (defaults to: nil)

    edge modules

  • ip_restriction (EndpointIPPolicyMutate) (defaults to: nil)
  • mutual_tls (EndpointMutualTLSMutate) (defaults to: nil)
  • tls_termination (EndpointTLSTermination) (defaults to: nil)
  • traffic_policy (EndpointTrafficPolicy) (defaults to: nil)

    the traffic policy associated with this edge or null

Returns:



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

def update!(id: "", description: nil, metadata: nil, hostports: nil, backend: nil, ip_restriction: nil, mutual_tls: nil, tls_termination: nil, policy: nil, traffic_policy: nil)
  path = '/edges/tls/%{id}'
  replacements = {
    id: id,
  }
  data = {}
  data[:description] = description if description
  data[:metadata] =  if 
  data[:hostports] = hostports if hostports
  data[:backend] = backend if backend
  data[:ip_restriction] = ip_restriction if ip_restriction
  data[:mutual_tls] = mutual_tls if mutual_tls
  data[:tls_termination] = tls_termination if tls_termination
  data[:traffic_policy] = traffic_policy if traffic_policy
  result = @client.patch(path % replacements, data: data, danger: true)
  NgrokAPI::Models::TLSEdge.new(client: self, attrs: result)
end