Documentation ¶
Overview ¶
Package rest defines the api services used to communicate with NS1.
Index ¶
- Variables
- func CheckResponse(resp *http.Response) error
- func SetAPIKey(key string) func(*Client)
- func SetBoolParam(key string, b bool) func(*url.Values)
- func SetDDIAPI() func(*Client)
- func SetEndpoint(endpoint string) func(*Client)
- func SetFollowPagination(shouldFollow bool) func(*Client)
- func SetHTTPClient(httpClient Doer) func(*Client)
- func SetIntParam(key string, val int) func(*url.Values)
- func SetRateLimitFunc(ratefunc func(rl RateLimit)) func(*Client)
- func SetStringParam(key, val string) func(*url.Values)
- func SetTimeParam(key string, t time.Time) func(*url.Values)
- func SetUserAgent(ua string) func(*Client)
- type APIKeysService
- func (s *APIKeysService) Create(a *account.APIKey) (*http.Response, error)
- func (s *APIKeysService) Delete(keyID string) (*http.Response, error)
- func (s *APIKeysService) Get(keyID string) (*account.APIKey, *http.Response, error)
- func (s *APIKeysService) List() ([]*account.APIKey, *http.Response, error)
- func (s *APIKeysService) Update(a *account.APIKey) (*http.Response, error)
- type ApplicationsService
- func (s *ApplicationsService) Create(a *pulsar.Application) (*http.Response, error)
- func (s *ApplicationsService) Delete(id string) (*http.Response, error)
- func (s *ApplicationsService) Get(id string) (*pulsar.Application, *http.Response, error)
- func (s *ApplicationsService) List() ([]*pulsar.Application, *http.Response, error)
- func (s *ApplicationsService) Update(a *pulsar.Application) (*http.Response, error)
- type Client
- func (c Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c Client) DoWithPagination(req *http.Request, v interface{}, f NextFunc) (*http.Response, error)
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) RateLimitStrategyConcurrent(parallelism int)
- func (c *Client) RateLimitStrategySleep()
- type DNSSECService
- type DNSViewService
- func (s *DNSViewService) Create(v *dns.DNSView) (*http.Response, error)
- func (s *DNSViewService) Delete(viewName string) (*http.Response, error)
- func (s *DNSViewService) Get(viewName string) (*dns.DNSView, *http.Response, error)
- func (s *DNSViewService) GetPreferences() (map[string]int, *http.Response, error)
- func (s *DNSViewService) List() ([]*dns.DNSView, *http.Response, error)
- func (s *DNSViewService) Update(v *dns.DNSView) (*http.Response, error)
- func (s *DNSViewService) UpdatePreferences(m map[string]int) (map[string]int, *http.Response, error)
- type DataFeedsService
- func (s *DataFeedsService) Create(sourceID string, df *data.Feed) (*http.Response, error)
- func (s *DataFeedsService) Delete(sourceID string, feedID string) (*http.Response, error)
- func (s *DataFeedsService) Get(sourceID string, feedID string) (*data.Feed, *http.Response, error)
- func (s *DataFeedsService) List(sourceID string) ([]*data.Feed, *http.Response, error)
- func (s *DataFeedsService) Update(sourceID string, df *data.Feed) (*http.Response, error)
- type DataSourcesService
- func (s *DataSourcesService) Create(ds *data.Source) (*http.Response, error)
- func (s *DataSourcesService) Delete(id string) (*http.Response, error)
- func (s *DataSourcesService) Get(id string) (*data.Source, *http.Response, error)
- func (s *DataSourcesService) List() ([]*data.Source, *http.Response, error)
- func (s *DataSourcesService) Publish(dsID string, data interface{}) (*http.Response, error)
- func (s *DataSourcesService) Update(ds *data.Source) (*http.Response, error)
- type Decorator
- type Doer
- type DoerFunc
- type Error
- type IPAMService
- func (s *IPAMService) CreateSubnet(addr *ipam.Address) (*ipam.Address, *http.Response, error)
- func (s *IPAMService) DeleteSubnet(id int) (*http.Response, error)
- func (s *IPAMService) EditSubnet(addr *ipam.Address, parent bool) (newAddr, parentAddr *ipam.Address, resp *http.Response, err error)
- func (s *IPAMService) GetChildren(addrID int) ([]*ipam.Address, *http.Response, error)
- func (s *IPAMService) GetParent(addrID int) (*ipam.Address, *http.Response, error)
- func (s *IPAMService) GetSubnet(addrID int) (*ipam.Address, *http.Response, error)
- func (s *IPAMService) ListAddrs() ([]ipam.Address, *http.Response, error)
- func (s *IPAMService) MergeSubnet(rootID, mergeID int) (*ipam.Address, *http.Response, error)
- func (s *IPAMService) SplitSubnet(id, prefix int) (rootAddr int, prefixIDs []int, resp *http.Response, err error)
- type JobsService
- func (s *JobsService) Create(mj *monitor.Job) (*http.Response, error)
- func (s *JobsService) Delete(id string) (*http.Response, error)
- func (s *JobsService) Get(id string) (*monitor.Job, *http.Response, error)
- func (s *JobsService) History(id string, opts ...func(*url.Values)) ([]*monitor.StatusLog, *http.Response, error)
- func (s *JobsService) List() ([]*monitor.Job, *http.Response, error)
- func (s *JobsService) Update(mj *monitor.Job) (*http.Response, error)
- type Link
- type Links
- type NextFunc
- type NotificationsService
- func (s *NotificationsService) Create(nl *monitor.NotifyList) (*http.Response, error)
- func (s *NotificationsService) Delete(listID string) (*http.Response, error)
- func (s *NotificationsService) Get(listID string) (*monitor.NotifyList, *http.Response, error)
- func (s *NotificationsService) List() ([]*monitor.NotifyList, *http.Response, error)
- func (s *NotificationsService) Update(nl *monitor.NotifyList) (*http.Response, error)
- type OptionDefService
- func (s *OptionDefService) Create(od *dhcp.OptionDef, odSpace, odKey string) (*dhcp.OptionDef, *http.Response, error)
- func (s *OptionDefService) Delete(odSpace, odKey string) (*http.Response, error)
- func (s *OptionDefService) Get(odSpace, odKey string) (*dhcp.OptionDef, *http.Response, error)
- func (s *OptionDefService) List() ([]dhcp.OptionDef, *http.Response, error)
- type PulsarJobsService
- func (s *PulsarJobsService) Create(j *pulsar.PulsarJob) (*http.Response, error)
- func (s *PulsarJobsService) Delete(pulsarJob *pulsar.PulsarJob) (*http.Response, error)
- func (s *PulsarJobsService) Get(appId string, jobId string) (*pulsar.PulsarJob, *http.Response, error)
- func (s *PulsarJobsService) List(appId string) ([]*pulsar.PulsarJob, *http.Response, error)
- func (s *PulsarJobsService) Update(j *pulsar.PulsarJob) (*http.Response, error)
- type RateLimit
- type RateLimitFunc
- type RecordsService
- func (s *RecordsService) Create(r *dns.Record) (*http.Response, error)
- func (s *RecordsService) Delete(zone string, domain string, t string) (*http.Response, error)
- func (s *RecordsService) Get(zone, domain, t string) (*dns.Record, *http.Response, error)
- func (s *RecordsService) Update(r *dns.Record) (*http.Response, error)
- type ReservationService
- func (s *ReservationService) Create(sc *dhcp.Reservation) (*dhcp.Reservation, *http.Response, error)
- func (s *ReservationService) Delete(id int) (*http.Response, error)
- func (s *ReservationService) Edit(sc *dhcp.Reservation) (*dhcp.Reservation, *http.Response, error)
- func (s *ReservationService) Get(scID int) (*dhcp.Reservation, *http.Response, error)
- func (s *ReservationService) List() ([]dhcp.Reservation, *http.Response, error)
- type Response
- type ScopeGroupService
- func (s *ScopeGroupService) Create(sg *dhcp.ScopeGroup) (*dhcp.ScopeGroup, *http.Response, error)
- func (s *ScopeGroupService) Delete(id int) (*http.Response, error)
- func (s *ScopeGroupService) Edit(sg *dhcp.ScopeGroup) (*dhcp.ScopeGroup, *http.Response, error)
- func (s *ScopeGroupService) Get(sgID int) (*dhcp.ScopeGroup, *http.Response, error)
- func (s *ScopeGroupService) List() ([]dhcp.ScopeGroup, *http.Response, error)
- type ScopeService
- func (s *ScopeService) Create(sc *dhcp.Scope) (*dhcp.Scope, *http.Response, error)
- func (s *ScopeService) Delete(id int) (*http.Response, error)
- func (s *ScopeService) Edit(sc *dhcp.Scope) (*dhcp.Scope, *http.Response, error)
- func (s *ScopeService) Get(scID int) (*dhcp.Scope, *http.Response, error)
- func (s *ScopeService) List() ([]dhcp.Scope, *http.Response, error)
- type SettingsService
- type StatsService
- type TeamsService
- func (s *TeamsService) Create(t *account.Team) (*http.Response, error)
- func (s *TeamsService) Delete(id string) (*http.Response, error)
- func (s *TeamsService) Get(id string) (*account.Team, *http.Response, error)
- func (s *TeamsService) List() ([]*account.Team, *http.Response, error)
- func (s *TeamsService) Update(t *account.Team) (*http.Response, error)
- type TsigService
- func (s *TsigService) Create(tk *dns.TSIGKey) (*http.Response, error)
- func (s *TsigService) Delete(name string) (*http.Response, error)
- func (s *TsigService) Get(name string) (*dns.TSIGKey, *http.Response, error)
- func (s *TsigService) List() ([]*dns.TSIGKey, *http.Response, error)
- func (s *TsigService) Update(tk *dns.TSIGKey) (*http.Response, error)
- type UsersService
- func (s *UsersService) Create(u *account.User) (*http.Response, error)
- func (s *UsersService) Delete(username string) (*http.Response, error)
- func (s *UsersService) Get(username string) (*account.User, *http.Response, error)
- func (s *UsersService) List() ([]*account.User, *http.Response, error)
- func (s *UsersService) Update(u *account.User) (*http.Response, error)
- type WarningsService
- type ZonesService
- func (s *ZonesService) Create(z *dns.Zone) (*http.Response, error)
- func (s *ZonesService) Delete(zone string) (*http.Response, error)
- func (s *ZonesService) Get(zone string) (*dns.Zone, *http.Response, error)
- func (s *ZonesService) List() ([]*dns.Zone, *http.Response, error)
- func (s *ZonesService) Update(z *dns.Zone) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyExists bundles PUT create error. ErrKeyExists = errors.New("key already exists") // ErrKeyMissing bundles GET/POST/DELETE error. ErrKeyMissing = errors.New("key does not exist") )
var ( // ErrTeamExists bundles PUT create error. ErrTeamExists = errors.New("team already exists") // ErrTeamMissing bundles GET/POST/DELETE error. ErrTeamMissing = errors.New("team does not exist") )
var ( // ErrUserExists bundles PUT create error. ErrUserExists = errors.New("user already exists") // ErrUserMissing bundles GET/POST/DELETE error. ErrUserMissing = errors.New("user does not exist") )
var ( // ErrViewExists bundles CREATE error. ErrViewExists = errors.New("DNS view already exists") // ErrViewExists bundles GET error. ErrViewMissing = errors.New("DNS view not found") )
var ( // ErrListExists bundles PUT create error. ErrListExists = errors.New("notify List already exists") // ErrListMissing bundles GET/POST/DELETE error. ErrListMissing = errors.New("notify List does not exist") )
var ( // ErrAppMissing bundles GET/PUT/POST/DELETE ErrAppMissing = errors.New("pulsar application does not exist") // ErrJobMissing bundles GET/POST/DELETE error. ErrJobMissing = errors.New("pulsar job does not exist") )
var ( // ErrRecordExists bundles PUT create error. ErrRecordExists = errors.New("record already exists") // ErrRecordMissing bundles GET/POST/DELETE error. ErrRecordMissing = errors.New("record does not exist") )
var ( // ErrTsigKeyExists bundles PUT create error. ErrTsigKeyExists = errors.New("TSIG key already exists") // ErrTsigKeyMissing bundles GET/POST/DELETE error. ErrTsigKeyMissing = errors.New("TSIG key does not exist") )
var ( // ErrZoneExists bundles PUT create error. ErrZoneExists = errors.New("zone already exists") // ErrZoneMissing bundles GET/POST/DELETE error. ErrZoneMissing = errors.New("zone does not exist") )
var ( // ErrApplicationMissing bundles GET/POST/DELETE error. ErrApplicationMissing = errors.New("application does not exist") )
var ( // ErrDNSECNotEnabled if DNSSEC is not enabled for the zone, regardless of // account-level DNSSEC permission. ErrDNSECNotEnabled = errors.New("DNSSEC is not enabled on the zone") )
Functions ¶
func CheckResponse ¶
CheckResponse handles parsing of rest api errors. Returns nil if no error.
func SetBoolParam ¶
SetBoolParam sets a url boolean query param given the parameters name.
func SetDDIAPI ¶
func SetDDIAPI() func(*Client)
SetDDIAPI configures the client to use permissions compatible with the DDI API.
func SetEndpoint ¶
SetEndpoint sets a Client instances' Endpoint.
func SetFollowPagination ¶
SetFollowPagination sets a Client instances' FollowPagination attribute.
func SetHTTPClient ¶
SetHTTPClient sets a Client instances' httpClient.
func SetIntParam ¶
SetIntParam sets a url integer query param given the parameters name.
func SetRateLimitFunc ¶
SetRateLimitFunc sets a Client instances' RateLimitFunc.
func SetStringParam ¶
SetStringParam sets a url string query param given the parameters name.
func SetTimeParam ¶
SetTimeParam sets a url timestamp query param given the parameters name.
func SetUserAgent ¶
SetUserAgent sets a Client instances' user agent.
Types ¶
type APIKeysService ¶
type APIKeysService service
APIKeysService handles 'account/apikeys' endpoint.
func (*APIKeysService) Create ¶
Create takes a *APIKey and creates a new account apikey.
NS1 API docs: https://ns1.com/api/#apikeys-put
func (*APIKeysService) Delete ¶
func (s *APIKeysService) Delete(keyID string) (*http.Response, error)
Delete deletes an apikey.
NS1 API docs: https://ns1.com/api/#apikeys-id-delete
func (*APIKeysService) Get ¶
Get returns details of an api key, including permissions, for a single API Key. Note: do not use the API Key itself as the keyid in the URL — use the id of the key.
NS1 API docs: https://ns1.com/api/#apikeys-id-get
func (*APIKeysService) List ¶
List returns all api keys in the account.
NS1 API docs: https://ns1.com/api/#apikeys-get
func (*APIKeysService) Update ¶
Update changes the name or access rights for an API Key.
NS1 API docs: https://ns1.com/api/#apikeys-id-post
type ApplicationsService ¶
type ApplicationsService service
ApplicationsService handles 'pulsar/apps/' endpoint.
func (*ApplicationsService) Create ¶
func (s *ApplicationsService) Create(a *pulsar.Application) (*http.Response, error)
Create takes a *pulsar.Application and creates a new Application.
The given application must have at least the name NS1 API docs: https://ns1.com/api#put-create-a-pulsar-application
func (*ApplicationsService) Delete ¶
func (s *ApplicationsService) Delete(id string) (*http.Response, error)
Delete takes a application Id, and removes an existing application
NS1 API docs: https://ns1.com/api#delete-delete-a-pulsar-application
func (*ApplicationsService) Get ¶
func (s *ApplicationsService) Get(id string) (*pulsar.Application, *http.Response, error)
Get takes a application id and returns application struct.
NS1 API docs: https://ns1.com/api#get-list-pulsar-applications
func (*ApplicationsService) List ¶
func (s *ApplicationsService) List() ([]*pulsar.Application, *http.Response, error)
List returns all pulsar Applications
NS1 API docs: https://ns1.com/api#get-list-pulsar-applications
func (*ApplicationsService) Update ¶
func (s *ApplicationsService) Update(a *pulsar.Application) (*http.Response, error)
Update takes a *pulsar.Application and updates the application with same id on Ns1.
NS1 API docs: https://ns1.com/api#post-modify-an-application
type Client ¶
type Client struct { // NS1 rest endpoint, overrides default if given. Endpoint *url.URL // NS1 api key (value for http request header 'X-NSONE-Key'). APIKey string // NS1 go rest user agent (value for http request header 'User-Agent'). UserAgent string // Func to call after response is returned in Do RateLimitFunc func(RateLimit) // Whether the client should handle paginated responses automatically. FollowPagination bool // Enables permissions compatibility with the DDI API. DDI bool // Services used for communicating with different components of the NS1 API. APIKeys *APIKeysService DataFeeds *DataFeedsService DataSources *DataSourcesService Jobs *JobsService PulsarJobs *PulsarJobsService Notifications *NotificationsService Records *RecordsService Applications *ApplicationsService Settings *SettingsService Stats *StatsService Teams *TeamsService Users *UsersService Warnings *WarningsService Zones *ZonesService DNSSEC *DNSSECService IPAM *IPAMService ScopeGroup *ScopeGroupService Scope *ScopeService Reservation *ReservationService OptionDef *OptionDefService TSIG *TsigService View *DNSViewService // contains filtered or unexported fields }
Client manages communication with the NS1 Rest API.
func (Client) Do ¶
Do satisfies the Doer interface. resp will be nil if a non-HTTP error occurs, otherwise it is available for inspection when the error reflects a non-2XX response.
func (Client) DoWithPagination ¶
func (c Client) DoWithPagination(req *http.Request, v interface{}, f NextFunc) (*http.Response, error)
DoWithPagination Does, and follows Link headers for pagination. The returned Response is from the last URI visited - either the last page, or one that responded with a non-2XX status. If a non-HTTP error occurs, resp will be nil.
func (*Client) NewRequest ¶
NewRequest constructs and returns a http.Request.
func (*Client) RateLimitStrategyConcurrent ¶
RateLimitStrategyConcurrent sleeps for WaitTime * parallelism when remaining is less than or equal to parallelism.
func (*Client) RateLimitStrategySleep ¶
func (c *Client) RateLimitStrategySleep()
RateLimitStrategySleep sets RateLimitFunc to sleep by WaitTimeRemaining
type DNSSECService ¶
type DNSSECService service
DNSSECService handles 'zones/ZONE/dnssec' endpoint.
func (*DNSSECService) Get ¶
func (s *DNSSECService) Get(zone string) (*dns.ZoneDNSSEC, *http.Response, error)
Get takes a zone, and returns DNSSEC information.
NS1 API docs: https://ns1.com/api#get-get-dnssec-details-for-a-zone
type DNSViewService ¶
type DNSViewService service
DNSViewService handles 'views/' endpoint.
func (*DNSViewService) Create ¶
Create takes a *dns.DNSView and creates a new DNS View.
The given DNSView must have at least the name NS1 API docs: https://ns1.com/api#putcreate-a-dns-view
func (*DNSViewService) Delete ¶
func (s *DNSViewService) Delete(viewName string) (*http.Response, error)
Delete takes a DNS view name, and removes an existing DNS view
NS1 API docs: https://ns1.com/api#deletedelete-a-dns-view
func (*DNSViewService) Get ¶
Get takes a DNS view name and returns DNSView struct.
NS1 API docs: https://ns1.com/api#getview-dns-view-details
func (*DNSViewService) GetPreferences ¶
GetPreference returns a map[string]int of preferences.
NS1 API docs: https://ns1.com/api#getget-dns-view-preference
func (*DNSViewService) List ¶
List returns all DNS Views
NS1 API docs: https://ns1.com/api#getlist-all-dns-views
func (*DNSViewService) Update ¶
Update takes a *dns.DNSView and updates the DNS view with same name on NS1.
NS1 API docs: https://ns1.com/api#postedit-a-dns-view
func (*DNSViewService) UpdatePreferences ¶
func (s *DNSViewService) UpdatePreferences(m map[string]int) (map[string]int, *http.Response, error)
UpdatePreference takes a map[string]int and returns a map[string]int of preferences.
NS1 API docs: https://ns1.com/api#postedit-dns-view-preference
type DataFeedsService ¶
type DataFeedsService service
DataFeedsService handles 'data/feeds' endpoint.
func (*DataFeedsService) Create ¶
Create takes a *DataFeed and connects a new data feed to an existing data source.
NS1 API docs: https://ns1.com/api/#feeds-put
func (*DataFeedsService) Delete ¶
Delete takes a data source ID and a data feed ID and disconnects the feed from the data source and all attached destination metadata tables.
NS1 API docs: https://ns1.com/api/#feeds-delete
func (*DataFeedsService) Get ¶
Get takes a data source ID and a data feed ID and returns the details of a single data feed
NS1 API docs: https://ns1.com/api/#feeds-feed-get
func (*DataFeedsService) List ¶
List returns all data feeds connected to a given data source.
NS1 API docs: https://ns1.com/api/#feeds-get
func (*DataFeedsService) Update ¶
Update takes a *Feed and modifies and existing data feed. Note:
- The 'data' portion of a feed does not actually get updated during a POST. In order to update a feeds' 'data' attribute, one must use the Publish method.
- Both the 'destinations' and 'networks' attributes are not updated during a POST.
NS1 API docs: https://ns1.com/api/#feeds-post
type DataSourcesService ¶
type DataSourcesService service
DataSourcesService handles 'data/sources' endpoint.
func (*DataSourcesService) Create ¶
Create takes a *DataSource and creates a new data source.
NS1 API docs: https://ns1.com/api/#sources-put
func (*DataSourcesService) Delete ¶
func (s *DataSourcesService) Delete(id string) (*http.Response, error)
Delete takes an ID and removes an existing data source and all connected feeds from the source.
NS1 API docs: https://ns1.com/api/#sources-delete
func (*DataSourcesService) Get ¶
Get takes an ID returns the details for a single data source.
NS1 API docs: https://ns1.com/api/#sources-source-get
func (*DataSourcesService) List ¶
List returns all connected data sources.
NS1 API docs: https://ns1.com/api/#sources-get
func (*DataSourcesService) Publish ¶
func (s *DataSourcesService) Publish(dsID string, data interface{}) (*http.Response, error)
Publish takes a datasources' id and data to publish.
NS1 API docs: https://ns1.com/api/#feed-post
func (*DataSourcesService) Update ¶
Update takes a *DataSource modifies basic details of a data source. NOTE: This does not 'publish' data. See the Publish method.
NS1 API docs: https://ns1.com/api/#sources-post
type Decorator ¶
A Decorator wraps a Doer with extra behavior, and doesnt affect the behavior of other instances of the same type.
type Doer ¶
Doer is a single method interface that allows a user to extend/augment an http.Client instance. Note: http.Client satisfies the Doer interface.
type DoerFunc ¶
DoerFunc satisfies Interface. DoerFuncs are useful for adding logging/instrumentation to the http.Client that is used within the rest.APIClient.
type IPAMService ¶
type IPAMService service
IPAMService handles the 'ipam' endpoint.
func (*IPAMService) CreateSubnet ¶
CreateSubnet creates an address or subnet. The Prefix and Network fields are required.
NS1 API docs: https://ns1.com/api#putcreate-a-subnet
func (*IPAMService) DeleteSubnet ¶
func (s *IPAMService) DeleteSubnet(id int) (*http.Response, error)
DeleteSubnet removes a subnet entirely.
NS1 API docs: https://ns1.com/api#deletedelete-a-subnet
func (*IPAMService) EditSubnet ¶
func (s *IPAMService) EditSubnet(addr *ipam.Address, parent bool) (newAddr, parentAddr *ipam.Address, resp *http.Response, err error)
EditSubnet updates an existing subnet. The ID field is required. Parent is whether or not to include the parent in the parent field.
NS1 API docs: https://ns1.com/api#postedit-a-subnet
func (*IPAMService) GetChildren ¶
GetChildren requests a list of all child addresses (or subnets) for the specified IP address.
NS1 API docs: https://ns1.com/api#getview-address-children
func (*IPAMService) GetParent ¶
GetParent fetches the addresses parent.
NS1 API docs: https://ns1.com/api#getview-address-parent
func (*IPAMService) GetSubnet ¶
GetSubnet returns the subnet corresponding to the provided address ID.
NS1 API docs: https://ns1.com/api#getview-a-subnet
func (*IPAMService) ListAddrs ¶
ListAddrs returns a list of all root addresses (i.e. Parent == 0) in all networks.
NS1 API docs: https://ns1.com/api#getview-a-list-of-root-addresses
func (*IPAMService) MergeSubnet ¶
MergeSubnet merges several subnets together.
NS1 API docs: https://ns1.com/api#postmerge-a-subnet
func (*IPAMService) SplitSubnet ¶
func (s *IPAMService) SplitSubnet(id, prefix int) (rootAddr int, prefixIDs []int, resp *http.Response, err error)
SplitSubnet splits a block of unassigned IP space into equal pieces. This will not function with ranges or individual hosts. Normal breaking out of a subnet is done with the standard PUT route. (Eg. root address is a /24 and request for /29s will break it into 32 /29s)
- Only planned subnets can be split
- Name and description will be unset on children
- KVPS and options will be copied; tags will be inherited
NS1 API docs: https://ns1.com/api#postsplit-a-subnet
type JobsService ¶
type JobsService service
JobsService handles 'monitoring/jobs' endpoint.
func (*JobsService) Create ¶
Create takes a *MonitoringJob and creates a new monitoring job.
NS1 API docs: https://ns1.com/api/#jobs-put
func (*JobsService) Delete ¶
func (s *JobsService) Delete(id string) (*http.Response, error)
Delete takes an ID and immediately terminates and deletes and existing monitoring job.
NS1 API docs: https://ns1.com/api/#jobs-jobid-delete
func (*JobsService) Get ¶
Get takes an ID and returns details for a specific monitoring job.
NS1 API docs: https://ns1.com/api/#jobs-jobid-get
func (*JobsService) History ¶
func (s *JobsService) History(id string, opts ...func(*url.Values)) ([]*monitor.StatusLog, *http.Response, error)
History takes an ID and returns status log history for a specific monitoring job.
NS1 API docs: https://ns1.com/api/#history-get
func (*JobsService) List ¶
List returns all monitoring jobs for the account.
NS1 API docs: https://ns1.com/api/#jobs-get
func (*JobsService) Update ¶
Update takes a *MonitoringJob and change the configuration details of an existing monitoring job.
NS1 API docs: https://ns1.com/api/#jobs-jobid-post
type Links ¶
Links represents a Link Header, keyed by the Rel attribute
func ParseLink ¶
ParseLink parses a Link header value into a Links, mainly cribbed from: https://github.com/peterhellberg/link/blob/master/link.go The forceHTTPS parameter will rewrite any HTTP URLs it finds to HTTPS.
type NotificationsService ¶
type NotificationsService service
NotificationsService handles 'monitoring/lists' endpoint.
func (*NotificationsService) Create ¶
func (s *NotificationsService) Create(nl *monitor.NotifyList) (*http.Response, error)
Create takes a *NotifyList and creates a new notify list.
NS1 API docs: https://ns1.com/api/#lists-put
func (*NotificationsService) Delete ¶
func (s *NotificationsService) Delete(listID string) (*http.Response, error)
Delete immediately deletes an existing notification list.
NS1 API docs: https://ns1.com/api/#lists-listid-delete
func (*NotificationsService) Get ¶
func (s *NotificationsService) Get(listID string) (*monitor.NotifyList, *http.Response, error)
Get returns the details and notifiers associated with a specific notification list.
NS1 API docs: https://ns1.com/api/#lists-listid-get
func (*NotificationsService) List ¶
func (s *NotificationsService) List() ([]*monitor.NotifyList, *http.Response, error)
List returns all configured notification lists.
NS1 API docs: https://ns1.com/api/#lists-get
func (*NotificationsService) Update ¶
func (s *NotificationsService) Update(nl *monitor.NotifyList) (*http.Response, error)
Update adds or removes entries or otherwise update a notification list.
NS1 API docs: https://ns1.com/api/#list-listid-post
type OptionDefService ¶
type OptionDefService service
OptionDefService handles the 'scope group' endpoints.
func (*OptionDefService) Create ¶
func (s *OptionDefService) Create(od *dhcp.OptionDef, odSpace, odKey string) (*dhcp.OptionDef, *http.Response, error)
Create creates or updates an option definition. The FriendlyName, Description, Code, Schema.Type fields are required.
NS1 API docs: https://ns1.com/api#putcreate-an-custom-dhcp-option-definition
func (*OptionDefService) Delete ¶
func (s *OptionDefService) Delete(odSpace, odKey string) (*http.Response, error)
Delete removes a option definition entirely.
NS1 API docs: https://ns1.com/api#deletedelete-a-custom-dhcp-option-definition
func (*OptionDefService) Get ¶
Get returns the option definition corresponding to the provided ID.
NS1 API docs: https://ns1.com/api#getview-dhcp-option-definition
func (*OptionDefService) List ¶
List returns a list of all option definitions.
NS1 API docs: https://ns1.com/api#getlist-dhcp-option-definitions
type PulsarJobsService ¶
type PulsarJobsService service
JobsService handles 'pulsar/apps/APPID/jobs/JOBID' endpoint.
func (*PulsarJobsService) Create ¶
Create takes a *PulsarJob and an AppId and creates a new Pulsar Job in the specified Application with the specific name, typeid, host and url_path.
NS1 API docs: https://ns1.com/api/#putcreate-a-pulsar-job
func (*PulsarJobsService) Delete ¶
Delete takes a appId and jobId and removes an existing Pulsar job .
NS1 API docs: https://ns1.com/api/#deletedelete-a-pulsar-job
func (*PulsarJobsService) Get ¶
func (s *PulsarJobsService) Get(appId string, jobId string) (*pulsar.PulsarJob, *http.Response, error)
Get takes an Application ID and Job Id and returns full configuration for a pulsar Job.
NS1 API docs: https://ns1.com/api/#getview-job-details
func (*PulsarJobsService) List ¶
List takes an Application ID and returns all Jobs inside said Application.
NS1 API docs: https://ns1.com/api/#getlist-jobs-within-an-app
func (*PulsarJobsService) Update ¶
Update takes a *PulsarJob and modifies configuration details for an existing Pulsar job.
Only the fields to be updated are required in the given job. NS1 API docs: https://ns1.com/api/#postmodify-a-pulsar-job
type RateLimit ¶
RateLimit stores X-Ratelimit-* headers
func (RateLimit) PercentageLeft ¶
PercentageLeft returns the ratio of Remaining to Limit as a percentage
func (RateLimit) WaitTimeRemaining ¶
WaitTimeRemaining returns the time.Duration ratio of Period to Remaining
type RateLimitFunc ¶
type RateLimitFunc func(RateLimit)
RateLimitFunc is rate limiting strategy for the Client instance.
type RecordsService ¶
type RecordsService service
RecordsService handles 'zones/ZONE/DOMAIN/TYPE' endpoint.
func (*RecordsService) Create ¶
Create takes a *Record and creates a new DNS record in the specified zone, for the specified domain, of the given record type.
The given record must have at least one answer. NS1 API docs: https://ns1.com/api/#record-put
func (*RecordsService) Delete ¶
Delete takes a zone, domain and record type t and removes an existing record and all associated answers and configuration details.
NS1 API docs: https://ns1.com/api/#record-delete
func (*RecordsService) Get ¶
Get takes a zone, domain and record type t and returns full configuration for a DNS record.
NS1 API docs: https://ns1.com/api/#record-get
func (*RecordsService) Update ¶
Update takes a *Record and modifies configuration details for an existing DNS record.
Only the fields to be updated are required in the given record. NS1 API docs: https://ns1.com/api/#record-post
type ReservationService ¶
type ReservationService service
ReservationService handles the 'reservation' endpoints.
func (*ReservationService) Create ¶
func (s *ReservationService) Create(sc *dhcp.Reservation) (*dhcp.Reservation, *http.Response, error)
Create creates a reservation. The Options field is required.
NS1 API docs: https://ns1.com/api#putcreate-a-reservation
func (*ReservationService) Delete ¶
func (s *ReservationService) Delete(id int) (*http.Response, error)
Delete removes a reservation entirely.
NS1 API docs: https://ns1.com/api#deletedelete-a-reservation
func (*ReservationService) Edit ¶
func (s *ReservationService) Edit(sc *dhcp.Reservation) (*dhcp.Reservation, *http.Response, error)
Edit updates an existing reservation. The ID, Options fields are required.
NS1 API docs: https://ns1.com/api#postmodify-a-reservation
func (*ReservationService) Get ¶
func (s *ReservationService) Get(scID int) (*dhcp.Reservation, *http.Response, error)
Get returns the reservation corresponding to the provided reservation ID.
NS1 API docs: https://ns1.com/api#getview-a-reservations-details
func (*ReservationService) List ¶
func (s *ReservationService) List() ([]dhcp.Reservation, *http.Response, error)
List returns a list of all reservations.
NS1 API docs: https://ns1.com/api#getlist-reservations
type ScopeGroupService ¶
type ScopeGroupService service
ScopeGroupService handles the 'scope group' endpoints.
func (*ScopeGroupService) Create ¶
func (s *ScopeGroupService) Create(sg *dhcp.ScopeGroup) (*dhcp.ScopeGroup, *http.Response, error)
Create creates a scope group. The Name field is required.
NS1 API docs: https://ns1.com/api#putcreate-a-scope-group
func (*ScopeGroupService) Delete ¶
func (s *ScopeGroupService) Delete(id int) (*http.Response, error)
Delete removes a Scope Group entirely.
NS1 API docs: https://ns1.com/api#deleteremove-scope-group-by-id
func (*ScopeGroupService) Edit ¶
func (s *ScopeGroupService) Edit(sg *dhcp.ScopeGroup) (*dhcp.ScopeGroup, *http.Response, error)
Edit updates an existing scope group. The ID field is required.
NS1 API docs: https://ns1.com/api#postedit-scope-group
func (*ScopeGroupService) Get ¶
func (s *ScopeGroupService) Get(sgID int) (*dhcp.ScopeGroup, *http.Response, error)
Get returns the Scope Group corresponding to the provided scope group ID.
NS1 API docs: https://ns1.com/api#getview-scope-group
func (*ScopeGroupService) List ¶
func (s *ScopeGroupService) List() ([]dhcp.ScopeGroup, *http.Response, error)
List returns a list of all scope groups.
NS1 API docs: https://ns1.com/api#getlist-scope-groups
type ScopeService ¶
type ScopeService service
ScopeService handles the 'scope' endpoints.
func (*ScopeService) Create ¶
Create creates a scope. The IDAddress field is required.
NS1 API docs: https://ns1.com/api#putcreate-a-scope
func (*ScopeService) Delete ¶
func (s *ScopeService) Delete(id int) (*http.Response, error)
Delete removes a scope entirely.
NS1 API docs: https://ns1.com/api#deleteremove-a-scope
func (*ScopeService) Edit ¶
Edit updates an existing scope. The IDAddress field is required.
NS1 API docs: https://ns1.com/api#postmodify-a-scope
func (*ScopeService) Get ¶
Get returns the scope corresponding to the provided scope ID.
NS1 API docs: https://ns1.com/api#getview-scope-details
func (*ScopeService) List ¶
List returns a list of all scopes.
NS1 API docs: https://ns1.com/api#getlist-scopes
type SettingsService ¶
type SettingsService service
SettingsService handles 'account/settings' endpoint.
func (*SettingsService) Get ¶
Get returns the basic contact details associated with the account.
NS1 API docs: https://ns1.com/api/#settings-get
func (*SettingsService) Update ¶
Update changes most of the basic contact details, except customerid.
NS1 API docs: https://ns1.com/api/#settings-post
type StatsService ¶
type StatsService service
StatsService handles 'stats/qps' endpoint.
func (*StatsService) GetQPS ¶
func (s *StatsService) GetQPS() (float32, *http.Response, error)
GetQPS returns current queries per second (QPS) for the account. The QPS number is lagged by approximately 30 seconds for statistics collection; and the rate is computed over the preceding minute.
func (*StatsService) GetRecordQPS ¶
GetRecordQPS returns current queries per second (QPS) for a specific record. The QPS number is lagged by approximately 30 seconds for statistics collection; and the rate is computed over the preceding minute.
func (*StatsService) GetZoneQPS ¶
GetZoneQPS returns current queries per second (QPS) for a specific zone. The QPS number is lagged by approximately 30 seconds for statistics collection; and the rate is computed over the preceding minute.
type TeamsService ¶
type TeamsService service
TeamsService handles 'account/teams' endpoint.
func (*TeamsService) Create ¶
Create takes a *Team and creates a new account team.
NS1 API docs: https://ns1.com/api/#teams-put
func (*TeamsService) Delete ¶
func (s *TeamsService) Delete(id string) (*http.Response, error)
Delete deletes a team.
NS1 API docs: https://ns1.com/api/#teams-id-delete
func (*TeamsService) Get ¶
Get returns details of a single team.
NS1 API docs: https://ns1.com/api/#teams-id-get
func (*TeamsService) List ¶
List returns all teams in the account.
NS1 API docs: https://ns1.com/api/#teams-get
func (*TeamsService) Update ¶
Update changes the name or access rights for a team.
NS1 API docs: https://ns1.com/api/#teams-id-post
type TsigService ¶
type TsigService service
TsigService handles 'tsig' endpoint.
func (*TsigService) Create ¶
Create takes a *TSIGkey and creates a new TSIG key.
NS1 API docs: https://ns1.com/api/#putcreate-a-tsig-key
func (*TsigService) Delete ¶
func (s *TsigService) Delete(name string) (*http.Response, error)
Delete takes a TSIG key name and destroys an existing TSIG key.
NS1 API docs: https://ns1.com/api/#deleteremove-a-tsig-key
func (*TsigService) Get ¶
Get takes a TSIG key name and returns a single TSIG key and its basic configuration details.
NS1 API docs: https://ns1.com/api/#getview-tsig-key-details
func (*TsigService) List ¶
List returns all tsig keys and basic tsig keys configuration details for each.
NS1 API docs: https://ns1.com/api/#getlist-tsig-keys
func (*TsigService) Update ¶
Update takes a *TSIGKey and modifies basic details of a TSIG key.
NS1 API docs: https://ns1.com/api/#postmodify-a-tsig-key
type UsersService ¶
type UsersService service
UsersService handles 'account/users' endpoint.
func (*UsersService) Create ¶
Create takes a *User and creates a new account user.
NS1 API docs: https://ns1.com/api/#users-put
func (*UsersService) Delete ¶
func (s *UsersService) Delete(username string) (*http.Response, error)
Delete deletes a user.
NS1 API docs: https://ns1.com/api/#users-user-delete
func (*UsersService) Get ¶
Get returns details of a single user.
NS1 API docs: https://ns1.com/api/#users-user-get
func (*UsersService) List ¶
List returns all users in the account.
NS1 API docs: https://ns1.com/api/#users-get
func (*UsersService) Update ¶
Update change contact details, notification settings, or access rights for a user.
NS1 API docs: https://ns1.com/api/#users-user-post
type WarningsService ¶
type WarningsService service
WarningsService handles 'account/usagewarnings' endpoint.
func (*WarningsService) Get ¶
func (s *WarningsService) Get() (*account.UsageWarning, *http.Response, error)
Get returns toggles and thresholds used when sending overage warning alert messages to users with billing notifications enabled.
NS1 API docs: https://ns1.com/api/#usagewarnings-get
func (*WarningsService) Update ¶
func (s *WarningsService) Update(uw *account.UsageWarning) (*http.Response, error)
Update changes alerting toggles and thresholds for overage warning alert messages.
NS1 API docs: https://ns1.com/api/#usagewarnings-post
type ZonesService ¶
type ZonesService service
ZonesService handles 'zones' endpoint.
func (*ZonesService) Create ¶
Create takes a *Zone and creates a new DNS zone.
NS1 API docs: https://ns1.com/api/#zones-put
func (*ZonesService) Delete ¶
func (s *ZonesService) Delete(zone string) (*http.Response, error)
Delete takes a zone and destroys an existing DNS zone and all records in the zone.
NS1 API docs: https://ns1.com/api/#zones-delete
func (*ZonesService) Get ¶
Get takes a zone name and returns a single active zone and its basic configuration details.
NS1 API docs: https://ns1.com/api/#zones-zone-get
func (*ZonesService) List ¶
List returns all active zones and basic zone configuration details for each.
NS1 API docs: https://ns1.com/api/#zones-get
func (*ZonesService) Update ¶
Update takes a *Zone and modifies basic details of a DNS zone.
NS1 API docs: https://ns1.com/api/#zones-post
Source Files ¶
- account_apikey.go
- account_setting.go
- account_team.go
- account_user.go
- account_warning.go
- application.go
- client.go
- data_feed.go
- data_source.go
- ddi.go
- dns_view.go
- dnssec.go
- doc.go
- headers.go
- ipam.go
- monitor_job.go
- monitor_notify.go
- optiondef.go
- pulsar_job.go
- record.go
- reservation.go
- scope.go
- scopegroup.go
- stat.go
- tsig_key.go
- util.go
- zone.go
Directories ¶
Path | Synopsis |
---|---|
Example referencing https://ns1.com/articles/automated-failover
|
Example referencing https://ns1.com/articles/automated-failover |
Package model defines structures for interacting with the NS1 API.
|
Package model defines structures for interacting with the NS1 API. |
account
Package account contains definitions for NS1 apikeys/teams/users/etc.
|
Package account contains definitions for NS1 apikeys/teams/users/etc. |
data
Package data contains definitions for NS1 metadata/sources/feeds/etc.
|
Package data contains definitions for NS1 metadata/sources/feeds/etc. |
dhcp
Package dhcp contains definitions for scope groups, scopes, etc.
|
Package dhcp contains definitions for scope groups, scopes, etc. |
dns
Package dns contains definitions for NS1 zones/records/answers/etc.
|
Package dns contains definitions for NS1 zones/records/answers/etc. |
filter
Package filter contains definitions for NS1 filter chains.
|
Package filter contains definitions for NS1 filter chains. |
ipam
Package ipam contains definitions for networks, addresses, etc.
|
Package ipam contains definitions for networks, addresses, etc. |
monitor
Package monitor contains definitions for NS1 monitoring jobs.
|
Package monitor contains definitions for NS1 monitoring jobs. |