Class: NgrokAPI::Services::IPWhitelistClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::IPWhitelistClient
- Defined in:
- lib/ngrokapi/services/ip_whitelist_client.rb
Overview
The IP Whitelist is deprecated and will be removed. Use an IP Restriction
with an endpoints type instead.
Constant Summary collapse
- PATH =
The API path for the requests
'/ip_whitelist'- LIST_PROPERTY =
The List Property from the resulting API for list calls
'whitelist'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(description: "", metadata: "", ip_net: "") ⇒ NgrokAPI::Models::IPWhitelistEntry
Create a new IP whitelist entry that will restrict traffic to all tunnel endpoints on the account.
-
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an IP whitelist entry.
-
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an IP whitelist entry.
-
#get(id: "") ⇒ NgrokAPI::Models::IPWhitelistEntry
Get detailed information about an IP whitelist entry by ID.
-
#get!(id: "") ⇒ NgrokAPI::Models::IPWhitelistEntry
Get detailed information about an IP whitelist entry by ID.
-
#initialize(client:) ⇒ IPWhitelistClient
constructor
A new instance of IPWhitelistClient.
-
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all IP whitelist entries on this account.
-
#update(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::IPWhitelistEntry
Update attributes of an IP whitelist entry by ID.
-
#update!(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::IPWhitelistEntry
Update attributes of an IP whitelist entry by ID Throws an exception if API error.
Constructor Details
#initialize(client:) ⇒ IPWhitelistClient
Returns a new instance of IPWhitelistClient.
18 19 20 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 18 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
16 17 18 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 16 def client @client end |
Instance Method Details
#create(description: "", metadata: "", ip_net: "") ⇒ NgrokAPI::Models::IPWhitelistEntry
Create a new IP whitelist entry that will restrict traffic to all tunnel endpoints on the account.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 32 def create( description: "", metadata: "", ip_net: "" ) path = '/ip_whitelist' replacements = { } data = {} data[:description] = description if description data[:metadata] = if data[:ip_net] = ip_net if ip_net result = @client.post(path % replacements, data: data) NgrokAPI::Models::IPWhitelistEntry.new(client: self, result: result) end |
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an IP whitelist entry.
55 56 57 58 59 60 61 62 63 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 55 def delete( id: "" ) path = '/ip_whitelist/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an IP whitelist entry. Throws an exception if API error.
73 74 75 76 77 78 79 80 81 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 73 def delete!( id: "" ) path = '/ip_whitelist/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::IPWhitelistEntry
Get detailed information about an IP whitelist entry by ID.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 90 def get( id: "" ) path = '/ip_whitelist/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::IPWhitelistEntry.new(client: self, result: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::IPWhitelistEntry
Get detailed information about an IP whitelist entry by ID. Throws an exception if API error.
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 110 def get!( id: "" ) path = '/ip_whitelist/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::IPWhitelistEntry.new(client: self, result: result) end |
#list(before_id: nil, limit: nil, url: nil) ⇒ NgrokAPI::Models::Listable
List all IP whitelist entries on this account
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 131 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::IPWhitelistEntry ) end |
#update(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::IPWhitelistEntry
Update attributes of an IP whitelist entry by ID
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 159 def update( id: "", description: nil, metadata: nil ) path = '/ip_whitelist/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = if result = @client.patch(path % replacements, data: data) NgrokAPI::Models::IPWhitelistEntry.new(client: self, result: result) end |
#update!(id: "", description: nil, metadata: nil) ⇒ NgrokAPI::Models::IPWhitelistEntry
Update attributes of an IP whitelist entry by ID Throws an exception if API error.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/ngrokapi/services/ip_whitelist_client.rb', line 185 def update!( id: "", description: nil, metadata: nil ) path = '/ip_whitelist/%{id}' replacements = { id: id, } data = {} data[:description] = description if description data[:metadata] = if result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::IPWhitelistEntry.new(client: self, result: result) end |