pullzone_add_custom_hostname.go raw

   1  package bunny
   2  
   3  import (
   4  	"context"
   5  	"fmt"
   6  )
   7  
   8  // AddCustomHostnameOptions represents the message that is sent to the
   9  // Add Custom Hostname API Endpoint.
  10  //
  11  // Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addhostname
  12  type AddCustomHostnameOptions struct {
  13  	// Hostname the hostname to add. (Required)
  14  	Hostname *string `json:"Hostname,omitempty"`
  15  }
  16  
  17  // AddCustomHostname adds a custom hostname to the Pull Zone.
  18  //
  19  // Bunny.net API docs: https://docs.bunny.net/reference/pullzonepublic_addhostname
  20  func (s *PullZoneService) AddCustomHostname(ctx context.Context, pullZoneID int64, opts *AddCustomHostnameOptions) error {
  21  	path := fmt.Sprintf("pullzone/%d/addHostname", pullZoneID)
  22  	return resourcePost(ctx, s.client, path, opts)
  23  }
  24