IP Addresses

An IPAddress is a record of IP addresses that you can use to automate keeping your firewall's configuration up to date.

Customers who maintain custom firewall configurations may require knowing the public IP addresses of Files.com's edge servers.

List IP Addresses associated with the current site

SDK Method

ip_address.List()

Return Values

Returns a *ip_address.Iter and an error. All() returns iter.Seq2[any, error] because this package has listings that return different resource types. This operation yields files_sdk.IpAddress values. Use a type assertion or type switch to access their fields. Check each loop error before using its resource. Next() and Err() remain supported.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    ip_address "github.com/Files-com/files-sdk-go/v3/ipaddress"
)

ipAddressIterator, err := ip_address.List(files_sdk.IpAddressListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

for ipAddress, err := range ipAddressIterator.All() {
    if err != nil {
        var respErr files_sdk.ResponseError
        if errors.As(err, &respErr) {
            fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
        } else {
            fmt.Printf("Request failed: %v\n", err)
        }
        return
    }
    switch address := ipAddress.(type) {
    case files_sdk.IpAddress:
        fmt.Println(address.IpAddresses)
    case files_sdk.PublicIpAddress:
        fmt.Println(address.IpAddress)
    }
}

The IpAddress Object

Some of the methods above return a IpAddress object. The attributes of this object are listed below.

AttributeDescription
Id
string
Unique label for list; used by Zapier and other integrations.
AssociatedWith
string
The object that this public IP address list is associated with.
GroupId
int64
Group ID
IpAddresses
array(string)
A list of IP addresses.