Custom Domains

A CustomDomain object represents an additional customer-owned domain that routes to a Files.com site.

List Custom Domains

SDK Method

customdomain.List()

Return Object

[]*CustomDomain

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    custom_domain "github.com/Files-com/files-sdk-go/v3/customdomain"
)

customDomainIterator, err := custom_domain.List(files_sdk.CustomDomainListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

for customDomainIterator.Next() {
    customDomain := customDomainIterator.customDomain()
}
err = customDomainIterator.Err()
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Show Custom Domain

SDK Method

customdomain.Find()

Return Object

CustomDomain

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

CustomDomainFindParams Fields

FieldDescription
Id
int64
Required
Custom Domain ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    custom_domain "github.com/Files-com/files-sdk-go/v3/customdomain"
)

customDomain, err := custom_domain.Find(files_sdk.CustomDomainFindParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Allocate dedicated IP addresses to this Custom Domain

SDK Method

customdomain.CreateAllocateIp()

Return Object

CustomDomain

Authorization Requirement

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

CustomDomainCreateAllocateIpParams Fields

FieldDescription
Id
int64
Required
Custom Domain ID.
Count
int64
Required
Number of dedicated IP addresses to allocate.
Possible values: 1, 2

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    custom_domain "github.com/Files-com/files-sdk-go/v3/customdomain"
)

customDomain, err := custom_domain.CreateAllocateIp(files_sdk.CustomDomainCreateAllocateIpParams{
  Id: 1,
  Count: 1
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Create Custom Domain

SDK Method

customdomain.Create()

Return Object

CustomDomain

Authorization Requirement

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

CustomDomainCreateParams Fields

FieldDefaultDescription
AvailableToAllWorkspaces
boolean
falseAllow all workspaces to use this default-workspace Custom Domain.
WorkspaceId
int64
0Workspace ID (0 for the default workspace).
Destination
string
"site_alias"Where this custom domain routes. Can be site_alias, public_hosting, s3_endpoint, or unassigned (not routing traffic). Set to unassigned automatically when a bound public_hosting folder behavior is deleted, and can be set manually via the API for any reason.
Possible values: site_alias, public_hosting, s3_endpoint, unassigned
FolderBehaviorId
int64
Public Hosting behavior ID when this domain routes to a specific Public Hosting behavior. Preserved as historical context when destination becomes unassigned.
SslCertificateId
int64
Current SSL certificate ID.
Domain
string
Required
Customer-owned domain name.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    custom_domain "github.com/Files-com/files-sdk-go/v3/customdomain"
)

customDomain, err := custom_domain.Create(files_sdk.CustomDomainCreateParams{Domain: "files.example.com"})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Update Custom Domain

SDK Method

customdomain.Update()

Return Object

CustomDomain

Authorization Requirement

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

CustomDomainUpdateParams Fields

FieldDescription
Id
int64
Required
Custom Domain ID.
AvailableToAllWorkspaces
boolean
Allow all workspaces to use this default-workspace Custom Domain.
WorkspaceId
int64
Workspace ID (0 for the default workspace).
Destination
string
Where this custom domain routes. Can be site_alias, public_hosting, s3_endpoint, or unassigned (not routing traffic). Set to unassigned automatically when a bound public_hosting folder behavior is deleted, and can be set manually via the API for any reason.
Possible values: site_alias, public_hosting, s3_endpoint, unassigned
FolderBehaviorId
int64
Public Hosting behavior ID when this domain routes to a specific Public Hosting behavior. Preserved as historical context when destination becomes unassigned.
SslCertificateId
int64
Current SSL certificate ID.
Domain
string
Customer-owned domain name.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    custom_domain "github.com/Files-com/files-sdk-go/v3/customdomain"
)

customDomain, err := custom_domain.Update(files_sdk.CustomDomainUpdateParams{
  Id: 1,
  AvailableToAllWorkspaces: lib.Bool(false)
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Delete Custom Domain

SDK Method

customdomain.Delete()

Return Object

No return value.

Authorization Requirement

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

CustomDomainDeleteParams Fields

FieldDescription
Id
int64
Required
Custom Domain ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    custom_domain "github.com/Files-com/files-sdk-go/v3/customdomain"
)

err := custom_domain.Delete(files_sdk.CustomDomainDeleteParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

The CustomDomain Object

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

AttributeDescription
Id
int64
Custom Domain ID.
WorkspaceId
int64
Workspace ID (0 for the default workspace).
AvailableToAllWorkspaces
boolean
Allow all workspaces to use this default-workspace Custom Domain.
OutboundIpAddresses
array(string)
Eligible public IP addresses for Remote Server outbound connections. Empty when this Custom Domain is not eligible for outbound selection.
Domain
string
Customer-owned domain name.
Destination
string
Where this custom domain routes. Can be site_alias, public_hosting, s3_endpoint, or unassigned (not routing traffic). Set to unassigned automatically when a bound public_hosting folder behavior is deleted, and can be set manually via the API for any reason.
Possible values: site_alias, public_hosting, s3_endpoint, unassigned
DnsStatus
string
Current DNS verification status.
Possible values: disabled, correct, no_records, cname_wrong, a_record, caa_conflict
SslCertificateId
int64
Current SSL certificate ID.
BrickManaged
boolean
Is this domain's SSL certificate automatically managed and renewed by Files.com?
FolderBehaviorId
int64
Public Hosting behavior ID when this domain routes to a specific Public Hosting behavior. Preserved as historical context when destination becomes unassigned.
IpAddresses
array(string)
Dedicated public IP addresses allocated to this Custom Domain.
CreatedAt
date-time
When this Custom Domain was created.
UpdatedAt
date-time
When this Custom Domain was last updated.