Class: Telnyx::Resources::WireguardPeers
- Inherits:
-
Object
- Object
- Telnyx::Resources::WireguardPeers
- Defined in:
- lib/telnyx/resources/wireguard_peers.rb
Overview
WireGuard Interface operations
Instance Method Summary collapse
-
#create(body:, request_options: {}) ⇒ Telnyx::Models::WireguardPeerCreateResponse
Create a new WireGuard Peer.
-
#delete(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerDeleteResponse
Delete the WireGuard peer.
-
#initialize(client:) ⇒ WireguardPeers
constructor
private
A new instance of WireguardPeers.
-
#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::WireguardPeer>
Some parameter documentations has been truncated, see Models::WireguardPeerListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerRetrieveResponse
Retrieve the WireGuard peer.
-
#retrieve_config(id, request_options: {}) ⇒ String
Retrieve Wireguard config template for Peer.
-
#update(id, public_key: nil, request_options: {}) ⇒ Telnyx::Models::WireguardPeerUpdateResponse
Some parameter documentations has been truncated, see Models::WireguardPeerUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ WireguardPeers
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of WireguardPeers.
151 152 153 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 151 def initialize(client:) @client = client end |
Instance Method Details
#create(body:, request_options: {}) ⇒ Telnyx::Models::WireguardPeerCreateResponse
Create a new WireGuard Peer. Current limitation of 5 peers per interface can be created.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 18 def create(params) parsed, = Telnyx::WireguardPeerCreateParams.dump_request(params) @client.request( method: :post, path: "wireguard_peers", body: parsed[:body], model: Telnyx::Models::WireguardPeerCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerDeleteResponse
Delete the WireGuard peer.
118 119 120 121 122 123 124 125 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 118 def delete(id, params = {}) @client.request( method: :delete, path: ["wireguard_peers/%1$s", id], model: Telnyx::Models::WireguardPeerDeleteResponse, options: params[:request_options] ) end |
#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::WireguardPeer>
Some parameter documentations has been truncated, see Models::WireguardPeerListParams for more details.
List all WireGuard peers.
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 94 def list(params = {}) parsed, = Telnyx::WireguardPeerListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "wireguard_peers", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::WireguardPeer, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerRetrieveResponse
Retrieve the WireGuard peer.
40 41 42 43 44 45 46 47 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 40 def retrieve(id, params = {}) @client.request( method: :get, path: ["wireguard_peers/%1$s", id], model: Telnyx::Models::WireguardPeerRetrieveResponse, options: params[:request_options] ) end |
#retrieve_config(id, request_options: {}) ⇒ String
Retrieve Wireguard config template for Peer
138 139 140 141 142 143 144 145 146 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 138 def retrieve_config(id, params = {}) @client.request( method: :get, path: ["wireguard_peers/%1$s/config", id], headers: {"accept" => "text/plain"}, model: String, options: params[:request_options] ) end |
#update(id, public_key: nil, request_options: {}) ⇒ Telnyx::Models::WireguardPeerUpdateResponse
Some parameter documentations has been truncated, see Models::WireguardPeerUpdateParams for more details.
Update the WireGuard peer.
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 65 def update(id, params = {}) parsed, = Telnyx::WireguardPeerUpdateParams.dump_request(params) @client.request( method: :patch, path: ["wireguard_peers/%1$s", id], body: parsed, model: Telnyx::Models::WireguardPeerUpdateResponse, options: ) end |