Skip to content

Latest commit

 

History

History
510 lines (334 loc) · 15.6 KB

DomainAPI.md

File metadata and controls

510 lines (334 loc) · 15.6 KB

DomainAPI

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
CheckDomain GET /service/{service_id}/version/{version_id}/domain/{domain_name}/check Validate DNS configuration for a single domain on a service
CheckDomains GET /service/{service_id}/version/{version_id}/domain/check_all Validate DNS configuration for all domains on a service
CreateDomain POST /service/{service_id}/version/{version_id}/domain Add a domain name to a service
DeleteDomain DELETE /service/{service_id}/version/{version_id}/domain/{domain_name} Remove a domain from a service
GetDomain GET /service/{service_id}/version/{version_id}/domain/{domain_name} Describe a domain
ListDomains GET /service/{service_id}/version/{version_id}/domain List domains
UpdateDomain PUT /service/{service_id}/version/{version_id}/domain/{domain_name} Update a domain

CheckDomain

Validate DNS configuration for a single domain on a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    domainName := "domainName_example" // string | The name of the domain or domains associated with this service.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.CheckDomain(ctx, serviceID, versionID, domainName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.CheckDomain`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CheckDomain`: []any
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.CheckDomain`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
domainName string The name of the domain or domains associated with this service.

Other Parameters

Other parameters are passed through a pointer to a apiCheckDomainRequest struct via the builder pattern

Name Type Description Notes

Return type

[]any

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

CheckDomains

Validate DNS configuration for all domains on a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.CheckDomains(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.CheckDomains`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CheckDomains`: [][]any
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.CheckDomains`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiCheckDomainsRequest struct via the builder pattern

Name Type Description Notes

Return type

[][]any

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

CreateDomain

Add a domain name to a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    comment := "comment_example" // string | A freeform descriptive note. (optional)
    name := "name_example" // string | The name of the domain or domains associated with this service. (optional)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.CreateDomain(ctx, serviceID, versionID).Comment(comment).Name(name).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.CreateDomain`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateDomain`: DomainResponse
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.CreateDomain`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiCreateDomainRequest struct via the builder pattern

Name Type Description Notes
comment string A freeform descriptive note. name

Return type

DomainResponse

Authorization

API Token

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Back to top | Back to API list | Back to README

DeleteDomain

Remove a domain from a service

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    domainName := "domainName_example" // string | The name of the domain or domains associated with this service.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.DeleteDomain(ctx, serviceID, versionID, domainName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.DeleteDomain`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `DeleteDomain`: InlineResponse200
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.DeleteDomain`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
domainName string The name of the domain or domains associated with this service.

Other Parameters

Other parameters are passed through a pointer to a apiDeleteDomainRequest struct via the builder pattern

Name Type Description Notes

Return type

InlineResponse200

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

GetDomain

Describe a domain

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    domainName := "domainName_example" // string | The name of the domain or domains associated with this service.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.GetDomain(ctx, serviceID, versionID, domainName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.GetDomain`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetDomain`: DomainResponse
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.GetDomain`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
domainName string The name of the domain or domains associated with this service.

Other Parameters

Other parameters are passed through a pointer to a apiGetDomainRequest struct via the builder pattern

Name Type Description Notes

Return type

DomainResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

ListDomains

List domains

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.ListDomains(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.ListDomains`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListDomains`: []DomainResponse
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.ListDomains`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiListDomainsRequest struct via the builder pattern

Name Type Description Notes

Return type

[]DomainResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

UpdateDomain

Update a domain

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    domainName := "domainName_example" // string | The name of the domain or domains associated with this service.
    comment := "comment_example" // string | A freeform descriptive note. (optional)
    name := "name_example" // string | The name of the domain or domains associated with this service. (optional)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.DomainAPI.UpdateDomain(ctx, serviceID, versionID, domainName).Comment(comment).Name(name).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `DomainAPI.UpdateDomain`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateDomain`: DomainResponse
    fmt.Fprintf(os.Stdout, "Response from `DomainAPI.UpdateDomain`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.
domainName string The name of the domain or domains associated with this service.

Other Parameters

Other parameters are passed through a pointer to a apiUpdateDomainRequest struct via the builder pattern

Name Type Description Notes
comment string A freeform descriptive note. name

Return type

DomainResponse

Authorization

API Token

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Back to top | Back to API list | Back to README