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 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 ActivityService
- 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{}, params ...Param) (*http.Response, error)
- func (c Client) DoWithPagination(req *http.Request, v interface{}, f NextFunc, params ...Param) (*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.View) (*http.Response, error)
- func (s *DNSViewService) Delete(viewName string) (*http.Response, error)
- func (s *DNSViewService) Get(viewName string) (*dns.View, *http.Response, error)
- func (s *DNSViewService) GetPreferences() (map[string]int, *http.Response, error)
- func (s *DNSViewService) List() ([]*dns.View, *http.Response, error)
- func (s *DNSViewService) Update(v *dns.View) (*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 DatasetsService
- func (s *DatasetsService) Create(dt *dataset.Dataset) (*dataset.Dataset, *http.Response, error)
- func (s *DatasetsService) Delete(dtID string) (*http.Response, error)
- func (s *DatasetsService) Get(dtID string) (*dataset.Dataset, *http.Response, error)
- func (s *DatasetsService) GetReport(dtID string, reportID string) (*bytes.Buffer, *http.Response, error)
- func (s *DatasetsService) List() ([]*dataset.Dataset, *http.Response, error)
- type Decorator
- type Doer
- type DoerFunc
- type Error
- type GlobalIPWhitelistService
- func (s *GlobalIPWhitelistService) Create(wl *account.IPWhitelist) (*http.Response, error)
- func (s *GlobalIPWhitelistService) Delete(id string) (*http.Response, error)
- func (s *GlobalIPWhitelistService) Get(id string) (*account.IPWhitelist, *http.Response, error)
- func (s *GlobalIPWhitelistService) List() ([]*account.IPWhitelist, *http.Response, error)
- func (s *GlobalIPWhitelistService) Update(wl *account.IPWhitelist) (*http.Response, 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 MonitorRegionsService
- type NetworkService
- 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 Param
- type PulsarJobsService
- func (s *PulsarJobsService) Create(j *pulsar.Job) (*http.Response, error)
- func (s *PulsarJobsService) Delete(pulsarJob *pulsar.Job) (*http.Response, error)
- func (s *PulsarJobsService) Get(appID string, jobID string) (*pulsar.Job, *http.Response, error)
- func (s *PulsarJobsService) List(appID string) ([]*pulsar.Job, *http.Response, error)
- func (s *PulsarJobsService) Update(j *pulsar.Job) (*http.Response, error)
- type RateLimit
- type RateLimitFunc
- type RecordSearchService
- 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 RedirectCertificateService
- func (s *RedirectCertificateService) Create(domain string) (*redirect.Certificate, *http.Response, error)
- func (s *RedirectCertificateService) Delete(certId string) (*http.Response, error)
- func (s *RedirectCertificateService) Get(certId string) (*redirect.Certificate, *http.Response, error)
- func (s *RedirectCertificateService) List() ([]*redirect.Certificate, *http.Response, error)
- func (s *RedirectCertificateService) Update(certId string) (*http.Response, error)
- type RedirectService
- func (s *RedirectService) Create(cfg *redirect.Configuration) (*redirect.Configuration, *http.Response, error)
- func (s *RedirectService) Delete(cfgId string) (*http.Response, error)
- func (s *RedirectService) Get(cfgId string) (*redirect.Configuration, *http.Response, error)
- func (s *RedirectService) List() ([]*redirect.Configuration, *http.Response, error)
- func (s *RedirectService) Update(cfg *redirect.Configuration) (*redirect.Configuration, *http.Response, error)
- type Response
- 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 VersionsService
- func (s *VersionsService) Activate(zone string, versionID int) (*http.Response, error)
- func (s *VersionsService) Create(zone string, force bool) (*dns.Version, *http.Response, error)
- func (s *VersionsService) Delete(zone string, versionID int) (*http.Response, error)
- func (s *VersionsService) List(zone string) ([]*dns.Version, *http.Response, error)
- type WarningsService
- type ZoneSearchService
- 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, records bool) (*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") // ErrViewMissing 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 ( ErrRedirectNil = errors.New("parameter missing") // ErrRedirectExists bundles PUT create error. ErrRedirectExists = errors.New("redirect configuration id already exists") // ErrRedirectNotFound bundles GET/POST/DELETE error. ErrRedirectNotFound = errors.New("redirect configuration id not found") )
var ( ErrRedirectCertificateNil = errors.New("parameter missing") // ErrRedirectCertificateExists bundles PUT create error. ErrRedirectCertificateExists = errors.New("redirect certificate id already exists") // ErrRedirectCertificateNotFound bundles GET/POST/DELETE error. ErrRedirectCertificateNotFound = errors.New("redirect certificate id not found") )
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") )
var ( // ErrDatasetNotFound bundles GET/POST/DELETE not found errors. ErrDatasetNotFound = errors.New("dataset not found") )
var ( // ErrIPWhitelistMissing bundles GET/POST/DELETE error. ErrIPWhitelistMissing = errors.New("whitelist does not exist") )
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 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 ActivityService ¶ added in v2.10.0
type ActivityService service
ActivityService handles 'account/activity' endpoint.
func (*ActivityService) List ¶ added in v2.10.0
List returns all activity in the account. It accepts a variadic number of optional URL parameters that can be used to edit the endpoint's behavior. Parameters are in the form of a `rest.Param` struct. The full list of valid parameters for this endpoint are available in the documentation.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#getActivity
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 // Services used for communicating with different components of the NS1 API. APIKeys *APIKeysService DataFeeds *DataFeedsService DataSources *DataSourcesService Jobs *JobsService MonitorRegions *MonitorRegionsService PulsarJobs *PulsarJobsService Notifications *NotificationsService Records *RecordsService Applications *ApplicationsService RecordSearch *RecordSearchService ZoneSearch *ZoneSearchService Settings *SettingsService Stats *StatsService Teams *TeamsService Users *UsersService Warnings *WarningsService Zones *ZonesService Versions *VersionsService DNSSEC *DNSSECService TSIG *TsigService View *DNSViewService Network *NetworkService GlobalIPWhitelist *GlobalIPWhitelistService Datasets *DatasetsService Activity *ActivityService Redirects *RedirectService RedirectCertificates *RedirectCertificateService // 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. It accepts a variadic number of optional URL parameters to supply to the request. URL parameters are of type `rest.Param`.
func (Client) DoWithPagination ¶
func (c Client) DoWithPagination(req *http.Request, v interface{}, f NextFunc, params ...Param) (*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. It accepts a variadic number of optional URL parameters to supply to the underlying `.Do()` method request(s). URL parameters are of type `rest.Param`.
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 ¶
GetPreferences 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)
UpdatePreferences 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 DatasetsService ¶ added in v2.8.0
type DatasetsService service
DatasetsService handles 'datasets' endpoint.
func (*DatasetsService) Create ¶ added in v2.8.0
Create takes a *Dataset and creates a new dataset.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#createDataset
func (*DatasetsService) Delete ¶ added in v2.8.0
func (s *DatasetsService) Delete(dtID string) (*http.Response, error)
Delete takes a dataset id and deletes it.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#deleteDataset
func (*DatasetsService) Get ¶ added in v2.8.0
Get takes a dataset id and returns all its data.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#getDataset
func (*DatasetsService) GetReport ¶ added in v2.8.0
func (s *DatasetsService) GetReport(dtID string, reportID string) (*bytes.Buffer, *http.Response, error)
GetReport takes a dataset id and a report id and returns bytes.Buffer which contains the file contents Additionally, file name can be grabbed from the 'Content-Disposition' header in the http.Response
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#getDatasetReport
func (*DatasetsService) List ¶ added in v2.8.0
List returns the configured datasets.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/api/API--ns1--ibm-ns1-connect-api#listDataset
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 GlobalIPWhitelistService ¶ added in v2.7.9
type GlobalIPWhitelistService service
GlobalIPWhitelistService handles 'account/whitelist' endpoint.
func (*GlobalIPWhitelistService) Create ¶ added in v2.7.9
func (s *GlobalIPWhitelistService) Create(wl *account.IPWhitelist) (*http.Response, error)
Create takes a *IPWhitelist and creates a new global IP whitelist.
func (*GlobalIPWhitelistService) Delete ¶ added in v2.7.9
func (s *GlobalIPWhitelistService) Delete(id string) (*http.Response, error)
Delete deletes a global IP whitelist.
func (*GlobalIPWhitelistService) Get ¶ added in v2.7.9
func (s *GlobalIPWhitelistService) Get(id string) (*account.IPWhitelist, *http.Response, error)
Get returns details of a single global IP whitelist.
func (*GlobalIPWhitelistService) List ¶ added in v2.7.9
func (s *GlobalIPWhitelistService) List() ([]*account.IPWhitelist, *http.Response, error)
List returns all global IP whitelists in the account.
func (*GlobalIPWhitelistService) Update ¶ added in v2.7.9
func (s *GlobalIPWhitelistService) Update(wl *account.IPWhitelist) (*http.Response, error)
Update changes the name or values for a global IP whitelist.
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 MonitorRegionsService ¶ added in v2.9.0
type MonitorRegionsService service
MonitorRegionsService handles 'monitoring/regions' endpoint.
type NetworkService ¶ added in v2.7.4
type NetworkService service
NetworkService handles the 'networks' endpoint
func (*NetworkService) Get ¶ added in v2.7.4
Get returns a list of all available NS1 DNS networks associated with your account. NS1 API docs: https://ns1.com/api?docId=403388
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 Param ¶ added in v2.10.0
type Param struct {
Key, Value string
}
Param is a container struct which holds a `Key` and `Value` field corresponding to the values of a URL parameter.
type PulsarJobsService ¶
type PulsarJobsService service
PulsarJobsService 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 ¶
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 RecordSearchService ¶ added in v2.7.7
type RecordSearchService service
RecordSearchService handles 'dns/record/search' endpoint.
func (*RecordSearchService) Search ¶ added in v2.7.7
func (s *RecordSearchService) Search(params string) (*dns.SearchResult, *http.Response, error)
Find takes query parameters and returns matching DNS records.
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 RedirectCertificateService ¶ added in v2.11.0
type RedirectCertificateService service
RedirectCertificateService handles 'redirect/certificates' endpoint.
func (*RedirectCertificateService) Create ¶ added in v2.11.0
func (s *RedirectCertificateService) Create(domain string) (*redirect.Certificate, *http.Response, error)
Create takes a *Certificate and creates a new redirect.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectCertificateService) Delete ¶ added in v2.11.0
func (s *RedirectCertificateService) Delete(certId string) (*http.Response, error)
Delete takes a certificate id and requests it to be revoked.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectCertificateService) Get ¶ added in v2.11.0
func (s *RedirectCertificateService) Get(certId string) (*redirect.Certificate, *http.Response, error)
Get takes a redirect config id and returns a single config.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectCertificateService) List ¶ added in v2.11.0
func (s *RedirectCertificateService) List() ([]*redirect.Certificate, *http.Response, error)
List returns the existing redirect certificates.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectCertificateService) Update ¶ added in v2.11.0
func (s *RedirectCertificateService) Update(certId string) (*http.Response, error)
Update takes a certificate id and requests it to be renewed.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
type RedirectService ¶ added in v2.11.0
type RedirectService service
RedirectService handles 'redirect' endpoint.
func (*RedirectService) Create ¶ added in v2.11.0
func (s *RedirectService) Create(cfg *redirect.Configuration) (*redirect.Configuration, *http.Response, error)
Create takes a *Configuration and creates a new redirect.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectService) Delete ¶ added in v2.11.0
func (s *RedirectService) Delete(cfgId string) (*http.Response, error)
Delete takes a configuration id and destroys the associated redirect configuration.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectService) Get ¶ added in v2.11.0
func (s *RedirectService) Get(cfgId string) (*redirect.Configuration, *http.Response, error)
Get takes a redirect config id and returns a single config.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectService) List ¶ added in v2.11.0
func (s *RedirectService) List() ([]*redirect.Configuration, *http.Response, error)
List returns the configured redirects.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
func (*RedirectService) Update ¶ added in v2.11.0
func (s *RedirectService) Update(cfg *redirect.Configuration) (*redirect.Configuration, *http.Response, error)
Update takes a *Configuration and modifies basic details of a redirect.
NS1 API docs: https://developer.ibm.com/apis/catalog/ns1--ibm-ns1-connect-api/Getting+Started Feature docs: https://www.ibm.com/docs/en/ns1-connect?topic=url-redirects
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 VersionsService ¶ added in v2.7.7
type VersionsService service
VersionsService handles 'zones/ZONE/versions' related endpoints.
func (*VersionsService) Activate ¶ added in v2.7.7
Activate activates a zone version
NS1 API docs: https://ns1.com/api/#zones-get
func (*VersionsService) Create ¶ added in v2.7.7
Create creates a new version for a zone
NS1 API docs: https://ns1.com/api/#zones-get
func (*VersionsService) Delete ¶ added in v2.7.7
Delete deletes a zone version
NS1 API docs: https://ns1.com/api/#zones-get
func (*VersionsService) List ¶ added in v2.7.7
List returns all versions for a zone.
NS1 API docs: https://ns1.com/api/#zones-get
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 ZoneSearchService ¶ added in v2.7.7
type ZoneSearchService service
ZoneSearchService handles 'dns/zone/search' endpoint.
func (*ZoneSearchService) Search ¶ added in v2.7.7
func (s *ZoneSearchService) Search(params string) (*dns.SearchResult, *http.Response, error)
Find takes query parameters and returns matching DNS zones.
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.
records Optional Query Parameter, if false records array in payload returns empty
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_activity.go
- account_apikey.go
- account_setting.go
- account_team.go
- account_user.go
- account_warning.go
- account_whitelist.go
- application.go
- client.go
- data_feed.go
- data_source.go
- dataset.go
- dns_view.go
- dnssec.go
- doc.go
- headers.go
- monitor_job.go
- monitor_notify.go
- monitor_regions.go
- network.go
- pulsar_job.go
- record.go
- redirect.go
- redirect_certificate.go
- search.go
- stat.go
- tsig_key.go
- util.go
- version.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. |
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. |
monitor
Package monitor contains definitions for NS1 monitoring jobs.
|
Package monitor contains definitions for NS1 monitoring jobs. |