Class: Telnyx::Resources::GlobalIPAssignments

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/global_ip_assignments.rb,
sig/telnyx/resources/global_ip_assignments.rbs

Overview

Global IPs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ GlobalIPAssignments

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 GlobalIPAssignments.

Parameters:



122
123
124
# File 'lib/telnyx/resources/global_ip_assignments.rb', line 122

def initialize(client:)
  @client = client
end

Instance Method Details

#create(request_options: {}) ⇒ Telnyx::Models::GlobalIPAssignmentCreateResponse

Assigns a Global IP to a WireGuard peer so traffic destined for the IP is delivered over that peer's tunnel. Assignment is asynchronous, so the request is accepted and completes in the background.

Parameters:

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/telnyx/resources/global_ip_assignments.rb', line 18

def create(params = {})
  @client.request(
    method: :post,
    path: "global_ip_assignments",
    model: Telnyx::Models::GlobalIPAssignmentCreateResponse,
    options: params[:request_options]
  )
end

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

Deletes the specified Global IP assignment, detaching the Global IP from its WireGuard peer.

Parameters:

  • id (String)

    Identifies the resource.

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

Returns:

See Also:



110
111
112
113
114
115
116
117
# File 'lib/telnyx/resources/global_ip_assignments.rb', line 110

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["global_ip_assignments/%1$s", id],
    model: Telnyx::Models::GlobalIPAssignmentDeleteResponse,
    options: params[:request_options]
  )
end

#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::GlobalIPAssignment>

Returns a paginated list of your Global IP assignments, the links between Global IPs and the WireGuard peers that receive their traffic.

Parameters:

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

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/telnyx/resources/global_ip_assignments.rb', line 85

def list(params = {})
  parsed, options = Telnyx::GlobalIPAssignmentListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "global_ip_assignments",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::GlobalIPAssignment,
    options: options
  )
end

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

Returns the details of a single Global IP assignment, including the Global IP and WireGuard peer it links.

Parameters:

  • id (String)

    Identifies the resource.

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

Returns:

See Also:



39
40
41
42
43
44
45
46
# File 'lib/telnyx/resources/global_ip_assignments.rb', line 39

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["global_ip_assignments/%1$s", id],
    model: Telnyx::Models::GlobalIPAssignmentRetrieveResponse,
    options: params[:request_options]
  )
end

#update(global_ip_assignment_id, global_ip_assignment_update_request:, request_options: {}) ⇒ Telnyx::Models::GlobalIPAssignmentUpdateResponse

Updates the specified Global IP assignment with the provided fields and returns the updated assignment.

Parameters:

Returns:

See Also:



62
63
64
65
66
67
68
69
70
71
# File 'lib/telnyx/resources/global_ip_assignments.rb', line 62

def update(global_ip_assignment_id, params)
  parsed, options = Telnyx::GlobalIPAssignmentUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["global_ip_assignments/%1$s", global_ip_assignment_id],
    body: parsed[:global_ip_assignment_update_request],
    model: Telnyx::Models::GlobalIPAssignmentUpdateResponse,
    options: options
  )
end