godo.CDNs.UpdateCustomDomain()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.CDNs.UpdateCustomDomain(ctx context.Context, id string, updateRequest *godo.CDNUpdateCustomDomainRequest) (*godo.CDN, *godo.Response, error)

Description

UpdateCustomDomain sets or removes the custom domain of an individual CDN

This method sends a PUT request to /v2/cdn/endpoints/{}.

Parameters

id string required
updateRequest *godo.CDNUpdateCustomDomainRequest required

Fields of godo.CDNUpdateCustomDomainRequest

CDNUpdateCustomDomainRequest represents a request to update the custom domain of a CDN.

CustomDomain string

JSON key: custom_domain

CertificateID string

JSON key: certificate_id

Returns

*godo.CDN
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.CDN

CDN represents a DigitalOcean CDN

ID string

JSON key: id

Origin string

JSON key: origin

Endpoint string

JSON key: endpoint

CreatedAt time.Time

JSON key: created_at

TTL uint32

JSON key: ttl

CertificateID string

Omitted from JSON when empty. JSON key: certificate_id

CustomDomain string

Omitted from JSON when empty. JSON key: custom_domain

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.CDNs.UpdateCustomDomain(ctx, "<your-id>", &godo.CDNUpdateCustomDomainRequest{
		CustomDomain: "<your-custom-domain>",
		CertificateID: "<your-certificate-id>",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

Response Example

Show Response Example
{
  "endpoint": {
    "id": "19f06b6a-3ace-4315-b086-499a0e521b76",
    "origin": "static-images.nyc3.digitaloceanspaces.com",
    "endpoint": "static-images.nyc3.cdn.digitaloceanspaces.com",
    "created_at": "2018-07-19T15:04:16Z",
    "ttl": 3600
  }
}

More Information

See PUT /v2/cdn/endpoints/{} in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.