billing_usage.go raw

   1  package billing_usage
   2  
   3  import "errors"
   4  
   5  type BillingUsage string
   6  
   7  // constants values for billing-usage module implementations
   8  const (
   9  	BillingUsageQueries      = BillingUsage("queries")
  10  	BillingUsageLimits       = BillingUsage("limits")
  11  	BillingUsageDecisions    = BillingUsage("decisions")
  12  	BillingUsageMonitors     = BillingUsage("monitors")
  13  	BillingUsageFilterChains = BillingUsage("filter-chains")
  14  	BillingUsageRecords      = BillingUsage("records")
  15  )
  16  
  17  var (
  18  	// ErrBillingUsageNotFound bundles GET not found errors.
  19  	ErrBillingUsageNotFound = errors.New("billing_usage not found")
  20  	NotFound                = " not found"
  21  )
  22  
  23  // Queries wraps an NS1 /billing-usage-queries resource
  24  type Queries struct {
  25  	CleanQueries int64              `json:"clean_queries"`
  26  	DdosQueries  int64              `json:"ddos_queries"`
  27  	NxdResponses int64              `json:"nxd_responses"`
  28  	ByNetwork    []QueriesByNetwork `json:"by_network"`
  29  }
  30  
  31  // Limits wraps an NS1 /billing-usage-limits resource
  32  type Limits struct {
  33  	QueriesLimit                                int64 `json:"queries_limit"`
  34  	ChinaQueriesLimit                           int64 `json:"china_queries_limit"`
  35  	RecordsLimit                                int64 `json:"records_limit"`
  36  	FilterChainsLimit                           int64 `json:"filter_chains_limit"`
  37  	MonitorsLimit                               int64 `json:"monitors_limit"`
  38  	DecisionsLimit                              int64 `json:"decisions_limit"`
  39  	NxdProtectionEnabled                        bool  `json:"nxd_protection_enabled"`
  40  	DdosProtectionEnabled                       bool  `json:"ddos_protection_enabled"`
  41  	IncludeDedicatedDnsNetworkInManagedDnsUsage bool  `json:"include_dedicated_dns_network_in_managed_dns_usage"`
  42  }
  43  
  44  // QueriesByNetwork wraps an NS1 /billing-usage-queries.ByNetwork resource
  45  type QueriesByNetwork struct {
  46  	Network         int64                   `json:"network"`
  47  	CleanQueries    int64                   `json:"clean_queries"`
  48  	DdosQueries     int64                   `json:"ddos_queries"`
  49  	NxdResponses    int64                   `json:"nxd_responses"`
  50  	BillableQueries int64                   `json:"billable_queries"`
  51  	Daily           []QueriesByNetworkDaily `json:"daily"`
  52  }
  53  
  54  // QueriesByNetworkDaily an NS1 /billing-usage-queries.ByNetwork.Daily resource
  55  type QueriesByNetworkDaily struct {
  56  	Timestamp    int64 `json:"timestamp"`
  57  	CleanQueries int64 `json:"clean_queries"`
  58  	DdosQueries  int64 `json:"ddos_queries"`
  59  	NxdResponses int64 `json:"nxd_responses"`
  60  }
  61  
  62  // TotalUsage wraps an NS1 /billing-usage-monitors, billing-usage-decisions, billing-usage-records resource
  63  type TotalUsage struct {
  64  	TotalUsage int64 `json:"total_usage"`
  65  }
  66