Class: Telnyx::Resources::WireguardPeers

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/wireguard_peers.rb

Instance Method Summary collapse

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.

Parameters:



155
156
157
# File 'lib/telnyx/resources/wireguard_peers.rb', line 155

def initialize(client:)
  @client = client
end

Instance Method Details

#create(wireguard_interface_id:, public_key: nil, request_options: {}) ⇒ Telnyx::Models::WireguardPeerCreateResponse

Some parameter documentations has been truncated, see Models::WireguardPeerCreateParams for more details.

Create a new WireGuard Peer. Current limitation of 5 peers per interface can be created.

Parameters:

  • wireguard_interface_id (String)

    The id of the wireguard interface associated with the peer.

  • public_key (String)

    The WireGuard ‘PublicKey`.<br /><br />If you do not provide a Public Key, a new

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/telnyx/resources/wireguard_peers.rb', line 23

def create(params)
  parsed, options = Telnyx::WireguardPeerCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "wireguard_peers",
    body: parsed,
    model: Telnyx::Models::WireguardPeerCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerDeleteResponse

Delete the WireGuard peer.

Parameters:

  • id (String)

    Identifies the resource.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



122
123
124
125
126
127
128
129
# File 'lib/telnyx/resources/wireguard_peers.rb', line 122

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.

Parameters:

Returns:

See Also:



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/telnyx/resources/wireguard_peers.rb', line 99

def list(params = {})
  parsed, options = Telnyx::WireguardPeerListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "wireguard_peers",
    query: parsed.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::WireguardPeerListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::WireguardPeerRetrieveResponse

Retrieve the WireGuard peer.

Parameters:

  • id (String)

    Identifies the resource.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



45
46
47
48
49
50
51
52
# File 'lib/telnyx/resources/wireguard_peers.rb', line 45

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

Parameters:

  • id (String)

    Identifies the resource.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (String)

See Also:



142
143
144
145
146
147
148
149
150
# File 'lib/telnyx/resources/wireguard_peers.rb', line 142

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.

Parameters:

  • id (String)

    Identifies the resource.

  • public_key (String)

    The WireGuard ‘PublicKey`.<br /><br />If you do not provide a Public Key, a new

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



70
71
72
73
74
75
76
77
78
79
# File 'lib/telnyx/resources/wireguard_peers.rb', line 70

def update(id, params = {})
  parsed, options = Telnyx::WireguardPeerUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["wireguard_peers/%1$s", id],
    body: parsed,
    model: Telnyx::Models::WireguardPeerUpdateResponse,
    options: options
  )
end