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(wireguard_interface_id:, 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::WireguardPeerListResponse>
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.
152 153 154 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 152 def initialize(client:) @client = client end |
Instance Method Details
#create(wireguard_interface_id:, request_options: {}) ⇒ Telnyx::Models::WireguardPeerCreateResponse
Create a new WireGuard Peer. Current limitation of 5 peers per interface can be created.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 19 def create(params) parsed, = Telnyx::WireguardPeerCreateParams.dump_request(params) @client.request( method: :post, path: "wireguard_peers", body: parsed, model: Telnyx::Models::WireguardPeerCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerDeleteResponse
Delete the WireGuard peer.
119 120 121 122 123 124 125 126 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 119 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::WireguardPeerListResponse>
Some parameter documentations has been truncated, see Models::WireguardPeerListParams for more details.
List all WireGuard peers.
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 95 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::Models::WireguardPeerListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerRetrieveResponse
Retrieve the WireGuard peer.
41 42 43 44 45 46 47 48 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 41 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
139 140 141 142 143 144 145 146 147 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 139 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.
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/telnyx/resources/wireguard_peers.rb', line 66 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 |