Documentation
¶
Overview ¶
Package czds implementing a client to the CZDS REST API using both the documented and undocumented API endpoints
Index ¶
- Constants
- type Client
- func (c *Client) Authenticate() error
- func (c *Client) DownloadAllRequests(output io.Writer) error
- func (c *Client) DownloadZone(url, destinationPath string) error
- func (c *Client) DownloadZoneToWriter(url string, dest io.Writer) (int64, error)
- func (c *Client) GetDownloadInfo(url string) (*DownloadInfo, error)
- func (c *Client) GetLinks() ([]string, error)
- func (c *Client) GetRequestInfo(requestID string) (*RequestsInfo, error)
- func (c *Client) GetRequests(filter *RequestsFilter) (*RequestsResponse, error)
- func (c *Client) GetTLDStatus() ([]TLDStatus, error)
- func (c *Client) GetTerms() (*Terms, error)
- func (c *Client) RequestAllTLDs(reason string) ([]string, error)
- func (c *Client) RequestTLDs(tlds []string, reason string) error
- func (c *Client) SubmitRequest(request *RequestSubmission) error
- type Credentials
- type DownloadInfo
- type FtpDetails
- type HistoryEntry
- type Request
- type RequestSubmission
- type RequestsFilter
- type RequestsInfo
- type RequestsPagination
- type RequestsResponse
- type RequestsSort
- type TLDStatus
- type Terms
Constants ¶
const ( // AuthURL production url endpoint AuthURL = "https://account-api.icann.org/api/authenticate" // BaseURL production url endpoint BaseURL = "https://czds-api.icann.org" // TestAuthURL testing url endpoint TestAuthURL = "https://account-api-test.icann.org/api/authenticate" // TestBaseURL testing url endpoint TestBaseURL = "https://czds-api-test.icann.org" )
const ( RequestAll = "" RequestSubmitted = "Submitted" RequestPending = "Pending" RequestApproved = "Approved" RequestDenied = "Denied" RequestRevoked = "Revoked" RequestExpired = "Expired" )
Filters for RequestsFilter.Status Statuses for RequestStatus.Status
const ( SortAsc = "asc" SortDesc = "desc" )
Filters for RequestsSort.Direction
const ( SortByTLD = "tld" SortByStatus = "status" SortByLastUpdated = "last_updated" SortByExpiration = "expired" SortByCreated = "created" )
Filters for RequestsSort.Field
const ( StatusAvailable = "available" StatusSubmitted = "submitted" StatusPending = "pending" StatusApproved = "approved" StatusDenied = "denied" StatusExpired = "expired" StatusRevoked = "revoked" // unverified )
Status from TLDStatus.CurrentStatus and RequestsInfo.Status
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { HTTPClient *http.Client AuthURL string BaseURL string Creds Credentials // contains filtered or unexported fields }
Client stores all session information for czds authentication and manages token renewal
func NewClient ¶
NewClient returns a new instance of the CZDS Client with the default production URLs
func (*Client) Authenticate ¶
Authenticate tests the client's credentials and gets an authentication token from the server calling this is optional. All other functions will check the auth state on their own first and authenticate if necessary.
func (*Client) DownloadAllRequests ¶
DownloadAllRequests outputs the contents of the csv file downloaded by the "Download All Requests" button on the CZDS portal to the provided output
func (*Client) DownloadZone ¶
DownloadZone provided the zone download URL retrieved from GetLinks() downloads the zone file and saves it to local disk at destinationPath
func (*Client) DownloadZoneToWriter ¶
DownloadZoneToWriter is analogous to DownloadZone but instead of writing it to a file, it will write it to a provided io.Writer. It returns the number of bytes written to dest and any error that was encountered.
func (*Client) GetDownloadInfo ¶
func (c *Client) GetDownloadInfo(url string) (*DownloadInfo, error)
GetDownloadInfo Performs a HEAD request to the zone at url and populates a DownloadInfo struct with the information returned by the headers
func (*Client) GetRequestInfo ¶
func (c *Client) GetRequestInfo(requestID string) (*RequestsInfo, error)
GetRequestInfo gets detailed information about a particular request and its timeline as seen on the CZDS dashboard page "https://czds.icann.org/zone-requests/{ID}"
func (*Client) GetRequests ¶
func (c *Client) GetRequests(filter *RequestsFilter) (*RequestsResponse, error)
GetRequests searches for the status of zones requests as seen on the CZDS dashboard page "https://czds.icann.org/zone-requests/all"
func (*Client) GetTLDStatus ¶
GetTLDStatus gets the current status of all TLDs and their ability to be requested
func (*Client) GetTerms ¶
GetTerms gets the current terms and conditions from the CZDS portal page "https://czds.icann.org/terms-and-conditions" this is required to accept the terms and conditions when submitting a new request
func (*Client) RequestAllTLDs ¶
RequestAllTLDs is a helper function to request access to all available TLDs with the provided reason
func (*Client) RequestTLDs ¶
RequestTLDs is a helper function that requests access to the provided tlds with the provided reason TLDs provided should be marked as able to request from GetTLDStatus()
func (*Client) SubmitRequest ¶
func (c *Client) SubmitRequest(request *RequestSubmission) error
SubmitRequest submits a new request for access to new zones
type Credentials ¶
Credentials used by the czds.Client
type DownloadInfo ¶
DownloadInfo information from the HEAD request from a DownloadLink
type FtpDetails ¶
type FtpDetails struct {
PrivateDataError bool `json:"privateDataError"`
}
FtpDetails contains FTP information for RequestsInfo
type HistoryEntry ¶
HistoryEntry contains a timestamp and description of action that happened for a RequestsInfo For example: requested, expired, approved, etc..
type Request ¶
type Request struct { RequestID string `json:"requestId"` TLD string `json:"tld"` ULabel string `json:"ulable"` // UTF-8 decoded punycode, looks like API has a typo Status string `json:"status"` // should be set to one of the Request* constants Created time.Time `json:"created"` LastUpdated time.Time `json:"last_updated"` Expired time.Time `json:"expired"` // Note: epoch 0 means no expiration set SFTP bool `json:"sftp"` }
Request holds information about a request in RequestsResponse from GetRequests()
type RequestSubmission ¶
type RequestSubmission struct { AllTLDs bool `json:"allTlds"` TLDNames []string `json:"tldNames"` Reason string `json:"reason"` TcVersion string `json:"tcVersion"` // terms and conditions revision version AdditionalFTPIps []string `json:"additionalFtfIps,omitempty"` }
RequestSubmission contains the information required to submit a new request with SubmitRequest()
type RequestsFilter ¶
type RequestsFilter struct { Status string `json:"status"` // should be set to one of the Request* constants Filter string `json:"filter"` // zone name search Pagination RequestsPagination `json:"pagination"` Sort RequestsSort `json:"sort"` }
RequestsFilter is used to set what results should be returned by GetRequests
type RequestsInfo ¶
type RequestsInfo struct { RequestID string `json:"requestId"` TLD *TLDStatus `json:"tld"` FtpIps []string `json:"ftpips"` Status string `json:"status"` // should be set to one of the Status* constants TcVersion string `json:"tcVersion"` Created time.Time `json:"created"` RequestIP string `json:"requestIp"` Reason string `json:"reason"` LastUpdated time.Time `json:"last_updated"` Expired time.Time `json:"expired"` // Note: epoch 0 means no expiration set History []HistoryEntry `json:"history"` FtpDetails *FtpDetails `json:"ftpDetails"` PrivateDataError bool `json:"privateDataError"` }
RequestsInfo contains the detailed information about a particular zone request returned by GetRequestInfo()
type RequestsPagination ¶
RequestsPagination sets the page size and offset for paginated results for RequestsFilter
type RequestsResponse ¶
type RequestsResponse struct { Requests []Request `json:"requests"` TotalRequests int64 `json:"totalRequests"` }
RequestsResponse holds Requests from from GetRequests() and total number of requests that match the query but may not be returned due to pagination
type RequestsSort ¶
RequestsSort sets which field and direction the results for the RequestsFilter request should be returned with
type TLDStatus ¶
type TLDStatus struct { TLD string `json:"tld"` ULabel string `json:"ulable"` // UTF-8 decoded punycode, looks like API has a typo CurrentStatus string `json:"currentStatus"` // should be set to one of the Status* constants SFTP bool `json:"sftp"` }
TLDStatus is information about a particular TLD returned from GetTLDStatus() or included in RequestsInfo
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
Package jwt defines the JWT types used by the czds authentication API
|
Package jwt defines the JWT types used by the czds authentication API |